diff --git a/src/chinese/CatChi.gf b/src/chinese/CatChi.gf index 7caa895e..6e0a5bd3 100644 --- a/src/chinese/CatChi.gf +++ b/src/chinese/CatChi.gf @@ -50,6 +50,8 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu Predet = {s : Str} ; ---- Ord = {s : Str} ; Num = {s : Str ; numType : NumType} ; + ACard = {s : Str} ; + DAP = Determiner ** {adj : Str} ; Adv = {s : Str ; advType : AdvType ; hasDe : Bool} ; diff --git a/src/chinese/ConstructionChi.gf b/src/chinese/ConstructionChi.gf index 5eda5b5a..922fc738 100644 --- a/src/chinese/ConstructionChi.gf +++ b/src/chinese/ConstructionChi.gf @@ -30,6 +30,17 @@ lin n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP (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 Weekday = N ; Monthday = NP ; diff --git a/src/chinese/ExtendChi.gf b/src/chinese/ExtendChi.gf index 771da61d..472a3ce1 100644 --- a/src/chinese/ExtendChi.gf +++ b/src/chinese/ExtendChi.gf @@ -11,7 +11,13 @@ concrete ExtendChi of Extend = CatChi ** , MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2 , ProDrop, ComplDirectVS, ComplDirectVQ , 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 Prelude , Coordination @@ -24,11 +30,28 @@ concrete ExtendChi of Extend = CatChi ** [VPS], [VPI] = ListX ; VPS2, VPI2 = SS ** {c2 : Preposition ; isPre : Bool} ; -- whether the missing arg is before verb [VPS2], [VPI2] = ListX ** {c2 : Preposition ; isPre : Bool} ; + [Imp] = {s1,s2 : Polarity => Str} ; + [Comp] = {s1,s2 : Str} ; lin PassVPSlash vps = 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 } ; + monoSyl = False ; hasAdA = False + } ; + PastPartAgentAP vps np = { + s = table {_ => passive_s ++ linNP np ++ infVP } ; + 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} ; ConjVPS c = conjunctDistrSS (c.s ! CSent) ; BaseVPS = twoSS ; @@ -51,6 +74,21 @@ concrete ExtendChi of Extend = CatChi ** BaseVPI = twoSS ; 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 [] ).s ! p.p ! t.t} ** vps ; ConjVPS2 c vs = conjunctDistrSS (c.s ! CSent) vs ** vs ; BaseVPS2 v w = twoSS v w ** w ; @@ -68,6 +106,16 @@ concrete ExtendChi of Extend = CatChi ** GerundAdv vp = mkAdv (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 = let adv : Adv = GerundAdv vp in adv ** {s = adv.s ++ "来" ; advType = ATTime} ; @@ -76,6 +124,38 @@ concrete ExtendChi of Extend = CatChi ** GenRP nu cn = {s = \\_ => cn.s ++ relative_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 = AdvVP (UseV ) (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 = lin Adv {s = str ; advType = ATManner ; hasDe = False} ; + dapNP : CatChi.DAP -> ResChi.NP = \dap -> { + s = dap.adj ; + det = dap.s + } ; + }; diff --git a/src/chinese/IdiomChi.gf b/src/chinese/IdiomChi.gf index d4f94513..732266c9 100644 --- a/src/chinese/IdiomChi.gf +++ b/src/chinese/IdiomChi.gf @@ -25,13 +25,15 @@ concrete IdiomChi of Idiom = CatChi ** open Prelude, ResChi in { 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) ; + ImpP3 np vp = ss ("让" ++ linNP np ++ infVP vp ++ ba0_s) ; + SelfAdvVP vp = insertAdv (ss reflPron) vp ; SelfAdVVP vp = insertAdv (ss reflPron) vp ; SelfNP np = np ** {s = linNP np ++ reflPron} ; } - - diff --git a/src/chinese/NamesChi.gf b/src/chinese/NamesChi.gf index 6d529154..a1d65f31 100644 --- a/src/chinese/NamesChi.gf +++ b/src/chinese/NamesChi.gf @@ -7,6 +7,8 @@ lin FullName gn sn = { } ; 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 = let prep : Prep = mkPrep "里" [] diff --git a/src/chinese/NounChi.gf b/src/chinese/NounChi.gf index 30cd7dde..564dac10 100644 --- a/src/chinese/NounChi.gf +++ b/src/chinese/NounChi.gf @@ -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? + 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 + }) ; + } diff --git a/src/chinese/NumeralChi.gf b/src/chinese/NumeralChi.gf index 71df8d7f..bd143a8c 100644 --- a/src/chinese/NumeralChi.gf +++ b/src/chinese/NumeralChi.gf @@ -139,6 +139,20 @@ lin pot3plus n m = {s,p = (n.s ! shiwan0) ++ (ling ! ) ++ m.s ! bai0} ; 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 ; -- numerals as sequences of digits diff --git a/src/chinese/SentenceChi.gf b/src/chinese/SentenceChi.gf index 03ed7c56..1cef0b40 100644 --- a/src/chinese/SentenceChi.gf +++ b/src/chinese/SentenceChi.gf @@ -16,6 +16,10 @@ concrete SentenceChi of Sentence = CatChi ** } } ; + AdvImp adv imp = { + s = \\p => adv.s ++ imp.s ! p + } ; + SlashVP np vp = mkClauseCompl (linNP np) vp [] ** {c2 = vp.c2} ;