mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-09-27 04:33:41 -06:00
extensions by Codex
This commit is contained in:
@@ -50,6 +50,8 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu
|
|||||||
Predet = {s : Str} ; ----
|
Predet = {s : Str} ; ----
|
||||||
Ord = {s : Str} ;
|
Ord = {s : Str} ;
|
||||||
Num = {s : Str ; numType : NumType} ;
|
Num = {s : Str ; numType : NumType} ;
|
||||||
|
ACard = {s : Str} ;
|
||||||
|
DAP = Determiner ** {adj : Str} ;
|
||||||
|
|
||||||
Adv = {s : Str ; advType : AdvType ; hasDe : Bool} ;
|
Adv = {s : Str ; advType : AdvType ; hasDe : Bool} ;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,17 @@ lin
|
|||||||
|
|
||||||
n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP <lin Card card : Card> (lin CN cn)))) (lin A a) ; ----
|
n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP <lin Card card : Card> (lin CN cn)))) (lin A a) ; ----
|
||||||
|
|
||||||
|
n_units_of_NP card unit np = lin NP (R.mkNP
|
||||||
|
(card.s ++ unit.s ++ R.linNP np)) ;
|
||||||
|
|
||||||
|
n_unit_CN card unit cn = lin CN {
|
||||||
|
s = card.s ++ unit.s ++ cn.s ; c = cn.c
|
||||||
|
} ;
|
||||||
|
|
||||||
|
bottle_of_CN np = lin CN {s = R.linNP np ; c = "瓶"} ;
|
||||||
|
cup_of_CN np = lin CN {s = R.linNP np ; c = "杯"} ;
|
||||||
|
glass_of_CN np = lin CN {s = R.linNP np ; c = "杯"} ;
|
||||||
|
|
||||||
lincat
|
lincat
|
||||||
Weekday = N ;
|
Weekday = N ;
|
||||||
Monthday = NP ;
|
Monthday = NP ;
|
||||||
|
|||||||
@@ -11,7 +11,13 @@ concrete ExtendChi of Extend = CatChi **
|
|||||||
, MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2
|
, MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2
|
||||||
, ProDrop, ComplDirectVS, ComplDirectVQ
|
, ProDrop, ComplDirectVS, ComplDirectVQ
|
||||||
, PassVPSlash, PassAgentVPSlash
|
, PassVPSlash, PassAgentVPSlash
|
||||||
, GerundAdv, GerundNP, ByVP, ApposNP ]
|
, PresPartAP, PastPartAP, PastPartAgentAP, ProgrVPSlash
|
||||||
|
, ReflRNP, ReflPron, ReflPoss, PredetRNP, ReflA2RNP
|
||||||
|
, AdvRNP, AdvRVP, AdvRAP, PossPronRNP
|
||||||
|
, CompoundN, CompoundAP, GerundCN, GerundAdv, GerundNP
|
||||||
|
, PositAdVAdj, UseDAP, UseDAPMasc, UseDAPFem
|
||||||
|
, ListComp, BaseComp, ConsComp, ConjComp
|
||||||
|
, ByVP, ApposNP ]
|
||||||
with (Grammar=GrammarChi) ** open
|
with (Grammar=GrammarChi) ** open
|
||||||
Prelude
|
Prelude
|
||||||
, Coordination
|
, Coordination
|
||||||
@@ -24,11 +30,28 @@ concrete ExtendChi of Extend = CatChi **
|
|||||||
[VPS], [VPI] = ListX ;
|
[VPS], [VPI] = ListX ;
|
||||||
VPS2, VPI2 = SS ** {c2 : Preposition ; isPre : Bool} ; -- whether the missing arg is before verb
|
VPS2, VPI2 = SS ** {c2 : Preposition ; isPre : Bool} ; -- whether the missing arg is before verb
|
||||||
[VPS2], [VPI2] = ListX ** {c2 : Preposition ; isPre : Bool} ;
|
[VPS2], [VPI2] = ListX ** {c2 : Preposition ; isPre : Bool} ;
|
||||||
|
[Imp] = {s1,s2 : Polarity => Str} ;
|
||||||
|
[Comp] = {s1,s2 : Str} ;
|
||||||
|
|
||||||
lin
|
lin
|
||||||
PassVPSlash vps = insertAdv (mkNP passive_s) vps ;
|
PassVPSlash vps = insertAdv (mkNP passive_s) vps ;
|
||||||
PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep (linNP np))) (insertAdv (mkNP passive_s) vps) ;
|
PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep (linNP np))) (insertAdv (mkNP passive_s) vps) ;
|
||||||
|
|
||||||
|
PresPartAP vp = {
|
||||||
|
s = table {_ => infVP vp} ; monoSyl = False ; hasAdA = False
|
||||||
|
} ;
|
||||||
|
PastPartAP vps = {
|
||||||
|
s = table {_ => infVP <vps : ResChi.VP>} ;
|
||||||
|
monoSyl = False ; hasAdA = False
|
||||||
|
} ;
|
||||||
|
PastPartAgentAP vps np = {
|
||||||
|
s = table {_ => passive_s ++ linNP np ++ infVP <vps : ResChi.VP>} ;
|
||||||
|
monoSyl = False ; hasAdA = False
|
||||||
|
} ;
|
||||||
|
ProgrVPSlash vps = vps ** {
|
||||||
|
prePart = "正在" ++ vps.prePart
|
||||||
|
} ;
|
||||||
|
|
||||||
MkVPS t p vp = {s = t.s ++ p.s ++ (mkClause [] vp).s ! p.p ! t.t} ;
|
MkVPS t p vp = {s = t.s ++ p.s ++ (mkClause [] vp).s ! p.p ! t.t} ;
|
||||||
ConjVPS c = conjunctDistrSS (c.s ! CSent) ;
|
ConjVPS c = conjunctDistrSS (c.s ! CSent) ;
|
||||||
BaseVPS = twoSS ;
|
BaseVPS = twoSS ;
|
||||||
@@ -51,6 +74,21 @@ concrete ExtendChi of Extend = CatChi **
|
|||||||
BaseVPI = twoSS ;
|
BaseVPI = twoSS ;
|
||||||
ConsVPI = consrSS duncomma ;
|
ConsVPI = consrSS duncomma ;
|
||||||
|
|
||||||
|
BaseComp x y = {s1 = infVP x ; s2 = infVP y} ;
|
||||||
|
ConsComp x xs = xs ** {s1 = infVP x ++ duncomma ++ xs.s1} ;
|
||||||
|
ConjComp c xs = {
|
||||||
|
verb = noVerb ; prePart, topic = [] ; isAdj = False ;
|
||||||
|
compl = let cs = c.s ! CPhr CVPhrase
|
||||||
|
in cs.s1 ++ xs.s1 ++ cs.s2 ++ xs.s2
|
||||||
|
} ;
|
||||||
|
|
||||||
|
BaseImp x y = {s1 = x.s ; s2 = y.s} ;
|
||||||
|
ConsImp x xs = xs ** {s1 = \\p => x.s ! p ++ duncomma ++ xs.s1 ! p} ;
|
||||||
|
ConjImp c xs = {
|
||||||
|
s = \\p => let cs = c.s ! CPhr CVPhrase
|
||||||
|
in cs.s1 ++ xs.s1 ! p ++ cs.s2 ++ xs.s2 ! p
|
||||||
|
} ;
|
||||||
|
|
||||||
MkVPS2 t p vps = {s = t.s ++ p.s ++ (mkClause [] <vps : ResChi.VP>).s ! p.p ! t.t} ** vps ;
|
MkVPS2 t p vps = {s = t.s ++ p.s ++ (mkClause [] <vps : ResChi.VP>).s ! p.p ! t.t} ** vps ;
|
||||||
ConjVPS2 c vs = conjunctDistrSS (c.s ! CSent) vs ** vs ;
|
ConjVPS2 c vs = conjunctDistrSS (c.s ! CSent) vs ** vs ;
|
||||||
BaseVPS2 v w = twoSS v w ** w ;
|
BaseVPS2 v w = twoSS v w ** w ;
|
||||||
@@ -68,6 +106,16 @@ concrete ExtendChi of Extend = CatChi **
|
|||||||
GerundAdv vp = mkAdv (infVP vp) ;
|
GerundAdv vp = mkAdv (infVP vp) ;
|
||||||
GerundNP vp = ResChi.mkNP (infVP vp) ;
|
GerundNP vp = ResChi.mkNP (infVP vp) ;
|
||||||
|
|
||||||
|
GerundCN vp = {s = infVP vp ++ possessive_s ++ "行为" ; c = ge_s} ;
|
||||||
|
|
||||||
|
CompoundN n1 n2 = {s = n1.s ++ n2.s ; c = n2.c} ;
|
||||||
|
CompoundAP n a = {
|
||||||
|
s = table {_ => n.s ++ a.s ! Attr} ;
|
||||||
|
monoSyl = False ; hasAdA = False
|
||||||
|
} ;
|
||||||
|
|
||||||
|
PositAdVAdj a = ss (a.s ! Attr ++ deAdvV_s) ;
|
||||||
|
|
||||||
ByVP vp =
|
ByVP vp =
|
||||||
let adv : Adv = GerundAdv vp
|
let adv : Adv = GerundAdv vp
|
||||||
in adv ** {s = adv.s ++ "来" ; advType = ATTime} ;
|
in adv ** {s = adv.s ++ "来" ; advType = ATTime} ;
|
||||||
@@ -76,6 +124,38 @@ concrete ExtendChi of Extend = CatChi **
|
|||||||
GenRP nu cn = {s = \\_ => cn.s ++ relative_s} ;
|
GenRP nu cn = {s = \\_ => cn.s ++ relative_s} ;
|
||||||
|
|
||||||
ProDrop pron = pron ** {s = []} ;
|
ProDrop pron = pron ** {s = []} ;
|
||||||
|
|
||||||
|
ReflPron = lin NP (ResChi.mkNP reflPron) ;
|
||||||
|
ReflPoss num cn = lin NP {
|
||||||
|
det = reflPron ++ possessive_s ;
|
||||||
|
s = case num.numType of {
|
||||||
|
NTFull => num.s ++ cn.c ++ cn.s ;
|
||||||
|
NTVoid _ => cn.s
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
PredetRNP pred rnp = rnp ** {s = pred.s ++ rnp.s} ;
|
||||||
|
ReflRNP slash rnp = GrammarChi.ComplSlash slash rnp ;
|
||||||
|
ReflA2RNP a rnp = GrammarChi.ComplA2 a rnp ;
|
||||||
|
AdvRNP np prep rnp = np ** {
|
||||||
|
s = appPrep prep (linNP rnp) ++ possessive_s ++ np.s
|
||||||
|
} ;
|
||||||
|
AdvRVP vp prep rnp = insertAdvPost
|
||||||
|
(ss (appPrep prep (linNP rnp))) vp ;
|
||||||
|
AdvRAP ap prep rnp = ap ** {
|
||||||
|
s = \\af => appPrep prep (linNP rnp) ++ ap.s ! af
|
||||||
|
} ;
|
||||||
|
PossPronRNP pron num cn rnp = {
|
||||||
|
det = [] ;
|
||||||
|
s = pron.s ++ "对" ++ linNP rnp ++ possessive_s ++
|
||||||
|
case num.numType of {
|
||||||
|
NTFull => num.s ++ cn.c ++ cn.s ;
|
||||||
|
NTVoid _ => cn.s
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
UseDAP dap = lin NP (dapNP dap) ;
|
||||||
|
UseDAPMasc dap = lin NP (dapNP dap) ;
|
||||||
|
UseDAPFem dap = lin NP (dapNP dap) ;
|
||||||
ComplDirectVS vs utt =
|
ComplDirectVS vs utt =
|
||||||
AdvVP (UseV <lin V vs : V>)
|
AdvVP (UseV <lin V vs : V>)
|
||||||
(mkAdv (":" ++ quoted utt.s)) ; -- DEFAULT complement added as Adv in quotes
|
(mkAdv (":" ++ quoted utt.s)) ; -- DEFAULT complement added as Adv in quotes
|
||||||
@@ -90,4 +170,9 @@ concrete ExtendChi of Extend = CatChi **
|
|||||||
mkAdv : Str -> CatChi.Adv ;
|
mkAdv : Str -> CatChi.Adv ;
|
||||||
mkAdv str = lin Adv {s = str ; advType = ATManner ; hasDe = False} ;
|
mkAdv str = lin Adv {s = str ; advType = ATManner ; hasDe = False} ;
|
||||||
|
|
||||||
|
dapNP : CatChi.DAP -> ResChi.NP = \dap -> {
|
||||||
|
s = dap.adj ;
|
||||||
|
det = dap.s
|
||||||
|
} ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,13 +25,15 @@ concrete IdiomChi of Idiom = CatChi ** open Prelude, ResChi in {
|
|||||||
isAdj = False ;
|
isAdj = False ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
ExistNPAdv np adv = mkClause adv.s (regVerb you_s) (linNP np) ;
|
||||||
|
ExistIPAdv ip adv = {s = \\_ => (mkClause adv.s (regVerb you_s) ip.s).s} ;
|
||||||
|
|
||||||
ImpPl1 vp = ss (zan_s ++ men_s ++ infVP vp ++ ba0_s) ;
|
ImpPl1 vp = ss (zan_s ++ men_s ++ infVP vp ++ ba0_s) ;
|
||||||
|
|
||||||
|
ImpP3 np vp = ss ("让" ++ linNP np ++ infVP vp ++ ba0_s) ;
|
||||||
|
|
||||||
SelfAdvVP vp = insertAdv (ss reflPron) vp ;
|
SelfAdvVP vp = insertAdv (ss reflPron) vp ;
|
||||||
SelfAdVVP vp = insertAdv (ss reflPron) vp ;
|
SelfAdVVP vp = insertAdv (ss reflPron) vp ;
|
||||||
SelfNP np = np ** {s = linNP np ++ reflPron} ;
|
SelfNP np = np ** {s = linNP np ++ reflPron} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ lin FullName gn sn = {
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
lin UseLN ln = ln ** {det = []} ;
|
lin UseLN ln = ln ** {det = []} ;
|
||||||
|
lin PlainLN ln = ln ** {det = []} ;
|
||||||
|
lin AdjLN ap ln = {s = ap.s ! Attr ++ possessive_s ++ ln.s} ;
|
||||||
|
|
||||||
lin InLN ln =
|
lin InLN ln =
|
||||||
let prep : Prep = mkPrep "里" []
|
let prep : Prep = mkPrep "里" []
|
||||||
|
|||||||
@@ -103,4 +103,14 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
|
|||||||
|
|
||||||
CountNP det np = np ** {det = det.s ++ ge_s ++ possessive_s ++ np.det} ; --- classifier from NP?
|
CountNP det np = np ** {det = det.s ++ ge_s ++ possessive_s ++ np.det} ; --- classifier from NP?
|
||||||
|
|
||||||
|
DetDAP det = det ** {adj = []} ;
|
||||||
|
AdjDAP dap ap = dap ** {
|
||||||
|
adj = dap.adj ++ ap.s ! Attr ++ possessive_s
|
||||||
|
} ;
|
||||||
|
|
||||||
|
QuantityNP decimal mu = mkNP (case mu.isPre of {
|
||||||
|
True => mu.s ++ decimal.s ;
|
||||||
|
False => decimal.s ++ mu.s
|
||||||
|
}) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,6 +139,20 @@ lin pot3plus n m =
|
|||||||
{s,p = (n.s ! shiwan0) ++ (ling ! <n.end0,m.beg0>) ++ m.s ! bai0} ;
|
{s,p = (n.s ! shiwan0) ++ (ling ! <n.end0,m.beg0>) ++ m.s ! bai0} ;
|
||||||
lin pot3as4 n = n ;
|
lin pot3as4 n = n ;
|
||||||
|
|
||||||
|
lin pot21 = {
|
||||||
|
beg0 = nozero ; end0 = zero ;
|
||||||
|
s,p = table {_ => yi_s ++ "百"}
|
||||||
|
} ;
|
||||||
|
lin pot31 = {s,p = yi_s ++ "千"} ;
|
||||||
|
|
||||||
|
lin pot41 = {s,p = yi_s ++ "百万"} ;
|
||||||
|
lin pot4 n = {s,p = n.s ! bai ++ "百万"} ;
|
||||||
|
lin pot4plus n m = {s,p = n.s ! bai ++ "百万" ++ m.s} ;
|
||||||
|
|
||||||
|
lin pot51 = {s,p = "十亿"} ;
|
||||||
|
lin pot5 n = {s,p = n.s ! bai ++ "十亿"} ;
|
||||||
|
lin pot5plus n m = {s,p = n.s ! bai ++ "十亿" ++ m.s} ;
|
||||||
|
|
||||||
lin pot4as5 n = n ;
|
lin pot4as5 n = n ;
|
||||||
|
|
||||||
-- numerals as sequences of digits
|
-- numerals as sequences of digits
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ concrete SentenceChi of Sentence = CatChi **
|
|||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
AdvImp adv imp = {
|
||||||
|
s = \\p => adv.s ++ imp.s ! p
|
||||||
|
} ;
|
||||||
|
|
||||||
SlashVP np vp =
|
SlashVP np vp =
|
||||||
mkClauseCompl (linNP np) vp []
|
mkClauseCompl (linNP np) vp []
|
||||||
** {c2 = vp.c2} ;
|
** {c2 = vp.c2} ;
|
||||||
|
|||||||
Reference in New Issue
Block a user