mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-21 02:39:31 -06:00
added ParseEng/ParseEngAbs which is the grammar used for parsing PennTreebank
This commit is contained in:
97
lib/src/english/ParseEng.gf
Normal file
97
lib/src/english/ParseEng.gf
Normal file
@@ -0,0 +1,97 @@
|
||||
--# -path=.:alltenses:/home/krasimir/www.grammaticalframework.org/lib/src/english
|
||||
concrete PennTreebankCnc of PennTreebank =
|
||||
TenseX - [Pol, PNeg, PPos],
|
||||
CatEng,
|
||||
NounEng,
|
||||
AdjectiveEng,
|
||||
NumeralEng,
|
||||
SymbolEng,
|
||||
ConjunctionEng,
|
||||
VerbEng - [SlashV2V, PassV2],
|
||||
AdverbEng,
|
||||
PhraseEng,
|
||||
SentenceEng,
|
||||
RelativeEng,
|
||||
IdiomEng [VP, Tense, ProgrVP],
|
||||
ExtraEng [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash],
|
||||
DictEng **
|
||||
open MorphoEng, ResEng, ParadigmsEng, Prelude in {
|
||||
|
||||
flags
|
||||
literal=Symb ;
|
||||
|
||||
lin
|
||||
myself_NP = regNP "myself" singular ;
|
||||
yourselfSg_NP = regNP "yourself" singular ;
|
||||
himself_NP = regNP "himself" singular ;
|
||||
herself_NP = regNP "herself" singular ;
|
||||
itself_NP = regNP "itself" singular ;
|
||||
ourself_NP = regNP "ourself" plural ;
|
||||
yourselfPl_NP = regNP "yourself" plural ;
|
||||
themself_NP = regNP "themself" plural ;
|
||||
|
||||
CompoundCN num noun cn = {
|
||||
s = \\n,c => num.s ! Nom ++ noun.s ! num.n ! Nom ++ cn.s ! n ! c ;
|
||||
g = cn.g
|
||||
} ;
|
||||
|
||||
DashCN noun1 noun2 = {
|
||||
s = \\n,c => noun1.s ! Sg ! Nom ++ "-" ++ noun2.s ! n ! c ;
|
||||
g = noun2.g
|
||||
} ;
|
||||
|
||||
GerundN v = {
|
||||
s = \\n,c => v.s ! VPresPart ;
|
||||
g = Neutr
|
||||
} ;
|
||||
|
||||
GerundAP v = {
|
||||
s = \\agr => v.s ! VPresPart ;
|
||||
isPre = True
|
||||
} ;
|
||||
|
||||
PastPartAP v = {
|
||||
s = \\agr => v.s ! VPPart ;
|
||||
isPre = True
|
||||
} ;
|
||||
|
||||
OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ;
|
||||
|
||||
PositAdVAdj a = {s = a.s ! AAdv} ;
|
||||
|
||||
UseQuantPN q pn = {s = \\c => q.s ! False ! Sg ++ pn.s ! npcase2case c ; a = agrgP3 Sg pn.g} ;
|
||||
|
||||
SlashV2V v p vp = insertObjc (\\a => p.s ++ case p.p of {CPos => ""; _ => "not"} ++
|
||||
v.c3 ++
|
||||
infVP v.typ vp a)
|
||||
(predVc v) ;
|
||||
|
||||
ComplPredVP np vp = {
|
||||
s = \\t,a,b,o =>
|
||||
let
|
||||
verb = vp.s ! t ! a ! b ! o ! np.a ;
|
||||
compl = vp.s2 ! np.a
|
||||
in
|
||||
case o of {
|
||||
ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ;
|
||||
OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf
|
||||
}
|
||||
} ;
|
||||
|
||||
that_RP = {
|
||||
s = \\_ => "that" ;
|
||||
a = RNoAg
|
||||
} ;
|
||||
no_RP = {
|
||||
s = \\_ => "" ;
|
||||
a = RNoAg
|
||||
} ;
|
||||
|
||||
CompS s = {s = \\_ => "that" ++ s.s} ;
|
||||
CompVP vp = {s = \\a => infVP VVInf vp a} ;
|
||||
|
||||
lin
|
||||
PPos = {s = [] ; p = CPos} ;
|
||||
PNeg = {s = [] ; p = CNeg True} ; -- contracted: don't
|
||||
|
||||
}
|
||||
46
lib/src/english/ParseEngAbs.gf
Normal file
46
lib/src/english/ParseEngAbs.gf
Normal file
@@ -0,0 +1,46 @@
|
||||
abstract PennTreebank =
|
||||
Tense,
|
||||
Cat,
|
||||
Noun,
|
||||
Adjective,
|
||||
Numeral,
|
||||
Symbol,
|
||||
Conjunction,
|
||||
Verb - [SlashV2V, PassV2],
|
||||
Adverb,
|
||||
Phrase,
|
||||
Sentence,
|
||||
Relative,
|
||||
Idiom [VP, ProgrVP],
|
||||
Extra [NP, Quant, VPSlash, VP, GenNP, PassVPSlash],
|
||||
DictEngAbs ** {
|
||||
|
||||
fun CompoundCN : Num -> N -> CN -> CN ;
|
||||
DashCN : N -> N -> N ;
|
||||
GerundN : V -> N ;
|
||||
GerundAP : V -> AP ;
|
||||
PastPartAP : V2 -> AP ;
|
||||
myself_NP : NP ;
|
||||
yourselfSg_NP : NP ;
|
||||
himself_NP : NP ;
|
||||
herself_NP : NP ;
|
||||
itself_NP : NP ;
|
||||
ourself_NP : NP ;
|
||||
yourselfPl_NP : NP ;
|
||||
themself_NP : NP ;
|
||||
OrdCompar : A -> Ord ;
|
||||
|
||||
PositAdVAdj : A -> AdV ;
|
||||
|
||||
UseQuantPN : Quant -> PN -> NP;
|
||||
|
||||
SlashV2V : V2V -> Pol -> VP -> VPSlash ;
|
||||
|
||||
ComplPredVP : NP -> VP -> Cl ;
|
||||
|
||||
that_RP, no_RP : RP ;
|
||||
|
||||
CompS : S -> Comp ;
|
||||
CompVP : VP -> Comp ;
|
||||
|
||||
}
|
||||
14460
lib/src/english/ParseEngAbs.probs
Normal file
14460
lib/src/english/ParseEngAbs.probs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user