forked from GitHub/gf-core
Added the beginnings of the PeaceKeep grammar.
This commit is contained in:
15
examples/peacekeeping/EXAMPLES
Normal file
15
examples/peacekeeping/EXAMPLES
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Working now:
|
||||||
|
|
||||||
|
Landmines are dangerous.
|
||||||
|
Are you cold?
|
||||||
|
Who coughs?
|
||||||
|
Show me the landmine!
|
||||||
|
We are your friends.
|
||||||
|
Give your weapon to the soldier!
|
||||||
|
Do you need medicine?
|
||||||
|
Who is hungry?
|
||||||
|
|
||||||
|
Should work:
|
||||||
|
|
||||||
|
Where is the factory? (no QuestIAdv_NP)
|
||||||
|
|
||||||
46
examples/peacekeeping/PeaceKeep.gf
Normal file
46
examples/peacekeeping/PeaceKeep.gf
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
abstract PeaceKeep = Cat, PeaceLex ** {
|
||||||
|
|
||||||
|
cat
|
||||||
|
Sent ; MassCN ;
|
||||||
|
|
||||||
|
fun
|
||||||
|
PhrPos : Sent -> Phr ;
|
||||||
|
PhrNeg : Sent -> Phr ;
|
||||||
|
PhrQuest : Sent -> Phr ;
|
||||||
|
PhrImp : Imp -> Phr ;
|
||||||
|
PhrImpNeg : Imp -> Phr ;
|
||||||
|
|
||||||
|
QuestIP_V : V -> IP -> Phr ;
|
||||||
|
QuestIP_V2 : V2 -> IP -> NP -> Phr ;
|
||||||
|
QuestIP_V2Mass : V2 -> IP -> MassCN -> Phr ;
|
||||||
|
QuestIP_A : A -> IP -> Phr ;
|
||||||
|
QuestIAdv_V : V -> NP -> IAdv -> Phr ;
|
||||||
|
QuestIAdv_V2 : V2 -> NP -> NP -> IAdv -> Phr ;
|
||||||
|
|
||||||
|
SentV : V -> NP -> Sent ;
|
||||||
|
SentV2 : V2 -> NP -> NP -> Sent ;
|
||||||
|
SentV2Mass : V2 -> NP -> MassCN -> Sent ;
|
||||||
|
SentV3 : V3 -> NP -> NP -> NP -> Sent ;
|
||||||
|
SentA : A -> NP -> Sent ;
|
||||||
|
SentNP : NP -> NP -> Sent ;
|
||||||
|
|
||||||
|
SentAdvV : V -> NP -> Adv -> Sent ;
|
||||||
|
SentAdvV2 : V2 -> NP -> NP -> Adv -> Sent ;
|
||||||
|
|
||||||
|
ImpV : V -> Imp ;
|
||||||
|
ImpV2 : V2 -> NP -> Imp ;
|
||||||
|
ImpV3 : V3 -> NP -> NP -> Imp ;
|
||||||
|
|
||||||
|
UsePron : Pron -> NP ;
|
||||||
|
PossPronCNSg : Pron -> CN -> NP ;
|
||||||
|
PossPronCNPl : Pron -> CN -> NP ;
|
||||||
|
DetCN : Det -> CN -> NP ;
|
||||||
|
NumCN : Num -> CN -> NP ;
|
||||||
|
|
||||||
|
UseN : N -> CN ;
|
||||||
|
ModCN : A -> CN -> CN ;
|
||||||
|
|
||||||
|
UseMassN : MassN -> MassCN ;
|
||||||
|
ModMass : A -> MassCN -> MassCN ;
|
||||||
|
|
||||||
|
}
|
||||||
75
examples/peacekeeping/PeaceKeepI.gf
Normal file
75
examples/peacekeeping/PeaceKeepI.gf
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
incomplete concrete PeaceKeepI of PeaceKeep = open Lang in {
|
||||||
|
|
||||||
|
flags
|
||||||
|
startcat = Phr ; optimize = all_subs ;
|
||||||
|
unlexer = text ; lexer = text ;
|
||||||
|
|
||||||
|
lincat
|
||||||
|
Sent = {s : SForm => Str} ; MassCN = CN ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
PhrPos sent = {s = sent.s ! SPos ++ "."} ;
|
||||||
|
PhrNeg sent = {s = sent.s ! SNeg ++ "."} ;
|
||||||
|
PhrQuest sent = {s = sent.s ! SQuest ++ "?"} ;
|
||||||
|
PhrImp imp = {s = (PhrUtt NoPConj (UttImpSg PPos imp) NoVoc).s ++ "!"} ;
|
||||||
|
PhrImpNeg imp = {s = (PhrUtt NoPConj (UttImpSg PNeg imp) NoVoc).s ++ "!"} ;
|
||||||
|
|
||||||
|
QuestIP_V v ip = mkQuest (QuestVP ip (UseV v)) ;
|
||||||
|
QuestIP_V2 v ip x = mkQuest (QuestVP ip (ComplV2 v x)) ;
|
||||||
|
QuestIP_V2Mass v ip x = mkQuest (QuestVP ip (ComplV2 v (massNP x))) ;
|
||||||
|
QuestIP_A : A -> IP -> Phr ;
|
||||||
|
QuestIP_A a ip = mkQuest (QuestVP ip (UseComp (CompAP (PositA a))));
|
||||||
|
|
||||||
|
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 np (UseV v) ;
|
||||||
|
|
||||||
|
SentV2 v x y = mkSent x (ComplV2 v y) ;
|
||||||
|
SentV2Mass v x y = mkSent x (ComplV2 v (massNP y)) ;
|
||||||
|
SentV3 v x y z = mkSent x (ComplV3 v y z) ;
|
||||||
|
SentA a x = mkSent x (UseComp (CompAP (PositA a))) ;
|
||||||
|
SentNP a x = mkSent x (UseComp (CompNP a)) ;
|
||||||
|
|
||||||
|
SentAdvV v np adv = mkSent np (AdvVP (UseV v) adv) ;
|
||||||
|
SentAdvV2 v x y adv = mkSent x (AdvVP (ComplV2 v y) adv) ;
|
||||||
|
|
||||||
|
ImpV v = ImpVP (UseV v) ;
|
||||||
|
ImpV2 v x = ImpVP (ComplV2 v x) ;
|
||||||
|
ImpV3 v x y = ImpVP (ComplV3 v x y) ;
|
||||||
|
|
||||||
|
UsePron p = UsePron p ;
|
||||||
|
PossPronCNSg p n = DetCN (DetSg (SgQuant (PossPron p)) NoOrd) n;
|
||||||
|
PossPronCNPl p n = DetCN (DetPl (PlQuant (PossPron p)) NoNum NoOrd) n;
|
||||||
|
DetCN d n = DetCN d n ;
|
||||||
|
NumCN k cn = DetCN (DetPl (PlQuant IndefArt) k NoOrd) cn ;
|
||||||
|
|
||||||
|
UseN n = UseN n ;
|
||||||
|
ModCN a cn = AdjCN (PositA a) cn ;
|
||||||
|
|
||||||
|
UseMassN mn = UseN mn ;
|
||||||
|
ModMass a cn = AdjCN (PositA a) cn ;
|
||||||
|
|
||||||
|
param
|
||||||
|
SForm = SPos | SNeg | SQuest ;
|
||||||
|
|
||||||
|
oper
|
||||||
|
mkSent : NP -> VP -> Sent ;
|
||||||
|
mkSent np vp =
|
||||||
|
let cl = PredVP np vp
|
||||||
|
in {
|
||||||
|
s = table {
|
||||||
|
SPos => Predef.toStr S (UseCl TPres ASimul PPos cl) ;
|
||||||
|
SNeg => Predef.toStr S (UseCl TPres ASimul PNeg cl) ;
|
||||||
|
SQuest => Predef.toStr QS (UseQCl TPres ASimul PPos (QuestCl cl))
|
||||||
|
} ;
|
||||||
|
lock_Sent = <>
|
||||||
|
} ;
|
||||||
|
|
||||||
|
massNP : CN -> NP = \mcn -> DetCN (DetSg MassDet NoOrd) mcn ;
|
||||||
|
|
||||||
|
mkQuest : QCl -> Phr ;
|
||||||
|
mkQuest q = { s = (Predef.toStr QS (UseQCl TPres ASimul PPos q)) ++ "?";
|
||||||
|
lock_Phr = <> } ;
|
||||||
|
|
||||||
|
}
|
||||||
5
examples/peacekeeping/PeaceKeep_Eng.gf
Normal file
5
examples/peacekeeping/PeaceKeep_Eng.gf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
--# -path=.:present:prelude
|
||||||
|
|
||||||
|
concrete PeaceKeep_Eng of PeaceKeep = CatEng, PeaceLex_Eng ** PeaceKeepI with
|
||||||
|
(Lang = LangEng) ;
|
||||||
|
|
||||||
107
examples/peacekeeping/PeaceLex.gf
Normal file
107
examples/peacekeeping/PeaceLex.gf
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
abstract PeaceLex = Cat ** {
|
||||||
|
|
||||||
|
cat
|
||||||
|
MassN ;
|
||||||
|
|
||||||
|
fun
|
||||||
|
|
||||||
|
-- Pronouns
|
||||||
|
|
||||||
|
i_Pron : Pron ;
|
||||||
|
youSg_Pron : Pron ;
|
||||||
|
he_Pron : Pron ;
|
||||||
|
we_Pron : Pron ;
|
||||||
|
youPl_Pron : Pron ;
|
||||||
|
they_Pron : Pron ;
|
||||||
|
whoPl_IP : IP ; -- only one who in Swadesh 207
|
||||||
|
whoSg_IP : IP ;
|
||||||
|
whatPl_IP : IP ; -- only one what in Swadesh 207
|
||||||
|
whatSg_IP : IP ;
|
||||||
|
|
||||||
|
-- Determiners
|
||||||
|
|
||||||
|
aSg_Det : Det ;
|
||||||
|
aPl_Det : Det ;
|
||||||
|
theSg_Det : Det ;
|
||||||
|
thePl_Det : Det ;
|
||||||
|
that_Det : Det ;
|
||||||
|
those_Det : Det ;
|
||||||
|
this_Det : Det ;
|
||||||
|
these_Det : Det ;
|
||||||
|
|
||||||
|
-- Adverbs
|
||||||
|
|
||||||
|
here_Adv : Adv ;
|
||||||
|
there_Adv : Adv ;
|
||||||
|
where_IAdv : IAdv ;
|
||||||
|
when_IAdv : IAdv ;
|
||||||
|
|
||||||
|
-- Numerals
|
||||||
|
|
||||||
|
one_Det : Det ;
|
||||||
|
two_Num : Num ;
|
||||||
|
three_Num : Num ;
|
||||||
|
four_Num : Num ;
|
||||||
|
five_Num : Num ;
|
||||||
|
|
||||||
|
-- Adjectives
|
||||||
|
|
||||||
|
black_A : A ;
|
||||||
|
blue_A : A ;
|
||||||
|
cold_A : A ;
|
||||||
|
dangerous_A : A ;
|
||||||
|
dead_A : A ;
|
||||||
|
green_A : A ;
|
||||||
|
hot_A : A ;
|
||||||
|
hungry_A : A ;
|
||||||
|
large_A : A ;
|
||||||
|
red_A : A ;
|
||||||
|
sick_A : A ;
|
||||||
|
small_A : A ;
|
||||||
|
white_A : A ;
|
||||||
|
yellow_A : A ;
|
||||||
|
|
||||||
|
-- Nouns
|
||||||
|
|
||||||
|
air_N : MassN ;
|
||||||
|
airplane_N : N ;
|
||||||
|
arm_N : N ;
|
||||||
|
animal_N : N ;
|
||||||
|
blood_N : MassN ;
|
||||||
|
boat_N : N ;
|
||||||
|
boy_N : N ;
|
||||||
|
child_N : N ;
|
||||||
|
building_N : N ;
|
||||||
|
car_N : N ;
|
||||||
|
doctor_N : N ;
|
||||||
|
enemy_N : N ;
|
||||||
|
factory_N : N ;
|
||||||
|
food_N : MassN ;
|
||||||
|
foot_N : N ;
|
||||||
|
friend_N : N ;
|
||||||
|
girl_N : N ;
|
||||||
|
hand_N : N ;
|
||||||
|
head_N : N ;
|
||||||
|
house_N : N ;
|
||||||
|
landmine_N : N ;
|
||||||
|
leg_N : N ;
|
||||||
|
medicine_N : MassN ;
|
||||||
|
man_N : N ;
|
||||||
|
road_N : N ;
|
||||||
|
soldier_N : N ;
|
||||||
|
water_N : MassN ;
|
||||||
|
weapon_N : N ;
|
||||||
|
woman_N : N;
|
||||||
|
|
||||||
|
-- Verbs
|
||||||
|
cough_V : V ;
|
||||||
|
eat_V2 : V2 ;
|
||||||
|
drink_V2 : V2 ;
|
||||||
|
give_V3 : V3 ;
|
||||||
|
have_V2 : V2;
|
||||||
|
need_V2 : V2;
|
||||||
|
see_V2 : V2 ;
|
||||||
|
show_V3 : V3 ;
|
||||||
|
walk_V : V ;
|
||||||
|
|
||||||
|
}
|
||||||
104
examples/peacekeeping/PeaceLex_Eng.gf
Normal file
104
examples/peacekeeping/PeaceLex_Eng.gf
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
concrete PeaceLex_Eng of PeaceLex = CatEng ** open LangEng, ParadigmsEng in {
|
||||||
|
|
||||||
|
lincat
|
||||||
|
MassN = N ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
|
||||||
|
-- Pronouns
|
||||||
|
|
||||||
|
i_Pron = i_Pron ;
|
||||||
|
youSg_Pron = youSg_Pron ;
|
||||||
|
he_Pron = he_Pron ;
|
||||||
|
we_Pron = we_Pron ;
|
||||||
|
youPl_Pron = youPl_Pron ;
|
||||||
|
they_Pron = they_Pron ;
|
||||||
|
whoPl_IP = whoPl_IP ;
|
||||||
|
whoSg_IP = whoSg_IP ;
|
||||||
|
whatPl_IP = whatPl_IP ;
|
||||||
|
whatSg_IP = whatSg_IP ;
|
||||||
|
|
||||||
|
-- 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 ;
|
||||||
|
|
||||||
|
|
||||||
|
-- Adverbs
|
||||||
|
here_Adv = here_Adv;
|
||||||
|
there_Adv = there_Adv;
|
||||||
|
where_IAdv = where_IAdv;
|
||||||
|
when_IAdv = when_IAdv;
|
||||||
|
|
||||||
|
-- Numerals
|
||||||
|
one_Det = DetSg one_Quant NoOrd ;
|
||||||
|
two_Num = NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))) ;
|
||||||
|
three_Num = NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))) ;
|
||||||
|
four_Num = NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n4))))) ;
|
||||||
|
five_Num = NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n5))))) ;
|
||||||
|
|
||||||
|
-- Adjectives
|
||||||
|
black_A = black_A ;
|
||||||
|
blue_A = blue_A ;
|
||||||
|
cold_A = cold_A ;
|
||||||
|
dangerous_A = regA "dangerous" ;
|
||||||
|
dead_A = regA "dead" ;
|
||||||
|
green_A = green_A ;
|
||||||
|
hot_A = hot_A ;
|
||||||
|
hungry_A = regA "hungry" ;
|
||||||
|
large_A = regA "large" ;
|
||||||
|
red_A = red_A ;
|
||||||
|
sick_A = regA "sick" ;
|
||||||
|
small_A = small_A ;
|
||||||
|
white_A = white_A ;
|
||||||
|
yellow_A = yellow_A ;
|
||||||
|
|
||||||
|
-- Nouns
|
||||||
|
air_N = regN "air" ;
|
||||||
|
airplane_N = airplane_N ;
|
||||||
|
animal_N = animal_N ;
|
||||||
|
arm_N = regN "arm" ;
|
||||||
|
blood_N = blood_N ;
|
||||||
|
boat_N = boat_N ;
|
||||||
|
boy_N = boy_N ;
|
||||||
|
building_N = regN "building" ;
|
||||||
|
car_N = regN "car" ;
|
||||||
|
child_N = child_N ;
|
||||||
|
doctor_N = regN "doctor";
|
||||||
|
enemy_N = regN "enemy";
|
||||||
|
factory_N = factory_N ;
|
||||||
|
food_N = regN "food";
|
||||||
|
foot_N = foot_N ;
|
||||||
|
friend_N = regN "friend";
|
||||||
|
girl_N = girl_N ;
|
||||||
|
hand_N = hand_N ;
|
||||||
|
head_N = head_N ;
|
||||||
|
house_N = house_N ;
|
||||||
|
landmine_N = regN "landmine" ;
|
||||||
|
leg_N = leg_N ;
|
||||||
|
man_N = man_N ;
|
||||||
|
medicine_N = regN "medicine" ;
|
||||||
|
road_N = road_N ;
|
||||||
|
soldier_N = regN "soldier" ;
|
||||||
|
water_N = water_N ;
|
||||||
|
weapon_N = regN "weapon";
|
||||||
|
woman_N = woman_N ;
|
||||||
|
|
||||||
|
-- Verbs
|
||||||
|
cough_V = regV "cough" ;
|
||||||
|
drink_V2 = drink_V2 ;
|
||||||
|
eat_V2 = eat_V2 ;
|
||||||
|
give_V3 = give_V3;
|
||||||
|
have_V2 = have_V2;
|
||||||
|
need_V2 = dirV2 (regV "need");
|
||||||
|
see_V2 = see_V2 ;
|
||||||
|
show_V3 = dirdirV3 (regV "show");
|
||||||
|
walk_V = walk_V ;
|
||||||
|
|
||||||
|
}
|
||||||
11
examples/peacekeeping/README
Normal file
11
examples/peacekeeping/README
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Some things we could use for inspiration:
|
||||||
|
|
||||||
|
Spanish Phrase Book for First-Aid Trained Activists
|
||||||
|
http://bostoncoop.net/balm/phrasebook1.pdf
|
||||||
|
|
||||||
|
Ogden's Basic English:
|
||||||
|
|
||||||
|
http://ogden.basic-english.org/words.html
|
||||||
Reference in New Issue
Block a user