forked from GitHub/gf-core
Moved punctuation to a separate field, to allow spoken language grammars to omit it. Created top-level spoken language grammars. (all in peacekeeping)
This commit is contained in:
@@ -2,5 +2,12 @@ abstract PeaceCat = Cat ** {
|
||||
|
||||
cat
|
||||
MassN ;
|
||||
Phrase ;
|
||||
PhraseWritten ;
|
||||
PhraseSpoken ;
|
||||
|
||||
fun
|
||||
Written : Phrase -> PhraseWritten ;
|
||||
Spoken : Phrase -> PhraseSpoken ;
|
||||
|
||||
}
|
||||
@@ -1,6 +1,22 @@
|
||||
incomplete concrete PeaceCatI of PeaceCat = Cat ** open Cat in {
|
||||
incomplete concrete PeaceCatI of PeaceCat =
|
||||
Cat ** open Lang, PeaceRes, Prelude in {
|
||||
|
||||
lincat
|
||||
MassN = N ;
|
||||
Phrase = { s : Str; p : Punct } ;
|
||||
PhraseWritten = { s : Str } ;
|
||||
PhraseSpoken = { s : Str } ;
|
||||
|
||||
lin
|
||||
Written x = mkWritten x.s x.p ;
|
||||
Spoken x = { s = x.s } ;
|
||||
|
||||
oper
|
||||
mkWritten : Str -> Punct -> { s : Str } ;
|
||||
mkWritten x p = case p of {
|
||||
FullStop => { s = x ++ "." } ; --TFullStop (ss s) TEmpty ;
|
||||
QuestMark => { s = x ++ "?" } ; --TQuestMark (ss s) TEmpty ;
|
||||
ExclMark => { s = x ++ "!" } --TExclMark (ss s) TEmpty
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
abstract PeacePhrases = Cat ** {
|
||||
abstract PeacePhrases = PeaceCat ** {
|
||||
|
||||
fun
|
||||
Hello : Phr ;
|
||||
GoodMorning : Phr ;
|
||||
GoodEvening : Phr ;
|
||||
WhatIsNamePron : Pron -> Phr ;
|
||||
Hello : Phrase ;
|
||||
GoodMorning : Phrase ;
|
||||
GoodEvening : Phrase ;
|
||||
WhatIsNamePron : Pron -> Phrase ;
|
||||
|
||||
}
|
||||
11
examples/peacekeeping/PeaceRes.gf
Normal file
11
examples/peacekeeping/PeaceRes.gf
Normal file
@@ -0,0 +1,11 @@
|
||||
resource PeaceRes = {
|
||||
|
||||
param Punct = FullStop | QuestMark | ExclMark ;
|
||||
|
||||
oper
|
||||
stop, quest, excl : Str -> { s : Str; p : Punct } ;
|
||||
stop x = { s = x; p = FullStop } ;
|
||||
quest x = { s = x; p = QuestMark } ;
|
||||
excl x = { s = x; p = ExclMark } ;
|
||||
|
||||
}
|
||||
1
examples/peacekeeping/PeaceSpoken.gf
Normal file
1
examples/peacekeeping/PeaceSpoken.gf
Normal file
@@ -0,0 +1 @@
|
||||
abstract PeaceSpoken = Peace ** {}
|
||||
@@ -6,14 +6,14 @@ abstract PeaceSyntax = PeaceCat ** {
|
||||
MassCN ;
|
||||
|
||||
fun
|
||||
PhrPos : Sent -> Phr ;
|
||||
PhrNeg : Sent -> Phr ;
|
||||
PhrQuest : Quest -> Phr ;
|
||||
PhrImp : Imp -> Phr ;
|
||||
PhrImpNeg : Imp -> Phr ;
|
||||
PhrPos : Sent -> Phrase ;
|
||||
PhrNeg : Sent -> Phrase ;
|
||||
PhrQuest : Quest -> Phrase ;
|
||||
PhrImp : Imp -> Phrase ;
|
||||
PhrImpNeg : Imp -> Phrase ;
|
||||
|
||||
PhrYes : Phr ;
|
||||
PhrNo : Phr ;
|
||||
PhrYes : Phrase ;
|
||||
PhrNo : Phrase ;
|
||||
|
||||
QuestSent : Sent -> Quest ;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
incomplete concrete PeaceSyntaxI of PeaceSyntax = PeaceCatI ** open Lang in {
|
||||
incomplete concrete PeaceSyntaxI of PeaceSyntax =
|
||||
PeaceCatI ** open Lang,PeaceRes in {
|
||||
|
||||
flags
|
||||
-- optimize = all_subs ;
|
||||
@@ -11,22 +12,21 @@ incomplete concrete PeaceSyntaxI of PeaceSyntax = PeaceCatI ** open Lang in {
|
||||
MassCN = CN ;
|
||||
|
||||
lin
|
||||
PhrPos sent = {s = sent.s ! SPos ++ "."} ;
|
||||
PhrNeg sent = {s = sent.s ! SNeg ++ "."} ;
|
||||
PhrQuest q = {s = q.s ++ "?" } ;
|
||||
PhrImp imp = {s = (PhrUtt NoPConj (UttImpSg PPos imp) NoVoc).s ++ "!"} ;
|
||||
PhrImpNeg imp = {s = (PhrUtt NoPConj (UttImpSg PNeg imp) NoVoc).s ++ "!"} ;
|
||||
PhrPos sent = stop (sent.s!SPos) ;
|
||||
PhrNeg sent = stop (sent.s!SNeg) ;
|
||||
PhrQuest q = quest q.s ;
|
||||
PhrImp imp = excl (PhrUtt NoPConj (UttImpSg PPos imp) NoVoc).s;
|
||||
PhrImpNeg imp = excl (PhrUtt NoPConj (UttImpSg PNeg imp) NoVoc).s;
|
||||
|
||||
PhrYes = { s = yes_Phr.s ++ "." } ;
|
||||
PhrNo = { s = no_Phr.s ++ "." } ;
|
||||
PhrYes = stop yes_Phr.s ;
|
||||
PhrNo = stop no_Phr.s ;
|
||||
|
||||
QuestSent sent = {s = sent.s ! SQuest } ;
|
||||
QuestSent sent = { s = sent.s!SQuest } ;
|
||||
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_V3 v ip x y = mkQuest (QuestVP ip (ComplV3 v x y)) ;
|
||||
QuestIP_V3Mass v ip x y = mkQuest (QuestVP ip (ComplV3 v (massNP x) y)) ;
|
||||
QuestIP_A : A -> IP -> Phr ;
|
||||
QuestIP_A a ip = mkQuest (QuestVP ip (UseComp (CompAP (PositA a))));
|
||||
QuestIAdv_NP x ia = mkQuest (QuestIComp (CompIAdv ia) x);
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
--# -path=.:present:prelude
|
||||
|
||||
concrete PeaceCat_Eng of PeaceCat = CatEng ** PeaceCatI with (Cat = CatEng);
|
||||
concrete PeaceCat_Eng of PeaceCat = CatEng ** PeaceCatI with (Lang = LangEng);
|
||||
@@ -1,12 +1,12 @@
|
||||
--# -path=.:..:present:prelude
|
||||
|
||||
concrete PeacePhrases_Eng of PeacePhrases =
|
||||
PeaceCat_Eng ** open ResEng in {
|
||||
PeaceCat_Eng ** open ResEng, PeaceRes in {
|
||||
|
||||
lin
|
||||
Hello = { s = "hello" ++ "." } ;
|
||||
GoodMorning = { s = ["good morning"] ++ "." } ;
|
||||
GoodEvening = { s = ["good evening"] ++ "." } ;
|
||||
WhatIsNamePron p = { s = ["what is"] ++ p.s!Gen ++ "name" ++ "?"; };
|
||||
Hello = stop "hello" ;
|
||||
GoodMorning = stop ["good morning"];
|
||||
GoodEvening = stop ["good evening"] ;
|
||||
WhatIsNamePron p = quest (["what is"] ++ p.s!Gen ++ "name") ;
|
||||
|
||||
}
|
||||
8
examples/peacekeeping/english/PeaceSpoken_Eng.gf
Normal file
8
examples/peacekeeping/english/PeaceSpoken_Eng.gf
Normal file
@@ -0,0 +1,8 @@
|
||||
--# -path=.:..:present:prelude
|
||||
|
||||
concrete PeaceSpoken_Eng of PeaceSpoken =
|
||||
Peace_Eng ** {
|
||||
|
||||
flags startcat = PhraseSpoken ;
|
||||
|
||||
}
|
||||
@@ -5,6 +5,6 @@ concrete Peace_Eng of Peace =
|
||||
PeaceLexExt_Eng, PeacePhrases_Eng
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = PhraseWritten ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
--# -path=.:present:prelude
|
||||
|
||||
concrete PeaceCat_Fin of PeaceCat = CatFin ** PeaceCatI with (Cat = CatFin);
|
||||
concrete PeaceCat_Fin of PeaceCat = CatFin ** PeaceCatI with (Lang = LangFin);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--# -path=.:..:present:prelude
|
||||
|
||||
concrete PeacePhrases_Fin of PeacePhrases =
|
||||
PeaceCat_Fin ** open LangFin, ParadigmsFin in {
|
||||
PeaceCat_Fin ** open LangFin, ParadigmsFin, PeaceRes in {
|
||||
|
||||
lin
|
||||
Hello = { s = "terve" ++ "." } ;
|
||||
GoodMorning = { s = ["hyvää huomenta"] ++ "." } ;
|
||||
GoodEvening = { s = ["hyvää iltaa"] ++ "." } ;
|
||||
WhatIsNamePron p = PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos
|
||||
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 ;
|
||||
(UseN (reg2N "nimi" "nimiä")))))))) NoVoc).s ;
|
||||
|
||||
}
|
||||
8
examples/peacekeeping/finnish/PeaceSpoken_Fin.gf
Normal file
8
examples/peacekeeping/finnish/PeaceSpoken_Fin.gf
Normal file
@@ -0,0 +1,8 @@
|
||||
--# -path=.:..:present:prelude
|
||||
|
||||
concrete PeaceSpoken_Fin of PeaceSpoken =
|
||||
Peace_Fin ** {
|
||||
|
||||
flags startcat = PhraseSpoken ;
|
||||
|
||||
}
|
||||
@@ -5,6 +5,6 @@ concrete Peace_Fin of Peace =
|
||||
PeaceLexExt_Fin, PeacePhrases_Fin
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
|
||||
flags startcat = PhraseWritten ;
|
||||
optimize = all_subs ;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
--# -path=.:present:prelude
|
||||
|
||||
concrete PeaceCat_Swe of PeaceCat = CatSwe ** PeaceCatI with (Cat = CatSwe);
|
||||
concrete PeaceCat_Swe of PeaceCat = CatSwe ** PeaceCatI with (Lang = LangSwe);
|
||||
@@ -1,12 +1,12 @@
|
||||
--# -path=.:..:present:prelude
|
||||
|
||||
concrete PeacePhrases_Swe of PeacePhrases =
|
||||
PeaceCat_Swe ** open CommonScand in {
|
||||
PeaceCat_Swe ** open CommonScand, PeaceRes in {
|
||||
|
||||
lin
|
||||
Hello = { s = "hej" ++ "." } ;
|
||||
GoodMorning = { s = ["god morgon"] ++ "." } ;
|
||||
GoodEvening = { s = ["god kväll"] ++ "." } ;
|
||||
WhatIsNamePron p = { s = ["vad heter"] ++ p.s!NPNom ++ "?"; };
|
||||
Hello = stop "hej" ;
|
||||
GoodMorning = stop ["god morgon"] ;
|
||||
GoodEvening = stop ["god kväll"] ;
|
||||
WhatIsNamePron p = stop (["vad heter"] ++ p.s!NPNom) ;
|
||||
|
||||
}
|
||||
8
examples/peacekeeping/swedish/PeaceSpoken_Swe.gf
Normal file
8
examples/peacekeeping/swedish/PeaceSpoken_Swe.gf
Normal file
@@ -0,0 +1,8 @@
|
||||
--# -path=.:..:present:prelude
|
||||
|
||||
concrete PeaceSpoken_Swe of PeaceSpoken =
|
||||
Peace_Swe ** {
|
||||
|
||||
flags startcat = PhraseSpoken ;
|
||||
|
||||
}
|
||||
@@ -5,6 +5,6 @@ concrete Peace_Swe of Peace =
|
||||
PeaceLexExt_Swe, PeacePhrases_Swe
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = PhraseWritten ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user