From 090d30c26b2d2a7f97fa8aeb61fcd139488d6db6 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 20 Aug 2008 07:14:20 +0000 Subject: [PATCH] peace grammars patched to work with the new API --- examples/peacekeeping/PeaceCat.gf | 5 +- examples/peacekeeping/PeaceCatI.gf | 3 +- examples/peacekeeping/PeaceLexCommon.gf | 21 ++++--- examples/peacekeeping/PeaceLexCommonI.gf | 22 ++++--- examples/peacekeeping/PeaceSyntax.gf | 6 +- examples/peacekeeping/PeaceSyntaxI.gf | 24 ++++---- .../english/PeaceLexCommon_Eng.gf | 3 +- .../peacekeeping/english/PeaceSyntax_Eng.gf | 1 + .../finnish/PeaceLexCommon_Fin.gf | 3 +- .../peacekeeping/finnish/PeaceLexExt_Fin.gf | 60 +++++++++---------- .../peacekeeping/finnish/PeacePhrases_Fin.gf | 9 ++- .../peacekeeping/finnish/PeaceSyntax_Fin.gf | 2 +- .../swedish/PeaceLexCommon_Swe.gf | 3 +- .../peacekeeping/swedish/PeaceSyntax_Swe.gf | 2 +- lib/resource/api/Constructors.gf | 7 +++ 15 files changed, 94 insertions(+), 77 deletions(-) diff --git a/examples/peacekeeping/PeaceCat.gf b/examples/peacekeeping/PeaceCat.gf index 033a33097..71ee4c0aa 100644 --- a/examples/peacekeeping/PeaceCat.gf +++ b/examples/peacekeeping/PeaceCat.gf @@ -3,7 +3,8 @@ abstract PeaceCat = { cat N; A; V; V2; V3; Pron; IP; IAdv; - Adv; NP; CN; Imp; Det; Num; + Adv; NP; CN; Imp; Det; Num ; + Card ; Art ; --a MassN ; Phrase ; PhraseWritten ; @@ -16,4 +17,4 @@ abstract PeaceCat = { Written : Phrase -> PhraseWritten ; Spoken : Phrase -> PhraseSpoken ; -} \ No newline at end of file +} diff --git a/examples/peacekeeping/PeaceCatI.gf b/examples/peacekeeping/PeaceCatI.gf index 67db1351d..7941de276 100644 --- a/examples/peacekeeping/PeaceCatI.gf +++ b/examples/peacekeeping/PeaceCatI.gf @@ -3,6 +3,7 @@ incomplete concrete PeaceCatI of PeaceCat = lincat N = N; A = A; V = V; V2 = V2; V3 = V3; Pron = Pron; + Card = Card ; Art = Art ; --a IP = IP; IAdv = IAdv; Adv = Adv; NP = NP; CN = CN; Imp = Imp; Det = Det; Num = Num; @@ -27,4 +28,4 @@ incomplete concrete PeaceCatI of PeaceCat = ExclMark => { s = x ++ "!" } --TExclMark (ss s) TEmpty } ; -} \ No newline at end of file +} diff --git a/examples/peacekeeping/PeaceLexCommon.gf b/examples/peacekeeping/PeaceLexCommon.gf index 75abaebdf..cec47c235 100644 --- a/examples/peacekeeping/PeaceLexCommon.gf +++ b/examples/peacekeeping/PeaceLexCommon.gf @@ -20,10 +20,13 @@ abstract PeaceLexCommon = PeaceCat ** { -- Determiners - aSg_Det : Det ; - aPl_Det : Det ; - theSg_Det : Det ; - thePl_Det : Det ; + the_Art : Art ; --a + a_Art : Art ; --a + -- aSg_Det : Det ; + -- aPl_Det : Det ; + -- theSg_Det : Det ; + -- thePl_Det : Det ; --a + that_Det : Det ; those_Det : Det ; this_Det : Det ; @@ -40,10 +43,10 @@ abstract PeaceLexCommon = PeaceCat ** { -- Causes too much ambiguity -- one_Det : Det ; - two_Num : Num ; - three_Num : Num ; - four_Num : Num ; - five_Num : Num ; + two_Num : Card ; --a + three_Num : Card ; + four_Num : Card ; + five_Num : Card ; -- Adjectives @@ -87,4 +90,4 @@ abstract PeaceLexCommon = PeaceCat ** { sleep_V : V ; walk_V : V ; -} \ No newline at end of file +} diff --git a/examples/peacekeeping/PeaceLexCommonI.gf b/examples/peacekeeping/PeaceLexCommonI.gf index b76949cb9..21dcac350 100644 --- a/examples/peacekeeping/PeaceLexCommonI.gf +++ b/examples/peacekeeping/PeaceLexCommonI.gf @@ -1,4 +1,5 @@ -incomplete concrete PeaceLexCommonI of PeaceLexCommon = PeaceCatI ** open Lang in { +incomplete concrete PeaceLexCommonI of PeaceLexCommon = PeaceCatI ** + open Lang, Constructors in { lin @@ -15,20 +16,17 @@ incomplete concrete PeaceLexCommonI of PeaceLexCommon = PeaceCatI ** open Lang i whatPl_IP = whatPl_IP ; whatSg_IP = whatSg_IP ; - this_NP = this_NP ; - that_NP = that_NP ; + this_NP = mkNP this_Quant ; + that_NP = mkNP that_Quant ; -- Determiners - aSg_Det = DetSg (SgQuant IndefArt) NoOrd; - aPl_Det = DetPl (PlQuant IndefArt) NoNum NoOrd; - theSg_Det = DetSg (SgQuant DefArt) NoOrd ; - thePl_Det = DetPl (PlQuant DefArt) NoNum NoOrd ; - that_Det = DetSg (SgQuant that_Quant) NoOrd ; - those_Det = DetPl (PlQuant that_Quant) NoNum NoOrd ; - this_Det = DetSg (SgQuant this_Quant) NoOrd ; - these_Det = DetPl (PlQuant this_Quant) NoNum NoOrd ; - + a_Art = IndefArt ; + the_Art = DefArt ; + that_Det = mkDet that_Quant ; + those_Det = mkDet that_Quant plNum ; + this_Det = mkDet this_Quant ; + these_Det = mkDet this_Quant plNum ; -- Adverbs here_Adv = here_Adv; diff --git a/examples/peacekeeping/PeaceSyntax.gf b/examples/peacekeeping/PeaceSyntax.gf index adbf42571..2cc7a8c93 100644 --- a/examples/peacekeeping/PeaceSyntax.gf +++ b/examples/peacekeeping/PeaceSyntax.gf @@ -42,8 +42,10 @@ abstract PeaceSyntax = PeaceCat ** { UsePron : Pron -> NP ; PossPronCNSg : Pron -> CN -> NP ; PossPronCNPl : Pron -> CN -> NP ; + ArtCNSg : Art -> CN -> NP ; --a + ArtCNPl : Art -> CN -> NP ; --a DetCN : Det -> CN -> NP ; - NumCN : Num -> CN -> NP ; + NumCN : Card -> CN -> NP ; --a UseN : N -> CN ; ModCN : A -> CN -> CN ; @@ -51,4 +53,4 @@ abstract PeaceSyntax = PeaceCat ** { UseMassN : MassN -> MassCN ; ModMass : A -> MassCN -> MassCN ; -} \ No newline at end of file +} diff --git a/examples/peacekeeping/PeaceSyntaxI.gf b/examples/peacekeeping/PeaceSyntaxI.gf index 6be637d84..7e738eea5 100644 --- a/examples/peacekeeping/PeaceSyntaxI.gf +++ b/examples/peacekeeping/PeaceSyntaxI.gf @@ -14,7 +14,7 @@ incomplete concrete PeaceSyntaxI of PeaceSyntax = PhrYes = stop yes_Utt.s ; PhrNo = stop no_Utt.s ; -{- + QuestSent sent = { s = sent.s!SQuest } ; QuestIP_V v ip = mkQuest (QuestVP ip (UseV v)) ; QuestIP_V2 v2 ip x = mkQuest (QuestVP ip (mkVP v2 x)) ; @@ -26,9 +26,9 @@ incomplete concrete PeaceSyntaxI of PeaceSyntax = QuestIAdv_V v x ia = mkQuest (QuestIAdv ia (PredVP x (UseV v))); QuestIAdv_V2 v x y ia = mkQuest (QuestIAdv ia (PredVP x (ComplV2 v y))); --} - SentV v np = mkSent (mkS np v) ; + + SentV v np = mkSent (mkCl np v) ; SentV2 v2 x y = mkSent (mkCl x v2 y) ; SentV2Mass v2 x y = mkSent (mkCl x v2 (MassNP y)) ; @@ -47,10 +47,12 @@ incomplete concrete PeaceSyntaxI of PeaceSyntax = ImpV3Mass v3 x y = mkImp (mkVP v3 (MassNP x) y) ; UsePron p = mkNP p ; --- PossPronCNSg p n = DetCN (DetSg (SgQuant (PossPron p)) NoOrd) n; --- PossPronCNPl p n = mkNP (DetPl (PlQuant (PossPron p)) NoNum NoOrd) n; + PossPronCNSg p n = mkNP (mkDet p) n ; + PossPronCNPl p n = mkNP (mkDet p plNum) n ; DetCN d n = mkNP d n ; NumCN k cn = mkNP a_Art k cn ; + ArtCNSg = DetArtSg ; + ArtCNPl = DetArtPl ; UseN n = mkCN n ; ModCN a cn = mkCN a cn ; @@ -59,19 +61,19 @@ incomplete concrete PeaceSyntaxI of PeaceSyntax = ModMass a cn = mkCN a cn ; oper - mkSent : Cl -> Sent ; + mkSent : Lang.Cl -> Sent ; mkSent cl = { s = table { - SPos => Predef.toStr S (mkS cl) ; - SNeg => Predef.toStr S (mkS negativePol cl) ; - SQuest => Predef.toStr QS (mkQS cl) + SPos => Predef.toStr Lang.S (mkS cl) ; + SNeg => Predef.toStr Lang.S (mkS negativePol cl) ; + SQuest => Predef.toStr Lang.QS (mkQS cl) } ; lock_Sent = <> } ; - mkQuest : QCl -> Quest ; - mkQuest q = { s = Predef.toStr QS (mkQS q); + mkQuest : Lang.QCl -> Quest ; + mkQuest q = { s = Predef.toStr Lang.QS (mkQS q); lock_Quest = <> } ; } diff --git a/examples/peacekeeping/english/PeaceLexCommon_Eng.gf b/examples/peacekeeping/english/PeaceLexCommon_Eng.gf index fc3ab664d..4a047facd 100644 --- a/examples/peacekeeping/english/PeaceLexCommon_Eng.gf +++ b/examples/peacekeeping/english/PeaceLexCommon_Eng.gf @@ -1,5 +1,6 @@ --# -path=.:present:prelude concrete PeaceLexCommon_Eng of PeaceLexCommon = - PeaceCat_Eng ** PeaceLexCommonI with (Lang = LangEng) ; + PeaceCat_Eng ** PeaceLexCommonI with (Lang = LangEng), + (Constructors = ConstructorsEng) ; diff --git a/examples/peacekeeping/english/PeaceSyntax_Eng.gf b/examples/peacekeeping/english/PeaceSyntax_Eng.gf index 674e1e123..46c26f183 100644 --- a/examples/peacekeeping/english/PeaceSyntax_Eng.gf +++ b/examples/peacekeeping/english/PeaceSyntax_Eng.gf @@ -1,5 +1,6 @@ --# -path=.:present:prelude concrete PeaceSyntax_Eng of PeaceSyntax = PeaceCat_Eng ** PeaceSyntaxI with + (Constructors = ConstructorsEng), (Lang = LangEng) ; diff --git a/examples/peacekeeping/finnish/PeaceLexCommon_Fin.gf b/examples/peacekeeping/finnish/PeaceLexCommon_Fin.gf index aad047909..faf70724b 100644 --- a/examples/peacekeeping/finnish/PeaceLexCommon_Fin.gf +++ b/examples/peacekeeping/finnish/PeaceLexCommon_Fin.gf @@ -1,5 +1,6 @@ --# -path=.:present:prelude concrete PeaceLexCommon_Fin of PeaceLexCommon = - PeaceCat_Fin ** PeaceLexCommonI with (Lang = LangFin) ; + PeaceCat_Fin ** PeaceLexCommonI with + (Lang = LangFin), (Constructors = ConstructorsFin) ; diff --git a/examples/peacekeeping/finnish/PeaceLexExt_Fin.gf b/examples/peacekeeping/finnish/PeaceLexExt_Fin.gf index eade50a49..637b52d65 100644 --- a/examples/peacekeeping/finnish/PeaceLexExt_Fin.gf +++ b/examples/peacekeeping/finnish/PeaceLexExt_Fin.gf @@ -6,39 +6,39 @@ concrete PeaceLexExt_Fin of PeaceLexExt = lin -- Adjectives - dangerous_A = regA "vaarallinen" ; - dead_A = mkA (nRae "kuollut" "kuolleena") ; - hungry_A = regA "nälkäinen" ; - large_A = regA "iso" ; - sick_A = regA "sairas" ; + dangerous_A = mkA "vaarallinen" ; + dead_A = mkA (mkN "kuollut" "kuolleita") ; + hungry_A = mkA "nälkäinen" ; + large_A = mkA "iso" ; + sick_A = mkA "sairas" ; -- Nouns - air_N = regN "ilma" ; - arm_N = reg3N "käsi" "käden" "käsiä" ; - building_N = regN "rakennus" ; - car_N = regN "auto" ; - corpse_N = regN "ruumis" ; - doctor_N = regN "lääkäri"; - enemy_N = regN "vihollinen"; - face_N = regN "naama" ; ---- kasvot - food_N = regN "ruoka"; - friend_N = regN "ystävä"; - ground_N = regN "maa" ; - knife_N = reg2N "veitsi" "veitsiä" ; ---- veistä - landmine_N = regN "maamiina" ; - map_N = regN "kartta" ; - medicine_N = regN "lääke" ; - police8officer_N = regN "poliisi" ; - skin_N = regN "iho" ; - soldier_N = regN "sotilas" ; - weapon_N = regN "ase"; + air_N = mkN "ilma" ; + arm_N = mk3N "käsi" "käden" "käsiä" ; + building_N = mkN "rakennus" ; + car_N = mkN "auto" ; + corpse_N = mkN "ruumis" ; + doctor_N = mkN "lääkäri"; + enemy_N = mkN "vihollinen"; + face_N = mkN "naama" ; ---- kasvot + food_N = mkN "ruoka"; + friend_N = mkN "ystävä"; + ground_N = mkN "maa" ; + knife_N = mk2N "veitsi" "veitsiä" ; ---- veistä + landmine_N = mkN "maamiina" ; + map_N = mkN "kartta" ; + medicine_N = mkN "lääke" ; + police8officer_N = mkN "poliisi" ; + skin_N = mkN "iho" ; + soldier_N = mkN "sotilas" ; + weapon_N = mkN "ase"; -- Verbs - cough_V = regV "yskiä" ; - drop_V2 = dirV2 (regV "pudottaa") ; - hurt_V = regV "sattua" ; - need_V2 = dirV2 (regV "tarvita"); - own_V2 = dirV2 (regV "omistaa") ; - show_V3 = dirdirV3 (regV "näyttää") ; + cough_V = mkV "yskiä" ; + drop_V2 = dirV2 (mkV "pudottaa") ; + hurt_V = mkV "sattua" ; + need_V2 = dirV2 (mkV "tarvita"); + own_V2 = dirV2 (mkV "omistaa") ; + show_V3 = dirdirV3 (mkV "näyttää") ; } diff --git a/examples/peacekeeping/finnish/PeacePhrases_Fin.gf b/examples/peacekeeping/finnish/PeacePhrases_Fin.gf index bd528c36b..1949e30e7 100644 --- a/examples/peacekeeping/finnish/PeacePhrases_Fin.gf +++ b/examples/peacekeeping/finnish/PeacePhrases_Fin.gf @@ -1,14 +1,13 @@ --# -path=.:..:present:prelude concrete PeacePhrases_Fin of PeacePhrases = - PeaceCat_Fin ** open LangFin, ParadigmsFin, PeaceRes in { + PeaceCat_Fin ** open LangFin, ParadigmsFin, ConstructorsFin, PeaceRes in { lin Hello = stop "terve" ; GoodMorning = stop ["hyvää huomenta"] ; GoodEvening = stop ["hyvää iltaa"] ; - WhatIsNamePron p = quest (PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos - (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetSg (SgQuant (PossPron p)) NoOrd) - (UseN (reg2N "nimi" "nimiä")))))))) NoVoc).s ; + WhatIsNamePron p = quest ( + mkPhr (mkUtt (mkQS (mkQCl whatSg_IP (mkVP (mkNP (mkDet p) name_N)))))).s ; -} \ No newline at end of file +} diff --git a/examples/peacekeeping/finnish/PeaceSyntax_Fin.gf b/examples/peacekeeping/finnish/PeaceSyntax_Fin.gf index 80bd821c4..3e728dbf8 100644 --- a/examples/peacekeeping/finnish/PeaceSyntax_Fin.gf +++ b/examples/peacekeeping/finnish/PeaceSyntax_Fin.gf @@ -1,5 +1,5 @@ --# -path=.:present:prelude concrete PeaceSyntax_Fin of PeaceSyntax = PeaceCat_Fin ** PeaceSyntaxI with - (Lang = LangFin) ; + (Lang = LangFin), (Constructors = ConstructorsFin) ; diff --git a/examples/peacekeeping/swedish/PeaceLexCommon_Swe.gf b/examples/peacekeeping/swedish/PeaceLexCommon_Swe.gf index 8f516ff7d..7d34010eb 100644 --- a/examples/peacekeeping/swedish/PeaceLexCommon_Swe.gf +++ b/examples/peacekeeping/swedish/PeaceLexCommon_Swe.gf @@ -1,5 +1,6 @@ --# -path=.:present:prelude concrete PeaceLexCommon_Swe of PeaceLexCommon = - PeaceCat_Swe ** PeaceLexCommonI with (Lang = LangSwe) ; + PeaceCat_Swe ** PeaceLexCommonI with + (Lang = LangSwe), (Constructors = ConstructorsSwe) ; ; diff --git a/examples/peacekeeping/swedish/PeaceSyntax_Swe.gf b/examples/peacekeeping/swedish/PeaceSyntax_Swe.gf index 4fd59e564..bfa0f0a1d 100644 --- a/examples/peacekeeping/swedish/PeaceSyntax_Swe.gf +++ b/examples/peacekeeping/swedish/PeaceSyntax_Swe.gf @@ -1,5 +1,5 @@ --# -path=.:present:prelude concrete PeaceSyntax_Swe of PeaceSyntax = PeaceCat_Swe ** PeaceSyntaxI with - (Lang = LangSwe) ; + (Lang = LangSwe), (Constructors = ConstructorsSwe) ; diff --git a/lib/resource/api/Constructors.gf b/lib/resource/api/Constructors.gf index b08a63eed..b1a94f993 100644 --- a/lib/resource/api/Constructors.gf +++ b/lib/resource/api/Constructors.gf @@ -1005,6 +1005,8 @@ incomplete resource Constructors = open Grammar in { = \d,n -> DetCN d (UseN n) ; mkNP : Quant -> NP -- this = \q -> DetNP (DetQuant q sgNum) ; + mkNP : Quant -> Num -> NP -- this + = \q,n -> DetNP (DetQuant q n) ; mkNP : Det -> NP -- this = DetNP ; mkNP : Card -> CN -> NP -- forty-five old men @@ -1632,6 +1634,11 @@ incomplete resource Constructors = open Grammar in { ComplV2A : V2A -> NP -> AP -> VP = \v,np,ap -> ComplSlash (SlashV2A v ap) np ; ComplV3 : V3 -> NP -> NP -> VP = \v,o,d -> ComplSlash (Slash2V3 v o) d ; + that_NP : NP = DetNP (DetQuant that_Quant sgNum) ; + this_NP : NP = DetNP (DetQuant this_Quant sgNum) ; + those_NP : NP = DetNP (DetQuant that_Quant plNum) ; + these_NP : NP = DetNP (DetQuant this_Quant plNum) ; + {- -- The definite and indefinite articles are commonly used determiners.