From 82af461eb8154cdf2fabfd9459daa9b98afa3b41 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 5 May 2025 12:13:29 +0200 Subject: [PATCH] updated Lab2 README with steps to take --- lab2/README.md | 15 +++++++++++++-- lab2/grammars/NobelEng.gf | 3 ++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lab2/README.md b/lab2/README.md index 5704632..4bb4f96 100644 --- a/lab2/README.md +++ b/lab2/README.md @@ -8,7 +8,18 @@ You are given - a Python file that connects Wikidata with GF, in the subdirectory scripts/ Your task is to create a concrete syntax for some other language by using the -GF RGL and evaluate the text generated by this. +GF RGL and evaluate the text generated by this. The steps to take are the following: -More instructions will be given in the lectures of the week 5-9 May 2025. +- in scripts/, run `python3 find_labels.py da > ../grammars/LabelsDan.gf` +- in grammars/, copy the beginnings of `LabelsEng.gf` to `LabelsDan.gf`, change Eng to Dan +- in grammars/, copy `NobelEng.gf` to `NobelDan.gf` and do the necessary changes +- in grammars/, start GF and `import NobelDan.gf`, to do some testing +- in grammars/ outside GF, do `gf -make NobelEng.gf NobelDan.gf` +- in scripts/, generate all texts with `python3 describe_nobel.py Dan` + +The last step requires `pip3 install pgf`. + +Replace da and Dan with your own language codes! + +More instructions and demos are given in the lectures of the week 5-9 May 2025. diff --git a/lab2/grammars/NobelEng.gf b/lab2/grammars/NobelEng.gf index dc5bf72..5a5d956 100644 --- a/lab2/grammars/NobelEng.gf +++ b/lab2/grammars/NobelEng.gf @@ -15,7 +15,7 @@ lin mkS pastTense (mkCl name (mkVP (mkVP born_VP (inAdv country)) date)) ; AwardSentence name award date = - mkS pastTense (mkCl name (mkVP (mkVP (mkV2 get_V) award) date)) ; + mkS pastTense (mkCl name (mkVP (mkVP get_V2 award) date)) ; DiedSentence name date = mkS pastTense (mkCl name (mkVP die_VP date)) ; @@ -32,5 +32,6 @@ oper inAdv : NP -> Adv = \np -> SyntaxEng.mkAdv in_Prep np ; born_VP = mkVP (mkA "born") ; die_VP = mkVP (mkV "die") ; + get_V2 = mkV2 get_V ; }