peace grammars patched to work with the new API

This commit is contained in:
aarne
2008-08-20 07:14:20 +00:00
parent b962c3a0d3
commit 090d30c26b
15 changed files with 94 additions and 77 deletions

View File

@@ -3,7 +3,8 @@ abstract PeaceCat = {
cat cat
N; A; V; V2; V3; Pron; N; A; V; V2; V3; Pron;
IP; IAdv; IP; IAdv;
Adv; NP; CN; Imp; Det; Num; Adv; NP; CN; Imp; Det; Num ;
Card ; Art ; --a
MassN ; MassN ;
Phrase ; Phrase ;
PhraseWritten ; PhraseWritten ;
@@ -16,4 +17,4 @@ abstract PeaceCat = {
Written : Phrase -> PhraseWritten ; Written : Phrase -> PhraseWritten ;
Spoken : Phrase -> PhraseSpoken ; Spoken : Phrase -> PhraseSpoken ;
} }

View File

@@ -3,6 +3,7 @@ incomplete concrete PeaceCatI of PeaceCat =
lincat lincat
N = N; A = A; V = V; V2 = V2; V3 = V3; Pron = Pron; N = N; A = A; V = V; V2 = V2; V3 = V3; Pron = Pron;
Card = Card ; Art = Art ; --a
IP = IP; IAdv = IAdv; IP = IP; IAdv = IAdv;
Adv = Adv; NP = NP; CN = CN; Imp = Imp; Det = Det; Num = Num; 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 ExclMark => { s = x ++ "!" } --TExclMark (ss s) TEmpty
} ; } ;
} }

View File

