mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-09-26 04:03:40 -06:00
extensions from Codex
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
concrete ConstructionEus of Construction = CatEus ** open ParadigmsEus in {
|
||||
concrete ConstructionEus of Construction = CatEus **
|
||||
open Prelude, ResEus, ParadigmsEus, (G=GrammarEus) in {
|
||||
|
||||
lincat
|
||||
Timeunit = N ;
|
||||
@@ -6,6 +7,63 @@ lincat
|
||||
Monthday = NP ;
|
||||
Month = N ;
|
||||
Year = NP ;
|
||||
|
||||
lin
|
||||
weekdayN w = w ;
|
||||
monthN m = m ;
|
||||
|
||||
monday_Weekday = mkN "astelehen" ;
|
||||
tuesday_Weekday = mkN "astearte" ;
|
||||
wednesday_Weekday = mkN "asteazken" ;
|
||||
thursday_Weekday = mkN "ostegun" ;
|
||||
friday_Weekday = mkN "ostiral" ;
|
||||
saturday_Weekday = mkN "larunbat" ;
|
||||
sunday_Weekday = mkN "igande" ;
|
||||
|
||||
january_Month = mkN "urtarril" ;
|
||||
february_Month = mkN "otsail" ;
|
||||
march_Month = mkN "martxo" ;
|
||||
april_Month = mkN "apiril" ;
|
||||
may_Month = mkN "maiatz" ;
|
||||
june_Month = mkN "ekain" ;
|
||||
july_Month = mkN "uztail" ;
|
||||
august_Month = mkN "abuztu" ;
|
||||
september_Month = mkN "irail" ;
|
||||
october_Month = mkN "urri" ;
|
||||
november_Month = mkN "azaro" ;
|
||||
december_Month = mkN "abendu" ;
|
||||
|
||||
weekdayPunctualAdv w = {s = w.s ++ artDef ! Sg ! Ine ! w.ph} ;
|
||||
weekdayHabitualAdv w = {s = w.s ++ artDef ! Pl ! Ine ! w.ph} ;
|
||||
weekdayNextAdv w = {s = "hurrengo" ++ w.s ++ artDef ! Sg ! Abs ! w.ph} ;
|
||||
weekdayLastAdv w = {s = "joan den" ++ w.s ++ artDef ! Sg ! Abs ! w.ph} ;
|
||||
monthAdv m = {s = m.s ++ artDef ! Sg ! Ine ! m.ph} ;
|
||||
yearAdv y = {s = glue y.stem "an"} ;
|
||||
intYear i = lin Year (invariantNP i.s) ;
|
||||
intMonthday i = lin Monthday (invariantNP i.s) ;
|
||||
|
||||
ready_VP = G.UseComp (G.CompAP (G.PositA (mkA "prest"))) ;
|
||||
has_age_VP card =
|
||||
(useV {prc = \\_ => [] ; nstem = "izate" ; val = Du Ukan}) ** {
|
||||
dobj = {s = \\_ => card.s ++ "urte" ; agr = Hauek ; isDef = True}
|
||||
} ;
|
||||
|
||||
cup_of_CN np = G.PartNP (useN (mkNoun "kikara")) np ;
|
||||
|
||||
n_units_AP card unit a = {
|
||||
s = \\_ => card.s ++ linCNIndef unit ++ a.s ! AF Posit ;
|
||||
ph = a.ph ; typ = Bare
|
||||
} ;
|
||||
|
||||
n_units_of_NP card unit np = lin NP (np ** {
|
||||
s = \\c => card.s ++ linCNIndef unit ++ np.s ! c ;
|
||||
stem = card.s ++ linCNIndef unit ++ np.stem ; agr = Hauek
|
||||
}) ;
|
||||
|
||||
oper
|
||||
invariantNP : Str -> NP = \s -> lin NP {
|
||||
s = \\_ => s ; stem = s ; agr = Hau ; anim = Inan ; isDef = True
|
||||
} ;
|
||||
{-
|
||||
lin
|
||||
|
||||
|
||||
+156
-3
@@ -1,18 +1,171 @@
|
||||
--# -path=.:../common:../abstract
|
||||
|
||||
concrete ExtendEus of Extend =
|
||||
CatEus ** ExtendFunctor - [GenNP,ICompAP]
|
||||
CatEus ** ExtendFunctor - [
|
||||
VPS, ListVPS, BaseVPS, ConsVPS, ConjVPS, MkVPS, PredVPS,
|
||||
VPI, ListVPI, BaseVPI, ConsVPI, ConjVPI, MkVPI, ComplVPIVV,
|
||||
ListComp, BaseComp, ConsComp, ConjComp,
|
||||
ListImp, BaseImp, ConsImp, ConjImp,
|
||||
GenNP, GenModNP, ICompAP,
|
||||
PresPartAP, PastPartAP, PastPartAgentAP,
|
||||
PassVPSlash, PassAgentVPSlash, ProgrVPSlash,
|
||||
ReflPron, ReflPoss, AdvRNP, AdvRVP, AdvRAP, PossPronRNP,
|
||||
CompoundN, CompoundAP, GerundCN, GerundNP, GerundAdv,
|
||||
ByVP, InOrderToVP, ApposNP, PositAdVAdj,
|
||||
UseDAP, UseDAPMasc, UseDAPFem, CompVP, ExistIPQS
|
||||
]
|
||||
with (Grammar=GrammarEus)
|
||||
** open Prelude, ResEus in {
|
||||
** open Prelude, ResEus, AditzTrinkoak, Coordination, (G=GrammarEus) in {
|
||||
|
||||
lincat
|
||||
VPS = {s : Agr => Str ; sc : Case} ;
|
||||
[VPS] = {s1,s2 : Agr => Str ; sc : Case} ;
|
||||
VPI = {s : Agr => Str} ;
|
||||
[VPI] = {s1,s2 : Agr => Str} ;
|
||||
[Comp] = {s1,s2 : Agr => Str ; copula : SyntVerb1} ;
|
||||
[Imp] = {s1,s2 : Str} ;
|
||||
|
||||
lin
|
||||
MkVPS temp pol vp = {
|
||||
s = \\agr => linS ((mkClause False
|
||||
(empty_NP ** {agr = agr}) vp).s
|
||||
! temp.t ! temp.a ! pol.p ! Stat) ;
|
||||
sc = subjCase vp.val
|
||||
} ;
|
||||
BaseVPS x y = {s1 = x.s ; s2 = y.s ; sc = x.sc} ;
|
||||
ConsVPS x xs = {
|
||||
s1 = \\agr => x.s ! agr ++ SOFT_BIND ++ "," ++ xs.s1 ! agr ;
|
||||
s2 = xs.s2 ; sc = x.sc
|
||||
} ;
|
||||
ConjVPS conj xs = {
|
||||
s = \\agr => conj.s1 ++ xs.s1 ! agr ++ conj.s2 ++ xs.s2 ! agr ;
|
||||
sc = xs.sc
|
||||
} ;
|
||||
PredVPS np vps = sentenceFromStr (np.s ! vps.sc ++ vps.s ! np.agr) ;
|
||||
|
||||
MkVPI vp = {s = linVPPrc vp} ;
|
||||
BaseVPI x y = {s1 = x.s ; s2 = y.s} ;
|
||||
ConsVPI x xs = {
|
||||
s1 = \\agr => x.s ! agr ++ SOFT_BIND ++ "," ++ xs.s1 ! agr ;
|
||||
s2 = xs.s2
|
||||
} ;
|
||||
ConjVPI conj xs = {
|
||||
s = \\agr => conj.s1 ++ xs.s1 ! agr ++ conj.s2 ++ xs.s2 ! agr
|
||||
} ;
|
||||
ComplVPIVV vv vpi = insertComp vpi.s (useV vv) ;
|
||||
|
||||
BaseComp x y = {s1 = x.s ; s2 = y.s ; copula = x.copula} ;
|
||||
ConsComp x xs = {
|
||||
s1 = \\agr => x.s ! agr ++ SOFT_BIND ++ "," ++ xs.s1 ! agr ;
|
||||
s2 = xs.s2 ; copula = xs.copula
|
||||
} ;
|
||||
ConjComp conj xs = {
|
||||
s = \\agr => conj.s1 ++ xs.s1 ! agr ++ conj.s2 ++ xs.s2 ! agr ;
|
||||
copula = xs.copula
|
||||
} ;
|
||||
|
||||
BaseImp x y = {s1 = x.s ; s2 = y.s} ;
|
||||
ConsImp x xs = {s1 = x.s ++ SOFT_BIND ++ "," ++ xs.s1 ; s2 = xs.s2} ;
|
||||
ConjImp conj xs = {s = conj.s1 ++ xs.s1 ++ conj.s2 ++ xs.s2} ;
|
||||
|
||||
GenNP np = -- NP -> Quant ; -- this man's
|
||||
{ s = artDef ;
|
||||
indep, isDef = True ;
|
||||
pref = np.s ! Gen } ;
|
||||
|
||||
GenModNP num np cn = G.DetCN (G.DetQuant G.DefArt num) (G.PossNP cn np) ;
|
||||
|
||||
|
||||
ICompAP ap = -- AP -> IComp ; -- "how old"
|
||||
{ s = "nola" ++ ap.s ! Hau } ; --TODO agreement -- change type of IComp
|
||||
} ;
|
||||
|
||||
PresPartAP vp = relativeAP vp ;
|
||||
PastPartAP vps = relativeAP (passVPSlash vps) ;
|
||||
PastPartAgentAP vps agent = relativeAP (passAgentVPSlash vps agent) ;
|
||||
|
||||
PassVPSlash = passVPSlash ;
|
||||
PassAgentVPSlash = passAgentVPSlash ;
|
||||
ProgrVPSlash vps = vps ** {prc = \\_ => vps.prc ! Pres ++ "ari"} ;
|
||||
|
||||
ReflPron = reflexiveNP ;
|
||||
ReflPoss num cn = lin RNP (G.DetCN (reflexiveDet num) cn) ;
|
||||
AdvRNP np prep rnp = lin RNP (np ** {
|
||||
s = \\c => np.s ! c ++ applyPost prep rnp ;
|
||||
stem = np.stem ++ applyPost prep rnp
|
||||
}) ;
|
||||
AdvRVP vp prep rnp = insertAdv (ss (applyPost prep rnp)) vp ;
|
||||
AdvRAP ap prep rnp = ap ** {
|
||||
s = \\agr => ap.s ! agr ++ applyPost prep rnp
|
||||
} ;
|
||||
PossPronRNP pron num cn rnp =
|
||||
G.DetCN (G.DetQuant (G.PossPron pron) num)
|
||||
(cn ** {s = \\agr => rnp.s ! Gen ++ cn.s ! agr}) ;
|
||||
|
||||
CompoundN modifier head = head ** {s = modifier.s ++ head.s} ;
|
||||
CompoundAP noun adjective = adjective ** {
|
||||
s = \\agr => noun.s ++ adjective.s ! AF Posit ;
|
||||
typ = Bare
|
||||
} ;
|
||||
|
||||
GerundCN vp = {
|
||||
s = \\_ => gerundStr vp ; comp = [] ; ph = FinalVow ; anim = Inan ;
|
||||
heavyMod = \\_ => []
|
||||
} ;
|
||||
GerundNP vp = G.MassNP (GerundCN vp) ;
|
||||
GerundAdv vp = {s = (GerundNP vp).s ! Gen ++ "bidez"} ;
|
||||
ByVP = GerundAdv ;
|
||||
InOrderToVP vp = {s = vpObjects vp ++ glue vp.nstem "ra"} ;
|
||||
|
||||
ApposNP np app = np ** {
|
||||
s = \\c => np.s ! c ++ SOFT_BIND ++ "," ++ app.s ! Abs ++ SOFT_BIND ++ "," ;
|
||||
stem = np.stem ++ SOFT_BIND ++ "," ++ app.stem ++ SOFT_BIND ++ ","
|
||||
} ;
|
||||
|
||||
PositAdVAdj a = {s = a.s ! AAdv} ;
|
||||
|
||||
UseDAP dap = G.DetNP dap ;
|
||||
UseDAPMasc = UseDAP ;
|
||||
UseDAPFem = UseDAP ;
|
||||
|
||||
CompVP ant pol vp = {
|
||||
s = \\agr => case pol.p of {
|
||||
Pos => vpObjects vp ++ vp.prc ! Past ;
|
||||
Neg => vpObjects vp ++ "ez" ++ vp.prc ! Past
|
||||
} ;
|
||||
copula = Izan
|
||||
} ;
|
||||
|
||||
ExistIPQS temp pol ip =
|
||||
G.UseQCl temp pol (G.QuestCl (G.ExistNP (lin NP ip))) ;
|
||||
|
||||
oper
|
||||
sentenceFromStr : Str -> {s : Sentence} = \str -> {
|
||||
s = {beforeAux = str ; aux = mkVForms [] ; afterAux = []}
|
||||
} ;
|
||||
|
||||
passVPSlash : ResEus.VPSlash -> ResEus.VerbPhrase = \vps -> vps ** {
|
||||
val = Da Izan ;
|
||||
dobj = {s = \\_ => [] ; agr = Hau ; isDef = True}
|
||||
} ;
|
||||
|
||||
passAgentVPSlash : ResEus.VPSlash -> NounPhrase -> ResEus.VerbPhrase = \vps,agent ->
|
||||
insertAdv (ss (agent.s ! Ins)) (passVPSlash vps) ;
|
||||
|
||||
relativeAP : ResEus.VerbPhrase -> AdjPhrase = \vp ->
|
||||
let rc = rclFromVP (BIND ++ "n") vp
|
||||
in {s = \\agr => rc.s ! Pres ! Simul ! Pos ! agr ;
|
||||
ph = FinalCons ; typ = Ko} ;
|
||||
|
||||
reflexiveDet : Num -> Determiner = \num -> {
|
||||
s = artDef ! num.n ; indep = True ; nbr = num.n ;
|
||||
pref = "bere" ; isDef = True
|
||||
} ;
|
||||
|
||||
reflexiveNP : RNP = lin RNP
|
||||
(G.DetCN (reflexiveDet G.NumSg) (useN (mkNoun "buru"))) ;
|
||||
|
||||
vpObjects : ResEus.VerbPhrase -> Str = \vp ->
|
||||
vp.adv ++ vp.iobj.s ++ vp.dobj.s ! Pos ++ vp.comp ! Hau ;
|
||||
|
||||
gerundStr : ResEus.VerbPhrase -> Str = \vp -> vpObjects vp ++ vp.nstem ;
|
||||
} ;
|
||||
|
||||
@@ -9,6 +9,7 @@ concrete GrammarEus of Grammar =
|
||||
RelativeEus,
|
||||
ConjunctionEus,
|
||||
PhraseEus,
|
||||
NamesEus,
|
||||
TextX,
|
||||
StructuralEus,
|
||||
IdiomEus,
|
||||
|
||||
@@ -21,6 +21,10 @@ concrete IdiomEus of Idiom = CatEus ** open Prelude, ResEus, VerbEus in {
|
||||
ExistNP np = let vp = UseComp (CompNP np)
|
||||
in clFromVP empty_NP vp ;
|
||||
|
||||
ExistNPAdv np adv =
|
||||
let vp = AdvVP (UseComp (CompNP np)) adv
|
||||
in clFromVP empty_NP vp ;
|
||||
|
||||
{- ExistIP : IP -> QCl ; -- which houses are there
|
||||
|
||||
-- 7/12/2012 generalizations of these
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
concrete NamesEus of Names = CatEus ** open ResEus, Prelude in {
|
||||
|
||||
lin
|
||||
GivenName = nameNP ;
|
||||
MaleSurname = nameNP ;
|
||||
FemaleSurname = nameNP ;
|
||||
PlSurname sn = (nameNP sn) ** {agr = Hauek} ;
|
||||
|
||||
FullName gn sn = nameNP (sn ** {s = gn.s ++ sn.s ; nbr = Sg}) ;
|
||||
|
||||
UseLN, PlainLN = nameNP ;
|
||||
|
||||
InLN ln = {s = (nameNP ln).s ! Ine} ;
|
||||
|
||||
AdjLN ap ln = ln ** {s = ap.s ! Hau ++ ln.s} ;
|
||||
|
||||
oper
|
||||
nameNP : PNoun -> NounPhrase = \pn -> {
|
||||
s = \\c => pn.s ++ artIndef ! c ! pn.ph ;
|
||||
stem = pn.s ;
|
||||
agr = case pn.nbr of {Sg => Hau ; Pl => Hauek} ;
|
||||
anim = pn.anim ;
|
||||
isDef = True
|
||||
} ;
|
||||
}
|
||||
@@ -127,6 +127,18 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in {
|
||||
NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ;
|
||||
NumDecimal dec = { s = dec.s ! NCard ; n = dec.n } ;
|
||||
|
||||
QuantityNP dec mu = {
|
||||
s = \\_ => case mu.isPre of {
|
||||
True => mu.s ++ dec.s ! NCard ;
|
||||
False => dec.s ! NCard ++ mu.s
|
||||
} ;
|
||||
stem = case mu.isPre of {
|
||||
True => mu.s ++ dec.s ! NCard ;
|
||||
False => dec.s ! NCard ++ mu.s
|
||||
} ;
|
||||
agr = Hauek ; anim = Inan ; isDef = True
|
||||
} ;
|
||||
|
||||
-- : Numeral -> Card ;
|
||||
NumNumeral num = num ;
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ lin pot2plus d e =
|
||||
n = Pl ;
|
||||
isHundred = True } ;
|
||||
lin pot2as3 n = n ;
|
||||
lin pot21 = {s = "ehun" ; n = Pl ; isHundred = True} ;
|
||||
lin pot3 n =
|
||||
{s = table {Sg => [] ; Pl => n.s } ! n.n ++ "mila" ;
|
||||
n = n.n } ;
|
||||
@@ -84,6 +85,21 @@ lin pot3plus n m =
|
||||
{ s = table {Sg => [] ; Pl => n.s } ! n.n ++ "mila" ++ ta ++ m.s ;
|
||||
n = n.n } ;
|
||||
|
||||
lin pot31 = {s = "mila" ; n = Pl} ;
|
||||
lin pot3as4 n = n ;
|
||||
lin pot3decimal n = {s = n.s ! NCard ++ "mila" ; n = Pl} ;
|
||||
|
||||
lin pot41 = {s = "milioi bat" ; n = Pl} ;
|
||||
lin pot4 n = {s = n.s ++ "milioi" ; n = Pl} ;
|
||||
lin pot4plus n m = {s = n.s ++ "milioi" ++ m.s ; n = Pl} ;
|
||||
lin pot4as5 n = n ;
|
||||
lin pot4decimal n = {s = n.s ! NCard ++ "milioi" ; n = Pl} ;
|
||||
|
||||
lin pot51 = {s = "mila milioi" ; n = Pl} ;
|
||||
lin pot5 n = {s = n.s ++ "mila milioi" ; n = Pl} ;
|
||||
lin pot5plus n m = {s = n.s ++ "mila milioi" ++ m.s ; n = Pl} ;
|
||||
lin pot5decimal n = {s = n.s ! NCard ++ "mila milioi" ; n = Pl} ;
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
lincat Dig = TDigit ;
|
||||
|
||||
@@ -96,6 +96,9 @@ oper
|
||||
lin V2 (egin ** { prc = \\t => lo ++ egin.prc ! t ;
|
||||
val = Du Ukan }) ;
|
||||
|
||||
-- A V2 always selects the transitive auxiliary. Keeping the auxiliary
|
||||
-- inherited from mkV made the very common `mkV2 (mkV "...")` idiom
|
||||
-- produce absolutive subjects and forms of izan (e.g. *hura ... da).
|
||||
mkV2 : V -> V2 = \x -> lin V2 x ;
|
||||
} ;
|
||||
|
||||
@@ -194,4 +197,3 @@ oper
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ lin
|
||||
-- : VP -> Imp ;
|
||||
ImpVP vp = { s = linVPPrc vp ! Hau } ; --TODO: check negation
|
||||
|
||||
AdvImp adv imp = {s = adv.s ++ imp.s} ;
|
||||
|
||||
--2 Embedded sentences
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user