From ed61647f867db75e8a889cbd73382b6f5ae069df Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 25 May 2023 11:27:37 +0200 Subject: [PATCH] (Chi) Fix word order in RelNP All the other changes are those needed due to changes in lincat of NP. --- src/chinese/AdjectiveChi.gf | 6 ++--- src/chinese/AdverbChi.gf | 4 +-- src/chinese/CatChi.gf | 6 +++-- src/chinese/ConjunctionChi.gf | 9 ++++--- src/chinese/ConstructionChi.gf | 18 ++++++------- src/chinese/ExtendChi.gf | 8 +++--- src/chinese/ExtraChi.gf | 6 ++--- src/chinese/IdiomChi.gf | 6 ++--- src/chinese/NounChi.gf | 49 +++++++++++++++++++--------------- src/chinese/ParadigmsChi.gf | 2 +- src/chinese/PhraseChi.gf | 4 +-- src/chinese/QuestionChi.gf | 4 +-- src/chinese/RelativeChi.gf | 2 +- src/chinese/ResChi.gf | 16 ++++++----- src/chinese/SentenceChi.gf | 6 ++--- src/chinese/StructuralChi.gf | 12 ++++----- src/chinese/SymbolChi.gf | 6 ++--- src/chinese/VerbChi.gf | 32 +++++++++++----------- 18 files changed, 104 insertions(+), 92 deletions(-) diff --git a/src/chinese/AdjectiveChi.gf b/src/chinese/AdjectiveChi.gf index ab17134a..2db33429 100644 --- a/src/chinese/AdjectiveChi.gf +++ b/src/chinese/AdjectiveChi.gf @@ -5,7 +5,7 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in { PositA a = a ** {hasAdA = False} ; ComparA a np = a ** { - s = table {_=> than_s ++ np.s ++ a.s!Attr}; + s = table {_=> than_s ++ linNP np ++ a.s!Attr}; hasAdA = False }; @@ -26,11 +26,11 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in { }; CAdvAP ad ap np = ap ** { - s = table {adjPlace => ad.s ++ np.s ++ ad.p ++ ap.s!adjPlace} + s = table {adjPlace => ad.s ++ linNP np ++ ad.p ++ ap.s!adjPlace} }; ComplA2 a np = a ** { - s= table { adjPlace => appPrep a.c2 np.s ++ a.s!adjPlace}; + s= table { adjPlace => appPrep a.c2 (linNP np) ++ a.s!adjPlace}; hasAdA = False }; diff --git a/src/chinese/AdverbChi.gf b/src/chinese/AdverbChi.gf index 206b14d5..57522056 100644 --- a/src/chinese/AdverbChi.gf +++ b/src/chinese/AdverbChi.gf @@ -4,9 +4,9 @@ concrete AdverbChi of Adverb = CatChi ** lin PositAdvAdj a = {s = a.s!Attr ++ "地" ; advType = ATManner ; hasDe = False} ; ---- for all adjs? - PrepNP prep np = ss (appPrep prep np.s) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ? + PrepNP prep np = ss (appPrep prep (linNP np)) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ? - ComparAdvAdj cadv a np = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ np.s) ** {advType = ATManner ; hasDe = False} ; + ComparAdvAdj cadv a np = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ (linNP np)) ** {advType = ATManner ; hasDe = False} ; ComparAdvAdjS cadv a s = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ linS s) ** {advType = ATManner ; hasDe = False} ; diff --git a/src/chinese/CatChi.gf b/src/chinese/CatChi.gf index ff996643..86360be1 100644 --- a/src/chinese/CatChi.gf +++ b/src/chinese/CatChi.gf @@ -43,7 +43,8 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu -- Noun CN = ResChi.Noun ; - NP, Pron = ResChi.NP ; + NP = ResChi.NP ; + Pron = SS ; Det = Determiner ; Quant = Determiner ** {pl : Str} ; Predet = {s : Str} ; ---- @@ -79,7 +80,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu N = ResChi.Noun ; N2 = ResChi.Noun ** {c2 : Preposition} ; N3 = ResChi.Noun ** {c2,c3 : Preposition} ; - GN, SN, PN = ResChi.NP ; + GN, SN, PN = SS ; -- overridden @@ -91,4 +92,5 @@ linref S = linS ; Prep = linPrep ; VP = infVP ; + NP = \np -> np.det ++ np.s ; } diff --git a/src/chinese/ConjunctionChi.gf b/src/chinese/ConjunctionChi.gf index 2dc17731..1c413f52 100644 --- a/src/chinese/ConjunctionChi.gf +++ b/src/chinese/ConjunctionChi.gf @@ -11,7 +11,7 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin postJiu = ss.postJiu} } ; ConjAdv c as = conjunctDistrSS (c.s ! CSent) as ** {advType = as.advType ; hasDe = as.hasDe} ; ---- ?? - ConjNP c = conjunctDistrSS (c.s ! CPhr CNPhrase) ; + ConjNP c nps = conjunctDistrSS (c.s ! CPhr CNPhrase) nps ** {det = []} ; ConjAP c as = conjunctDistrTable AdjPlace (c.s ! CPhr CAPhrase) as ** {monoSyl = notB as.monoSyl ; hasAdA = True} ; ---- add de iff as doesn't ConjRS c = conjunctDistrSS (c.s ! CSent) ; ConjCN c ns = conjunctDistrSS (c.s ! CPhr CNPhrase) ns ** {c = ns.c} ; @@ -28,8 +28,8 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin BaseAdv x y = twoSS x y ** {advType = x.advType ; hasDe = y.hasDe} ; ---- ?? ConsAdv x xs = consrSS duncomma x xs ** {advType = x.advType ; hasDe = xs.hasDe} ; ---- ?? - BaseNP = twoSS ; - ConsNP = consrSS duncomma ; + BaseNP np1 np2 = twoSS (mergeNP np1) (mergeNP np2) ; + ConsNP np nps = consrSS duncomma (mergeNP np) nps ; BaseAP x y = twoTable AdjPlace x y ** {monoSyl = y.monoSyl} ; ConsAP x xs = consrTable AdjPlace duncomma x xs ** {monoSyl = xs.monoSyl} ; BaseRS = twoSS ; @@ -46,5 +46,8 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin [RS] = {s1,s2 : Str} ; [CN] = {s1,s2 : Str ; c : Str} ; + oper + mergeNP : ResChi.NP -> SS = \np -> ss (linNP np) ; + } diff --git a/src/chinese/ConstructionChi.gf b/src/chinese/ConstructionChi.gf index c6032b85..5eda5b5a 100644 --- a/src/chinese/ConstructionChi.gf +++ b/src/chinese/ConstructionChi.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract -concrete ConstructionChi of Construction = CatChi ** +concrete ConstructionChi of Construction = CatChi ** open SyntaxChi, ParadigmsChi, (L = LexiconChi), (E = ExtraChi), (G = GrammarChi), (R = ResChi), Prelude in { flags coding=utf8 ; @@ -24,9 +24,9 @@ lin -- some more things weather_adjCl ap = mkCl (mkVP (lin AP ap)) ; - - is_right_VP = mkVP (ParadigmsChi.mkA "对") ; - is_wrong_VP = mkVP (ParadigmsChi.mkA "错") ; + + is_right_VP = mkVP (ParadigmsChi.mkA "对") ; + is_wrong_VP = mkVP (ParadigmsChi.mkA "错") ; n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP (lin CN cn)))) (lin A a) ; ---- @@ -47,8 +47,8 @@ lin monthYearAdv m y = lin Adv {s = y.s ++ "年" ++ m.s ; advType = timeAdvType ; hasDe = False} ; dayMonthYearAdv d m y = lin Adv {s = y.s ++ "年" ++ m.s ++ d.s ++ "日" ; advType = timeAdvType ; hasDe = False} ; - intYear i = lin NP i ; - intMonthday i = lin NP i ; + intYear i = lin NP (R.mkNP i.s) ; + intMonthday i = lin NP (R.mkNP i.s) ; lincat Language = N ; @@ -74,9 +74,9 @@ lin friday_Weekday = mkN "星期五" ; lin saturday_Weekday = mkN "星期六" ; lin sunday_Weekday = mkN "星期日" ; -lin january_Month = mkN "一月" ; -lin february_Month = mkN "二月" ; -lin march_Month = mkN "三月" ; +lin january_Month = mkN "一月" ; +lin february_Month = mkN "二月" ; +lin march_Month = mkN "三月" ; lin april_Month = mkN "四月" ; lin may_Month = mkN "五月" ; lin june_Month = mkN "六月" ; diff --git a/src/chinese/ExtendChi.gf b/src/chinese/ExtendChi.gf index 48b9080d..e88b0944 100644 --- a/src/chinese/ExtendChi.gf +++ b/src/chinese/ExtendChi.gf @@ -27,7 +27,7 @@ concrete ExtendChi of Extend = CatChi ** lin PassVPSlash vps = insertAdv (mkNP passive_s) vps ; - PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep np.s)) (insertAdv (mkNP passive_s) vps) ; + PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep (linNP np))) (insertAdv (mkNP passive_s) vps) ; MkVPS t p vp = {s = t.s ++ p.s ++ (mkClause [] vp).s ! p.p ! t.t} ; ConjVPS c = conjunctDistrSS (c.s ! CSent) ; @@ -35,10 +35,10 @@ concrete ExtendChi of Extend = CatChi ** ConsVPS = consrSS duncomma ; -- : NP -> VPS -> S ; -- she [has walked and won't sleep] - PredVPS np vps = {preJiu = np.s ; postJiu = vps.s} ; + PredVPS np vps = {preJiu = (linNP np) ; postJiu = vps.s} ; -- : NP -> VPS -> QS ; -- has she walked - SQuestVPS np vps = {s = \\_ => np.s ++ vps.s ++ question_s} ; + SQuestVPS np vps = {s = \\_ => linNP np ++ vps.s ++ question_s} ; -- : IP -> VPS -> QS ; -- who has walked -- QuestVPS ip vps = -- TODO: probably need to change structure of VPS @@ -72,7 +72,7 @@ concrete ExtendChi of Extend = CatChi ** let adv : Adv = GerundAdv vp in adv ** {s = adv.s ++ "来" ; advType = ATTime} ; - GenNP np = {s,pl = np.s ++ possessive_s ; detType = DTPoss} ; + GenNP np = {s,pl = linNP np ++ possessive_s ; detType = DTPoss} ; GenRP nu cn = {s = \\_ => cn.s ++ relative_s} ; ProDrop pron = pron ** {s = []} ; diff --git a/src/chinese/ExtraChi.gf b/src/chinese/ExtraChi.gf index 689432d3..ef517d75 100644 --- a/src/chinese/ExtraChi.gf +++ b/src/chinese/ExtraChi.gf @@ -11,21 +11,21 @@ concrete ExtraChi of ExtraChiAbs = CatChi ** lin PassVPSlash vps = insertAdv (mkNP passive_s) vps ; - PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep np.s)) (insertAdv (mkNP passive_s) vps) ; + PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep (linNP np))) (insertAdv (mkNP passive_s) vps) ; MkVPS t p vp = {s = t.s ++ p.s ++ (mkClause [] vp).s ! p.p ! t.t} ; ConjVPS c = conjunctDistrSS (c.s ! CSent) ; BaseVPS = twoSS ; ConsVPS = consrSS duncomma ; - PredVPS np vps = {preJiu = np.s ; postJiu = vps.s} ; + PredVPS np vps = {preJiu = (linNP np) ; postJiu = vps.s} ; MkVPI vp = {s = (mkClause [] vp).s ! Pos ! APlain} ; --- ?? almost just a copy of VPS ConjVPI c = conjunctDistrSS (c.s ! CSent) ; BaseVPI = twoSS ; ConsVPI = consrSS duncomma ; - GenNP np = {s,pl = np.s ++ possessive_s ; detType = DTPoss} ; + GenNP np = {s,pl = linNP np ++ possessive_s ; detType = DTPoss} ; GenRP nu cn = {s = \\_ => cn.s ++ relative_s} ; ---- ?? diff --git a/src/chinese/IdiomChi.gf b/src/chinese/IdiomChi.gf index 6b803ac7..d4f94513 100644 --- a/src/chinese/IdiomChi.gf +++ b/src/chinese/IdiomChi.gf @@ -10,11 +10,11 @@ concrete IdiomChi of Idiom = CatChi ** open Prelude, ResChi in { -- GenericCl vp = mkClause "有人" vp ; (meaning: there is a person) ---- it is John who did it - CleftNP np rs = mkClause rs.s copula np.s ; -- did it + de + is I + CleftNP np rs = mkClause rs.s copula (linNP np) ; -- did it + de + is I CleftAdv ad s = mkClause (linS s ++ possessive_s) copula ad.s ; -- she sleeps + de + is here - ExistNP np = mkClause [] (regVerb you_s) np.s ; ---- infl of you + ExistNP np = mkClause [] (regVerb you_s) (linNP np) ; ---- infl of you ExistIP ip = {s = \\_ => (mkClause [] (regVerb you_s) ip.s).s} ; ---- infl of you @@ -30,7 +30,7 @@ concrete IdiomChi of Idiom = CatChi ** open Prelude, ResChi in { SelfAdvVP vp = insertAdv (ss reflPron) vp ; SelfAdVVP vp = insertAdv (ss reflPron) vp ; - SelfNP np = {s = np.s ++ reflPron} ; + SelfNP np = np ** {s = linNP np ++ reflPron} ; } diff --git a/src/chinese/NounChi.gf b/src/chinese/NounChi.gf index a9a18076..9912791e 100644 --- a/src/chinese/NounChi.gf +++ b/src/chinese/NounChi.gf @@ -1,28 +1,33 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { lin - DetCN det cn = case det.detType of { - DTFull Sg => {s = det.s ++ cn.c ++ cn.s} ; -- this house - DTFull Pl => {s = det.s ++ xie_s ++ cn.s} ; -- these houses - DTNum => {s = det.s ++ cn.c ++ cn.s} ; -- (these) five houses - DTPoss => {s = det.s ++ cn.s} -- our (five) houses - } ; - UsePN pn = pn ; - UsePron p = p ; + DetCN det cn = cn ** { + det = case det.detType of { + DTFull Sg => det.s ++ cn.c ; -- this house + DTFull Pl => det.s ++ xie_s ; -- these houses + DTNum => det.s ++ cn.c ; -- (these) five houses + DTPoss => det.s -- our (five) houses + } + } ; - DetNP det = {s = case det.detType of { + UsePN pn = pn ** {det = []} ; + UsePron p = p ** {det = []} ; + + DetNP det = { + s = [] ; + det = case det.detType of { DTFull Pl => det.s ++ xie_s ; DTPoss => det.s ; _ => det.s ++ ge_s } ; - } ; ---- + } ; ---- - PredetNP pred np = mkNP (pred.s ++ np.s) ; ---- possessive_s ++ np.s) ; + PredetNP pred np = np ** {s = pred.s ++ np.s} ; ---- possessive_s ++ np.s) ; - PPartNP np v2 = mkNP ((predV v2 v2.part).verb.s ++ possessive_s ++ np.s) ; ---- ?? + PPartNP np v2 = np ** {s = (predV v2 v2.part).verb.s ++ possessive_s ++ np.s} ; ---- ?? - AdvNP np adv = mkNP (adv.s ++ possessiveIf adv.hasDe ++ np.s) ; - ExtAdvNP np adv = mkNP (adv.s ++ possessiveIf adv.hasDe ++ embedInCommas np.s) ; ---- commas? + AdvNP np adv = np ** {s = adv.s ++ possessiveIf adv.hasDe ++ np.s} ; + ExtAdvNP np adv = np ** {s = adv.s ++ possessiveIf adv.hasDe ++ embedInCommas np.s} ; ---- commas? DetQuant quant num = { s = case num.numType of { @@ -70,15 +75,15 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { DefArt = mkQuant [] [] DTPoss ; -- use that_Quant if you want the_s IndefArt = mkQuant yi_s [] DTNum ; -- (DTFull Sg) ; -- empty in the plural - MassNP cn = cn ; + MassNP cn = mkNP cn.s ; UseN n = n ; UseN2 n = n ; Use2N3 f = {s = f.s ; c = f.c ; c2 = f.c2} ; Use3N3 f = {s = f.s ; c = f.c ; c2 = f.c3} ; - ComplN2 f x = {s = appPrep f.c2 x.s ++ f.s ; c = f.c} ; - ComplN3 f x = {s = appPrep f.c2 x.s ++ f.s ; c = f.c ; c2 = f.c3} ; + ComplN2 f x = {s = appPrep f.c2 (linNP x) ++ f.s ; c = f.c} ; + ComplN3 f x = {s = appPrep f.c2 (linNP x) ++ f.s ; c = f.c ; c2 = f.c3} ; AdjCN ap cn = case ap.monoSyl of { True => {s = ap.s ! Attr ++ cn.s ; c = cn.c} ; @@ -88,13 +93,13 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { RelCN cn rs = {s = rs.s ++ cn.s ; c = cn.c} ; AdvCN cn ad = {s = ad.s ++ possessiveIf ad.hasDe ++ cn.s ; c = cn.c} ; SentCN cn cs = {s = cs.s ++ cn.s ; c = cn.c} ; - ApposCN cn np = {s = np.s ++ cn.s ; c = cn.c} ; + ApposCN cn np = {s = linNP np ++ cn.s ; c = cn.c} ; - RelNP np rs = mkNP (rs.s ++ np.s) ; + RelNP np rs = np ** {s = rs.s ++ np.s} ; - PossNP cn np = {s = np.s ++ possessive_s ++ cn.s ; c = cn.c} ; - PartNP cn np = {s = np.s ++ possessive_s ++ cn.s ; c = cn.c} ; + PossNP cn np = {s = linNP np ++ possessive_s ++ cn.s ; c = cn.c} ; + PartNP cn np = {s = linNP np ++ possessive_s ++ cn.s ; c = cn.c} ; - CountNP det np = {s = det.s ++ ge_s ++ possessive_s ++ np.s} ; --- classifier from NP? + CountNP det np = np ** {det = det.s ++ ge_s ++ possessive_s ++ np.det} ; --- classifier from NP? } diff --git a/src/chinese/ParadigmsChi.gf b/src/chinese/ParadigmsChi.gf index eec89b92..a130bd08 100644 --- a/src/chinese/ParadigmsChi.gf +++ b/src/chinese/ParadigmsChi.gf @@ -184,7 +184,7 @@ oper emptyPrep : Preposition = mkPrep [] ; mkpNP : Str -> CatChi.NP - = \s -> lin NP {s = word s} ; + = \s -> lin NP {s = word s ; det = []} ; mkAdV : Str -> AdV = \s -> lin AdV {s = word s} ; mkAdN : Str -> AdN diff --git a/src/chinese/PhraseChi.gf b/src/chinese/PhraseChi.gf index 4f181342..bc3a8ed8 100644 --- a/src/chinese/PhraseChi.gf +++ b/src/chinese/PhraseChi.gf @@ -11,7 +11,7 @@ concrete PhraseChi of Phrase = CatChi ** open Prelude, ResChi in { UttIP ip = ip ; UttIAdv iadv = iadv ; - UttNP np = np ; + UttNP np = ss (linNP np) ; UttCN cn = cn ; UttAP ap = {s = ap.s!Attr} ; UttCard x = x ; @@ -23,6 +23,6 @@ concrete PhraseChi of Phrase = CatChi ** open Prelude, ResChi in { PConjConj conj = ss (conj.s ! CSent).s2 ; NoVoc = {s = []} ; - VocNP np = {s = np.s ++ chcomma} ; ---- ?? + VocNP np = {s = linNP np ++ chcomma} ; ---- ?? } diff --git a/src/chinese/QuestionChi.gf b/src/chinese/QuestionChi.gf index d190869d..54b70def 100644 --- a/src/chinese/QuestionChi.gf +++ b/src/chinese/QuestionChi.gf @@ -14,11 +14,11 @@ concrete QuestionChi of Question = CatChi ** s = \\_,p,a => ip.s ++ vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl } ; - QuestSlash ip cls = {s = \\_ => (mkClauseCompl cls.np (insertObj (ss (appPrep cls.c2 ip.s)) cls.vp) []).s} ; + QuestSlash ip cls = {s = \\_ => (mkClauseCompl cls.np (insertObj (mkNP (appPrep cls.c2 ip.s)) cls.vp) []).s} ; QuestIAdv iadv cl = {s = \\_ => (mkClauseCompl cl.np (insertAdv iadv cl.vp) []).s} ; - QuestIComp icomp np = {s = \\_,p,a => np.s ++ icomp.s} ; ---- order + QuestIComp icomp np = {s = \\_,p,a => linNP np ++ icomp.s} ; ---- order PrepIP p ip = ss (appPrep p ip.s) ; diff --git a/src/chinese/RelativeChi.gf b/src/chinese/RelativeChi.gf index 222c187c..5971d5e3 100644 --- a/src/chinese/RelativeChi.gf +++ b/src/chinese/RelativeChi.gf @@ -9,7 +9,7 @@ concrete RelativeChi of Relative = CatChi ** open ResChi, Prelude in { } ; } ; ---- ?? RelSlash rp slash = {s = \\p,a => slash.s ! p ! a ++ appPrep slash.c2 (rp.s ! False)} ; - FunRP p np rp = {s = \\a => appPrep p np.s ++ rp.s ! a} ; ---- ?? + FunRP p np rp = {s = \\a => appPrep p (linNP np) ++ rp.s ! a} ; ---- ?? IdRP = {s = table {True => [] ; False => relative_s}} ; } diff --git a/src/chinese/ResChi.gf b/src/chinese/ResChi.gf index ff904063..b4be073d 100644 --- a/src/chinese/ResChi.gf +++ b/src/chinese/ResChi.gf @@ -112,7 +112,8 @@ oper isAdj : Bool ; -- whether it is an adjectival predication and behaves differently in relative } ; - NP = {s : Str} ; + NP = {det,s : Str} ; -- keep Det separate, because RelNP may put in a RS and that goes before the Det + linNP : NP -> Str = \np -> np.det ++ np.s ; -- for morphology @@ -192,11 +193,11 @@ oper } ; insertObj : NP -> VP -> VP = \np,vp -> vp ** { - compl = np.s ++ vp.compl ; + compl = linNP np ++ vp.compl ; } ; insertObjPost : NP -> VP -> VP = \np,vp -> vp ** { - compl = vp.compl ++ np.s ; + compl = vp.compl ++ linNP np ; } ; insertAdv : SS -> VP -> VP = \adv,vp -> vp ** { @@ -215,7 +216,7 @@ oper } ; insertExtra : SS -> VP -> VP = \ext,vp -> - insertObjPost ext vp ; + insertObjPost (mkNP ext.s) vp ; -- clauses: keep np and vp separate to enable insertion of IAdv @@ -250,7 +251,7 @@ oper mkClauseCompl : Str -> VP -> Str -> Clause = \np,vp,compl -> { s = \\p,a => vp.topic ++ np ++ vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl ++ compl ; np = vp.topic ++ np ; - vp = insertObj (ss compl) vp ; + vp = insertObj (mkNP compl) vp ; postJiu = \\p,a => vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl ++ compl ; } ; @@ -278,7 +279,8 @@ oper } ; pronNP : (s : Str) -> NP = \s -> { - s = word s + s = word s ; + det = [] } ; Preposition = {prepPre : Str ; prepPost : Str ; advType : AdvType ; hasDe : Bool} ; @@ -316,7 +318,7 @@ oper -- added by AR - mkNP : Str -> NP = ss ; -- not to be used in lexicon building + mkNP : Str -> NP = \s -> {s = s ; det = []} ; -- not to be used in lexicon building appPrep : Preposition -> Str -> Str = \prep,s -> prep.prepPre ++ s ++ prep.prepPost ; diff --git a/src/chinese/SentenceChi.gf b/src/chinese/SentenceChi.gf index 9e9e1f38..03ed7c56 100644 --- a/src/chinese/SentenceChi.gf +++ b/src/chinese/SentenceChi.gf @@ -5,7 +5,7 @@ concrete SentenceChi of Sentence = CatChi ** lin - PredVP np vp = mkClause np.s vp ; + PredVP np vp = mkClause (linNP np) vp ; PredSCVP sc vp = mkClause sc.s vp ; @@ -17,10 +17,10 @@ concrete SentenceChi of Sentence = CatChi ** } ; SlashVP np vp = - mkClauseCompl np.s vp [] + mkClauseCompl (linNP np) vp [] ** {c2 = vp.c2} ; - SlashVS np vs sslash = ** {c2 = sslash.c2} ; + SlashVS np vs sslash = ** {c2 = sslash.c2} ; -- yet another reason for discontinuity of clauses diff --git a/src/chinese/StructuralChi.gf b/src/chinese/StructuralChi.gf index 40cf45cf..b3e9a86e 100644 --- a/src/chinese/StructuralChi.gf +++ b/src/chinese/StructuralChi.gf @@ -142,8 +142,8 @@ either7or_DConj = {s = table { -- modified by chenpeng 11.19 conjType = NotJiu ; } ; -everybody_NP = ssword "每个人" ; -- [mark] "每个人": 每(every)+个(classifier)+人(person) -everything_NP = ssword "每件事" ; -- [mark] "每件事": 每(every)+件(classifier)+事(thing) +everybody_NP = mkNP (ssword "每个人").s ; -- [mark] "每个人": 每(every)+个(classifier)+人(person) +everything_NP = mkNP (ssword "每件事").s ; -- [mark] "每件事": 每(every)+件(classifier)+事(thing) everywhere_Adv = mkAdv "到处" ; here7from_Adv = mkAdv "从这里" ; -- from here here7to_Adv = mkAdv "到这里" ; -- to here @@ -161,13 +161,13 @@ if_then_Conj = {s = table { -- added by chenpeng 11.19 } ; conjType = Jiu ; } ; -nobody_NP = ssword "没人" ; -nothing_NP = ssword "没有什么" ; +nobody_NP = mkNP (ssword "没人").s ; +nothing_NP = mkNP (ssword "没有什么").s ; on_Prep = mkPrep "在" "上" ; only_Predet = ssword "只有" ; -- only John so_AdA = ssword "如此" ; -somebody_NP = ssword "某人" ; -something_NP = ssword "某事" ; -- [mark] in sent, it depends on the context +somebody_NP = mkNP (ssword "某人").s ; +something_NP = mkNP (ssword "某事").s ; -- [mark] in sent, it depends on the context somewhere_Adv = mkAdv "某处" ; that_Subj = mkSubj [] chcomma ; -- that + S [mark] comma there7from_Adv = mkAdv "从那里" ; -- from there diff --git a/src/chinese/SymbolChi.gf b/src/chinese/SymbolChi.gf index 264e5bee..400e4625 100644 --- a/src/chinese/SymbolChi.gf +++ b/src/chinese/SymbolChi.gf @@ -11,12 +11,12 @@ concrete SymbolChi of Symbol = CatChi ** open Prelude, ResChi in { NumPN i = i ; CNIntNP cn i = { s = cn.s ++ i.s ; - c = cn.c + det = cn.c } ; - CNSymbNP det cn xs = ss (det.s ++ cn.s ++ xs.s) ; ---- + CNSymbNP det cn xs = {det = det.s ; s = cn.s ++ xs.s} ; ---- CNNumNP cn i = { s = cn.s ++ i.s ; - c = cn.c + det = cn.c } ; SymbS sy = simpleS sy.s ; diff --git a/src/chinese/VerbChi.gf b/src/chinese/VerbChi.gf index 9c0503d4..2d3b4b9c 100644 --- a/src/chinese/VerbChi.gf +++ b/src/chinese/VerbChi.gf @@ -7,14 +7,14 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { SlashV2a v = predV v v.part ** {c2 = v.c2 ; isPre = v.hasPrep} ; - Slash2V3 v np = insertAdv (mkNP (ba_s ++ np.s)) (predV v v.part) ** {c2 = v.c3 ; isPre = v.hasPrep} ; -- slot for third argument - Slash3V3 v np = insertObj (mkNP (appPrep v.c3 np.s)) (predV v v.part) ** {c2 = v.c2 ; isPre = True} ; -- slot for ba object + Slash2V3 v np = insertAdv (mkNP (ba_s ++ linNP np)) (predV v v.part) ** {c2 = v.c3 ; isPre = v.hasPrep} ; -- slot for third argument + Slash3V3 v np = insertObj (mkNP (appPrep v.c3 (linNP np))) (predV v v.part) ** {c2 = v.c2 ; isPre = True} ; -- slot for ba object - SlashV2A v ap = insertObj {s = ap.s ! Pred} (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; + SlashV2A v ap = insertObj (mkNP (ap.s ! Pred)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; SlashV2V v vp = insertObj (mkNP (infVP vp)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; - SlashV2S v s = insertObj (ss (say_s ++ linS s)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; - SlashV2Q v q = insertObj (ss (say_s ++ q.s ! False)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; + SlashV2S v s = insertObj (mkNP (say_s ++ linS s)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; + SlashV2Q v q = insertObj (mkNP (say_s ++ q.s ! False)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; ComplVV v vp = { verb = v ; @@ -23,14 +23,14 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { isAdj = False ; } ; - ComplVS v s = insertObj (ss (linS s)) (predV v []) ; - ComplVQ v q = insertObj (ss (q.s ! False)) (predV v []) ; - ComplVA v ap = insertObj {s = ap.s ! Pred} (predV v []) ; + ComplVS v s = insertObj (mkNP (linS s)) (predV v []) ; + ComplVQ v q = insertObj (mkNP (q.s ! False)) (predV v []) ; + ComplVA v ap = insertObj (mkNP (ap.s ! Pred)) (predV v []) ; ComplSlash vp np = case vp.isPre of { --- True => insertAdv (mkNP (ba_s ++ np.s)) vp ; --- ba or vp.c2 ? - True => insertPP (mkNP (appPrep vp.c2 np.s)) vp ; --- ba or vp.c2 ? - False => insertObj (mkNP (appPrep vp.c2 np.s)) vp + True => insertPP (mkNP (appPrep vp.c2 (linNP np))) vp ; --- ba or vp.c2 ? + False => insertObj (mkNP (appPrep vp.c2 (linNP np))) vp } ; UseComp comp = comp ; @@ -44,13 +44,13 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { (insertObj (mkNP (infVP vp)) (predV v v.part)) ** {c2 = vp.c2 ; isPre = vp.isPre} ; AdvVP vp adv = case adv.advType of { - ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well* + ATManner => insertObj (mkNP (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well* ATPlace True => insertAdvPost adv vp ; -- he today *in the house* sleeps ATPlace False => insertAdvPost (ss (zai_V.s ++ adv.s)) vp ; -- he today *here* sleeps ATTime | ATPoss => insertTopic adv vp -- *today* he here sleeps } ; ExtAdvVP vp adv = case adv.advType of { ---- ExtAdvVP also ? - ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well* + ATManner => insertObj (mkNP (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well* ATPlace True => insertAdvPost adv vp ; -- he today *in the house* sleeps ATPlace False => insertAdvPost (ss (zai_V.s ++ adv.s)) vp ; -- he today *here* sleeps ATTime | ATPoss => insertTopic adv vp -- *today* he here sleeps @@ -73,17 +73,17 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { CompNP np = insertObj np (predV copula []) ; ---- - CompCN cn = insertObj cn (predV copula []) ; ---- + CompCN cn = insertObj (mkNP cn.s) (predV copula []) ; ---- CompAdv adv = case adv.advType of { - ATPlace True => insertObj adv (predV noVerb []) ; - _ => insertObj adv (predV zai_V []) ---- for all others ?? + ATPlace True => insertObj (mkNP adv.s) (predV noVerb []) ; + _ => insertObj (mkNP adv.s) (predV zai_V []) ---- for all others ?? } ; VPSlashPrep vp prep = vp ** {c2 = prep ; isPre = True} ; AdvVPSlash vp adv = case adv.advType of { - ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps well + ATManner => insertObj (mkNP (deVAdv_s ++ adv.s)) vp ; -- he sleeps well ATPlace True => insertAdv adv vp ; -- he sleeps on the table _ => insertAdv (ss (zai_V.s ++ adv.s)) vp -- he sleeps in the house / today } ** {c2 = vp.c2 ; isPre = vp.isPre} ;