@@ -20,10 +20,13 @@ abstract PeaceLexCommon = PeaceCat ** {
-- Determiners -- Determiners
aSg_Det : Det ; the_Art : Art ; --a
aPl_Det : Det ; a_Art : Art ; --a
theSg_Det : Det ; -- aSg_Det : Det ;
thePl_Det : Det ; -- aPl_Det : Det ;
-- theSg_Det : Det ;
-- thePl_Det : Det ; --a
that_Det : Det ; that_Det : Det ;
those_Det : Det ; those_Det : Det ;
this_Det : Det ; this_Det : Det ;
@@ -40,10 +43,10 @@ abstract PeaceLexCommon = PeaceCat ** {
-- Causes too much ambiguity -- Causes too much ambiguity
-- one_Det : Det ; -- one_Det : Det ;
two_Num : Num ; two_Num : Card ; --a
three_Num : Num ; three_Num : Card ;
four_Num : Num ; four_Num : Card ;
five_Num : Num ; five_Num : Card ;
-- Adjectives -- Adjectives
@@ -87,4 +90,4 @@ abstract PeaceLexCommon = PeaceCat ** {
sleep_V : V ; sleep_V : V ;
walk_V : V ; walk_V : V ;
} }

View File

@@ -1,4 +1,5 @@
incomplete concrete PeaceLexCommonI of PeaceLexCommon = PeaceCatI ** open Lang in { incomplete concrete PeaceLexCommonI of PeaceLexCommon = PeaceCatI **
open Lang, Constructors in {
lin lin
@@ -15,20 +16,17 @@ incomplete concrete PeaceLexCommonI of PeaceLexCommon = PeaceCatI ** open Lang i
whatPl_IP = whatPl_IP ; whatPl_IP = whatPl_IP ;
whatSg_IP = whatSg_IP ; whatSg_IP = whatSg_IP ;
this_NP = this_NP ; this_NP = mkNP this_Quant ;
that_NP = that_NP ; that_NP = mkNP that_Quant ;
-- Determiners -- Determiners
aSg_Det = DetSg (SgQuant IndefArt) NoOrd; a_Art = IndefArt ;
aPl_Det = DetPl (PlQuant IndefArt) NoNum NoOrd; the_Art = DefArt ;
theSg_Det = DetSg (SgQuant DefArt) NoOrd ; that_Det = mkDet that_Quant ;
thePl_Det = DetPl (PlQuant DefArt) NoNum NoOrd ; those_Det = mkDet that_Quant plNum ;
that_Det = DetSg (SgQuant that_Quant) NoOrd ; this_Det = mkDet this_Quant ;
those_Det = DetPl (PlQuant that_Quant) NoNum NoOrd ; these_Det = mkDet this_Quant plNum ;
this_Det = DetSg (SgQuant this_Quant) NoOrd ;
these_Det = DetPl (PlQuant this_Quant) NoNum NoOrd ;
-- Adverbs -- Adverbs
here_Adv = here_Adv; here_Adv = here_Adv;

View File

@@ -42,8 +42,10 @@ abstract PeaceSyntax = PeaceCat ** {
UsePron : Pron -> NP ; UsePron : Pron -> NP ;
PossPronCNSg : Pron -> CN -> NP ; PossPronCNSg : Pron -> CN -> NP ;
PossPronCNPl : Pron -> CN -> NP ; PossPronCNPl : Pron -> CN -> NP ;
ArtCNSg : Art -> CN -> NP ; --a
ArtCNPl : Art -> CN -> NP ; --a
DetCN : Det -> CN -> NP ; DetCN : Det -> CN -> NP ;
NumCN : Num -> CN -> NP ; NumCN : Card -> CN -> NP ; --a
UseN : N -> CN ; UseN : N -> CN ;
ModCN : A -> CN -> CN ; ModCN : A -> CN -> CN ;
@@ -51,4 +53,4 @@ abstract PeaceSyntax = PeaceCat ** {
UseMassN : MassN -> MassCN ; UseMassN : MassN -> MassCN ;
ModMass : A -> MassCN -> MassCN ; ModMass : A -> MassCN -> MassCN ;
} }

View File

@@ -14,7 +14,7 @@ incomplete concrete PeaceSyntaxI of PeaceSyntax =
PhrYes = stop yes_Utt.s ; PhrYes = stop yes_Utt.s ;
PhrNo = stop no_Utt.s ; PhrNo = stop no_Utt.s ;
{-
QuestSent sent = { s = sent.s!SQuest } ; QuestSent sent = { s = sent.s!SQuest } ;
QuestIP_V v ip = mkQuest (QuestVP ip (UseV v)) ; QuestIP_V v ip = mkQuest (QuestVP ip (UseV v)) ;
QuestIP_V2 v2 ip x = mkQuest (QuestVP ip (mkVP v2 x)) ; 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_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))); 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) ; SentV2 v2 x y = mkSent (mkCl x v2 y) ;
SentV2Mass v2 x y = mkSent (mkCl x v2 (MassNP 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) ; ImpV3Mass v3 x y = mkImp (mkVP v3 (MassNP x) y) ;
UsePron p = mkNP p ; UsePron p = mkNP p ;
-- PossPronCNSg p n = DetCN (DetSg (SgQuant (PossPron p)) NoOrd) n; PossPronCNSg p n = mkNP (mkDet p) n ;
-- PossPronCNPl p n = mkNP (DetPl (PlQuant (PossPron p)) NoNum NoOrd) n; PossPronCNPl p n = mkNP (mkDet p plNum) n ;
DetCN d n = mkNP d n ; DetCN d n = mkNP d n ;
NumCN k cn = mkNP a_Art k cn ; NumCN k cn = mkNP a_Art k cn ;
ArtCNSg = DetArtSg ;
ArtCNPl = DetArtPl ;
UseN n = mkCN n ; UseN n = mkCN n ;
ModCN a cn = mkCN a cn ; ModCN a cn = mkCN a cn ;
@@ -59,19 +61,19 @@ incomplete concrete PeaceSyntaxI of PeaceSyntax =
ModMass a cn = mkCN a cn ; ModMass a cn = mkCN a cn ;
oper oper
mkSent : Cl -> Sent ; mkSent : Lang.Cl -> Sent ;
mkSent cl = mkSent cl =
{ {
s = table { s = table {
SPos => Predef.toStr S (mkS cl) ; SPos => Predef.toStr Lang.S (mkS cl) ;
SNeg => Predef.toStr S (mkS negativePol cl) ; SNeg => Predef.toStr Lang.S (mkS negativePol cl) ;
SQuest => Predef.toStr QS (mkQS cl) SQuest => Predef.toStr Lang.QS (mkQS cl)
} ; } ;
lock_Sent = <> lock_Sent = <>
} ; } ;
mkQuest : QCl -> Quest ; mkQuest : Lang.QCl -> Quest ;
mkQuest q = { s = Predef.toStr QS (mkQS q); mkQuest q = { s = Predef.toStr Lang.QS (mkQS q);
lock_Quest = <> } ; lock_Quest = <> } ;
} }

