forked from GitHub/gf-core
added examples/SUMO
This commit is contained in:
13
examples/SUMO/RGLExt/DictLang.gf
Normal file
13
examples/SUMO/RGLExt/DictLang.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
--1 Lang: a Test Module for the Resource Grammar
|
||||
|
||||
-- This grammar is for testing the resource as included in the
|
||||
-- language-independent API, consisting of a grammar and a lexicon.
|
||||
-- The grammar without a lexicon is [``Grammar`` Grammar.html],
|
||||
-- which may be more suitable to open in applications.
|
||||
|
||||
abstract DictLang =
|
||||
Grammar,
|
||||
Extension
|
||||
** {
|
||||
-- flags startcat=NP ;
|
||||
} ;
|
||||
9
examples/SUMO/RGLExt/DictLangEng.gf
Normal file
9
examples/SUMO/RGLExt/DictLangEng.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
--# -path=.:../../../lib/src/abstract:../../../lib/src/english:../../../lib/src/common
|
||||
|
||||
concrete DictLangEng of DictLang =
|
||||
GrammarEng,
|
||||
ExtensionEng ** {
|
||||
|
||||
flags unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
10
examples/SUMO/RGLExt/DictLangFre.gf
Normal file
10
examples/SUMO/RGLExt/DictLangFre.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
--# -path=.:../abstract:../common:../prelude:../romance:
|
||||
|
||||
concrete DictLangFre of DictLang =
|
||||
GrammarFre,
|
||||
ExtensionFre
|
||||
** {
|
||||
|
||||
flags unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
10
examples/SUMO/RGLExt/DictLangRon.gf
Normal file
10
examples/SUMO/RGLExt/DictLangRon.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
|
||||
concrete DictLangRon of DictLang =
|
||||
GrammarRon,
|
||||
ExtensionRon
|
||||
** {
|
||||
|
||||
flags unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
32
examples/SUMO/RGLExt/Extension.gf
Normal file
32
examples/SUMO/RGLExt/Extension.gf
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
-- other functions needed for parsing
|
||||
|
||||
abstract Extension = Cat ** {
|
||||
|
||||
|
||||
|
||||
cat
|
||||
PolSentence;
|
||||
StmtS ;
|
||||
[CN]{2};
|
||||
fun
|
||||
|
||||
VerbToNounV2 : V2 -> N2 ; -- discovering
|
||||
VerbToNoun : V -> N ; -- walking is healthy
|
||||
VerbToGerundA : V -> A ; -- singing bird
|
||||
VerbToParticipeA : V -> A ; -- the required number
|
||||
ConjCN : Conj -> [CN] -> CN ; -- set or class
|
||||
mkPolSent : Cl -> PolSentence ;
|
||||
sentToNoun : PolSentence -> NP ;
|
||||
UsePolSentence : Pol -> PolSentence -> StmtS ;
|
||||
|
||||
at_Prep : Prep ;
|
||||
per_Prep : Prep ;
|
||||
O1 : NP ;
|
||||
O2 : NP ;
|
||||
O3 : NP ;
|
||||
O4 : NP ;
|
||||
O5 : NP ;
|
||||
|
||||
|
||||
};
|
||||
58
examples/SUMO/RGLExt/ExtensionEng.gf
Normal file
58
examples/SUMO/RGLExt/ExtensionEng.gf
Normal file
@@ -0,0 +1,58 @@
|
||||
concrete ExtensionEng of Extension = CatEng ** open MorphoEng, ResEng, ConjunctionEng, StructuralEng, Prelude, ParadigmsEng, Coordination,ParamBasic in {
|
||||
|
||||
|
||||
lincat
|
||||
PolSentence = {s : SentForm => Polarity => Str ; flag : Flag};
|
||||
[CN] = {s1,s2 : Number => Case => Str ; g : Gender} ;
|
||||
StmtS = {s : Str};
|
||||
lin
|
||||
|
||||
VerbToNounV2 vs = VerbToNoun vs ** {c2 = vs.c2};
|
||||
|
||||
VerbToNoun v = {s = \\_,_ => v.s ! VPresPart;
|
||||
g = Masc};
|
||||
|
||||
VerbToGerundA v = {s = \\_ => v.s ! VPresPart};
|
||||
|
||||
VerbToParticipeA v = {s = \\_ => v.s ! VPPart};
|
||||
|
||||
mkPolSent cl = {s = \\f,b => case b of
|
||||
{Pos => cl.s ! Pres ! Simul ! CPos ! ODir;
|
||||
_ => cl.s ! Pres ! Simul ! CNeg False ! ODir};
|
||||
flag = NothingS ;
|
||||
lock_PolSentence = <>};
|
||||
|
||||
sentToNoun ps = {s = \\_ => "\"" ++ ps.s ! Indep ! Pos ++ "\"";
|
||||
a = agrP3 Sg};
|
||||
|
||||
ConjCN conj ss = conjunctDistrTable2 Number Case conj ss ** {g = ss.g};
|
||||
|
||||
BaseCN x y ={s1 = \\n,c => x.s ! n ! c ;
|
||||
s2 = \\n,c => y.s ! n ! c ;
|
||||
g = x.g} ;
|
||||
|
||||
ConsCN xs x = consrTable2 Number Case comma xs x ** {g = Masc} ;
|
||||
|
||||
|
||||
UsePolSentence p ps = {s = ps.s ! Indep ! p.p};
|
||||
|
||||
at_Prep = mkPrep "at" ;
|
||||
per_Prep = mkPrep "per" ;
|
||||
|
||||
O1 = {s = \\_ => "o1" ;
|
||||
a = agrP3 Sg};
|
||||
|
||||
O2 = {s = \\_ => "o2" ;
|
||||
a = agrP3 Sg};
|
||||
|
||||
O3 = {s = \\_ => "o3" ;
|
||||
a = agrP3 Sg};
|
||||
|
||||
O4 = {s = \\_ => "o4" ;
|
||||
a = agrP3 Sg};
|
||||
|
||||
O5 = {s = \\_ => "o5" ;
|
||||
a = agrP3 Sg};
|
||||
|
||||
|
||||
}
|
||||
64
examples/SUMO/RGLExt/ExtensionFre.gf
Normal file
64
examples/SUMO/RGLExt/ExtensionFre.gf
Normal file
@@ -0,0 +1,64 @@
|
||||
--# -path=.:../romance:../common:../abstract:../prelude:
|
||||
concrete ExtensionFre of Extension = CatFre ** open MorphoFre, Prelude, Coordination,ParamBasic, ResFre, GrammarFre, ParadigmsFre in {
|
||||
|
||||
|
||||
lincat
|
||||
PolSentence = {s : SentForm => Polarity => Str ; flag : Flag};
|
||||
[CN] = {s1,s2 : Number => Str ; g : Gender} ;
|
||||
SS = {s : Str};
|
||||
|
||||
|
||||
|
||||
lin
|
||||
|
||||
VerbToNoun v = {s = \\_ => v.s ! (VInfin True);
|
||||
g = Masc};
|
||||
|
||||
VerbToNounV2 v2 = VerbToNoun v2 ** {c2 = v2.c2};
|
||||
|
||||
VerbToGerundA v = {s = \\_,af => case af of
|
||||
{AF g n => v.s ! VGer; -- need more data for feminine and plural forms
|
||||
AA => "en" ++ v.s ! VGer
|
||||
};
|
||||
isPre = False};
|
||||
|
||||
VerbToParticipeA v = {s = \\_,af => case af of
|
||||
{AF g n => v.s ! (VPart g n);
|
||||
AA => "en" ++ v.s ! VGer
|
||||
};
|
||||
isPre = False} ;
|
||||
|
||||
mkPolSent cl = {s = \\f,b => cl.s ! DDir ! RPres ! Simul ! b ! Indic ;
|
||||
flag = NothingS ;
|
||||
lock_PolSentence = <>
|
||||
};
|
||||
|
||||
sentToNoun ps = heavyNP {s = \\_ => "\"" ++ ps.s ! Indep ! Pos ++ "\"";
|
||||
a = agrP3 Masc Sg
|
||||
};
|
||||
|
||||
at_Prep = mkPreposition "à" ;
|
||||
per_Prep = mkPreposition "per" ;
|
||||
|
||||
ConjCN conj ss = conjunctDistrTable Number conj ss ** {
|
||||
g = ss.g
|
||||
};
|
||||
|
||||
BaseCN x y ={
|
||||
s1 = \\n => x.s ! n ;
|
||||
s2 = \\n => y.s ! n ;
|
||||
g = x.g};
|
||||
|
||||
ConsCN xs x = consrTable Number comma xs x ** {g = x.g} ;
|
||||
|
||||
UsePolSentence p ps = {s = ps.s ! Indep ! p.p};
|
||||
|
||||
O1 = UsePN (mkPN "o1") ;
|
||||
O2 = UsePN (mkPN "o2") ;
|
||||
O3 = UsePN (mkPN "o3") ;
|
||||
O4 = UsePN (mkPN "o4") ;
|
||||
O5 = UsePN (mkPN "o5") ;
|
||||
|
||||
|
||||
|
||||
}
|
||||
61
examples/SUMO/RGLExt/ExtensionRon.gf
Normal file
61
examples/SUMO/RGLExt/ExtensionRon.gf
Normal file
@@ -0,0 +1,61 @@
|
||||
concrete ExtensionRon of Extension = CatRon ** open MorphoRon, ResRon, ConjunctionRon, StructuralRon, Prelude, Coordination,ParamBasic, ParadigmsRon, NounRon in {
|
||||
|
||||
|
||||
lincat
|
||||
PolSentence = {s : SentForm => Polarity => Str ; flag : Flag};
|
||||
[CN] = {s1,s2 : Number => Species => ACase => Str; g : NGender; a : Animacy ; isComp : Bool} ;
|
||||
StmtS = {s : Str};
|
||||
lin
|
||||
|
||||
VerbToNounV2 v2 = VerbToNoun v2 ** {c2 = v2.c2};
|
||||
|
||||
|
||||
VerbToNoun vp = { s = \\n,sp,c => vp.s ! PPasse Masc n sp c ;
|
||||
g = NNeut ; a = Inanimate };
|
||||
|
||||
|
||||
VerbToGerundA vp = {s = \\af => vp.s ! Ger;
|
||||
isPre = False
|
||||
};
|
||||
|
||||
VerbToParticipeA v = {s = \\af => case af of
|
||||
{AF g n sp c => v.s ! PPasse g n sp c;
|
||||
AA => v.s ! PPasse Masc Sg Indef ANomAcc
|
||||
};
|
||||
isPre = False
|
||||
};
|
||||
|
||||
mkPolSent cl = {s = \\f,b => cl.s ! DDir ! RPres ! Simul ! b ! Indic ;
|
||||
flag = NothingS ;
|
||||
lock_PolSentence = <>
|
||||
};
|
||||
|
||||
sentToNoun ps = heavyNP {s = \\_ => "\"" ++ ps.s ! Indep ! Pos ++ "\"";
|
||||
a = agrP3 Masc Sg; hasClit = HasClit ; isComp = True ;
|
||||
ss = "\"" ++ ps.s ! Indep ! Pos ++ "\""
|
||||
};
|
||||
|
||||
ConjCN conj ss = conjunctDistrTable3 Number Species ACase conj ss ** {
|
||||
g = ss.g; a = ss.a; isComp = ss.isComp
|
||||
};
|
||||
|
||||
|
||||
BaseCN x y ={
|
||||
s1 = \\n,sp,c => x.s ! n ! sp ! c ;
|
||||
s2 = \\n,sp,c => y.s ! n ! sp ! c ;
|
||||
g = x.g; a = x.a ; isComp = x.isComp};
|
||||
|
||||
ConsCN xs x = consrTable3 Number Species ACase comma xs x ** {g = x.g; a = x.a; isComp = x.isComp} ;
|
||||
|
||||
at_Prep = mkPrep "la" Ac True;
|
||||
per_Prep = mkPrep "per" Ac True;
|
||||
|
||||
UsePolSentence p ps = {s = ps.s ! Indep ! p.p};
|
||||
|
||||
O1 = UsePN (mkPN "o1") ;
|
||||
O2 = UsePN (mkPN "o2") ;
|
||||
O3 = UsePN (mkPN "o3") ;
|
||||
O4 = UsePN (mkPN "o4") ;
|
||||
O5 = UsePN (mkPN "o5") ;
|
||||
|
||||
}
|
||||
7
examples/SUMO/RGLExt/ExtraLexicon.gf
Normal file
7
examples/SUMO/RGLExt/ExtraLexicon.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
abstract ExtraLexicon = Cat ** {
|
||||
fun
|
||||
time_N : N ;
|
||||
square_A : A ;
|
||||
value_N : N ;
|
||||
element_N : N ;
|
||||
}
|
||||
18
examples/SUMO/RGLExt/ExtraLexiconFre.gf
Normal file
18
examples/SUMO/RGLExt/ExtraLexiconFre.gf
Normal file
@@ -0,0 +1,18 @@
|
||||
--# -path=.:../romance:../common:../abstract:../../prelude
|
||||
|
||||
concrete ExtraLexiconFre of ExtraLexicon = CatFre **
|
||||
open ParadigmsFre,MorphoFre,BeschFre in {
|
||||
|
||||
flags
|
||||
optimize=values ;
|
||||
|
||||
lin
|
||||
value_N = regGenN "valeur" feminine ;
|
||||
square_A = regA "caré" ;
|
||||
time_N = regN "heure" ;
|
||||
element_N = mkN "élément" ;
|
||||
|
||||
|
||||
|
||||
|
||||
} ;
|
||||
18
examples/SUMO/RGLExt/ExtraLexiconRon.gf
Normal file
18
examples/SUMO/RGLExt/ExtraLexiconRon.gf
Normal file
@@ -0,0 +1,18 @@
|
||||
--# -path=.:../romance:../common:../abstract:../../prelude
|
||||
|
||||
concrete ExtraLexiconRon of ExtraLexicon = CatRon **
|
||||
open ParadigmsRon,MorphoRon,BeschRon in {
|
||||
|
||||
flags
|
||||
optimize=values ;
|
||||
|
||||
lin
|
||||
value_N = mkN "valoare" "valori" ;
|
||||
square_A = regA "patrat" ;
|
||||
time_N = mkNR "timp" ;
|
||||
element_N = mkN "element" ;
|
||||
|
||||
|
||||
|
||||
|
||||
} ;
|
||||
5
examples/SUMO/RGLExt/ParamBasic.gf
Normal file
5
examples/SUMO/RGLExt/ParamBasic.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
resource ParamBasic = {
|
||||
param Flag = ExistS NumQuant | ForallS NumQuant | NothingS ;
|
||||
param SentForm = Indep | Attrib ;
|
||||
param NumQuant = One | Many ;
|
||||
}
|
||||
Reference in New Issue
Block a user