mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 19:22:50 -06:00
command eb for example-based grammar conversion; see 'help eb' and the example in examples/animals/QuestionsI.gfe
This commit is contained in:
12
examples/animals/Animals.gf
Normal file
12
examples/animals/Animals.gf
Normal file
@@ -0,0 +1,12 @@
|
||||
-- The Question grammar specialized to animals.
|
||||
|
||||
abstract Animals = Questions ** {
|
||||
|
||||
flags startcat=Phrase ;
|
||||
|
||||
fun
|
||||
-- a lexicon of animals and actions among them
|
||||
Dog, Cat, Mouse, Lion, Zebra : Entity ;
|
||||
Chase, Eat, See : Action ;
|
||||
}
|
||||
|
||||
16
examples/animals/AnimalsEng.gf
Normal file
16
examples/animals/AnimalsEng.gf
Normal file
@@ -0,0 +1,16 @@
|
||||
--# -path=.:present:prelude
|
||||
--resource/english:resource/abstract:resource/../prelude
|
||||
|
||||
concrete AnimalsEng of Animals = QuestionsEng **
|
||||
open LangEng, ParadigmsEng, IrregEng in {
|
||||
|
||||
lin
|
||||
Dog = regN "dog" ;
|
||||
Cat = regN "cat" ;
|
||||
Mouse = mk2N "mouse" "mice" ;
|
||||
Lion = regN "lion" ;
|
||||
Zebra = regN "zebra" ;
|
||||
Chase = dirV2 (regV "chase") ;
|
||||
Eat = dirV2 eat_V ;
|
||||
See = dirV2 see_V ;
|
||||
}
|
||||
15
examples/animals/AnimalsFre.gf
Normal file
15
examples/animals/AnimalsFre.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--# -path=.:present:prelude
|
||||
|
||||
concrete AnimalsFre of Animals = QuestionsFre **
|
||||
open LangFre, ParadigmsFre, IrregFre in {
|
||||
|
||||
lin
|
||||
Dog = regN "chien" ;
|
||||
Cat = regN "chat" ;
|
||||
Mouse = regGenN "souris" feminine ;
|
||||
Lion = regN "lion" ;
|
||||
Zebra = regGenN "zèbre" masculine ;
|
||||
Chase = dirV2 (regV "chasser") ;
|
||||
Eat = dirV2 (regV "manger") ;
|
||||
See = voir_V2 ;
|
||||
}
|
||||
15
examples/animals/AnimalsSwe.gf
Normal file
15
examples/animals/AnimalsSwe.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--# -path=.:present:prelude
|
||||
|
||||
concrete AnimalsSwe of Animals = QuestionsSwe **
|
||||
open LangSwe, ParadigmsSwe, IrregSwe in {
|
||||
|
||||
lin
|
||||
Dog = regN "hund" ;
|
||||
Cat = mk2N "katt" "katter" ;
|
||||
Mouse = mkN "mus" "musen" "möss" "mössen" ;
|
||||
Lion = mk2N "lejon" "lejon" ;
|
||||
Zebra = regN "zebra" ;
|
||||
Chase = dirV2 (regV "jaga") ;
|
||||
Eat = dirV2 äta_V ;
|
||||
See = dirV2 se_V ;
|
||||
}
|
||||
10
examples/animals/Questions.gf
Normal file
10
examples/animals/Questions.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
-- Simple questions and answers, in present tense.
|
||||
|
||||
abstract Questions = {
|
||||
cat
|
||||
Phrase ; Entity ; Action ;
|
||||
fun
|
||||
Who : Action -> Entity -> Phrase ; -- who chases X
|
||||
Whom : Entity -> Action -> Phrase ; -- whom does X chase
|
||||
Answer : Entity -> Action -> Entity -> Phrase ; -- X chases Y
|
||||
}
|
||||
2
examples/animals/QuestionsEng.gf
Normal file
2
examples/animals/QuestionsEng.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete QuestionsEng of Questions = QuestionsI with
|
||||
(Lang = LangEng) ;
|
||||
2
examples/animals/QuestionsFre.gf
Normal file
2
examples/animals/QuestionsFre.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete QuestionsFre of Questions = QuestionsI with
|
||||
(Lang = LangFre) ;
|
||||
27
examples/animals/QuestionsI.gf
Normal file
27
examples/animals/QuestionsI.gf
Normal file
@@ -0,0 +1,27 @@
|
||||
-- to compile: echo "eb -file=QuestionsI.gfe" | gf $GF_LIB_PATH/present/LangEng.gfo
|
||||
-- or use directly gf <mkAnimals.gfs
|
||||
|
||||
incomplete concrete QuestionsI of Questions = open Lang in {
|
||||
lincat
|
||||
Phrase = Utt ;
|
||||
Entity = N ;
|
||||
Action = V2 ;
|
||||
|
||||
lin
|
||||
Who love_V2 man_N = (
|
||||
UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestVP whoSg_IP (ComplSlash (SlashV2a love_V2) (DetCN (DetQuant IndefArt NumPl) (UseN man_N)))))
|
||||
)
|
||||
;
|
||||
Whom man_N love_V2 = (
|
||||
UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestSlash whoPl_IP (SlashVP (DetCN (DetQuant DefArt NumSg) (UseN man_N)) (SlashV2a love_V2))))
|
||||
--- UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestSlash whoSg_IP (SlashVP (DetCN (DetQuant DefArt NumSg) (UseN man_N)) (SlashV2a love_V2))))
|
||||
)
|
||||
;
|
||||
Answer woman_N love_V2 man_N = (
|
||||
UttNP (DetCN (DetQuant DefArt NumSg) (ApposCN (ApposCN (UseN woman_N) (DetCN (DetQuant IndefArt NumPl) (UseN love_N))) (DetCN (DetQuant IndefArt NumPl) (UseN man_N))))
|
||||
--- UttNP (DetCN (DetQuant DefArt NumSg) (ApposCN (UseN woman_N) (DetCN (DetQuant IndefArt NumPl) (ApposCN (UseN love_N) (DetCN (DetQuant IndefArt NumPl) (UseN man_N))))))
|
||||
--- UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN woman_N)) (ComplSlash (SlashV2a love_V2) (DetCN (DetQuant IndefArt NumPl) (UseN man_N)))))
|
||||
)
|
||||
;
|
||||
|
||||
}
|
||||
15
examples/animals/QuestionsI.gfe
Normal file
15
examples/animals/QuestionsI.gfe
Normal file
@@ -0,0 +1,15 @@
|
||||
-- to compile: echo "eb -file=QuestionsI.gfe" | gf $GF_LIB_PATH/present/LangEng.gfo
|
||||
-- or use directly gf <mkAnimals.gfs
|
||||
|
||||
incomplete concrete QuestionsI of Questions = open Lang in {
|
||||
lincat
|
||||
Phrase = Utt ;
|
||||
Entity = N ;
|
||||
Action = V2 ;
|
||||
|
||||
lin
|
||||
Who love_V2 man_N = %ex Utt "who loves men" ;
|
||||
Whom man_N love_V2 = %ex Utt "whom does the man love" ;
|
||||
Answer woman_N love_V2 man_N = %ex Utt "the woman loves men" ;
|
||||
|
||||
}
|
||||
2
examples/animals/QuestionsSwe.gf
Normal file
2
examples/animals/QuestionsSwe.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete QuestionsSwe of Questions = QuestionsI with
|
||||
(Lang = LangSwe) ;
|
||||
Reference in New Issue
Block a user