View File

@@ -1,5 +1,6 @@
--# -path=.:present:prelude --# -path=.:present:prelude
concrete PeaceLexCommon_Eng of PeaceLexCommon = concrete PeaceLexCommon_Eng of PeaceLexCommon =
PeaceCat_Eng ** PeaceLexCommonI with (Lang = LangEng) ; PeaceCat_Eng ** PeaceLexCommonI with (Lang = LangEng),
(Constructors = ConstructorsEng) ;

View File

@@ -1,5 +1,6 @@
--# -path=.:present:prelude --# -path=.:present:prelude
concrete PeaceSyntax_Eng of PeaceSyntax = PeaceCat_Eng ** PeaceSyntaxI with concrete PeaceSyntax_Eng of PeaceSyntax = PeaceCat_Eng ** PeaceSyntaxI with
(Constructors = ConstructorsEng),
(Lang = LangEng) ; (Lang = LangEng) ;

View File

@@ -1,5 +1,6 @@
--# -path=.:present:prelude --# -path=.:present:prelude
concrete PeaceLexCommon_Fin of PeaceLexCommon = concrete PeaceLexCommon_Fin of PeaceLexCommon =
PeaceCat_Fin ** PeaceLexCommonI with (Lang = LangFin) ; PeaceCat_Fin ** PeaceLexCommonI with
(Lang = LangFin), (Constructors = ConstructorsFin) ;

View File

@@ -6,39 +6,39 @@ concrete PeaceLexExt_Fin of PeaceLexExt =
lin lin
-- Adjectives -- Adjectives
dangerous_A = regA "vaarallinen" ; dangerous_A = mkA "vaarallinen" ;
dead_A = mkA (nRae "kuollut" "kuolleena") ; dead_A = mkA (mkN "kuollut" "kuolleita") ;
hungry_A = regA "nälkäinen" ; hungry_A = mkA "nälkäinen" ;
large_A = regA "iso" ; large_A = mkA "iso" ;
sick_A = regA "sairas" ; sick_A = mkA "sairas" ;
-- Nouns -- Nouns
air_N = regN "ilma" ; air_N = mkN "ilma" ;
arm_N = reg3N "käsi" "käden" "käsiä" ; arm_N = mk3N "käsi" "käden" "käsiä" ;
building_N = regN "rakennus" ; building_N = mkN "rakennus" ;
car_N = regN "auto" ; car_N = mkN "auto" ;
corpse_N = regN "ruumis" ; corpse_N = mkN "ruumis" ;
doctor_N = regN "lääkäri"; doctor_N = mkN "lääkäri";
enemy_N = regN "vihollinen"; enemy_N = mkN "vihollinen";
face_N = regN "naama" ; ---- kasvot face_N = mkN "naama" ; ---- kasvot
food_N = regN "ruoka"; food_N = mkN "ruoka";
friend_N = regN "ystävä"; friend_N = mkN "ystävä";
ground_N = regN "maa" ; ground_N = mkN "maa" ;
knife_N = reg2N "veitsi" "veitsiä" ; ---- veistä knife_N = mk2N "veitsi" "veitsiä" ; ---- veistä
landmine_N = regN "maamiina" ; landmine_N = mkN "maamiina" ;
map_N = regN "kartta" ; map_N = mkN "kartta" ;
medicine_N = regN "lääke" ; medicine_N = mkN "lääke" ;
police8officer_N = regN "poliisi" ; police8officer_N = mkN "poliisi" ;
skin_N = regN "iho" ; skin_N = mkN "iho" ;
soldier_N = regN "sotilas" ; soldier_N = mkN "sotilas" ;
weapon_N = regN "ase"; weapon_N = mkN "ase";
-- Verbs -- Verbs
cough_V = regV "yskiä" ; cough_V = mkV "yskiä" ;
drop_V2 = dirV2 (regV "pudottaa") ; drop_V2 = dirV2 (mkV "pudottaa") ;
hurt_V = regV "sattua" ; hurt_V = mkV "sattua" ;
need_V2 = dirV2 (regV "tarvita"); need_V2 = dirV2 (mkV "tarvita");
own_V2 = dirV2 (regV "omistaa") ; own_V2 = dirV2 (mkV "omistaa") ;
show_V3 = dirdirV3 (regV "näyttää") ; show_V3 = dirdirV3 (mkV "näyttää") ;
} }

View File

@@ -1,14 +1,13 @@
--# -path=.:..:present:prelude --# -path=.:..:present:prelude
concrete PeacePhrases_Fin of PeacePhrases = concrete PeacePhrases_Fin of PeacePhrases =
PeaceCat_Fin ** open LangFin, ParadigmsFin, PeaceRes in { PeaceCat_Fin ** open LangFin, ParadigmsFin, ConstructorsFin, PeaceRes in {
lin lin
Hello = stop "terve" ; Hello = stop "terve" ;
GoodMorning = stop ["hyvää huomenta"] ; GoodMorning = stop ["hyvää huomenta"] ;
GoodEvening = stop ["hyvää iltaa"] ; GoodEvening = stop ["hyvää iltaa"] ;
WhatIsNamePron p = quest (PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos WhatIsNamePron p = quest (
(QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetSg (SgQuant (PossPron p)) NoOrd) mkPhr (mkUtt (mkQS (mkQCl whatSg_IP (mkVP (mkNP (mkDet p) name_N)))))).s ;
(UseN (reg2N "nimi" "nimiä")))))))) NoVoc).s ;
} }

View File

@@ -1,5 +1,5 @@
--# -path=.:present:prelude --# -path=.:present:prelude
concrete PeaceSyntax_Fin of PeaceSyntax = PeaceCat_Fin ** PeaceSyntaxI with concrete PeaceSyntax_Fin of PeaceSyntax = PeaceCat_Fin ** PeaceSyntaxI with
(Lang = LangFin) ; (Lang = LangFin), (Constructors = ConstructorsFin) ;

View File

@@ -1,5 +1,6 @@
--# -path=.:present:prelude --# -path=.:present:prelude
concrete PeaceLexCommon_Swe of PeaceLexCommon = concrete PeaceLexCommon_Swe of PeaceLexCommon =
PeaceCat_Swe ** PeaceLexCommonI with (Lang = LangSwe) ; PeaceCat_Swe ** PeaceLexCommonI with
(Lang = LangSwe), (Constructors = ConstructorsSwe) ; ;

View File

@@ -1,5 +1,5 @@
--# -path=.:present:prelude --# -path=.:present:prelude
concrete PeaceSyntax_Swe of PeaceSyntax = PeaceCat_Swe ** PeaceSyntaxI with concrete PeaceSyntax_Swe of PeaceSyntax = PeaceCat_Swe ** PeaceSyntaxI with
(Lang = LangSwe) ; (Lang = LangSwe), (Constructors = ConstructorsSwe) ;

View File

@@ -1005,6 +1005,8 @@ incomplete resource Constructors = open Grammar in {
= \d,n -> DetCN d (UseN n) ; = \d,n -> DetCN d (UseN n) ;
mkNP : Quant -> NP -- this mkNP : Quant -> NP -- this
= \q -> DetNP (DetQuant q sgNum) ; = \q -> DetNP (DetQuant q sgNum) ;
mkNP : Quant -> Num -> NP -- this
= \q,n -> DetNP (DetQuant q n) ;
mkNP : Det -> NP -- this mkNP : Det -> NP -- this
= DetNP ; = DetNP ;
mkNP : Card -> CN -> NP -- forty-five old men 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 ; 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 ; 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. -- The definite and indefinite articles are commonly used determiners.