From 33ffc1db48914c857c5a95fe71c54b1d16cdada1 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 24 Nov 2021 10:29:20 +0800 Subject: [PATCH 01/26] fix malay for these cats arent' green for negation in unittest --- src/malay/unittest/negation.gftest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/malay/unittest/negation.gftest b/src/malay/unittest/negation.gftest index 95c152333..f44c7a3db 100644 --- a/src/malay/unittest/negation.gftest +++ b/src/malay/unittest/negation.gftest @@ -8,7 +8,7 @@ LangMay: kucing tidak berjalan Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant this_Quant NumPl) (UseN cat_N)) (UseComp (CompAP (PositA green_A)))) LangEng: these cats aren't green -LangMay: kucing-kucing ini hijau +LangMay: kucing-kucing ini tidak hijau Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant that_Quant NumPl) (UseN cat_N)) (UseComp (CompAdv (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN house_N)))))) LangEng: those cats aren't in the house From e4e304d55184803b32837c6e426aea9b4f27b737 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 24 Nov 2021 11:26:23 +0800 Subject: [PATCH 02/26] WIP negation for chinese --- src/chinese/unittest/negation.gftest | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/chinese/unittest/negation.gftest diff --git a/src/chinese/unittest/negation.gftest b/src/chinese/unittest/negation.gftest new file mode 100644 index 000000000..1d9f4c6f8 --- /dev/null +++ b/src/chinese/unittest/negation.gftest @@ -0,0 +1,29 @@ +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (MassNP (UseN cat_N)) (UseComp (CompCN (UseN dog_N)))) +LangEng: cat isn't a dog +LangChi: 猫 不 是 狗 + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant this_Quant NumPl) (UseN cat_N)) (UseComp (CompAP (PositA green_A)))) +LangEng: these cats aren't green +LangChi: 这 些 猫 不 是 绿 色 的 + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant that_Quant NumPl) (UseN cat_N)) (UseComp (CompAdv (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN house_N)))))) +LangEng: those cats aren't in the house +LangChi: 那 些 猫 不 在 房 子 中 + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant this_Quant NumPl) (UseN cat_N)) (ComplVV can8know_VV (UseV walk_V))) +LangChi: 这 些 猫 不 会 走 +LangEng: these cats can't walk + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant this_Quant NumPl) (UseN cat_N)) (ComplVV can_VV (UseV walk_V))) +LangChi: 这 些 猫 不 能 走 +LangEng: these cats can't walk + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant this_Quant NumPl) (UseN cat_N)) (ComplVV want_VV (UseV walk_V))) +LangChi: 这 些 猫 不 想 走 +LangEng: these cats don't want to walk + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant that_Quant NumPl) (UseN cat_N)) (ComplVV must_VV (UseV walk_V))) +LangChi: 那 些 猫 不 行 走 +LangEng: those cats mustn't walk + +-- 没有 and must not , bu ke yi \ No newline at end of file From b26e6e1c9f6522eee06bee83fdd655a303d01002 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Tue, 7 Dec 2021 16:28:09 +0800 Subject: [PATCH 03/26] adjectives colour --- src/chinese/unittest/adjectives.gftest | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/chinese/unittest/adjectives.gftest diff --git a/src/chinese/unittest/adjectives.gftest b/src/chinese/unittest/adjectives.gftest new file mode 100644 index 000000000..4fbfc9a89 --- /dev/null +++ b/src/chinese/unittest/adjectives.gftest @@ -0,0 +1,3 @@ +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (AdjCN (PositA green_A) (UseN cat_N))) (UseComp (CompAP (PositA green_A)))) +LangChi: 那 只 绿 猫 是 绿 色 的 +LangEng: that green cat is green \ No newline at end of file From 565cd8fa61da1a69660188d470591c5bbd7e9eab Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Fri, 17 Dec 2021 14:50:20 +0800 Subject: [PATCH 04/26] fixed SentAP and AdvAP for AdjPlace in ResChi --- src/chinese/AdjectiveChi.gf | 14 ++++-- src/chinese/ResChi.gf | 92 ++++++++++++++++++++----------------- 2 files changed, 60 insertions(+), 46 deletions(-) diff --git a/src/chinese/AdjectiveChi.gf b/src/chinese/AdjectiveChi.gf index 61c2fa60f..4befaaf42 100644 --- a/src/chinese/AdjectiveChi.gf +++ b/src/chinese/AdjectiveChi.gf @@ -18,12 +18,20 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in { ReflA2 a = complexAP (a.s ++ appPrep a.c2 reflPron) ; - SentAP ap sc = complexAP (ap.s ++ sc.s) ; + + -- SentAP ap sc = complexAP (ap.s ++ sc.s) ; + SentAP ap sc = ap ** { + + s = table { adjPlace => ap.s ! adjPlace ++ sc.s } + } ; AdAP ada ap = {s = ada.s ++ ap.s ; monoSyl = False ; hasAdA = True} ; UseA2 a = a ** {hasAdA = False} ; - - AdvAP ap adv = complexAP (adv.s ++ ap.s) ; ---- + + -- AdvAP ap adv = complexAP (adv.s ++ ap.s) ; + AdvAP ap adv = ap ** { + s = table { adjPlace => adv.s ++ ap.s ! adjPlace } + }; } diff --git a/src/chinese/ResChi.gf b/src/chinese/ResChi.gf index e30a87941..08804798e 100644 --- a/src/chinese/ResChi.gf +++ b/src/chinese/ResChi.gf @@ -67,9 +67,9 @@ resource ResChi = ParamX ** open Prelude in { bword : Str -> Str -> Str = \x,y -> x ++ y ; -- change to x + y to treat words as single tokens word : Str -> Str = \s -> case s of { - x@? + y@? + z@? + u@? + v@? + w@? + a@? + b@? + c@? + d@? + e@? => + x@? + y@? + z@? + u@? + v@? + w@? + a@? + b@? + c@? + d@? + e@? => bword x (bword y (bword z (bword u (bword v (bword w (bword a (bword b (bword c (bword d e))))))))) ; - x@? + y@? + z@? + u@? + v@? + w@? + a@? + b@? + c@? + d@? => + x@? + y@? + z@? + u@? + v@? + w@? + a@? + b@? + c@? + d@? => bword x (bword y (bword z (bword u (bword v (bword w (bword a (bword b (bword c d)))))))) ; x@? + y@? + z@? + u@? + v@? + w@? + a@? + b@? + c@? => bword x (bword y (bword z (bword u (bword v (bword w (bword a (bword b c))))))) ; x@? + y@? + z@? + u@? + v@? + w@? + a@? + b@? => bword x (bword y (bword z (bword u (bword v (bword w (bword a b)))))) ; @@ -96,6 +96,8 @@ param AdvType = ATPlace Bool | ATTime | ATManner | ATPoss ; -- ATPlace True = has zai_s already + AdjPlace = Attr | Pred ; -- a green cat / the cat is green colour + -- parts of speech oper @@ -103,25 +105,29 @@ oper VP = { topic : Str ; -- topicalized item, before subject prePart : Str ; -- between subject and verb - verb : Verb ; + verb : Verb ; compl : Str ; -- after verb - isAdj : Bool ; -- whether it is an adjectival predication and behaves differently in relative + isAdj : Bool ; -- whether it is an adjectival predication and behaves differently in relative } ; - NP = {s : Str} ; + NP = {s : Str} ; -- for morphology Noun : Type = {s : Str ; c : Str} ; - Adj : Type = {s : Str ; monoSyl: Bool} ; + Adj : Type = {s : AdjPlace => Str ; monoSyl: Bool} ; Verb : Type = {s,sn : Str ; pp,ds,dp,ep : Str ; neg : Str} ; --- sn=[] needed for "hen" as copula regNoun : Str -> Str -> Noun = \s,c -> {s = word s ; c = word c}; - mkAdj : Str -> Bool -> Adj = \s,b -> {s = word s ; monoSyl = b}; + mkAdj : Str -> Bool -> Adj = \s,b -> {s = + table { + _ => word s + }; + monoSyl = b}; - complexAP : Str -> Adj ** {hasAdA : Bool} = - \s -> {s = s ; monoSyl = False ; hasAdA = False} ; --- not used for adding AdA + complexAP : Str -> Adj ** {hasAdA : Bool} = + \s -> mkAdj s False ** {hasAdA = False} ; --- not used for adding AdA simpleAdj : Str -> Adj = \s -> case s of { ? => mkAdj s True ; -- monosyllabic @@ -129,22 +135,22 @@ oper } ; copula : Verb = mkVerb "是" [] [] [] [] "不" ; - hen_copula : Verb = - {s = hen_s ; sn = [] ; pp = [] ; ds = [] ; dp = [] ; ep = [] ; neg = "不"} ; --- - nocopula : Verb = - {s = [] ; sn = [] ; pp = [] ; ds = [] ; dp = [] ; ep = [] ; neg = "不"} ; --- - adjcopula : Verb = - {s = "是" ; sn = [] ; pp = [] ; ds = [] ; dp = [] ; ep = [] ; neg = "不"} ; --- + hen_copula : Verb = + {s = hen_s ; sn = [] ; pp = [] ; ds = [] ; dp = [] ; ep = [] ; neg = "不"} ; --- + nocopula : Verb = + {s = [] ; sn = [] ; pp = [] ; ds = [] ; dp = [] ; ep = [] ; neg = "不"} ; --- + adjcopula : Verb = + {s = "是" ; sn = [] ; pp = [] ; ds = [] ; dp = [] ; ep = [] ; neg = "不"} ; --- - regVerb : (walk : Str) -> Verb = \v -> + regVerb : (walk : Str) -> Verb = \v -> mkVerb v "了" "着" "在" "过" "不" ; -- 没" ; noVerb : Verb = regVerb [] ; ---?? -- used as copula for verbal adverbs - mkVerb : (v : Str) -> (pp,ds,dp,ep,neg : Str) -> Verb = \v,pp,ds,dp,ep,neg -> + mkVerb : (v : Str) -> (pp,ds,dp,ep,neg : Str) -> Verb = \v,pp,ds,dp,ep,neg -> {s,sn = word v ; pp = pp ; ds = ds ; dp = dp ; ep = ep ; neg = neg} ; - useVerb : Verb -> Polarity => Aspect => Str = \v -> + useVerb : Verb -> Polarity => Aspect => Str = \v -> table { Pos => table { APlain => v.s ; @@ -162,37 +168,37 @@ oper } } ; - infVP : VP -> Str = \vp -> vp.topic ++ vp.prePart ++ vp.verb.s ++ vp.compl ; + infVP : VP -> Str = \vp -> vp.topic ++ vp.prePart ++ vp.verb.s ++ vp.compl ; predV : Verb -> Str -> VP = \v,part -> { - verb = v ; + verb = v ; compl = part ; prePart, topic = [] ; isAdj = False ; - } ; + } ; insertObj : NP -> VP -> VP = \np,vp -> vp ** { compl = np.s ++ vp.compl ; - } ; + } ; insertObjPost : NP -> VP -> VP = \np,vp -> vp ** { compl = vp.compl ++ np.s ; - } ; + } ; insertAdv : SS -> VP -> VP = \adv,vp -> vp ** { prePart = adv.s ++ vp.prePart ; - } ; + } ; insertTopic : SS -> VP -> VP = \adv,vp -> vp ** { topic = adv.s ++ vp.topic - } ; + } ; insertAdvPost : SS -> VP -> VP = \adv,vp -> vp ** { prePart = vp.prePart ++ adv.s ; - } ; + } ; insertPP : SS -> VP -> VP = \pp,vp -> vp ** { prePart = vp.prePart ++ pp.s ; - } ; + } ; insertExtra : SS -> VP -> VP = \ext,vp -> insertObjPost ext vp ; @@ -200,33 +206,33 @@ oper -- clauses: keep np and vp separate to enable insertion of IAdv Clause : Type = { - s : Polarity => Aspect => Str ; - np : Str; - vp : VP - } ; + s : Polarity => Aspect => Str ; + np : Str; + vp : VP + } ; mkClause = overload { - mkClause : Str -> Verb -> Clause = \np,v -> + mkClause : Str -> Verb -> Clause = \np,v -> mkClauseCompl np (predV v []) [] ; mkClause : Str -> Verb -> Str -> Clause = \subj,verb,obj -> mkClauseCompl subj (predV verb []) obj ; - mkClause : Str -> VP -> Clause = \np,vp -> + mkClause : Str -> VP -> Clause = \np,vp -> mkClauseCompl np vp [] ; - mkClause : Str -> VP -> Str -> Clause = + mkClause : Str -> VP -> Str -> Clause = mkClauseCompl ; } ; - + 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 ; } ; - + -- for structural words -param +param DetType = DTFull Number | DTNum | DTPoss ; -- this, these, five, our NumType = NTFull | NTVoid Number ; -- five, sg, pl @@ -250,8 +256,8 @@ oper s = word s } ; - Preposition = {prepPre : Str ; prepPost : Str ; advType : AdvType ; hasDe : Bool} ; - + Preposition = {prepPre : Str ; prepPost : Str ; advType : AdvType ; hasDe : Bool} ; + mkPreposition : Str -> Str -> AdvType -> Preposition = \s1,s2,at -> { prepPre = word s1 ; prepPost = word s2 ; @@ -262,8 +268,8 @@ oper advTypeHasDe : AdvType -> Bool = \at -> case at of { ATPoss => True ; _ => False - } ; - + } ; + getAdvType : Str -> AdvType = \s -> case s of { "的" => ATPoss ; "在" + _ => ATPlace True ; -- certain that True @@ -271,7 +277,7 @@ oper } ; possessiveIf : Bool -> Str = \hasDe -> case hasDe of { - True => [] ; --- to avoid double "de" + True => [] ; --- to avoid double "de" _ => possessive_s } ; @@ -285,7 +291,7 @@ oper mkNP : Str -> NP = ss ; -- not to be used in lexicon building - appPrep : Preposition -> Str -> Str = \prep,s -> + appPrep : Preposition -> Str -> Str = \prep,s -> prep.prepPre ++ s ++ prep.prepPost ; } From 1b02447b44e51d0750f7b761a1dbb1bcfe60018b Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Fri, 17 Dec 2021 15:28:42 +0800 Subject: [PATCH 05/26] attempt to edit complexAP for table selection --- src/chinese/AdjectiveChi.gf | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/chinese/AdjectiveChi.gf b/src/chinese/AdjectiveChi.gf index 4befaaf42..87a2c6eb5 100644 --- a/src/chinese/AdjectiveChi.gf +++ b/src/chinese/AdjectiveChi.gf @@ -5,18 +5,36 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in { PositA a = a ** {hasAdA = False} ; --ComparA a np = complexAP (a.s ++ than_s ++ np.s) ; - ComparA a np = complexAP (than_s ++ np.s ++ a.s) ; + -- ComparA a np = complexAP (than_s ++ np.s ++ a.s) ; + ComparA a np = a ** { + s = table { adjPlace => than_s ++ np.s ++ a.s!adjPlace} + }; - UseComparA a = complexAP (geng_s ++ a.s) ; + --UseComparA a = complexAP (geng_s ++ a.s) ; + UseComparA a = geng ** { + s = table { adjPlace => geng.s!adjPlace ++ a.s} + }; - AdjOrd ord = complexAP ord.s ; + -- AdjOrd ord = complexAP ord.s ; + AdjOrd ord = ord ** { + s = table {adjPlace => ord.s!adjPlace} + }; -- CAdvAP ad ap np = complexAP (ap.s ++ ad.s ++ ad.p ++ np.s) ; - CAdvAP ad ap np = complexAP (ad.s++ np.s++ad.p++ap.s ) ; --modified by ChenPeng 11.24 + -- CAdvAP ad ap np = complexAP (ad.s++ np.s++ad.p++ap.s ) ; --modified by ChenPeng 11.24 + CAdvAP ad ap np = ap ** { + s = table {adjPlace => ad.s ++ np.s ++ ad.p ++ ap.s!adjPlace} + }; - ComplA2 a np = complexAP (appPrep a.c2 np.s ++ a.s) ; + -- ComplA2 a np = complexAP (appPrep a.c2 np.s ++ a.s) ; + ComplA2 a np = a ** { + s= table { adjPlace => appPrep a.c2 np.s ++ a.s!adjPlace} + }; - ReflA2 a = complexAP (a.s ++ appPrep a.c2 reflPron) ; + -- ReflA2 a = complexAP (a.s ++ appPrep a.c2 reflPron) ; + ReflA2 a = a ** { + s = table {adjPlace => a.s!adjPlace ++ appPrep a.c2 reflPron} + }; -- SentAP ap sc = complexAP (ap.s ++ sc.s) ; @@ -25,9 +43,12 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in { s = table { adjPlace => ap.s ! adjPlace ++ sc.s } } ; - AdAP ada ap = {s = ada.s ++ ap.s ; monoSyl = False ; hasAdA = True} ; + -- AdAP ada ap = {s = ada.s ++ ap.s ; monoSyl = False ; hasAdA = True} ; + AdAP ada ap = ap ** { + s = table { adjPlace => ada.s ++ ap.s ! adjPlace ; monoSyl = False; hasAdA = True} + }; - UseA2 a = a ** {hasAdA = False} ; + UseA2 a = a ** {hasAdA = False} ; -- AdvAP ap adv = complexAP (adv.s ++ ap.s) ; AdvAP ap adv = ap ** { From 9a6301691dca4bf3f13970191c20526f17017338 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Mon, 3 Jan 2022 15:54:05 +0800 Subject: [PATCH 06/26] add distinction between Attributive vs Predicative (esp for colours) --- src/chinese/AdjectiveChi.gf | 65 ++++++++++--------- src/chinese/AdverbChi.gf | 12 ++-- src/chinese/ConjunctionChi.gf | 10 +-- src/chinese/DocumentationChi.gf | 6 +- src/chinese/ExtraChi.gf | 16 ++--- src/chinese/LexiconChi.gf | 66 ++++++++++---------- src/chinese/NounChi.gf | 10 +-- src/chinese/ParadigmsChi.gf | 107 ++++++++++++++++---------------- src/chinese/PhraseChi.gf | 2 +- src/chinese/ResChi.gf | 11 +++- src/chinese/VerbChi.gf | 26 ++++---- 11 files changed, 172 insertions(+), 159 deletions(-) diff --git a/src/chinese/AdjectiveChi.gf b/src/chinese/AdjectiveChi.gf index 87a2c6eb5..5098f5ed5 100644 --- a/src/chinese/AdjectiveChi.gf +++ b/src/chinese/AdjectiveChi.gf @@ -4,55 +4,58 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in { PositA a = a ** {hasAdA = False} ; - --ComparA a np = complexAP (a.s ++ than_s ++ np.s) ; - -- ComparA a np = complexAP (than_s ++ np.s ++ a.s) ; - ComparA a np = a ** { - s = table { adjPlace => than_s ++ np.s ++ a.s!adjPlace} - }; + ComparA a np = a ** { + s = table { adjPlace => than_s ++ np.s ++ a.s!adjPlace}; + hasAdA = False - --UseComparA a = complexAP (geng_s ++ a.s) ; - UseComparA a = geng ** { - s = table { adjPlace => geng.s!adjPlace ++ a.s} - }; + }; + + UseComparA a = a ** { + s = table { adjPlace => geng_s ++ a.s!adjPlace}; + hasAdA = False + }; - -- AdjOrd ord = complexAP ord.s ; AdjOrd ord = ord ** { - s = table {adjPlace => ord.s!adjPlace} + s = table { + adjPlace => ord.s + -- Attr => ord.s; --"first is he" ; + -- Pred => ord.s --"he is first" + } ; + hasAdA = False; + monoSyl = True -- to do and figure out in relation to Ord = {s : Str} }; - -- CAdvAP ad ap np = complexAP (ap.s ++ ad.s ++ ad.p ++ np.s) ; - -- CAdvAP ad ap np = complexAP (ad.s++ np.s++ad.p++ap.s ) ; --modified by ChenPeng 11.24 - CAdvAP ad ap np = ap ** { + CAdvAP ad ap np = ap ** { s = table {adjPlace => ad.s ++ np.s ++ ad.p ++ ap.s!adjPlace} - }; + }; - -- ComplA2 a np = complexAP (appPrep a.c2 np.s ++ a.s) ; ComplA2 a np = a ** { - s= table { adjPlace => appPrep a.c2 np.s ++ a.s!adjPlace} - }; + s= table { adjPlace => appPrep a.c2 np.s ++ a.s!adjPlace}; + hasAdA = False + }; + - -- ReflA2 a = complexAP (a.s ++ appPrep a.c2 reflPron) ; ReflA2 a = a ** { - s = table {adjPlace => a.s!adjPlace ++ appPrep a.c2 reflPron} - }; + s = table {adjPlace => a.s!adjPlace ++ appPrep a.c2 reflPron}; + hasAdA = False + }; - -- SentAP ap sc = complexAP (ap.s ++ sc.s) ; SentAP ap sc = ap ** { - s = table { adjPlace => ap.s ! adjPlace ++ sc.s } - } ; + } ; -- AdAP ada ap = {s = ada.s ++ ap.s ; monoSyl = False ; hasAdA = True} ; - AdAP ada ap = ap ** { - s = table { adjPlace => ada.s ++ ap.s ! adjPlace ; monoSyl = False; hasAdA = True} - }; + AdAP ada ap = ap ** { + s = table { adjPlace => ada.s ++ ap.s ! adjPlace }; + monoSyl = False; + hasAdA = True + }; - UseA2 a = a ** {hasAdA = False} ; + UseA2 a = a ** {hasAdA = False} ; - -- AdvAP ap adv = complexAP (adv.s ++ ap.s) ; - AdvAP ap adv = ap ** { + AdvAP ap adv = ap ** { s = table { adjPlace => adv.s ++ ap.s ! adjPlace } - }; + }; } diff --git a/src/chinese/AdverbChi.gf b/src/chinese/AdverbChi.gf index 8a50ddd90..557d29858 100644 --- a/src/chinese/AdverbChi.gf +++ b/src/chinese/AdverbChi.gf @@ -1,14 +1,14 @@ -concrete AdverbChi of Adverb = CatChi ** +concrete AdverbChi of Adverb = CatChi ** open ResChi, Prelude in { lin - PositAdvAdj a = {s = a.s ++ "地" ; advType = ATManner ; hasDe = False} ; ---- for all adjs? + 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 np.s) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ? - ComparAdvAdj cadv a np = ss (a.s ++ cadv.s ++ cadv.p ++ np.s) ** {advType = ATManner ; hasDe = False} ; + ComparAdvAdj cadv a np = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ np.s) ** {advType = ATManner ; hasDe = False} ; - ComparAdvAdjS cadv a s = ss (a.s ++ cadv.s ++ cadv.p ++ s.s) ** {advType = ATManner ; hasDe = False} ; + ComparAdvAdjS cadv a s = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ s.s) ** {advType = ATManner ; hasDe = False} ; AdAdv ad adv = adv ** {s = ad.s ++ adv.s} ; @@ -16,6 +16,6 @@ concrete AdverbChi of Adverb = CatChi ** AdnCAdv cadv = ss (cadv.s ++ conjThat) ** {advType = ATManner ; hasDe = False} ; ----- - PositAdAAdj a = {s = a.s} ; ---- + PositAdAAdj a = {s = a.s!Attr} ; ---- } diff --git a/src/chinese/ConjunctionChi.gf b/src/chinese/ConjunctionChi.gf index e507667ae..f5607d856 100644 --- a/src/chinese/ConjunctionChi.gf +++ b/src/chinese/ConjunctionChi.gf @@ -5,9 +5,9 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin ConjS c = conjunctDistrSS (c.s ! CSent) ; ConjAdv c as = conjunctDistrSS (c.s ! CSent) as ** {advType = as.advType ; hasDe = as.hasDe} ; ---- ?? ConjNP c = conjunctDistrSS (c.s ! CPhr CNPhrase) ; - ConjAP c as = conjunctDistrSS (c.s ! CPhr CAPhrase) as ** {monoSyl = notB as.monoSyl ; hasAdA = True} ; ---- add de iff as doesn't + 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} ; + ConjCN c ns = conjunctDistrSS (c.s ! CPhr CNPhrase) ns ** {c = ns.c} ; -- These fun's are generated from the list cat's. @@ -17,8 +17,8 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin ConsAdv x xs = consrSS duncomma x xs ** {advType = x.advType ; hasDe = xs.hasDe} ; ---- ?? BaseNP = twoSS ; ConsNP = consrSS duncomma ; - BaseAP x y = twoSS x y ** {monoSyl = y.monoSyl} ; - ConsAP x xs = consrSS duncomma x xs ** {monoSyl = xs.monoSyl} ; + BaseAP x y = twoTable AdjPlace x y ** {monoSyl = y.monoSyl} ; + ConsAP x xs = consrTable AdjPlace duncomma x xs ** {monoSyl = xs.monoSyl} ; BaseRS = twoSS ; ConsRS = consrSS duncomma ; BaseCN x y = twoSS x y ** {c = x.c} ; --- classified comes from first part ; should it rather be ge? @@ -28,7 +28,7 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin [S] = {s1,s2 : Str} ; [Adv] = {s1,s2 : Str ; advType : AdvType ; hasDe : Bool} ; [NP] = {s1,s2 : Str} ; - [AP] = {s1,s2 : Str ; monoSyl : Bool} ; + [AP] = {s1,s2 : AdjPlace => Str ; monoSyl : Bool} ; [RS] = {s1,s2 : Str} ; [CN] = {s1,s2 : Str ; c : Str} ; diff --git a/src/chinese/DocumentationChi.gf b/src/chinese/DocumentationChi.gf index ef76c9ee5..9ac20f480 100644 --- a/src/chinese/DocumentationChi.gf +++ b/src/chinese/DocumentationChi.gf @@ -1,6 +1,6 @@ concrete DocumentationChi of Documentation = CatChi ** open ResChi, - HTML + HTML in { lincat @@ -19,9 +19,9 @@ lin InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 "Adjective" ; - s2 = adj.s + s2 = adj.s!Attr } ; - + InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> { t = "adv" ; s1 = heading1 "Adverb" ; diff --git a/src/chinese/ExtraChi.gf b/src/chinese/ExtraChi.gf index cba1a0924..e745e3b4e 100644 --- a/src/chinese/ExtraChi.gf +++ b/src/chinese/ExtraChi.gf @@ -1,9 +1,9 @@ -concrete ExtraChi of ExtraChiAbs = CatChi ** +concrete ExtraChi of ExtraChiAbs = CatChi ** open ResChi, Coordination, (S = StructuralChi), Prelude in { flags coding = utf8 ; - lincat + lincat VPS = {s : Str} ; [VPS] = {s1,s2 : Str} ; VPI = {s : Str} ; --- ??? @@ -37,15 +37,15 @@ concrete ExtraChi of ExtraChiAbs = CatChi ** Aspect = {s : Str ; a : ResChi.Aspect} ; lin CompBareAP ap = case ap.hasAdA of { - True => insertObj (mkNP ap.s) (predV nocopula []) ; - False => insertObj (mkNP ap.s) (predV hen_copula []) - } ; + True => insertObj (mkNP (ap.s!Pred)) (predV nocopula []) ; + False => insertObj (mkNP (ap.s!Pred)) (predV hen_copula []) + } ; QuestRepV cl = { s = \\_,p,a => ---- also for indirect questions? let - v = cl.vp.verb ; + v = cl.vp.verb ; verb = case a of { - APlain => v.s ++ v.neg ++ v.sn ; + APlain => v.s ++ v.neg ++ v.sn ; APerf => v.s ++ "不" ++ v.sn ++ v.pp ; ADurStat => v.s ++ "不" ++ v.sn ; ADurProg => v.s ++ v.neg ++ v.dp ++ v.sn ; -- mei or bu @@ -57,4 +57,4 @@ concrete ExtraChi of ExtraChiAbs = CatChi ** TopicAdvVP vp adv = insertTopic adv vp ; -} +} diff --git a/src/chinese/LexiconChi.gf b/src/chinese/LexiconChi.gf index 1296b2af7..3468e7e90 100644 --- a/src/chinese/LexiconChi.gf +++ b/src/chinese/LexiconChi.gf @@ -1,7 +1,7 @@ -concrete LexiconChi of Lexicon = CatChi ** +concrete LexiconChi of Lexicon = CatChi ** open ParadigmsChi, ResChi, Prelude in { -flags +flags coding = utf8 ; lin @@ -14,13 +14,13 @@ lin tree_N = mkN "树" "棵"; -- "shu" "ke" big_A = mkA "大" ; -- "da" small_A = mkA "小" ; -- "xiao" - green_A = mkA "绿" ; -- "lv" + green_A = colourA "绿" ; -- "lv" walk_V = mkV "走" ; -- "zou" sleep_V = mkV "睡觉" ; -- "shui" love_V2 = mkV2 "爱" ; -- "ai" watch_V2 = mkV2 "看" ; -- "kan" know_VS = mkV "知道" ; -- "zhidao" - wonder_VQ = mkV "好奇" ; -- "haoqi" + wonder_VQ = mkV "好奇" ; -- "haoqi" john_PN = mkPN "约翰" ; -- "yuehan" @@ -63,7 +63,7 @@ horn_N = mkN "角" "根"; tail_N = mkN "尾巴" "条"; -- [mark] "尾" -> "尾巴" , "尾" is often treated as morpheme, or if stands alone, it is a classifier itself feather_N = mkN "羽毛" "根"; hair_N = mkN "头发" "根"; -- [mark] several classifiers , "根"(single hair), "把"(several hairs) -head_N = mkN "头" "颗"; +head_N = mkN "头" "颗"; ear_N = mkN "耳朵" "只"; eye_N = mkN "眼睛" "只"; nose_N = mkN "鼻子" ; @@ -79,7 +79,7 @@ wing_N = mkN "翅膀" "只"; -- [mark] "翼" -> "翅膀", "翅膀" is the common belly_N = mkN "肚子" ; guts_N = mkN "肠子" "根"; neck_N = mkN "脖子" ; -back_N = mkN "背" ; +back_N = mkN "背" ; breast_N = mkN "胸" ; heart_N = mkN "心脏" "颗"; liver_N = mkN "肝" ; @@ -101,7 +101,7 @@ live_V = mkV "活" ; die_V = mkV "死" ; kill_V2 = mkV2 "杀" ; fight_V2 = mkV2 "打架" ; -- [mark] "吵架" -> "打架", "吵架" = quarrel, argue -hunt_V2 = mkV2 "打猎" ; -- [mark] "打猎" is iv, can't think of proper translation in v2 form for hunt +hunt_V2 = mkV2 "打猎" ; -- [mark] "打猎" is iv, can't think of proper translation in v2 form for hunt hit_V2 = mkV2 "打" ; cut_V2 = mkV2 "割" ; split_V2 = mkV2 "劈开" ; @@ -159,10 +159,10 @@ ashes_N = mkN "灰" []; burn_V = mkV "烧" ; road_N = mkN "路" "条"; mountain_N = mkN "山" "座"; -red_A = mkA "红" ; -yellow_A = mkA "黄" ; -white_A = mkA "白" ; -black_A = mkA "黑" ; +red_A = colourA "红" ; +yellow_A = colourA "黄" ; +white_A = colourA "白" ; +black_A = colourA "黑" ; night_N = mkN "夜晚" ; -- [mark] "夜晚" 's classifier is "个" day_N = mkN "白天" []; -- [mark] "白天" -> "天", "天" itself is classifier year_N = mkN "年" [] ; -- [mark] "年" itself is classifier @@ -343,7 +343,7 @@ shirt_N = mkN "衬衫" "件" ; silver_N = mkN "银子" "块"; -- [mark] "银" --> "银子" sister_N = mkN "妹妹" ; sock_N = mkN "袜子" "只"; -steel_N = mkN "钢" "块"; +steel_N = mkN "钢" "块"; stove_N = mkN "炉子" ; village_N = mkN "村庄" "座"; war_N = mkN "战争" "场" ; -- [mark] rewritten @@ -353,29 +353,27 @@ wood_N = mkN "木头" "块" ; -- [mark] "木" --> "木头" -- from scratch, by Jolene lin - alas_Interj = ssword "唉" ; + alas_Interj = ssword "唉" ; beg_V2V = mkV2V (mkV "乞求") ; -- beg him to do something - break_V2 = mkV2 "打破" ; - broad_A = mkA "宽" ; - brown_A = mkA "棕" ; - clever_A = mkA "聪明" ; - close_V2 = mkV2 "关闭" ; - easy_A2V = mkA2 "简单" ; - empty_A = mkA "空" ; - fun_AV = mkA "有趣" ; - hate_V2 = mkV2 "讨厌" ; - married_A2 = mkA2 "结婚" ; - paris_PN = mkPN "巴黎" ; - probable_AS = mkA "可能" ; + break_V2 = mkV2 "打破" ; + broad_A = mkA "宽" ; + brown_A = colourA "棕" ; + clever_A = mkA "聪明" ; + close_V2 = mkV2 "关闭" ; + easy_A2V = mkA2 "简单" ; + empty_A = mkA "空" ; + fun_AV = mkA "有趣" ; + hate_V2 = mkV2 "讨厌" ; + married_A2 = mkA2 "结婚" ; + paris_PN = mkPN "巴黎" ; + probable_AS = mkA "可能" ; ready_A = mkA "准备好" ; -- [mark] "准备好": 准备(v) + 好(adj,complement) - seek_V2 = mkV2 "寻求" ; - stop_V = mkV "停止" ; - stupid_A = mkA "笨" ; - switch8off_V2 = mkV2 "关" ; - switch8on_V2 = mkV2 "开" ; - ugly_A = mkA "丑" ; + seek_V2 = mkV2 "寻求" ; + stop_V = mkV "停止" ; + stupid_A = mkA "笨" ; + switch8off_V2 = mkV2 "关" ; + switch8on_V2 = mkV2 "开" ; + ugly_A = mkA "丑" ; uncertain_A = mkA "不确定" ; -- [mark] "不确定": 不("un-") + 确定("certain") - - -} +} \ No newline at end of file diff --git a/src/chinese/NounChi.gf b/src/chinese/NounChi.gf index 4a4a330b4..234056e25 100644 --- a/src/chinese/NounChi.gf +++ b/src/chinese/NounChi.gf @@ -28,7 +28,7 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { NTFull => quant.pl ++ num.s ; -- to avoid yi in indef NTVoid Pl => quant.pl ++ num.s ; _ => quant.s ++ num.s - } ; + } ; detType = case num.numType of { NTFull => DTNum ; -- five NTVoid n => case quant.detType of { @@ -63,8 +63,8 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { AdNum adn num = {s = adn.s ++ num.s ; hasC = True} ; - OrdSuperl a = {s = superlative_s ++ a.s} ; - OrdNumeralSuperl n a = {s = ordinal_s ++ n.s ++ superlative_s ++ a.s} ; ---- to check AR 24/8/2014 + OrdSuperl a = {s = superlative_s ++ a.s ! Attr} ; + OrdNumeralSuperl n a = {s = ordinal_s ++ n.s ++ superlative_s ++ a.s ! Attr} ; ---- to check AR 24/8/2014 DefArt = mkQuant [] [] DTPoss ; -- use that_Quant if you want the_s IndefArt = mkQuant yi_s [] DTNum ; -- (DTFull Sg) ; -- empty in the plural @@ -80,8 +80,8 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { ComplN3 f x = {s = appPrep f.c2 x.s ++ f.s ; c = f.c ; c2 = f.c3} ; AdjCN ap cn = case ap.monoSyl of { - True => {s = ap.s ++ cn.s ; c = cn.c} ; - False => {s = ap.s ++ possessive_s ++ cn.s ; c = cn.c} + True => {s = ap.s ! Attr ++ cn.s ; c = cn.c} ; + False => {s = ap.s ! Attr ++ possessive_s ++ cn.s ; c = cn.c} } ; RelCN cn rs = {s = rs.s ++ cn.s ; c = cn.c} ; diff --git a/src/chinese/ParadigmsChi.gf b/src/chinese/ParadigmsChi.gf index 6ec08c2f4..a04c87c55 100644 --- a/src/chinese/ParadigmsChi.gf +++ b/src/chinese/ParadigmsChi.gf @@ -5,11 +5,11 @@ flags coding = utf8 ; flags coding=utf8; oper mkN = overload { - mkN : (man : Str) -> N - = \n -> lin N (regNoun n ge_s) ; - mkN : (man : Str) -> Str -> N + mkN : (man : Str) -> N + = \n -> lin N (regNoun n ge_s) ; + mkN : (man : Str) -> Str -> N = \n,c -> lin N (regNoun n c) - } ; + } ; mkN2 = overload { mkN2 : Str -> N2 @@ -21,7 +21,7 @@ oper mkN3 : N -> Prep -> Prep -> N3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; - + mkPN : (john : Str) -> PN = \s -> lin PN {s = word s} ; -- normal name, in Chinese characters @@ -29,11 +29,14 @@ oper = \s -> lin PN {s = s} ; -- foreign name, in Latin or other non-Chinese characters mkA = overload { - mkA : (small : Str) -> A + mkA : (small : Str) -> A = \a -> lin A (simpleAdj a) ; - mkA : (small : Str) -> Bool -> A + mkA : (small : Str) -> Bool -> A = \a,b -> lin A (mkAdj a b) ; - } ; + } ; + + colourA : Str -> A ; -- colour Adjectives have a "色" when used as predicative + colourA colour = lin A (colourAdj colour); mkA2 = overload { mkA2 : Str -> A2 @@ -43,32 +46,32 @@ oper mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** {c2 = p}) ; } ; - - mkV = overload { - mkV : (walk : Str) -> V + + mkV = overload { + mkV : (walk : Str) -> V = \walk -> case walk of { v + "+" + p => lin V (regVerb (v + p)) ; _ => lin V (regVerb walk) } ; - mkV : (walk,out : Str) -> V + mkV : (walk,out : Str) -> V = \v,p -> lin V (regVerb (v + p)) ; ---- mkV : (arrive : Str) -> Str -> Str -> Str -> Str -> V = \arrive,pp,ds,dp,ep -> lin V (mkVerb arrive pp ds dp ep neg_s) ; mkV : (arrive : Str) -> Str -> Str -> Str -> Str -> Str -> V = \arrive,pp,ds,dp,ep,neg -> lin V (mkVerb arrive pp ds dp ep neg) ; - } ; + } ; mkV2 = overload { - mkV2 : Str -> V2 + mkV2 : Str -> V2 = \s -> case s of { v + "+" + p => lin V2 (regVerb v ** {c2 = emptyPrep ; hasPrep = False ; part = word p}) ; - v + "*" + p => lin V2 (regVerb v ** + v + "*" + p => lin V2 (regVerb v ** {c2 = ResChi.mkPreposition p [] (getAdvType p) ; hasPrep = True ; part = []}) ; _ => lin V2 (regVerb s ** {c2 = emptyPrep ; hasPrep = False ; part = []}) } ; - mkV2 : V -> V2 + mkV2 : V -> V2 = \v -> lin V2 (v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ; - mkV2 : V -> Prep -> V2 + mkV2 : V -> Prep -> V2 = \v,p -> lin V2 (v ** {c2 = p ; hasPrep = True ; part = []}) ; } ; @@ -110,47 +113,47 @@ oper mkV2Q = overload { mkV2Q : V -> V2Q = - \v -> lin V2Q (v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ; + \v -> lin V2Q (v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ; mkV2Q : Str -> V2Q = - \v -> lin V2Q (regVerb v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ; + \v -> lin V2Q (regVerb v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ; } ; mkV2V= overload { - mkV2V : Str -> V2V = - \s -> lin V2V (regVerb s ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ; + mkV2V : Str -> V2V = + \s -> lin V2V (regVerb s ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ; mkV2V : V -> V2V = - \v -> lin V2V (v ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ; + \v -> lin V2V (v ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ; ---- mkV2V : V -> Str -> Str -> V2V = ----- \v,p,q -> lin V2V (v ** {c2 = mkPrep p ; c3 = mkPrep q}) ; +---- \v,p,q -> lin V2V (v ** {c2 = mkPrep p ; c3 = mkPrep q}) ; } ; mkV2S = overload { mkV2S : Str -> V2S = - \s -> lin V2S (regVerb s ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ; + \s -> lin V2S (regVerb s ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ; mkV2S : V -> V2S = - \v -> lin V2S (v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ; + \v -> lin V2S (v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ; ---- mkV2S : V -> Str -> V2S = ----- \v,p -> lin V2S (v ** {c2 = mkPrep p}) ; +---- \v,p -> lin V2S (v ** {c2 = mkPrep p}) ; } ; mkV2A = overload { mkV2A : Str -> V2A - = \s -> lin V2A (regVerb s ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ; + = \s -> lin V2A (regVerb s ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ; mkV2A : V -> V2A - = \v -> lin V2A (v ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ; + = \v -> lin V2A (v ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ; } ; ---- mkV2A : V -> Str -> Str -> V2A ----- = \v,p,q -> lin V2A (v ** {c2 = mkPrep p ; c3 = mkPrep q}) ; +---- = \v,p,q -> lin V2A (v ** {c2 = mkPrep p ; c3 = mkPrep q}) ; mkAdv = overload { - mkAdv : Str -> Adv + mkAdv : Str -> Adv = \s -> let at = getAdvType s in lin Adv {s = word s ; advType = at ; hasDe = advTypeHasDe at} ; - mkAdv : Str -> Str -> Adv + mkAdv : Str -> Str -> Adv = \s,t -> let at = getAdvType s in lin Adv {s = word (s + t) ; advType = at ; hasDe = advTypeHasDe at} ; ---- - mkAdv : Str -> AdvType -> Adv + mkAdv : Str -> AdvType -> Adv = \s,at -> lin Adv {s = word s ; advType = at ; hasDe = advTypeHasDe at} ; - mkAdv : Adv -> AdvType -> Adv -- To fix the AdvType in an Adv produced by SyntaxChi.mkAdv + mkAdv : Adv -> AdvType -> Adv -- To fix the AdvType in an Adv produced by SyntaxChi.mkAdv = \adv,at -> adv ** {advType = at ; hasDe = advTypeHasDe at} ; } ; @@ -165,50 +168,50 @@ oper = ATTime ; mannerAdvType : AdvType = ATManner ; - + mkPrep = overload { -- first pre part, then optional post part - mkPrep : Str -> Prep + mkPrep : Str -> Prep = \s -> lin Prep (ResChi.mkPreposition s [] (getAdvType s)) ; - mkPrep : Str -> Str -> Prep + mkPrep : Str -> Str -> Prep = \s,t -> lin Prep (ResChi.mkPreposition s t (getAdvType s)) ; - mkPrep : Str -> Str -> AdvType -> Prep + mkPrep : Str -> Str -> AdvType -> Prep = \s,t,a -> lin Prep (ResChi.mkPreposition s t a) ; } ; - mkInterj : Str -> Interj + mkInterj : Str -> Interj = \s -> lin Interj {s = word s} ; emptyPrep : Preposition = mkPrep [] ; - mkpNP : Str -> CatChi.NP + mkpNP : Str -> CatChi.NP = \s -> lin NP {s = word s} ; - mkAdV : Str -> AdV + mkAdV : Str -> AdV = \s -> lin AdV {s = word s} ; - mkAdN : Str -> AdN + mkAdN : Str -> AdN = \s -> lin AdN {s = word s} ; - mkSubj : Str -> Subj + mkSubj : Str -> Subj = \s -> lin Subj (ResChi.mkSubj s []) ; mkConj = overload { - mkConj : Str -> Conj + mkConj : Str -> Conj = \s -> lin Conj {s = \\_ => mkConjForm s} ; - mkConj : (both,and : Str) -> Conj + mkConj : (both,and : Str) -> Conj = \s,t -> lin Conj {s = \\_ => mkConjForm2 s t} ; } ; - mkpDet : Str -> Det + mkpDet : Str -> Det = \s -> lin Det {s = word s ; detType = DTFull Sg} ; - mkQuant : Str -> Quant + mkQuant : Str -> Quant = \s -> lin Quant {s,pl = word s ; detType = DTFull Sg} ; - mkAdA : Str -> AdA + mkAdA : Str -> AdA = \s -> lin AdA {s = word s} ; - mkNum : Str -> Num + mkNum : Str -> Num = \s -> lin Num {s = word s ; numType = NTFull} ; - mkPredet : Str -> Predet + mkPredet : Str -> Predet = \s -> lin Predet {s = word s} ; - mkIDet : Str -> IDet + mkIDet : Str -> IDet = \s -> lin IDet {s = word s ; detType = DTNum} ; ---- - mkPConj : Str -> PConj + mkPConj : Str -> PConj = \s -> lin PConj {s = word s} ; - mkRP : Str -> RP + mkRP : Str -> RP = \s -> lin RP {s = table {True => [] ; False => word s}} ; diff --git a/src/chinese/PhraseChi.gf b/src/chinese/PhraseChi.gf index 51b3787d1..66f85995d 100644 --- a/src/chinese/PhraseChi.gf +++ b/src/chinese/PhraseChi.gf @@ -13,7 +13,7 @@ concrete PhraseChi of Phrase = CatChi ** open Prelude, ResChi in { UttIAdv iadv = iadv ; UttNP np = np ; UttCN cn = cn ; - UttAP ap = ap ; + UttAP ap = {s = ap.s!Attr} ; UttCard x = x ; UttVP vp = ss (infVP vp) ; UttAdv adv = adv ; diff --git a/src/chinese/ResChi.gf b/src/chinese/ResChi.gf index 08804798e..9b6a6494d 100644 --- a/src/chinese/ResChi.gf +++ b/src/chinese/ResChi.gf @@ -99,7 +99,6 @@ param AdjPlace = Attr | Pred ; -- a green cat / the cat is green colour -- parts of speech - oper VP = { @@ -134,6 +133,16 @@ oper _ => mkAdj s False } ; + colourAdj : Str -> Adj = \s -> { + s = table { + Attr => word s ; + Pred => word s ++ "色" + }; + monoSyl = case s of { + ? => True ; + _ => False } + }; + copula : Verb = mkVerb "是" [] [] [] [] "不" ; hen_copula : Verb = {s = hen_s ; sn = [] ; pp = [] ; ds = [] ; dp = [] ; ep = [] ; neg = "不"} ; --- diff --git a/src/chinese/VerbChi.gf b/src/chinese/VerbChi.gf index 013ee1994..be6bed536 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 + 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 - SlashV2A v ap = insertObj ap (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; + SlashV2A v ap = insertObj {s = 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 ++ s.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 (ss (say_s ++ s.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} ; ComplVV v vp = { verb = v ; @@ -23,9 +23,9 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { isAdj = False ; } ; - ComplVS v s = insertObj s (predV v []) ; - ComplVQ v q = insertObj (ss (q.s ! False)) (predV v []) ; - ComplVA v ap = insertObj ap (predV v []) ; + ComplVS v s = insertObj s (predV v []) ; + ComplVQ v q = insertObj (ss (q.s ! False)) (predV v []) ; + ComplVA v ap = insertObj {s = ap.s ! Pred} (predV v []) ; ComplSlash vp np = case vp.isPre of { --- True => insertAdv (mkNP (ba_s ++ np.s)) vp ; --- ba or vp.c2 ? @@ -39,7 +39,7 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { SlashVV v vp = ---- too simple? insertObj (mkNP (infVP vp)) (predV v []) ** {c2 = vp.c2 ; isPre = vp.isPre} ; - SlashV2VNP v np vp = + SlashV2VNP v np vp = insertObj np (insertObj (mkNP (infVP vp)) (predV v v.part)) ** {c2 = vp.c2 ; isPre = vp.isPre} ; @@ -56,19 +56,19 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { ATTime | ATPoss => insertTopic adv vp -- *today* he here sleeps } ; - AdVVP adv vp = insertAdv adv vp ; - + AdVVP adv vp = insertAdv adv vp ; + ReflVP vp = insertObj (mkNP reflPron) vp ; PassV2 v = insertAdv (mkNP passive_s) (predV v v.part) ; ---- - CompAP ap = insertObj (mkNP (ap.s ++ de_s)) (predV copula []) ** {isAdj = True} ; + CompAP ap = insertObj (mkNP (ap.s ! Pred ++ de_s)) (predV copula []) ** {isAdj = True} ; {- CompAP ap = case ap.hasAdA of { - True => insertObj (mkNP ap.s) (predV nocopula []) ; + True => insertObj (mkNP ap.s) (predV nocopula []) ; False => insertObj (mkNP (ap.s ++ de_s)) (predV copula []) - } ; + } ; -} CompNP np = insertObj np (predV copula []) ; ---- From 92bfa85a49251bde4018e4f4267070986ca362ad Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 5 Jan 2022 12:02:58 +0800 Subject: [PATCH 07/26] add AST to test for complements --- src/chinese/unittest/complements.gftest | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/chinese/unittest/complements.gftest diff --git a/src/chinese/unittest/complements.gftest b/src/chinese/unittest/complements.gftest new file mode 100644 index 000000000..3068c2dcb --- /dev/null +++ b/src/chinese/unittest/complements.gftest @@ -0,0 +1,3 @@ +-- One way of saying "he/she gives me a cat" +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (ComplSlash (Slash2V3 give_V3 (DetCN (DetQuant DefArt NumSg) (UseN cat_N))) (UsePron i_Pron))) +LangChi: 他 把 猫 给 我 \ No newline at end of file From b7b4c08e8a1208d9a5ee5a0dfb81809ae6ae63fe Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 12 Jan 2022 14:20:13 +0800 Subject: [PATCH 08/26] add test for chinese numerals -- passed --- src/chinese/unittest/numerals.gftest | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/chinese/unittest/numerals.gftest diff --git a/src/chinese/unittest/numerals.gftest b/src/chinese/unittest/numerals.gftest new file mode 100644 index 000000000..ff2077a23 --- /dev/null +++ b/src/chinese/unittest/numerals.gftest @@ -0,0 +1,11 @@ +Lang: DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01))))))) (UseN cat_N) +LangEng: one cat +LangChi: 一 只 猫 + +Lang: DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n5)))))))) (UseN cat_N) +LangEng: these five cats +LangChi: 这 五 只 猫 + +Lang: DetCN (DetQuant (PossPron i_Pron) (NumCard (NumNumeral (num (pot2as3 (pot2 (pot0 n7))))))) (UseN cat_N) +LangEng: my seven hundred cats +LangChi: 我 的 七 百 只 猫 \ No newline at end of file From 5f8a21dc08d8a9edb5e98ba2a77173bfa70dd037 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 12 Jan 2022 15:32:55 +0800 Subject: [PATCH 09/26] add test for chinese passive tests -- passed --- src/chinese/unittest/passive.gftest | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/chinese/unittest/passive.gftest diff --git a/src/chinese/unittest/passive.gftest b/src/chinese/unittest/passive.gftest new file mode 100644 index 000000000..3a2e5c887 --- /dev/null +++ b/src/chinese/unittest/passive.gftest @@ -0,0 +1,11 @@ +Lang: PredVP (DetCN (DetQuant that_Quant NumSg) (UseN boy_N)) (PassV2 kill_V2) +LangEng: that boy is killed +LangChi: 那 个 男 孩 被 杀 + +Lang: PredVP (DetCN (DetQuant DefArt NumSg) (UseN chair_N)) (PassV2 split_V2) +LangEng: the chair is split +LangChi: 椅 子 被 劈 开 + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN boy_N)) (ComplVV want_VV (PassV2 kill_V2))) +LangEng: that boy doesn't want to be killed +LangChi: 那 个 男 孩 不 想 被 杀 From 3aefd51280e9b43607851d8f9a3e154cf04a9131 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 12 Jan 2022 16:16:25 +0800 Subject: [PATCH 10/26] fix DetNP for positive case for ge --- src/chinese/NounChi.gf | 1 + 1 file changed, 1 insertion(+) diff --git a/src/chinese/NounChi.gf b/src/chinese/NounChi.gf index 234056e25..a9a180761 100644 --- a/src/chinese/NounChi.gf +++ b/src/chinese/NounChi.gf @@ -12,6 +12,7 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { DetNP det = {s = case det.detType of { DTFull Pl => det.s ++ xie_s ; + DTPoss => det.s ; _ => det.s ++ ge_s } ; } ; ---- From bbf109a473e9055d2fc525a1dfd092b57c0f5a3e Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 12 Jan 2022 16:56:07 +0800 Subject: [PATCH 11/26] add 25 tests for chinese pronouns -- passed --- src/chinese/unittest/pronouns.gftest | 117 +++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 src/chinese/unittest/pronouns.gftest diff --git a/src/chinese/unittest/pronouns.gftest b/src/chinese/unittest/pronouns.gftest new file mode 100644 index 000000000..37f6c4bd8 --- /dev/null +++ b/src/chinese/unittest/pronouns.gftest @@ -0,0 +1,117 @@ +---------- +-- Objects + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (ComplSlash (VPSlashPrep (ComplSlash (VPSlashPrep (UseV go_V) with_Prep) (UsePron i_Pron)) to_Prep) (DetCN (DetQuant DefArt NumSg) (UseN moon_N)))) +LangEng: the cat goes with me to the moon +LangChi: 猫 和 我 一 起 往 月 亮 去 + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumPl) (UseN cat_N)) (UseComp (CompAdv (PrepNP with_Prep (DetCN (DetQuant that_Quant NumSg) (UseN person_N)))))) +LangEng: my cats are with that person +LangChi: 我 的 猫 和 那 个 人 一 起 + +Lang: UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a hit_V2) (UsePron he_Pron))) +LangEng: I hit him +LangChi: 我 打 了 他 + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a hit_V2) (UsePron he_Pron))) +LangEng: I hit him +LangChi: 我 打 他 + +------------- +-- Possession +Lang: DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N) +LangEng: my cat +LangChi: 我 的 猫 + +-- that is my cat +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetNP (DetQuant that_Quant NumSg)) (UseComp (CompNP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N))))) +LangEng: that is my cat +LangChi: 那 个 是 我 的 猫 + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN cat_N)) (UseComp (CompNP (DetNP (DetQuant (PossPron i_Pron) NumSg))))) +LangEng: that cat is mine +LangChi: 那 只 猫 是 我 的 + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron she_Pron) NumSg) (UseN cat_N)) (UseComp (CompAP (PositA green_A)))) +LangEng: her cat is green +LangChi: 她 的 猫 是 绿 色 的 + +-- two variants, different trees +-- read a book +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant IndefArt NumSg) (PossNP (UseN book_N) (UsePron she_Pron))))) +LangEng: he reads a book of hers +LangChi: 他 读 一 本 她 的 书 + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant (PossPron she_Pron) NumSg) (UseN book_N)))) +LangEng: he reads her book +LangChi: 他 读 她 的 书 + +-- I read his/her father's book +Lang: UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant DefArt NumSg) (PossNP (UseN book_N) (DetCN (DetQuant DefArt NumSg) (PossNP (UseN2 father_N2) (UsePron she_Pron))))))) +LangEng: I read the book of the father of hers +LangChi: 我 读 了 她 的 父 亲 的 书 + +-- Only the noun phrase +Lang: MassNP (PossNP (UseN book_N) (UsePron he_Pron)) +LangEng: book of his +LangChi: 他 的 书 + +Lang: DetCN (DetQuant (PossPron he_Pron) NumSg) (UseN book_N) +LangEng: his book +LangChi: 他 的 书 + +-- For non-pronoun NPs, multiple trees +Lang: AdvNP (MassNP (UseN book_N)) (PrepNP part_Prep (DetCN (DetQuant DefArt NumSg) (UseN cat_N))) +LangEng: book of the cat +LangChi: 猫 的 书 + +Lang: AdvNP (MassNP (UseN book_N)) (PrepNP possess_Prep (DetCN (DetQuant DefArt NumSg) (UseN cat_N))) +LangEng: book of the cat +LangChi: 猫 的 书 + +Lang: MassNP (AdvCN (UseN book_N) (PrepNP part_Prep (DetCN (DetQuant DefArt NumSg) (UseN cat_N)))) +LangEng: book of the cat +LangChi: 猫 的 书 + +Lang: MassNP (AdvCN (UseN book_N) (PrepNP possess_Prep (DetCN (DetQuant DefArt NumSg) (UseN cat_N)))) +LangEng: book of the cat +LangChi: 猫 的 书 + +Lang: MassNP (ApposCN (AdvCN (UseN book_N) (PrepNP part_Prep (DetNP (DetQuant DefArt NumPl)))) (MassNP (UseN cat_N))) +LangEng: book of the cat +LangChi: 猫 的 书 + +Lang: MassNP (ApposCN (AdvCN (UseN book_N) (PrepNP possess_Prep (DetNP (DetQuant DefArt NumPl)))) (MassNP (UseN cat_N))) +LangEng: book of the cat +LangChi: 猫 的 书 + +Lang: MassNP (ApposCN (PartNP (UseN book_N) (DetNP (DetQuant DefArt NumPl))) (MassNP (UseN cat_N))) +LangEng: book of the cat +LangChi: 猫 的 书 + +Lang: MassNP (ApposCN (PossNP (UseN book_N) (DetNP (DetQuant DefArt NumPl))) (MassNP (UseN cat_N))) +LangEng: book of the cat +LangChi: 猫 的 书 + +Lang: MassNP (PartNP (UseN book_N) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))) +LangEng: book of the cat +LangChi: 猫 的 书 + +Lang: MassNP (PossNP (UseN book_N) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))) +LangEng: book of the cat +LangChi: 猫 的 书 + +-- You can also produce nonsensical variants, in all languages. +-- The point of RGL is to be a collection of syntactic structures, +-- and application grammarians can choose to use them in any combinations. +-- So the following English linearizations aren't *wrong*, they just don't make sense. + +-- If theese Chinese linearizations are merely weird, like the English ones, then they are correct. +-- If they feel wrong in the same way as "his cat of my" would in English, then they are wrong. +Lang: DetCN (DetQuant (PossPron he_Pron) NumSg) (PossNP (UseN cat_N) (UsePron i_Pron)) +LangEng: his cat of mine +LangChi: 他 的 我 的 猫 + +Lang: DetCN (DetQuant (PossPron i_Pron) NumSg) (PossNP (UseN cat_N) (UsePron she_Pron)) +LangEng: my cat of hers +LangChi: 我 的 她 的 猫 \ No newline at end of file From 734d000b4d7d8217708b44a3fba6da865308b2ea Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Fri, 4 Feb 2022 16:52:22 +0800 Subject: [PATCH 12/26] if then conjunctions --- src/chinese/unittest/conjunctions.gftest | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/chinese/unittest/conjunctions.gftest diff --git a/src/chinese/unittest/conjunctions.gftest b/src/chinese/unittest/conjunctions.gftest new file mode 100644 index 000000000..e281ab5dd --- /dev/null +++ b/src/chinese/unittest/conjunctions.gftest @@ -0,0 +1,33 @@ +Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron she_Pron) (UseV walk_V)))) +LangChi: 如 果 我 睡 觉 那 么 她 就 会 走 +LangEng: if I sleep then she walks + +Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (UsePron she_Pron) (UseV walk_V)))) +LangChi: 如 果 我 睡 觉 那 么 她 将 会 走 +LangEng: if I sleep then she will walk + +Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron she_Pron) (UseV die_V)))) +LangChi: 如 果 我 睡 觉 那 么 她 死 +LangEng: if I sleep then she dies + +Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (UsePron she_Pron) (UseV die_V)))) +LangChi: 如 果 我 睡 觉 那 么 她 将 会 死 +LangEng: if I sleep then she will die + +Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TPres ASimul) PNeg (PredVP (UsePron she_Pron) (UseV die_V)))) +LangChi: 如 果 我 睡 觉 那 么 她 不 死 +LangEng: if I sleep then she doesn't die + +Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TFut ASimul) PNeg (PredVP (UsePron she_Pron) (UseV die_V)))) +LangChi: 如 果 我 睡 觉 那 么 她 将 不 会 死 +LangEng: if I sleep then she won't die + +-- NP conjunctions +Lang: ConjNP or_Conj (BaseNP (MassNP (UseN fish_N)) (MassNP (UseN beer_N))) +LangChi: 鱼 或 啤 酒 +LangEng: fish or beer + +--NB: unnatural non-empty strings just for testing purpose +Lang: ConjNP if_then_Conj (BaseNP (MassNP (UseN fish_N)) (MassNP (UseN beer_N))) +LangChi: 鱼 啤 酒 +LangEng: if fish then beer \ No newline at end of file From 0dbb5e4ee825e41f8e1268cabba207ba7a682461 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 9 Feb 2022 13:56:11 +0800 Subject: [PATCH 13/26] =?UTF-8?q?replace=20future=20with=20"=E5=B0=B1?= =?UTF-8?q?=E4=BC=9A"=20instead=20of=20old=20"=E5=9C=A8"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chinese/ExtraChi.gf | 3 ++- src/chinese/QuestionChi.gf | 19 ++++++++++--------- src/chinese/ResChi.gf | 10 +++++++--- src/chinese/TenseChi.gf | 8 ++++---- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/chinese/ExtraChi.gf b/src/chinese/ExtraChi.gf index e745e3b4e..d025ed0fe 100644 --- a/src/chinese/ExtraChi.gf +++ b/src/chinese/ExtraChi.gf @@ -49,7 +49,8 @@ concrete ExtraChi of ExtraChiAbs = CatChi ** APerf => v.s ++ "不" ++ v.sn ++ v.pp ; ADurStat => v.s ++ "不" ++ v.sn ; ADurProg => v.s ++ v.neg ++ v.dp ++ v.sn ; -- mei or bu - AExper => v.s ++ v.neg ++ v.sn ++ v.ep + AExper => v.s ++ v.neg ++ v.sn ++ v.ep ; + AFut => jiu_s ++ v.s ++ v.neg ++ v.sn ++ v.ep -- TODO check placement of jiang } in cl.np ++ cl.vp.prePart ++ verb ++ cl.vp.compl diff --git a/src/chinese/QuestionChi.gf b/src/chinese/QuestionChi.gf index 7dac73416..8037d4d46 100644 --- a/src/chinese/QuestionChi.gf +++ b/src/chinese/QuestionChi.gf @@ -1,4 +1,4 @@ -concrete QuestionChi of Question = CatChi ** +concrete QuestionChi of Question = CatChi ** open ResChi, Prelude in { flags optimize=all_subs ; @@ -11,13 +11,14 @@ concrete QuestionChi of Question = CatChi ** True => \\p,a => cl.s ! p ! a ++ question_s ; -- redup question as variant in ExtraChi False => \\p,a => --- code copied from ExtraChi let - v = cl.vp.verb ; + v = cl.vp.verb ; verb = case a of { - APlain => v.s ++ v.neg ++ v.sn ; + APlain => v.s ++ v.neg ++ v.sn ; APerf => v.s ++ neg_s ++ v.sn ++ v.pp ; ADurStat => v.s ++ neg_s ++ v.sn ; ADurProg => v.s ++ v.neg ++ v.dp ++ v.sn ; -- mei or bu - AExper => v.s ++ v.neg ++ v.sn ++ v.ep + AExper => v.s ++ v.neg ++ v.sn ++ v.ep ; + AFut => jiu_s ++ hui_s ++ v.s ++ v.neg ++ v.sn ++ v.ep -- TODO check placement of jiang } in cl.np ++ cl.vp.prePart ++ verb ++ cl.vp.compl @@ -27,9 +28,9 @@ concrete QuestionChi of Question = CatChi ** QuestVP ip vp = { 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 (ss (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 @@ -49,13 +50,13 @@ concrete QuestionChi of Question = CatChi ** IdetIP idet = idet ; IdetQuant iquant num = { - s = iquant.s ++ num.s ; + s = iquant.s ++ num.s ; detType = case num.numType of { NTFull => DTNum ; -- which five NTVoid n => DTFull n ---- TODO: whose } } ; - + AdvIAdv i a = ss (a.s ++ i.s) ; diff --git a/src/chinese/ResChi.gf b/src/chinese/ResChi.gf index 9b6a6494d..3c1cf3902 100644 --- a/src/chinese/ResChi.gf +++ b/src/chinese/ResChi.gf @@ -42,6 +42,8 @@ resource ResChi = ParamX ** open Prelude in { geng_s = "更" ; -- more, in comparison hen_s = "很" ; -- very, or predicating a monosyllabic adjective taN_s = "它" ; + jiu_s = "就" ; + hui_s = "会" ; zai_V = mkVerb "在" [] [] [] [] "不" ; fullstop_s = "。" ; @@ -89,7 +91,7 @@ resource ResChi = ParamX ** open Prelude in { -- parameters param - Aspect = APlain | APerf | ADurStat | ADurProg | AExper ; ---- APlain added by AR + Aspect = APlain | APerf | ADurStat | ADurProg | AExper | AFut ; ---- APlain added by AR ConjForm = CPhr CPosType | CSent; CPosType = CAPhrase | CNPhrase | CVPhrase ; DeForm = DeNoun | NdNoun ; -- parameter created for noun with/out partical "de" @@ -166,14 +168,16 @@ oper APerf => v.s ++ v.pp ; ADurStat => v.s ++ v.ds ; ADurProg => v.dp ++ v.s ; - AExper => v.s ++ v.ep + AExper => v.s ++ v.ep ; + AFut => jiu_s ++ hui_s ++ v.s } ; Neg => table { APlain => v.neg ++ v.sn ; --- neg? APerf => "不" ++ v.sn ++ v.pp ; ADurStat => "不" ++ v.sn ; ADurProg => v.neg ++ v.dp ++ v.sn ; -- mei or bu - AExper => v.neg ++ v.sn ++ v.ep + AExper => v.neg ++ v.sn ++ v.ep ; + AFut => jiu_s ++ "不" ++ hui_s ++ v.s } } ; diff --git a/src/chinese/TenseChi.gf b/src/chinese/TenseChi.gf index f2c196c05..b03702068 100644 --- a/src/chinese/TenseChi.gf +++ b/src/chinese/TenseChi.gf @@ -1,4 +1,4 @@ -concrete TenseChi of Tense = +concrete TenseChi of Tense = CatChi [Tense,Temp,Ant], TenseX [Pol,PNeg,PPos] ** open ResChi in { lin @@ -6,11 +6,11 @@ concrete TenseChi of Tense = ---- ?? TPres = {s = [] ; t = APlain} ; - TPast = {s = [] ; t = APerf} ; - TFut = {s = [] ; t = ADurProg} ; + TPast = {s = [] ; t = APerf} ; + TFut = {s = [] ; t = AFut} ; TCond = {s = [] ; t = ADurStat} ; ASimul = {s = [] ; t = APlain} ; - AAnter = {s = [] ; t = APerf} ; + AAnter = {s = [] ; t = APerf} ; } From 4e947e4ce86207d634e13b5eeecb6dfef6b23ac9 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:39:19 +0800 Subject: [PATCH 14/26] changes in conjunction and sentences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to accomodate if _ then conjuction with jiu "就" --- src/chinese/AdverbChi.gf | 4 +-- src/chinese/CatChi.gf | 19 ++++++---- src/chinese/ConjunctionChi.gf | 22 +++++++++--- src/chinese/ExtraChi.gf | 2 +- src/chinese/IdiomChi.gf | 2 +- src/chinese/ParadigmsChi.gf | 4 +-- src/chinese/PhraseChi.gf | 2 +- src/chinese/ResChi.gf | 22 +++++++++--- src/chinese/SentenceChi.gf | 44 ++++++++++++++++-------- src/chinese/StructuralChi.gf | 31 +++++++++-------- src/chinese/SymbolChi.gf | 6 ++-- src/chinese/VerbChi.gf | 4 +-- src/chinese/unittest/conjunctions.gftest | 36 +++++++++++++------ src/chinese/unittest/future.gftest | 32 +++++++++++++++++ 14 files changed, 163 insertions(+), 67 deletions(-) create mode 100644 src/chinese/unittest/future.gftest diff --git a/src/chinese/AdverbChi.gf b/src/chinese/AdverbChi.gf index 557d29858..206b14d57 100644 --- a/src/chinese/AdverbChi.gf +++ b/src/chinese/AdverbChi.gf @@ -8,11 +8,11 @@ concrete AdverbChi of Adverb = CatChi ** ComparAdvAdj cadv a np = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ np.s) ** {advType = ATManner ; hasDe = False} ; - ComparAdvAdjS cadv a s = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ s.s) ** {advType = ATManner ; hasDe = False} ; + ComparAdvAdjS cadv a s = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ linS s) ** {advType = ATManner ; hasDe = False} ; AdAdv ad adv = adv ** {s = ad.s ++ adv.s} ; - SubjS subj s = ss (subj.prePart ++ s.s ++ subj.sufPart) ** {advType = ATTime ; hasDe = False} ; + SubjS subj s = ss (subj.prePart ++ linS s ++ subj.sufPart) ** {advType = ATTime ; hasDe = False} ; AdnCAdv cadv = ss (cadv.s ++ conjThat) ** {advType = ATManner ; hasDe = False} ; ----- diff --git a/src/chinese/CatChi.gf b/src/chinese/CatChi.gf index 679846ced..a046e7550 100644 --- a/src/chinese/CatChi.gf +++ b/src/chinese/CatChi.gf @@ -4,14 +4,14 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu -- Tensed/Untensed - S = {s : Str} ; + S = Sentence ; QS = {s : Bool => Str} ; -- True = direct question (with ma for sentential questions) RS = {s : Str} ; - SSlash = {s : Str ; c2 : Preposition} ; + SSlash = {s : Str ; c2 : Preposition} ; -- Sentence - Cl = Clause ; -- {s : Polarity => Aspect => Str ; np: Str ; vp: Polarity => Aspect => Str} ; + Cl = Clause ; -- {s : Polarity => Aspect => Str ; np: Str ; vp: Polarity => Aspect => Str} ; ClSlash = Clause ** {c2 : Preposition} ; @@ -21,7 +21,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu QCl = {s : Bool => Polarity => Aspect => Str} ; -- True = direct question IP = {s : Str} ; - IComp = {s : Str} ; + IComp = {s : Str} ; IDet = {s : Str ; detType : DetType} ; IQuant = {s : Str} ; @@ -32,7 +32,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu -- Verb - VP = ResChi.VP ; + VP = ResChi.VP ; Comp = ResChi.VP ; VPSlash = ResChi.VP ** {c2 : Preposition ; isPre : Bool} ; -- whether the missing arg is before verb @@ -59,13 +59,16 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu -- Structural - Conj = {s : ConjForm => {s1,s2 : Str}} ; + Conj = { + s : ConjForm => {s1,s2 : Str} ; -- different form whether it's used for S, A, N, ... + conjType : ConjType -- different placement whether it's and,or,... or if-then + } ; Subj = {prePart : Str ; sufPart : Str} ; Prep = Preposition ; -- Open lexical classes, e.g. Lexicon - V, VS, VQ, VA = Verb ; + V, VS, VQ, VA = Verb ; V2, V2Q, V2S = Verb ** {c2 : Preposition ; hasPrep : Bool ; part : Str} ; V3, V2A, V2V = Verb ** {c2, c3 : Preposition ; hasPrep : Bool ; part : Str} ; VV = Verb ; @@ -84,4 +87,6 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu Tense = {s : Str ; t : Aspect} ; Ant = {s : Str ; t : Aspect} ; +linref + S = linS ; } diff --git a/src/chinese/ConjunctionChi.gf b/src/chinese/ConjunctionChi.gf index f5607d856..2dc17731e 100644 --- a/src/chinese/ConjunctionChi.gf +++ b/src/chinese/ConjunctionChi.gf @@ -2,7 +2,14 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin lin - ConjS c = conjunctDistrSS (c.s ! CSent) ; + ConjS c ss = + let conj = c.s ! CSent + in case c.conjType of { + Jiu => {preJiu = conj.s1 ++ ss.s1 ++ comma ++ ss.preJiu ; + postJiu = conj.s2 ++ ss.postJiu} ; + NotJiu => {preJiu = conj.s1 ++ ss.s1 ++ conj.s2 ++ ss.preJiu ; + postJiu = ss.postJiu} + } ; ConjAdv c as = conjunctDistrSS (c.s ! CSent) as ** {advType = as.advType ; hasDe = as.hasDe} ; ---- ?? ConjNP c = conjunctDistrSS (c.s ! CPhr CNPhrase) ; ConjAP c as = conjunctDistrTable AdjPlace (c.s ! CPhr CAPhrase) as ** {monoSyl = notB as.monoSyl ; hasAdA = True} ; ---- add de iff as doesn't @@ -11,8 +18,14 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin -- These fun's are generated from the list cat's. - BaseS = twoSS ; - ConsS = consrSS duncomma ; + BaseS s t = t ** { + s1 = linS s + } ; + + ConsS s ss = -- here we do the same thing actually, the crucial split has happened in BaseS + ss ** {s1 = linS s ++ comma ++ ss.s1}; + + 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 ; @@ -25,7 +38,8 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin ConsCN x xs = consrSS duncomma x xs ** {c = x.c} ; lincat - [S] = {s1,s2 : Str} ; + --[S] = ConjType => {s1,s2 : Str} ; + [S] = {s1,preJiu,postJiu : Str} ; [Adv] = {s1,s2 : Str ; advType : AdvType ; hasDe : Bool} ; [NP] = {s1,s2 : Str} ; [AP] = {s1,s2 : AdjPlace => Str ; monoSyl : Bool} ; diff --git a/src/chinese/ExtraChi.gf b/src/chinese/ExtraChi.gf index d025ed0fe..689432d3d 100644 --- a/src/chinese/ExtraChi.gf +++ b/src/chinese/ExtraChi.gf @@ -18,7 +18,7 @@ concrete ExtraChi of ExtraChiAbs = CatChi ** BaseVPS = twoSS ; ConsVPS = consrSS duncomma ; - PredVPS np vps = {s = np.s ++ vps.s} ; + PredVPS np vps = {preJiu = np.s ; postJiu = vps.s} ; MkVPI vp = {s = (mkClause [] vp).s ! Pos ! APlain} ; --- ?? almost just a copy of VPS ConjVPI c = conjunctDistrSS (c.s ! CSent) ; diff --git a/src/chinese/IdiomChi.gf b/src/chinese/IdiomChi.gf index 9a9d4d107..6b803ac79 100644 --- a/src/chinese/IdiomChi.gf +++ b/src/chinese/IdiomChi.gf @@ -12,7 +12,7 @@ concrete IdiomChi of Idiom = CatChi ** open Prelude, ResChi in { ---- it is John who did it CleftNP np rs = mkClause rs.s copula np.s ; -- did it + de + is I - CleftAdv ad s = mkClause (s.s ++ possessive_s) copula ad.s ; -- she sleeps + de + is here + 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 diff --git a/src/chinese/ParadigmsChi.gf b/src/chinese/ParadigmsChi.gf index a04c87c55..eec89b92e 100644 --- a/src/chinese/ParadigmsChi.gf +++ b/src/chinese/ParadigmsChi.gf @@ -193,9 +193,9 @@ oper = \s -> lin Subj (ResChi.mkSubj s []) ; mkConj = overload { mkConj : Str -> Conj - = \s -> lin Conj {s = \\_ => mkConjForm s} ; + = \s -> lin Conj {s = \\_ => mkConjForm s ; conjType = NotJiu} ; mkConj : (both,and : Str) -> Conj - = \s,t -> lin Conj {s = \\_ => mkConjForm2 s t} ; + = \s,t -> lin Conj {s = \\_ => mkConjForm2 s t ; conjType = NotJiu} ; } ; mkpDet : Str -> Det = \s -> lin Det {s = word s ; detType = DTFull Sg} ; diff --git a/src/chinese/PhraseChi.gf b/src/chinese/PhraseChi.gf index 66f85995d..4f1813421 100644 --- a/src/chinese/PhraseChi.gf +++ b/src/chinese/PhraseChi.gf @@ -3,7 +3,7 @@ concrete PhraseChi of Phrase = CatChi ** open Prelude, ResChi in { lin PhrUtt pconj utt voc = {s = pconj.s ++ voc.s ++ utt.s} ; - UttS s = s ; + UttS s = ss (linS s) ; UttQS qs = ss (qs.s ! True) ; UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p} ; UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p} ; diff --git a/src/chinese/ResChi.gf b/src/chinese/ResChi.gf index 3c1cf3902..9ed6c7a50 100644 --- a/src/chinese/ResChi.gf +++ b/src/chinese/ResChi.gf @@ -93,6 +93,7 @@ resource ResChi = ParamX ** open Prelude in { param Aspect = APlain | APerf | ADurStat | ADurProg | AExper | AFut ; ---- APlain added by AR ConjForm = CPhr CPosType | CSent; + ConjType = Jiu | NotJiu ; -- to put conjunction in the right place in ConjS: "I sleep *and* she walks" vs. "if I sleep, she *then* walks" CPosType = CAPhrase | CNPhrase | CVPhrase ; DeForm = DeNoun | NdNoun ; -- parameter created for noun with/out partical "de" @@ -169,7 +170,7 @@ oper ADurStat => v.s ++ v.ds ; ADurProg => v.dp ++ v.s ; AExper => v.s ++ v.ep ; - AFut => jiu_s ++ hui_s ++ v.s + AFut => hui_s ++ v.s } ; Neg => table { APlain => v.neg ++ v.sn ; --- neg? @@ -177,7 +178,7 @@ oper ADurStat => "不" ++ v.sn ; ADurProg => v.neg ++ v.dp ++ v.sn ; -- mei or bu AExper => v.neg ++ v.sn ++ v.ep ; - AFut => jiu_s ++ "不" ++ hui_s ++ v.s + AFut => "不" ++ hui_s ++ v.s } } ; @@ -218,12 +219,22 @@ oper -- clauses: keep np and vp separate to enable insertion of IAdv - Clause : Type = { + Clause : Type = { s : Polarity => Aspect => Str ; - np : Str; - vp : VP + np : Str ; + vp : VP ; + postJiu : Polarity => Aspect => Str ; } ; + Sentence : Type = { + preJiu, -- everything until the subject + postJiu -- everything after the subject + : Str + } ; + + linS : Sentence -> Str = \s -> s.preJiu ++ s.postJiu ; + simpleS : Str -> Sentence = \s -> {preJiu=s ; postJiu=[]} ; + mkClause = overload { mkClause : Str -> Verb -> Clause = \np,v -> @@ -240,6 +251,7 @@ oper 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 ; + postJiu = \\p,a => vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl ++ compl ; } ; diff --git a/src/chinese/SentenceChi.gf b/src/chinese/SentenceChi.gf index 65d8ae4d3..9e9e1f38b 100644 --- a/src/chinese/SentenceChi.gf +++ b/src/chinese/SentenceChi.gf @@ -1,4 +1,4 @@ -concrete SentenceChi of Sentence = CatChi ** +concrete SentenceChi of Sentence = CatChi ** open Prelude, ResChi in { flags optimize=all_subs ; @@ -12,39 +12,55 @@ concrete SentenceChi of Sentence = CatChi ** ImpVP vp = { s = table { Pos => infVP vp ; - Neg => neg_s ++ infVP vp + Neg => neg_s ++ infVP vp } } ; - SlashVP np vp = + SlashVP np vp = mkClauseCompl np.s vp [] ** {c2 = vp.c2} ; SlashVS np vs sslash = ** {c2 = sslash.c2} ; - + -- yet another reason for discontinuity of clauses AdvSlash slash adv = slash ** {vp = insertAdv adv slash.vp} ; ---- parser loops with unknown tokens if this version is used AR 20/4/2014 ---- mkClauseCompl slash.np [] ---- ** {c2 = slash.c2} ; - + SlashPrep cl prep = cl ** {c2 = prep} ; - - EmbedS s = ss (conjThat ++ s.s) ; + + EmbedS s = ss (conjThat ++ linS s) ; EmbedQS qs = ss (qs.s ! False) ; EmbedVP vp = ss (infVP vp) ; - UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! p.p ! t.t} ; - UseQCl t p cl = {s = \\isDir => t.s ++ p.s ++ cl.s ! isDir ! p.p ! t.t} ; - UseRCl t p cl = {s = t.s ++ p.s ++ cl.s ! p.p ! t.t} ; + UseCl t p cl = { + preJiu = cl.np ; + postJiu = t.s ++ p.s ++ cl.postJiu ! p.p ! t.t} ; + + UseQCl t p cl = {s = \\isDir => t.s ++ p.s ++ cl.s ! isDir ! p.p ! t.t} ; + UseRCl t p cl = {s = t.s ++ p.s ++ cl.s ! p.p ! t.t} ; UseSlash t p cl = {s = t.s ++ p.s ++ cl.s ! p.p ! t.t ; c2 = cl.c2} ; - AdvS a s = ss (a.s ++ s.s) ; - ExtAdvS a s = ss (a.s ++ chcomma ++ s.s) ; + AdvS a s = s ** { + preJiu = a.s ++ s.preJiu -- tomorrow she + } ; - RelS s r = ss (s.s ++ r.s) ; + ExtAdvS a s = s ** { + preJiu = a.s ++ chcomma ++ s.preJiu -- tomorrow, she + } ; - SSubjS a subj b = ss (a.s ++ subj.prePart ++ b.s ++ subj.sufPart) ; + RelS s r = s ** { + postJiu = s.postJiu ++ r.s ; + } ; + + -- a="she walks", b="I die" + -- result: preJiu="if she walks, I", postJiu="die" + SSubjS a subj b = { + preJiu = linS a ++ subj.prePart -- if she walks, + ++ b.preJiu ; -- I + postJiu = b.postJiu ++ subj.sufPart -- die + } ; } diff --git a/src/chinese/StructuralChi.gf b/src/chinese/StructuralChi.gf index 2fc84c74b..fd9b53ef3 100644 --- a/src/chinese/StructuralChi.gf +++ b/src/chinese/StructuralChi.gf @@ -5,7 +5,7 @@ concrete StructuralChi of Structural = CatChi ** lin every_Det = mkDet "每" Sg ; - + this_Quant = mkQuant "这" ; that_Quant = mkQuant "那" ; @@ -25,18 +25,20 @@ lin possess_Prep = mkPrep [] "的" ATPoss ; with_Prep = mkPrep "和" "一起" (ATPlace True) ; -- "with you" ---- with_Prep = mkPrep "和" [] ; -- "with bread" - + and_Conj = {s = table { CPhr CNPhrase => mkConjForm "和" ; CPhr CAPhrase => mkConjForm "而" ; CPhr CVPhrase => mkConjForm "又" ; - CSent => mkConjForm "并且" --modified by chenpneg 11.19 - } + CSent => mkConjForm "而" --modified by chenpneg 11.19 + } ; + conjType = NotJiu ; } ; or_Conj = {s = table { CPhr _ => mkConjForm "或" ; CSent => mkConjForm "还是" - } + } ; + conjType = NotJiu ; } ; although_Subj = mkSubj "虽然" "但"; @@ -116,13 +118,14 @@ as_CAdv = {s = word "和" ; p = word "一样" } ; -- modified by chenpeng 11.24 at_least_AdN = ssword "最少" ; -- at least five at_most_AdN = ssword "最多" ; behind_Prep = mkPrep "在" "后面" ; - + both7and_DConj = {s = table { -- modified by chenpeng 11.19 CPhr CNPhrase => mkConjForm2 "包括" "和" ; CPhr CAPhrase => mkConjForm2 "即" "又" ; CPhr CVPhrase => mkConjForm2 "不但" "而且" ; CSent => mkConjForm2 "不但" "而且" - } + } ; + conjType = NotJiu ; } ; by8agent_Prep = mkPrep "被" [] mannerAdvType; -- by for agent in passive @@ -135,7 +138,8 @@ either7or_DConj = {s = table { -- modified by chenpeng 11.19 CPhr CAPhrase => mkConjForm2 "要么" "要么" ; CPhr CVPhrase => mkConjForm2 "要么" "要么" ; CSent => mkConjForm2 "要么" "要么" - } + } ; + conjType = NotJiu ; } ; everybody_NP = ssword "每个人" ; -- [mark] "每个人": 每(every)+个(classifier)+人(person) @@ -152,11 +156,10 @@ less_CAdv = {s = than_s ; p = word "没更"} ; -- modified by chenpeng 11.24 more_CAdv = {s = than_s ; p = word "更"} ; -- modified by chenpeng 11.24 most_Predet = ssword "大多数" ; if_then_Conj = {s = table { -- added by chenpeng 11.19 - CPhr CNPhrase => mkConjForm [] ; - CPhr CAPhrase => mkConjForm [] ; - CPhr CVPhrase => mkConjForm [] ; - CSent => mkConjForm2 "如果" "那么" - } + CSent => mkConjForm2 "如果" "就" ; -- if she walks, I then sleep + CPhr _ => mkConjForm2 "如果" "那么" -- if fish , then rice + } ; + conjType = Jiu ; } ; nobody_NP = ssword "没人" ; nothing_NP = ssword "没有什么" ; @@ -171,7 +174,7 @@ there7from_Adv = mkAdv "从那里" ; -- from there there7to_Adv = mkAdv "到那里" ; therefore_PConj = ssword "因此" ; through_Prep = mkPrep "通过" ; -which_IQuant = mkIQuant "哪" ; -- +which_IQuant = mkIQuant "哪" ; -- --which_IQuant = ssword [] ; -- [mark] in sent, it depends on the context without_Prep = mkPrep "没有" [] mannerAdvType ; youPol_Pron = ssword "您" ; -- polite you diff --git a/src/chinese/SymbolChi.gf b/src/chinese/SymbolChi.gf index 69457d54c..264e5bee5 100644 --- a/src/chinese/SymbolChi.gf +++ b/src/chinese/SymbolChi.gf @@ -13,17 +13,17 @@ concrete SymbolChi of Symbol = CatChi ** open Prelude, ResChi in { s = cn.s ++ i.s ; c = cn.c } ; - CNSymbNP det cn xs = ss (det.s ++ cn.s ++ xs.s) ; ---- + CNSymbNP det cn xs = ss (det.s ++ cn.s ++ xs.s) ; ---- CNNumNP cn i = { s = cn.s ++ i.s ; c = cn.c } ; - SymbS sy = sy ; + SymbS sy = simpleS sy.s ; SymbNum sy = sy ; SymbOrd sy = sy ; -lincat +lincat Symb, [Symb] = SS ; diff --git a/src/chinese/VerbChi.gf b/src/chinese/VerbChi.gf index be6bed536..9c0503d4b 100644 --- a/src/chinese/VerbChi.gf +++ b/src/chinese/VerbChi.gf @@ -13,7 +13,7 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { SlashV2A v ap = insertObj {s = 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 ++ s.s)) (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} ; ComplVV v vp = { @@ -23,7 +23,7 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { isAdj = False ; } ; - ComplVS v s = insertObj s (predV v []) ; + 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 []) ; diff --git a/src/chinese/unittest/conjunctions.gftest b/src/chinese/unittest/conjunctions.gftest index e281ab5dd..024012a0d 100644 --- a/src/chinese/unittest/conjunctions.gftest +++ b/src/chinese/unittest/conjunctions.gftest @@ -1,27 +1,41 @@ -Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron she_Pron) (UseV walk_V)))) -LangChi: 如 果 我 睡 觉 那 么 她 就 会 走 -LangEng: if I sleep then she walks +-- Basic conjunctions, no jiu +Lang: ConjS and_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron she_Pron) (UseV walk_V)))) +LangChi: 我 睡 觉 而 她 走 +LangEng: I sleep and she walks -Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (UsePron she_Pron) (UseV walk_V)))) -LangChi: 如 果 我 睡 觉 那 么 她 将 会 走 -LangEng: if I sleep then she will walk +Lang: ConjS or_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV go_V))) (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron she_Pron) (UseV go_V)))) +LangChi: 我 去 还 是 她 去 +LangEng: I go or she goes +Lang: ConjS either7or_DConj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV go_V))) (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron she_Pron) (UseV go_V)))) +LangChi: 要 么 我 去 要 么 她 去 +LangEng: either I go or she goes + +-- If-then in different tenses Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron she_Pron) (UseV die_V)))) -LangChi: 如 果 我 睡 觉 那 么 她 死 +LangChi: 如 果 我 睡 觉 , 她 就 死 LangEng: if I sleep then she dies Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (UsePron she_Pron) (UseV die_V)))) -LangChi: 如 果 我 睡 觉 那 么 她 将 会 死 +LangChi: 如 果 我 睡 觉 , 她 就 会 死 LangEng: if I sleep then she will die +-- contrast: if_Subj, not if_then_Conj +Lang: ExtAdvS (SubjS if_Subj (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V)))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (UsePron she_Pron) (UseV die_V))) +LangChi: 如 果 我 睡 觉 , 她 会 死 +LangEng: if I sleep , she will die + +-- back to if_then_Conj, now with negations Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TPres ASimul) PNeg (PredVP (UsePron she_Pron) (UseV die_V)))) -LangChi: 如 果 我 睡 觉 那 么 她 不 死 +LangChi: 如 果 我 睡 觉 , 她 就 不 死 LangEng: if I sleep then she doesn't die Lang: ConjS if_then_Conj (BaseS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V))) (UseCl (TTAnt TFut ASimul) PNeg (PredVP (UsePron she_Pron) (UseV die_V)))) -LangChi: 如 果 我 睡 觉 那 么 她 将 不 会 死 +LangChi: 如 果 我 睡 觉 , 她 就 不 会 死 LangEng: if I sleep then she won't die + + -- NP conjunctions Lang: ConjNP or_Conj (BaseNP (MassNP (UseN fish_N)) (MassNP (UseN beer_N))) LangChi: 鱼 或 啤 酒 @@ -29,5 +43,5 @@ LangEng: fish or beer --NB: unnatural non-empty strings just for testing purpose Lang: ConjNP if_then_Conj (BaseNP (MassNP (UseN fish_N)) (MassNP (UseN beer_N))) -LangChi: 鱼 啤 酒 +LangChi: 如 果 鱼 那 么 啤 酒 LangEng: if fish then beer \ No newline at end of file diff --git a/src/chinese/unittest/future.gftest b/src/chinese/unittest/future.gftest new file mode 100644 index 000000000..e94f6a1d1 --- /dev/null +++ b/src/chinese/unittest/future.gftest @@ -0,0 +1,32 @@ +Lang: UseCl (TTAnt TFut ASimul) PPos (PredVP (UsePron i_Pron) (UseV die_V)) +LangChi: 我 就 会 死 +LangEng: I will die + +Lang: ExtAdvS (SubjS if_Subj (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V)))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (UsePron she_Pron) (UseV walk_V))) +LangChi: 如 果 我 睡 觉 , 她 会 走 +LangEng: if I sleep , she will walk + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ProgrVP (UseV die_V))) +LangChi: 我 在 死 +LangEng: I am dying + +Lang: UseCl (TTAnt TFut ASimul) PNeg (PredVP (UsePron i_Pron) (UseV die_V)) +LangChi: 我 就 不 会 死 +LangEng: I won't die + +Lang: UseQCl (TTAnt TFut ASimul) PPos (QuestCl (PredVP (UsePron i_Pron) (UseV die_V))) +-- LangChi: 我 会 不 会 死 +LangChi: 我 会 死 吗 +LangEng: will I die + +Lang: UseQCl (TTAnt TFut ASimul) PNeg (QuestCl (PredVP (UsePron i_Pron) (UseV die_V))) +LangChi: 我 不 会 死 吗 +LangEng: won't I die + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (UsePron i_Pron) (ComplVQ know_VQ (UseQCl (TTAnt TFut ASimul) PPos (QuestCl (PredVP (UsePron i_Pron) (UseV die_V)))))) +LangChi: 我 不 知 道 我 会 不 会 死 +LangEng: I don't know if I will die + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (UsePron i_Pron) (ComplVQ know_VQ (UseQCl (TTAnt TFut ASimul) PNeg (QuestCl (PredVP (UsePron i_Pron) (UseV die_V)))))) +LangChi: 我 不 知 道 我 不 会 死 +LangEng: I don't know if I won't die \ No newline at end of file From 460ec475bdf1c50c58c59f48e35a1af2aa570e01 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:56:59 +0800 Subject: [PATCH 15/26] =?UTF-8?q?make=20all=20the=20questions=20by=20exten?= =?UTF-8?q?ding=20a=20"=E5=90=97"=20at=20end?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chinese/QuestionChi.gf | 17 +---------------- src/chinese/unittest/future.gftest | 8 ++++---- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/chinese/QuestionChi.gf b/src/chinese/QuestionChi.gf index 8037d4d46..d190869d9 100644 --- a/src/chinese/QuestionChi.gf +++ b/src/chinese/QuestionChi.gf @@ -7,22 +7,7 @@ concrete QuestionChi of Question = CatChi ** lin QuestCl cl = { - s = table { - True => \\p,a => cl.s ! p ! a ++ question_s ; -- redup question as variant in ExtraChi - False => \\p,a => --- code copied from ExtraChi - let - v = cl.vp.verb ; - verb = case a of { - APlain => v.s ++ v.neg ++ v.sn ; - APerf => v.s ++ neg_s ++ v.sn ++ v.pp ; - ADurStat => v.s ++ neg_s ++ v.sn ; - ADurProg => v.s ++ v.neg ++ v.dp ++ v.sn ; -- mei or bu - AExper => v.s ++ v.neg ++ v.sn ++ v.ep ; - AFut => jiu_s ++ hui_s ++ v.s ++ v.neg ++ v.sn ++ v.ep -- TODO check placement of jiang - } - in - cl.np ++ cl.vp.prePart ++ verb ++ cl.vp.compl - } + s = \\b,p,a => cl.s ! p ! a ++ question_s ; -- redup question as variant in ExtraChi } ; QuestVP ip vp = { diff --git a/src/chinese/unittest/future.gftest b/src/chinese/unittest/future.gftest index e94f6a1d1..6a7110fad 100644 --- a/src/chinese/unittest/future.gftest +++ b/src/chinese/unittest/future.gftest @@ -1,5 +1,5 @@ Lang: UseCl (TTAnt TFut ASimul) PPos (PredVP (UsePron i_Pron) (UseV die_V)) -LangChi: 我 就 会 死 +LangChi: 我 会 死 LangEng: I will die Lang: ExtAdvS (SubjS if_Subj (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV sleep_V)))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (UsePron she_Pron) (UseV walk_V))) @@ -11,7 +11,7 @@ LangChi: 我 在 死 LangEng: I am dying Lang: UseCl (TTAnt TFut ASimul) PNeg (PredVP (UsePron i_Pron) (UseV die_V)) -LangChi: 我 就 不 会 死 +LangChi: 我 不 会 死 LangEng: I won't die Lang: UseQCl (TTAnt TFut ASimul) PPos (QuestCl (PredVP (UsePron i_Pron) (UseV die_V))) @@ -24,9 +24,9 @@ LangChi: 我 不 会 死 吗 LangEng: won't I die Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (UsePron i_Pron) (ComplVQ know_VQ (UseQCl (TTAnt TFut ASimul) PPos (QuestCl (PredVP (UsePron i_Pron) (UseV die_V)))))) -LangChi: 我 不 知 道 我 会 不 会 死 +LangChi: 我 不 知 道 我 会 死 吗 LangEng: I don't know if I will die Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (UsePron i_Pron) (ComplVQ know_VQ (UseQCl (TTAnt TFut ASimul) PNeg (QuestCl (PredVP (UsePron i_Pron) (UseV die_V)))))) -LangChi: 我 不 知 道 我 不 会 死 +LangChi: 我 不 知 道 我 不 会 死 吗 LangEng: I don't know if I won't die \ No newline at end of file From 7f58e8ec8bfface341278e0071a823345de01e50 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 9 Feb 2022 17:00:15 +0800 Subject: [PATCH 16/26] adjustment for "mustn't" not idiomatic but compositionally correct now for mustn't --- src/chinese/unittest/negation.gftest | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chinese/unittest/negation.gftest b/src/chinese/unittest/negation.gftest index 1d9f4c6f8..f78c4144d 100644 --- a/src/chinese/unittest/negation.gftest +++ b/src/chinese/unittest/negation.gftest @@ -22,8 +22,9 @@ Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant this_Quant NumPl) LangChi: 这 些 猫 不 想 走 LangEng: these cats don't want to walk +-- this tree does not make semantic sense in chinese but is compositionally correct due to the direct word for word translation for "must" Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant that_Quant NumPl) (UseN cat_N)) (ComplVV must_VV (UseV walk_V))) -LangChi: 那 些 猫 不 行 走 +LangChi: 那 些 猫 不 必 须 走 LangEng: those cats mustn't walk -- 没有 and must not , bu ke yi \ No newline at end of file From fe5c1246024c0e46097b6db7840ca8fe02536170 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Mon, 21 Feb 2022 11:53:56 +0800 Subject: [PATCH 17/26] remove predicative form in CompareA UseComparA --- src/chinese/AdjectiveChi.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chinese/AdjectiveChi.gf b/src/chinese/AdjectiveChi.gf index 5098f5ed5..ab17134ac 100644 --- a/src/chinese/AdjectiveChi.gf +++ b/src/chinese/AdjectiveChi.gf @@ -5,13 +5,13 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in { PositA a = a ** {hasAdA = False} ; ComparA a np = a ** { - s = table { adjPlace => than_s ++ np.s ++ a.s!adjPlace}; + s = table {_=> than_s ++ np.s ++ a.s!Attr}; hasAdA = False }; UseComparA a = a ** { - s = table { adjPlace => geng_s ++ a.s!adjPlace}; + s = table { _=> geng_s ++ a.s!Attr}; hasAdA = False }; From 57490c18d2d32df6ed02efccf579378afa9de6ef Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Mon, 21 Feb 2022 16:35:09 +0800 Subject: [PATCH 18/26] unit tests for relative --- src/chinese/unittest/relative.gftest | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/chinese/unittest/relative.gftest diff --git a/src/chinese/unittest/relative.gftest b/src/chinese/unittest/relative.gftest new file mode 100644 index 000000000..1d697bba4 --- /dev/null +++ b/src/chinese/unittest/relative.gftest @@ -0,0 +1,57 @@ +-------------------------------------------------------------- +-- Basics + +Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V)))) +LangEng: a cat that walks +LangChi: 一 只 走 的 猫 + +Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a drink_V2) (MassNP (UseN milk_N)))))) +LangEng: a cat that drinks milk +LangChi: 一 只 喝 牛 奶 的 猫 + +Lang: MassNP (RelCN (UseN milk_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (SlashV2a drink_V2))))) +LangEng: milk that the cat drinks +LangChi: 猫 喝 的 牛 奶 + + +Lang: DetCN (DetQuant DefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (VPSlashPrep (UseV walk_V) with_Prep) (DetCN (DetQuant DefArt NumSg) (UseN dog_N)))))) +LangChi: 和 狗 一 起 走 的 猫 +LangEng: the cat that walks with the dog + +-------------------------------------------------------------- +-- Determiner placement + +Lang: DetCN (DetQuant this_Quant NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V)))) +LangEng: this cat that walks +LangChi: 这 只 走 的 猫 + +Lang: DetCN (DetQuant (PossPron i_Pron) NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a drink_V2) (MassNP (UseN milk_N)))))) +LangEng: my cat that drinks milk +LangChi: 我 的 喝 牛 奶 的 猫 + + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetNP (DetQuant this_Quant NumSg)) (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V)))))))) +LangEng: this is the cat that walks +LangChi: 这 个 是 走 的 猫 + + +-------------------------------------------------------------- +-- Complex example: "the book that his/her father gave him/her" + +-- 1. His father gave him a book +Lang: UseCl (TTAnt TPast ASimul) PPos (PredVP (MassNP (ComplN2 father_N2 (UsePron he_Pron))) (ComplSlash (Slash2V3 give_V3 (MassNP (UseN book_N))) (UsePron he_Pron))) +LangChi: 他 父 亲 把 书 给 了 他 + +-- 2. the book that the father of her gave her +Lang: DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (ComplN2 father_N2 (UsePron she_Pron))) (Slash3V3 give_V3 (UsePron she_Pron)))))) +LangChi: 她 父 亲 给 了 她 的 书 +LangEng: the book that the father of her gave her + +-- I want to read the book that my father gave me +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN2 father_N2)) (Slash3V3 give_V3 (UsePron i_Pron)))))))))) +LangChi: 我 想 读 我 的 父 亲 给 了 我 的 书 + + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN2 father_N2)) (SlashV2a read_V2))))))))) +LangChi: 我 想 读 我 的 父 亲 读 了 的 书 +LangEng: I want to read the book that my father read \ No newline at end of file From 5c415fc913e61a612d98b0674e38192747ac256c Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Mon, 21 Feb 2022 16:35:33 +0800 Subject: [PATCH 19/26] unit test for tenses --- src/chinese/unittest/tenses.gftest | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/chinese/unittest/tenses.gftest diff --git a/src/chinese/unittest/tenses.gftest b/src/chinese/unittest/tenses.gftest new file mode 100644 index 000000000..9927b82ce --- /dev/null +++ b/src/chinese/unittest/tenses.gftest @@ -0,0 +1,33 @@ +------------- +-- Basics + +Lang: UseCl (TTAnt TPres AAnter) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseV walk_V)) +LangEng: the cat has walked +LangChi: 猫 走 了 + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant this_Quant NumSg) (UseN cat_N)) (UseV walk_V)) +LangEng: this cat walks +LangChi: 这 只 猫 走 + +Lang: UseCl (TTAnt TFut ASimul) PPos (PredVP (DetCN (DetQuant this_Quant NumSg) (UseN cat_N)) (UseV walk_V)) +LangEng: this cat will walk +LangChi: 这 只 猫 会 走 + +Lang: PredVP (DetCN (DetQuant this_Quant NumSg) (UseN cat_N)) (ComplVV can8know_VV (UseV walk_V)) +LangChi: 这 只 猫 会 走 +LangEng: this cat can walk + +Lang: PredVP (DetCN (DetQuant this_Quant NumSg) (UseN cat_N)) (ComplVV can_VV (UseV walk_V)) +LangChi: 这 只 猫 能 走 +LangEng: this cat can walk + +------------- +-- Conditions + +Lang: AdvS (SubjS if_Subj (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV walk_V)))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseV walk_V))) +LangEng: if I walk the cat will walk +LangChi: 如 果 我 走 猫 会 走 + +Lang: ExtAdvS (SubjS when_Subj (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV walk_V)))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseV walk_V))) +LangEng: when I walk , the cat will walk +LangChi: 我 走 的 时 候 , 猫 会 走 From 57e6f8f2444a282e6e3ab40e4c09650769ed793a Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 23 Feb 2022 10:57:06 +0800 Subject: [PATCH 20/26] remove collectives in collective nouns for xie for quantifier --- src/chinese/unittest/quantifier.gftest | 63 ++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/chinese/unittest/quantifier.gftest diff --git a/src/chinese/unittest/quantifier.gftest b/src/chinese/unittest/quantifier.gftest new file mode 100644 index 000000000..137e670ad --- /dev/null +++ b/src/chinese/unittest/quantifier.gftest @@ -0,0 +1,63 @@ +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a have_V2) (DetCN somePl_Det (UseN cat_N)))) +--LangChi: 我 有 一 些 只 猫 +LangChi: 我 有 一 些 猫 +LangEng: I have some cats + +Lang: DetCN someSg_Det (UseN water_N) +--LangChi: 一 些 滴 水 +LangChi: 一 些 水 +LangEng: some water + +Lang: DetCN someSg_Det (UseN beer_N) +--LangChi: 一 些 杯 啤 酒 +LangChi: 一 些 啤 酒 +LangEng: some beer + +--LangChi: 我 有 几 只 猫 +--LangEng: I have a few cats + + +Lang: DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 pot111)))))) (UseN cat_N) +LangChi: 十 一 只 猫 +LangEng: eleven cats + +Lang: DetCN many_Det (UseN cat_N) +LangChi: 很 多 猫 +LangEng: many cats + +Lang: PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a have_V2) (DetCN many_Det (UseN child_N)))) +LangChi: 我 想 有 很 多 孩 子 +LangEng: I want to have many children + + +Lang: DetCN (DetQuant this_Quant NumPl) (UseN cat_N) +LangChi: 这 些 猫 +LangEng: these cats + +Lang: DetCN (DetQuant this_Quant NumSg) (UseN cat_N) +LangChi: 这 只 猫 +LangEng: this cat + +Lang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant that_Quant NumPl) (UseN cat_N))) +LangChi: 我 喜 欢 那 些 猫 +LangEng: I like those cats + +Lang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant that_Quant NumSg) (UseN cat_N))) +LangChi: 我 喜 欢 那 只 猫 +LangEng: I like that cat + +Lang: DetCN every_Det (UseN rule_N) +LangChi: 每 项 规 则 +LangEng: every rule + +Lang: DetCN few_Det (UseN child_N) +LangChi: 少 些 孩 子 +LangEng: few children + +Lang: PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a have_V2) (DetCN few_Det (UseN child_N)))) +LangChi: 我 想 有 少 些 孩 子 +LangEng: I want to have few children + +Lang: DetCN much_Det (UseN beer_N) +LangChi: 多 杯 啤 酒 +LangEng: much beer From e0b4d6940afd158bbfb19eb6e99443187eacc32c Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 23 Feb 2022 11:08:31 +0800 Subject: [PATCH 21/26] remove collectives in collective nouns for xie for quantifier --- src/chinese/StructuralChi.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chinese/StructuralChi.gf b/src/chinese/StructuralChi.gf index fd9b53ef3..40cf45cf1 100644 --- a/src/chinese/StructuralChi.gf +++ b/src/chinese/StructuralChi.gf @@ -54,8 +54,8 @@ when_IAdv = mkIAdvL "什么时候" ; how_IAdv = mkIAdvL "如何" ; all_Predet = ssword "所有" ; many_Det = mkDet (word "很多") DTPoss ; -someSg_Det = mkDet (word "一些") Sg ; -somePl_Det = mkDet (word "一些") Sg ; +someSg_Det = mkDet (word "一些") DTPoss ; +somePl_Det = mkDet (word "一些") DTPoss ; few_Det = mkDet "少" Pl ; other_A = mkA "其他" ; From 5e308e7aa71bdf6accb0e8673ecad6a4ab4702f9 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 23 Feb 2022 11:09:07 +0800 Subject: [PATCH 22/26] add test for quantifier --- src/chinese/unittest/quantifier.gftest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chinese/unittest/quantifier.gftest b/src/chinese/unittest/quantifier.gftest index 137e670ad..2a15d0cbf 100644 --- a/src/chinese/unittest/quantifier.gftest +++ b/src/chinese/unittest/quantifier.gftest @@ -50,7 +50,7 @@ Lang: DetCN every_Det (UseN rule_N) LangChi: 每 项 规 则 LangEng: every rule -Lang: DetCN few_Det (UseN child_N) +Lang: DetCN few_Det (UseN child_N) LangChi: 少 些 孩 子 LangEng: few children From 0c659deae3af91c3da1e88f1a078bd1195b78ed9 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 2 Mar 2022 10:46:46 +0800 Subject: [PATCH 23/26] move transitive and complements from affixes to tenses --- src/chinese/unittest/tenses.gftest | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/chinese/unittest/tenses.gftest b/src/chinese/unittest/tenses.gftest index 9927b82ce..e85c43fa9 100644 --- a/src/chinese/unittest/tenses.gftest +++ b/src/chinese/unittest/tenses.gftest @@ -21,6 +21,17 @@ Lang: PredVP (DetCN (DetQuant this_Quant NumSg) (UseN cat_N)) (ComplVV can_VV (U LangChi: 这 只 猫 能 走 LangEng: this cat can walk +-- As a verbal complement +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N)) (ComplVV want_VV (UseV walk_V))) +LangChi: 我 的 猫 想 走 +LangEng: my cat wants to walk + +-- Transitive verbs + +Lang: UseCl (TTAnt TPres AAnter) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a eat_V2) (DetCN (DetQuant IndefArt NumSg) (UseN fish_N)))) +LangChi: 我 吃 了 一 条 鱼 +LangEng: I have eaten a fish + ------------- -- Conditions From 4df65b593e3af7ba45ca0b6b386415774b3eb0c8 Mon Sep 17 00:00:00 2001 From: 1Regina <46968488+1Regina@users.noreply.github.com> Date: Wed, 2 Mar 2022 15:23:10 +0800 Subject: [PATCH 24/26] adverbials todo: add semantic context constructors --- src/chinese/unittest/adverbial.gftest | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/chinese/unittest/adverbial.gftest diff --git a/src/chinese/unittest/adverbial.gftest b/src/chinese/unittest/adverbial.gftest new file mode 100644 index 000000000..842d9c90c --- /dev/null +++ b/src/chinese/unittest/adverbial.gftest @@ -0,0 +1,12 @@ +-- These are not ideal output. TODO: Add new constructor for semantic contexts to achieve the correct output for "地" vs "得" + +Lang: PredVP (AdvNP (UsePron it_Pron) (PositAdvAdj beautiful_A)) (UseV walk_V) +LangChi: 漂 亮 地 的 它 走 +LangEng: it beautifully walks +-- Correct LangChi: 它 漂 亮 地 走 + + +Lang: PredVP (UsePron it_Pron) (AdvVP (UseV walk_V) (PositAdvAdj beautiful_A)) +LangChi: 它 走 得 漂 亮 地 +LangEng: it walks beautifully +-- Correct LangChi: 它 走 得 漂 亮 From b3d1ccbc40034c103eebc301cf1a42d6f777b92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?bc=C2=B2?= Date: Thu, 7 Apr 2022 08:37:04 +0000 Subject: [PATCH 25/26] (gf2ud) label updates (#97) * (gf2ud) add ConsNP "," rule - use CCONJ instead of CONJ * (gf2ud) dobj -> obj (ud 2 -> ud 1) - clean up whitespace * (gf2ud) fix eng labels - comma exists in SSubjS, not SubjS - add local rule for comma in VocNP - auxpass (UD1) -> aux:pass (UD2) --- src/Lang.labels | 268 ++++++++++++++++++------------------- src/english/LangEng.labels | 10 +- 2 files changed, 134 insertions(+), 144 deletions(-) diff --git a/src/Lang.labels b/src/Lang.labels index 7b574b343..fb55ff6d9 100644 --- a/src/Lang.labels +++ b/src/Lang.labels @@ -1,157 +1,157 @@ -PredVP nsubj head -PredVPS nsubj head -DirectComplVQ empty nsubj head ccomp -- Temp argument can only be empty in English -DirectComplVS empty nsubj head ccomp -- Temp argument can only be empty in English -SlashVP nsubj head -SlashVS nsubj head ccomp -FocusObjS nsubj head -- again might be wrong; more correct to call it dobj -QuestIAdv advmod head -- "where does John sleep" cf. AdvVP -QuestIComp head nsubj -- "where is John": John is clearly nsubj, but is where the head? -QuestQVP nsubj head -QuestSlash obj head -QuestVP nsubj head +PredVP nsubj head +PredVPS nsubj head +DirectComplVQ empty nsubj head ccomp -- Temp argument can only be empty in English +DirectComplVS empty nsubj head ccomp -- Temp argument can only be empty in English +SlashVP nsubj head +SlashVS nsubj head ccomp +FocusObjS nsubj head -- again might be wrong; more correct to call it obj +QuestIAdv advmod head -- "where does John sleep" cf. AdvVP +QuestIComp head nsubj -- "where is John": John is clearly nsubj, but is where the head? +QuestQVP nsubj head +QuestSlash obj head +QuestVP nsubj head IdetCN det head -PredSCVP csubj head +PredSCVP csubj head -ComplSlash head obj -ComplSlashIP head obj -Slash3V3 head obj -SlashV2VNP head obj xcomp -PastPartAgentAP head obj -AdvQVP head obj +ComplSlash head obj +ComplSlashIP head obj +Slash3V3 head obj +SlashV2VNP head obj xcomp +PastPartAgentAP head obj +AdvQVP head obj -Slash2V3 head iobj +Slash2V3 head iobj -ComplVS head ccomp -ComplVQ head ccomp -SlashV2S head ccomp -SlashV2Q head ccomp -CleftAdv head advcl -- not sure +ComplVS head ccomp +ComplVQ head ccomp +SlashV2S head ccomp +SlashV2Q head ccomp +CleftAdv head advcl -- not sure -ComplVA head xcomp -ComplVV head xcomp -SlashVV head acl -SlashV2A head xcomp -SlashV2V head xcomp +ComplVA head xcomp +ComplVV head xcomp +SlashVV head acl +SlashV2A head xcomp +SlashV2V head xcomp -AdvNP head nmod -- not sure -ExtAdvNP head nmod -- not sure -PassAgentVPSlash head nmod -- not sure -CleftNP head acl -- this cannot be nmod, not with type RS +AdvNP head nmod -- not sure +ExtAdvNP head nmod -- not sure +PassAgentVPSlash head nmod -- not sure +CleftNP head acl -- this cannot be nmod, not with type RS -SSubjS head mark advcl -RelS head advcl +SSubjS head mark advcl +RelS head advcl -AdNum advmod head -AdAP advmod head -AdvAP head advmod -ComparAdvAdj advmod amod head -ComparAdvAdjS advmod amod head -AdvIAdv advmod head -AdVVP advmod head -AdvVP head advmod -ExtAdvVP head advmod -AddAdvQVP head advmod -AdVVPSlash advmod head -AdvVPSlash head advmod -AdvSlash head advmod -ExistIPAdv head advmod -AdvS advmod head -ExtAdvS advmod head +AdNum advmod head +AdAP advmod head +AdvAP head advmod +ComparAdvAdj advmod amod head +ComparAdvAdjS advmod amod head +AdvIAdv advmod head +AdVVP advmod head +AdvVP head advmod +ExtAdvVP head advmod +AddAdvQVP head advmod +AdVVPSlash advmod head +AdvVPSlash head advmod +AdvSlash head advmod +ExistIPAdv head advmod +AdvS advmod head +ExtAdvS advmod head -SubjS mark head -RelVP mark head -RelSlash mark head +SubjS mark head +RelVP mark head +RelSlash mark head -ComplN2 head nmod -ComplN3 nmod head -AdvCN head nmod -PossNP head nmod -PartNP head nmod -ExistNPAdv head nmod +ComplN2 head nmod +ComplN3 nmod head +AdvCN head nmod +PossNP head nmod +PartNP head nmod +ExistNPAdv head nmod -OrdNumeralSuperl nummod head -- quite wrong; cannot find relevant details in the documentation; but most probably head lies outside the score of this function -DetQuant head nummod -- quite wrong; I think the head lies outside the scope of the function -CNNumNP head nummod +OrdNumeralSuperl nummod head -- quite wrong; cannot find relevant details in the documentation; but most probably head lies outside the score of this function +DetQuant head nummod -- quite wrong; I think the head lies outside the scope of the function +CNNumNP head nummod -ApposCN head appos -ApposNP head appos +ApposCN head appos +ApposNP head appos -RelNP head acl -RelCN head acl -SentCN head acl -SentAP head acl +RelNP head acl +RelCN head acl +SentCN head acl +SentAP head acl -DetQuantOrd head nummod amod -- quite wrong; again for same reason as DetQuant function -DetCN det head -IdetCN det head +DetQuantOrd head nummod amod -- quite wrong; again for same reason as DetQuant function +DetCN det head +IdetCN det head IdetQuant head nummod -CountNP det head -PredetNP det head +CountNP det head +PredetNP det head PPartNP head amod -- only in core RGL -AdjCN amod head -AdjDAP head amod -CAdvAP case amod head -ComparA amod head -ComplA2 amod head -CompoundAP head amod -AdAdV amod head -AdAdv amod head +AdjCN amod head +AdjDAP head amod +CAdvAP case amod head +ComparA amod head +ComplA2 amod head +CompoundAP head amod +AdAdV amod head +AdAdv amod head -CompoundN compound head +CompoundN compound head -IIDig head goeswith +IIDig head goeswith -PrepNP case head -PrepIP case head -SlashPrep head case -VPSlashPrep head case +PrepNP case head +PrepIP case head +SlashPrep head case +VPSlashPrep head case -UttImpPl empty head -UttImpPol empty head -UttImpSg empty head +UttImpPl empty head +UttImpPol empty head +UttImpSg empty head -MkVPS empty empty head +MkVPS empty empty head -UseCl empty empty head -UseQCl empty empty head -UseRCl empty empty head -UseSlash empty empty head -UseVC empty empty head +UseCl empty empty head +UseQCl empty empty head +UseRCl empty empty head +UseSlash empty empty head +UseVC empty empty head -BaseAP head conj -BaseAdV head conj -BaseAdv head conj -BaseCN head conj -BaseDAP head conj -BaseIAdv head conj -BaseNP head conj -BaseRS head conj -BaseS head conj -ConsAP head conj -ConsAdV head conj -ConsAdv head conj -ConsCN head conj -ConsDAP head conj -ConsIAdv head conj -ConsNP head conj -ConsRS head conj -ConsS head conj -ConjAP cc head -ConjAdV cc head -ConjAdv cc head -ConjCN cc head -ConjDet cc head -ConjIAdv cc head -ConjNP cc head -ConjRS cc head -ConjS cc head -PhrUtt cc head discourse +BaseAP head conj +BaseAdV head conj +BaseAdv head conj +BaseCN head conj +BaseDAP head conj +BaseIAdv head conj +BaseNP head conj +BaseRS head conj +BaseS head conj +ConsAP head conj +ConsAdV head conj +ConsAdv head conj +ConsCN head conj +ConsDAP head conj +ConsIAdv head conj +ConsNP head conj +ConsRS head conj +ConsS head conj +ConjAP cc head +ConjAdV cc head +ConjAdv cc head +ConjCN cc head +ConjDet cc head +ConjIAdv cc head +ConjNP cc head +ConjRS cc head +ConjS cc head +PhrUtt cc head discourse -PlusChunk head dep -TTAnt empty empty head +PlusChunk head dep +TTAnt empty empty head TExclMark head dep -- punctuation in the middle in these three TFullStop head dep @@ -159,13 +159,13 @@ TQuestMark head dep ComplV2 head obj -- shortcuts in App ComplV2V head obj xcomp -ComplV3 head iobj obj ---- could be dobj dobj +ComplV3 head iobj obj ---- could be obj obj PassAgentV2 head ncomp -- not sure RelV2 mark nsubj head QuestV2 obj nsubj head ModCN amod head -- in ResourceDemo -RSubjS mark advcl head +RSubjS mark advcl head SlashV2 nsubj head RAdvCN head case nmod SubjCl head mark advcl @@ -181,7 +181,7 @@ AdV ADV Adv ADV CAdv ADV Card NUM -Conj CONJ +Conj CCONJ Det DET Digits NUM IAdv ADV @@ -194,7 +194,7 @@ N2 NOUN N3 NOUN Numeral NUM Ord NUM -PConj CONJ +PConj CCONJ PN PROPN Predet DET Prep ADP @@ -214,7 +214,3 @@ VA VERB VQ VERB VS VERB VV VERB - - - - diff --git a/src/english/LangEng.labels b/src/english/LangEng.labels index e011bab47..625bd231f 100644 --- a/src/english/LangEng.labels +++ b/src/english/LangEng.labels @@ -3,13 +3,13 @@ UseV,ComplVV,ComplVS,ComplVQ,ComplVA,SlashV2a,SlashV2V,SlashV2A,SlashV2S,Slash2V UseV,UseComp {"to"} PART mark head UseComp,CompAdv,CompAP,CompNP,CompCN,ProgrVP,QuestIComp {"is","are","am","was","were","been","be"} VERB cop head CompCN {"a","an"} DET det head -PassV2 {"is","are","am","was","were""been","be"} VERB auxpass head +PassV2 {"is","are","am","was","were""been","be"} VERB aux:pass head ComplVV {"to"} PART mark xcomp ComplVS {"that"} PART mark ccomp EmbedVP {"to"} PART mark head EmbedS {"that"} PART mark head SentCN {"that","to"} PART mark acl -ExtAdvS,SubjS {","} PUNCT punct head +ConsNP,ExtAdvS,SSubjS,VocNP {","} PUNCT punct head ExistNPAdv,ExistNP {"not","don't","doesn't","didn't","haven't","hasn't","hadn't","wouldn't","won't","isn't","aren't","wasn't","weren't"} PART neg head ExistNPAdv,ExistNP {"has","had","have","will","would","do","does","did"} AUX aux head ExistNPAdv,ExistNP {"is","are","am","was","were""been","be"} VERB cop head @@ -34,9 +34,3 @@ PossNP,PartNP {"of"} ADP case nmod @"am" PresSg1 @"is" PresSg3 @"are" PresPl - - - - - - From b8ddf4304bc1c8f6e44863f78059640d5041fe6b Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Mon, 11 Apr 2022 12:27:39 +0200 Subject: [PATCH 26/26] (Ger) Small fix to get 'present' installed new SlashVP, RelSlash in tests/german/TestLangGer.gf to control reflexives in relative clauses --- src/german/CatGer.gf | 20 +- src/german/ConstructionGer.gf | 12 +- src/german/DocumentationGerFunctor.gf | 4 +- src/german/ExtendGer.gf | 60 +++-- src/german/ExtraGer.gf | 241 +++++++++--------- src/german/ExtraGerAbs.gf | 4 +- src/german/IdiomGer.gf | 2 +- src/german/ParadigmsGer.gf | 10 +- src/german/QuestionGer.gf | 2 +- src/german/ResGer.gf | 343 +++++++++++++------------- src/german/SentenceGer.gf | 14 +- src/german/VerbGer.gf | 120 +++++---- tests/german/TestLang.gf | 12 +- tests/german/TestLangEng.gf | 2 +- tests/german/TestLangGer.gf | 250 ++++++++++++------- tests/german/TestLexiconGer.gf | 28 ++- tests/german/infinitives.lin.out | 54 ++-- tests/german/vp-paradigm.gfs | 8 +- 18 files changed, 657 insertions(+), 529 deletions(-) diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index 1b247c859..d76d60d8f 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -50,11 +50,13 @@ concrete CatGer of Cat = -- Noun - CN = {s : Adjf => Number => Case => Str ; - rc : Number => Str ; -- Frage , [rc die ich gestellt habe] - ext : Str ; -- Frage , [sc wo sie schläft]) - adv : Str ; -- Frage [a von Max] - g : Gender} ; + CN = { + s : Adjf => Number => Case => Str ; + rc : Number => Str ; -- Frage , [rc die ich gestellt habe] + ext : Str ; -- Frage , [sc wo sie schläft] + adv : Str ; -- Haus [adv auf dem Hügel] + g : Gender + } ; NP = ResGer.NP ; Pron = {s : NPForm => Str ; a : Agr} ; Det, DAP = {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} ; @@ -86,10 +88,10 @@ concrete CatGer of Cat = -- Open lexical classes, e.g. Lexicon - V, VS, VQ = ResGer.Verb ; -- = {s : VForm => Str} ; + V, VA, VS, VQ = ResGer.Verb ; -- = {s : VForm => Str} ; VV = Verb ** {isAux : Bool} ; - V2, VA, V2A, V2S, V2Q = Verb ** {c2 : Preposition} ; - V2V = Verb ** {c2 : Preposition ; isAux : Bool ; ctrl : Control} ; + V2, V2A, V2S, V2Q = Verb ** {c2 : Preposition} ; + V2V = Verb ** {c2 : Preposition ; isAux : Bool ; objCtrl : Bool} ; V3 = Verb ** {c2, c3 : Preposition} ; A = {s : Degree => AForm => Str} ; @@ -113,7 +115,7 @@ concrete CatGer of Cat = ClSlash = \cls -> cls.s ! MIndic ! Pres ! Simul ! Pos ! Main ++ cls.c2.s ; VP = \vp -> useInfVP False vp ; - VPSlash = \vps -> useInfVP False vps ++ vps.c2.s ; + VPSlash = \vps -> useInfVP False vps ++ vps.c2.s ++ vps.ext; AP = \ap -> ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ++ ap.ext ; A2 = \a2 -> a2.s ! Posit ! APred ++ a2.c2.s ; diff --git a/src/german/ConstructionGer.gf b/src/german/ConstructionGer.gf index f256d8af9..27f53f620 100644 --- a/src/german/ConstructionGer.gf +++ b/src/german/ConstructionGer.gf @@ -42,13 +42,13 @@ lin where_go_QCl np = mkQCl (lin IAdv (ss "wohin")) (mkCl np (mkVP L.go_V)) ; where_come_from_QCl np = mkQCl (lin IAdv (ss "woher")) (mkCl np (mkVP L.come_V)) ; - go_here_VP = mkVP (mkVP L.go_V) (mkAdv "her") ; - come_here_VP = mkVP (mkVP L.come_V) (mkAdv "her") ; - come_from_here_VP = mkVP (mkVP L.come_V) (mkAdv "von hier") ; + go_here_VP = mkVP (mkVP L.go_V) (ParadigmsGer.mkAdv "her") ; + come_here_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "her") ; + come_from_here_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "von hier") ; - go_there_VP = mkVP (mkVP L.go_V) (mkAdv "hin") ; - come_there_VP = mkVP (mkVP L.come_V) (mkAdv "hin") ; - come_from_there_VP = mkVP (mkVP L.come_V) (mkAdv "von dort") ; + go_there_VP = mkVP (mkVP L.go_V) (ParadigmsGer.mkAdv "hin") ; + come_there_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "hin") ; + come_from_there_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "von dort") ; lincat Weekday = N ; diff --git a/src/german/DocumentationGerFunctor.gf b/src/german/DocumentationGerFunctor.gf index aa912a279..eedea374e 100644 --- a/src/german/DocumentationGerFunctor.gf +++ b/src/german/DocumentationGerFunctor.gf @@ -147,8 +147,8 @@ lin lin NoDefinition t = {s=t.s}; - MkDefinition t d = {s="

Definierung:"++t.s++d.s++"

"}; - MkDefinitionEx t d e = {s="

Definierung:"++t.s++d.s++"

Beispiel:"++e.s++"

"}; + MkDefinition t d = {s="

Definition:"++t.s++d.s++"

"}; + MkDefinitionEx t d e = {s="

Definition:"++t.s++d.s++"

Beispiel:"++e.s++"

"}; MkDocument d i e = ss (i.s1 ++ d.s ++ i.s2 ++ paragraph e.s) ; -- explanation appended in a new paragraph MkTag i = ss i.t ; diff --git a/src/german/ExtendGer.gf b/src/german/ExtendGer.gf index d5b271334..bf6757c7c 100644 --- a/src/german/ExtendGer.gf +++ b/src/german/ExtendGer.gf @@ -35,9 +35,8 @@ lin ConjVPI = conjunctDistrTable Bool ; ComplVPIVV v vpi = --- insertInf (vpi.s ! v.isAux) ( - insertInf {s=(vpi.s ! v.isAux);isAux=v.isAux;ctrl=SubjC} ( -- HL ?? - predVGen v.isAux v) ; ---- + insertInf {inpl = <\\_ => [], (vpi.s ! v.isAux)> ; extr = \\_ => []} -- HL 3/22 + (predVGen v.isAux v) ; BaseVPS = twoTable2 Order Agr ; ConsVPS = consrTable2 Order Agr comma ; @@ -70,37 +69,46 @@ lin m = tm.m ; subj = [] ; verb = vps.s ! ord ! agr ! VPFinite m t a ; + haben = verb.inf2 ; neg = tm.s ++ p.s ++ vp.a1 ++ negation ! b ; -- HL 8/19 ++ vp.a1 ! b ; -- obj1 = (vp.nn ! agr).p1 ; -- obj = (vp.nn ! agr).p2 ; -- compl = obj1 ++ neg ++ obj ++ vp.a2 ; -- from EG 15/5 - obj1 = (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ; -- refl ++ pronouns ++ nonpronouns - obj2 = (vp.nn ! agr).p3 ; -- pp-objects + obj1 = (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ; -- refl ++ pronouns ++ light nps + obj2 = (vp.nn ! agr).p3 ; -- pp-objects and heavy nps obj3 = (vp.nn ! agr).p4 ++ vp.adj ++ vp.a2 ; -- pred.AP|CN|Adv, via useComp HL 6/2019 compl = obj1 ++ neg ++ obj2 ++ obj3 ; - inf = vp.inf.s ++ verb.inf ++ verb.inf2 ; - extra = vp.ext ; - infE : Str = -- HL 30/6/2019 - case of { - => inf ; --# notpresent - -- Duden 318: kommen wollen haben => haben kommen wollen --# notpresent - => verb.inf2 ++ vp.inf.s ++ verb.inf ; --# notpresent - <_,Anter,True> => inf ; --# notpresent - _ => verb.inf ++ verb.inf2 ++ vp.inf.s } ; - inffin : Str = - case of { - -- ... wird|würde haben kommen wollen --# notpresent - => verb.fin ++ verb.inf2 ++ vp.inf.s ++ verb.inf ; --# notpresent - <_,Anter,True> --# notpresent - => verb.fin ++ inf ; -- double inf --# notpresent - _ => inf ++ verb.fin --- or just auxiliary vp - } ; + infObjs = (vp.inf.inpl.p1)!agr ; -- adapted to new VP.inf, HL 3/2022 + infPred = vp.inf.inpl.p2 ; + infCompl : Str = case of { + => [] ; --# notpresent + _ => infObjs ++ infPred } ; + pred : {inf, infComplfin : Str} = case of { + => --# notpresent + {inf = infObjs ++ haben ++ infPred ++ verb.inf ; --# notpresent Duden 318 + infComplfin = -- es ++ wird ++ haben ++ tun ++ wollen --# notpresent + infObjs ++ verb.fin ++ haben ++ infPred ++ verb.inf} ; --# notpresent + <_,Anter,True> => --# notpresent + {inf = verb.inf ++ haben ; --# notpresent + infComplfin = -- es ++ wird/hat/hatte ++ tun ++ wollen --# notpresent + infObjs ++ verb.fin ++ infPred ++ verb.inf ++ haben} ; --# notpresent + => + {inf = verb.inf ++ haben ; + infComplfin = -- es zu tun ++ [] ++ [] ++ versucht + infCompl ++ verb.inf ++ haben ++ verb.fin} + ; --# notpresent + _ => --# notpresent + {inf = verb.inf ++ haben ; --# notpresent + infComplfin = -- es zu tun ++ versucht ++ [] ++ hat --# notpresent + infCompl ++ verb.inf ++ haben ++ verb.fin} --# notpresent + } ; + extra = vp.inf.extr!agr ++ vp.ext ; in case o of { - Main => subj ++ verb.fin ++ compl ++ vp.infExt ++ infE ++ extra ; - Inv => verb.fin ++ subj ++ compl ++ vp.infExt ++ infE ++ extra ; - Sub => subj ++ compl ++ vp.infExt ++ inffin ++ extra - } + Main => subj ++ verb.fin ++ compl ++ infCompl ++ pred.inf ++ extra ; + Inv => verb.fin ++ subj ++ compl ++ infCompl ++ pred.inf ++ extra ; + Subj => subj ++ compl ++ pred.infComplfin ++ extra + } } ; ConjVPS = conjunctDistrTable2 Order Agr ; diff --git a/src/german/ExtraGer.gf b/src/german/ExtraGer.gf index f11cc072f..0ae816242 100644 --- a/src/german/ExtraGer.gf +++ b/src/german/ExtraGer.gf @@ -12,16 +12,9 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** MkVPI vp = {s = \\b => useInfVP b vp} ; ConjVPI = conjunctDistrTable Bool ; - ComplVPIVV v vpi = --- insertInf (vpi.s ! v.isAux) ( - insertInf {s=(vpi.s ! v.isAux);isAux=v.isAux;ctrl=SubjC} ( -- HL ?? - predVGen v.isAux v) ; ---- -{- - insertExtrapos vpi.p3 ( - insertInf vpi.p2 ( - insertObj vpi.p1 ( - predVGen v.isAux v))) ; --} + ComplVPIVV v vpi = + insertInf {inpl = <\\_ => [], (vpi.s ! v.isAux)> ; extr = \\_ => []} -- HL 3/22 + (predVGen v.isAux v) ; PPzuAdv cn = {s = case cn.g of { Masc | Neutr => "zum" ; @@ -33,8 +26,8 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** moegen_VV = auxVV mögen_V ; - ICompAP ap = {s = \\_ => "wie" ++ ap.s ! APred ; - ext = ap.c.p1 ++ ap.c.p2 ++ ap.ext} ; + ICompAP ap = {s = \\_ => "wie" ++ ap.s ! APred ; + ext = ap.c.p1 ++ ap.c.p2 ++ ap.ext} ; CompIQuant iq = {s = table {Ag g n p => iq.s ! n ! g ! Nom} ; ext = ""} ; @@ -43,8 +36,6 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** DetNPMasc det = { s = \\c => det.sp ! Masc ! c ; ---- genders a = agrP3 det.n ; - -- isPron = False ; - -- isLight = True ; w = WLight ; ext, rc = [] } ; @@ -52,8 +43,6 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** DetNPFem det = { s = \\c => det.sp ! Fem ! c ; ---- genders a = agrP3 det.n ; - -- isPron = False ; - -- isLight = True ; w = WLight ; ext, rc = [] } ; @@ -66,37 +55,40 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** } ; PassVPSlash vp = - let c = case of { - => NPC Nom ; - _ => vp.c2.c} - in insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) ** - {subjc = vp.c2 ** {c= c}} ; - -- regulates passivised object: accusative objects -> nom; all others: same case - -- this also gives "mit dir wird gerechnet" ; - -- the alternative linearisation ("es wird mit dir gerechnet") is not implemented + let c = case of { + => NPC Nom ; + _ => vp.c2.c} + in insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) ** + { c1 = vp.c2 ** {c = c}} ; + -- regulates passivised object: accusative objects -> nom; all others: same case + -- this also gives "mit dir wird gerechnet" ; + -- the alternative linearisation ("es wird mit dir gerechnet") is not implemented PassAgentVPSlash vp np = ---- "von" here, "durch" in StructuralGer insertObj (\\_ => (PastPartAgentAP (lin VPSlash vp) (lin NP np)).s ! APred) (predV werdenPass) ; Pass3V3 v = -- HL 7/19 let bekommenPass : Verb = P.habenV (P.irregV "bekommen" "bekommt" "bekam" "bekäme" "bekommen") - in insertObj (\\_ => (v.s ! VPastPart APred)) (predV bekommenPass) ** { subjc = PrepNom ; c2 = v.c2 } ; + in insertObj (\\_ => (v.s ! VPastPart APred)) (predV bekommenPass) ** + { c1 = PrepNom ; c2 = v.c2 ; objCtrl = False } ; - PastPartAP vp = { - s = \\af => (vp.nn ! agrP3 Sg).p1 ++ (vp.nn ! agrP3 Sg).p2 ++ (vp.nn ! agrP3 Sg).p3 ++ vp.a2 ++ vp.inf.s ++ - vp.ext ++ vp.infExt ++ vp.s.s ! VPastPart af ; - isPre = True ; - c = <[],[]> ; - ext = [] + PastPartAP vp = + let a = agrP3 Sg in { + s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3 ++ vp.a2 + ++ vp.inf.inpl.p2 ++ (vp.inf.extr ! a) ++ vp.s.s ! VPastPart af ; + isPre = True ; + c = <[],[]> ; + ext = vp.ext } ; - PastPartAgentAP vp np = - let agent = appPrepNP P.von_Prep np - in { - s = \\af => (vp.nn ! agrP3 Sg).p1 ++ (vp.nn ! agrP3 Sg).p2 ++ (vp.nn ! agrP3 Sg).p3 ++ vp.a2 ++ agent ++ - vp.inf.s ++ - vp.c2.s ++ --- junk if not TV - vp.ext ++ vp.infExt ++ vp.s.s ! VPastPart af ; + PastPartAgentAP vp np = + let a = agrP3 Sg ; + agent = appPrepNP P.von_Prep np + in { + s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3 + ++ vp.a2 ++ agent ++ vp.inf.inpl.p2 + ++ vp.c2.s -- junk if not TV + ++ vp.ext ++ (vp.inf.extr ! a) ++ vp.s.s ! VPastPart af ; isPre = True ; c = <[],[]> ; ext = [] @@ -138,37 +130,46 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** m = tm.m ; subj = [] ; verb = vps.s ! ord ! agr ! VPFinite m t a ; + haben = verb.inf2 ; neg = tm.s ++ p.s ++ vp.a1 ++ negation ! b ; -- HL 8/19 ++ vp.a1 ! b ; -- obj1 = (vp.nn ! agr).p1 ; -- obj = (vp.nn ! agr).p2 ; -- compl = obj1 ++ neg ++ obj ++ vp.a2 ; -- from EG 15/5 - obj1 = (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ; -- refl ++ pronouns ++ nonpronouns - obj2 = (vp.nn ! agr).p3 ; -- pp-objects + obj1 = (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ; -- refl ++ pronouns ++ light nps + obj2 = (vp.nn ! agr).p3 ; -- pp-objects and heavy nps obj3 = (vp.nn ! agr).p4 ++ vp.adj ++ vp.a2 ; -- pred.AP|CN|Adv, via useComp HL 6/2019 compl = obj1 ++ neg ++ obj2 ++ obj3 ; - inf = vp.inf.s ++ verb.inf ++ verb.inf2 ; - extra = vp.ext ; - infE : Str = -- HL 30/6/2019 - case of { - => inf ; --# notpresent - -- Duden 318: kommen wollen haben => haben kommen wollen --# notpresent - => verb.inf2 ++ vp.inf.s ++ verb.inf ; --# notpresent - <_,Anter,True> => inf ; --# notpresent - _ => verb.inf ++ verb.inf2 ++ vp.inf.s } ; - inffin : Str = - case of { - -- ... wird|würde haben kommen wollen --# notpresent - => verb.fin ++ verb.inf2 ++ vp.inf.s ++ verb.inf ; --# notpresent - <_,Anter,True> --# notpresent - => verb.fin ++ inf ; -- double inf --# notpresent - _ => inf ++ verb.fin --- or just auxiliary vp - } ; + infObjs = (vp.inf.inpl.p1)!agr ; -- adapted to new VP.inf, HL 3/2022 + infPred = vp.inf.inpl.p2 ; + infCompl : Str = case of { + => [] ; --# notpresent + _ => infObjs ++ infPred } ; + pred : {inf, infComplfin : Str} = case of { + => --# notpresent + {inf = infObjs ++ haben ++ infPred ++ verb.inf ; --# notpresent Duden 318 + infComplfin = -- es ++ wird ++ haben ++ tun ++ wollen --# notpresent + infObjs ++ verb.fin ++ haben ++ infPred ++ verb.inf} ; --# notpresent + <_,Anter,True> => --# notpresent + {inf = verb.inf ++ haben ; --# notpresent + infComplfin = -- es ++ wird/hat/hatte ++ tun ++ wollen --# notpresent + infObjs ++ verb.fin ++ infPred ++ verb.inf ++ haben} ; --# notpresent + => + {inf = verb.inf ++ haben ; + infComplfin = -- es zu tun ++ [] ++ [] ++ versucht + infCompl ++ verb.inf ++ haben ++ verb.fin} + ; --# notpresent + _ => --# notpresent + {inf = verb.inf ++ haben ; --# notpresent + infComplfin = -- es zu tun ++ versucht ++ [] ++ hat --# notpresent + infCompl ++ verb.inf ++ haben ++ verb.fin} --# notpresent + } ; + extra = vp.inf.extr!agr ++ vp.ext ; in case o of { - Main => subj ++ verb.fin ++ compl ++ vp.infExt ++ infE ++ extra ; - Inv => verb.fin ++ subj ++ compl ++ vp.infExt ++ infE ++ extra ; - Sub => subj ++ compl ++ vp.infExt ++ inffin ++ extra - } + Main => subj ++ verb.fin ++ compl ++ infCompl ++ pred.inf ++ extra ; + Inv => verb.fin ++ subj ++ compl ++ infCompl ++ pred.inf ++ extra ; + Subj => subj ++ compl ++ pred.infComplfin ++ extra + } } ; ConjVPS = conjunctDistrTable2 Order Agr ; @@ -182,67 +183,78 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** ReflPoss num cn = {s = \\a,c => num.s ! cn.g ! c ++ possPron a num.n cn.g c ++ cn.s ! adjfCase Strong c ! num.n ! c} ; + ReflPron = { s = ResGer.reflPron } ; -- reflexively used personal pronoun, with special forms in P3 Sg + + -- In P1,P2 we might use "selbst" to define a (stronger) reflexive pronoun instead: -- HL 3/2022 + -- du kennst mich vs. ich kenne mich selbst + -- er kennt ihn vs. er kennt sich (selbst) + -- sie kennen sich (selbst) =/= sie kennen einander + -- Likewise, instead of ReflPoss we might define a reflexive possessive pronoun: + -- du kennst meine Fehler vs. ich kenne meine eigenen Fehler + -- er|sie|es kennt seine Fehler vs. er|sie|es kennt seine|ihre|seine eigenen Fehler + oper + reflPronSelf : Agr => Case => Str = \\a => \\c => reflPron ! a ! c ++ "selbst" ; + + reflPossPron : Agr -> Number -> Gender -> Case -> Str = + let eigen = adjForms "eigen" "eigen" in + \a,n,g,c -> possPron a n g c ++ (eigen ! (AMod (gennum g n) c)) ; + -- implementation of some of the relevant Foc rules from Extra lincat - Foc = {s : Mood => ResGer.Tense => Anteriority => Polarity => Str} ; + Foc = {s : Mood => ResGer.Tense => Anteriority => Polarity => Str} ; lin FocObj np cl = - let n = appPrepNP cl.c2 np - in mkFoc n cl ; + let n = appPrepNP cl.c2 np in mkFoc n cl ; - FocAdv adv cl = mkFoc adv.s cl ; + FocAdv adv cl = mkFoc adv.s cl ; - FocAP ap np = - let adj = ap.s ! APred ; - vp = predV sein_V ** {ext = ap.c.p1 ++ ap.c.p2 ++ ap.ext}; - -- potentially not correct analysis for all examples - -- works for: - -- "treu ist sie ihm" - -- "froh ist sie dass er da ist" - -- "stolz ist sie auf ihn" - subj = mkSubj np vp.subjc ; - cl = mkClause subj.p1 subj.p2 vp - in mkFoc adj cl ; + FocAP ap np = + let adj = ap.s ! APred ; + vp = predV ResGer.sein_V ** {ext = ap.c.p1 ++ ap.c.p2 ++ ap.ext}; + -- potentially not correct analysis for all examples + -- works for: + -- "treu ist sie ihm" + -- "froh ist sie dass er da ist" + -- "stolz ist sie auf ihn" + subj = mkSubj np vp.c1 ; + cl = mkClause subj.p1 subj.p2 vp + in mkFoc adj cl ; - UseFoc t p f = {s = t.s ++ p.s ++ f.s ! t.m ! t.t ! t.a ! p.p} ; + UseFoc t p f = {s = t.s ++ p.s ++ f.s ! t.m ! t.t ! t.a ! p.p} ; -- extra rules to get some of the "es" alternative linearisations lin - EsVV vv vp = predV vv ** { - nn = \\a => let n = vp.nn ! a in <"es" ++ n.p1, n.p2, n.p3, n.p4, n.p5, n.p6> ; - inf = vp.inf ** {s = vp.s.s ! (VInf True) ++ vp.inf.s} ; -- ich genieße es zu versuchen zu gehen; alternative word order could be produced by vp.inf ++ vp.s.s... (zu gehen zu versuchen) - a1 = vp.a1 ; - a2 = vp.a2 ; - ext = vp.ext ; - infExt = vp.infExt ; - adj = vp.adj } ; - - EsV2A v2a ap s = predV v2a ** { - nn = \\_ => <"es",[],[],[],[],[]> ; - adj = ap.s ! APred ; - ext = "," ++ "dass" ++ s.s ! Sub} ; + EsVV vv vp = -- HL 3/2022 + let inf = mkInf False Simul Pos vp ; -- False = force extraction + objs : Agr => Str * Str * Str * Str = \\a => <"es",[],[],[]> ; + vps = predV vv ** { nn = objs } + in insertExtrapos vp.ext ( + insertInf inf vps) ; + + EsV2A v2a ap s = predV v2a ** { + nn = \\_ => <"es",[],[],[]> ; + adj = ap.s ! APred ; + ext = "," ++ conjThat ++ s.s ! Sub} ; -- "es wird gelacht"; generating formal sentences lincat - FClause = ResGer.VP ** {subj : ResGer.NP} ; - + FClause = ResGer.VP ** {subj : ResGer.NP} ; lin - VPass v = - let vp = predV werdenPass ; - in vp ** { - subj = esSubj ; - inf = vp.inf ** {s = v.s ! VPastPart APred } } ; -- construct the formal clause + VPass v = + let vp = predV werdenPass + in vp ** {subj = esSubj ; + inf = vp.inf ** {s = v.s ! VPastPart APred } } ; -- construct the formal clause - AdvFor adv fcl = fcl ** {a2 = adv.s} ; + AdvFor adv fcl = fcl ** {a2 = adv.s} ; FtoCl cl = - let subj = mkSubj cl.subj cl.subjc + let subj = mkSubj cl.subj cl.c1 in DisToCl subj.p1 subj.p2 cl ; @@ -251,16 +263,14 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** mkFoc : Str -> Cl -> Foc = \focus, cl -> lin Foc {s = \\m,t,a,p => focus ++ cl.s ! m ! t ! a ! p ! Inv} ; - esSubj : NP = lin NP { - s = \\_ => "es" ; - rc, ext = [] ; - a = Ag Neutr Sg P3 ; - -- isLight = True ; - -- isPron = True - w = WPron - } ; + esSubj : CatGer.NP = lin NP { + s = \\_ => "es" ; + rc, ext = [] ; + a = Ag Neutr Sg P3 ; + w = WPron + } ; - DisToCl : Str -> Agr -> FClause -> Clause = \subj,agr,vp -> + DisToCl : Str -> Agr -> FClause -> Clause = \subj,agr,vp -> let vps = useVP vp in { s = \\m,t,a,b,o => let @@ -273,20 +283,23 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** obj1 = (vp.nn ! agr).p1 ; obj2 = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ; compl = obj1 ++ neg ++ vp.adj ++ obj2 ++ vp.a2 ; -- adj added - inf = vp.inf.s ++ verb.inf ; -- not used for linearisation of Main/Inv + inf = vp.inf.inpl.p2 ++ verb.inf ; -- not used for linearisation of Main/Inv + infExt = vp.inf.extr ! agr ; extra = vp.ext ; - inffin : Str = + inffin : Str = case of { => verb.fin ++ inf ; -- double inf --# notpresent - _ => inf ++ verb.fin --- or just auxiliary vp + _ => inf ++ verb.fin --- or just auxiliary vp } in case o of { - Main => subj ++ verb.fin ++ compl ++ vp.infExt ++ verb.inf ++ extra ++ vp.inf.s ; - Inv => verb.fin ++ compl ++ vp.infExt ++ verb.inf ++ extra ++ vp.inf.s ; - Sub => compl ++ vp.infExt ++ inffin ++ extra } + Main => subj ++ verb.fin ++ compl ++ infExt ++ verb.inf ++ extra ++ vp.inf.inpl.p2 ; + Inv => verb.fin ++ compl ++ infExt ++ verb.inf ++ extra ++ vp.inf.inpl.p2 ; -- vp.inf.s ; + Sub => compl ++ infExt ++ inffin ++ extra } } ; -- this function is not entirely satisfactory as largely -- though not entirely duplicating mkClause in ResGer + + } diff --git a/src/german/ExtraGerAbs.gf b/src/german/ExtraGerAbs.gf index ef02bf633..eff464de3 100644 --- a/src/german/ExtraGerAbs.gf +++ b/src/german/ExtraGerAbs.gf @@ -4,13 +4,12 @@ abstract ExtraGerAbs = Extra [ VPSlash, PassVPSlash, PassAgentVPSlash, CompIQuant, PastPartAP, PastPartAgentAP, Temp,Tense,Pol,S,NP,VV,VP,Conj,IAdv,IQuant,IComp,ICompAP,IAdvAdv,Adv,AP, Foc,FocObj,FocAdv,FocAP,UseFoc, - RNP,ReflRNP,ReflPoss + RNP,ReflRNP,ReflPoss,ReflPron ] ** { flags coding=utf8; cat FClause ; -- formal clause - fun PPzuAdv : CN -> Adv ; -- zum Lied, zur Flasche TImpfSubj : Tense ; -- ich möchte... --# notpresent @@ -27,4 +26,5 @@ abstract ExtraGerAbs = Extra [ FtoCl : FClause -> Cl ; -- embedding FClause within the RGL, to allow generation of S, Utt, etc. Pass3V3 : V3 -> VPSlash ; -- wir bekommen den Beweis erklärt + } diff --git a/src/german/IdiomGer.gf b/src/german/IdiomGer.gf index b12bf1b0a..4802a1dd6 100644 --- a/src/german/IdiomGer.gf +++ b/src/german/IdiomGer.gf @@ -59,7 +59,7 @@ concrete IdiomGer of Idiom = CatGer ** } ; ImpP3 np vp = { - s = (mkClause ((mkSubj np vp.subjc).p1) np.a vp).s ! + s = (mkClause ((mkSubj np vp.c1).p1) np.a vp).s ! MConjunct ! Pres ! Simul ! Pos ! Inv } ; diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index df3a24fe1..1afd08861 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -607,17 +607,17 @@ mkV2 : overload { mkV2V = overload { -- default: object-control mkV2V : V -> V2V - = \v -> dirV2 v ** {isAux = False ; ctrl = ObjC ; lock_V2V = <>} ; + = \v -> dirV2 v ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ; -- ermahne jmdn, sich zu waschen mkV2V : V -> Prep -> V2V - = \v,p -> prepV2 v p ** {isAux = False ; ctrl = ObjC ; lock_V2V = <>} ; + = \v,p -> prepV2 v p ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ; } ; auxV2V = overload { auxV2V : V -> V2V - = \v -> dirV2 v ** {isAux = True ; ctrl = ObjC ; lock_V2V = <>} ; + = \v -> dirV2 v ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ; -- lasse jmdn sich waschen auxV2V : V -> Prep -> V2V - = \v,p -> prepV2 v p ** {isAux = True ; ctrl = ObjC ; lock_V2V = <>} ; + = \v,p -> prepV2 v p ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ; } ; - subjV2V v = v ** {ctrl = SubjC} ; + subjV2V v = v ** {objCtrl = False} ; mkV2A = overload { mkV2A : V -> V2A diff --git a/src/german/QuestionGer.gf b/src/german/QuestionGer.gf index b6b97fd0b..2f89455fd 100644 --- a/src/german/QuestionGer.gf +++ b/src/german/QuestionGer.gf @@ -50,7 +50,7 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { s = \\m,t,a,p => let vp = predV sein_V ** {ext = icomp.ext}; - subj = mkSubj np vp.subjc ; + subj = mkSubj np vp.c1 ; cls = (mkClause subj.p1 subj.p2 vp).s ! m ! t ! a ! p ; why = icomp.s ! np.a in table { diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index 4bedb4f7a..b390f995a 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -101,14 +101,14 @@ resource ResGer = ParamX ** open Prelude in { --2 For $Verb$ - param VForm = + param VForm = VInf Bool -- True = with the particle "zu" | VFin Bool VFormFin -- True = prefix glued to verb | VImper Number -- prefix never glued | VPresPart AForm -- prefix always glued | VPastPart AForm ; - param VFormFin = + param VFormFin = VPresInd Number Person | VPresSubj Number Person | VImpfInd Number Person --# notpresent @@ -124,10 +124,6 @@ resource ResGer = ParamX ** open Prelude in { param VType = VAct | VRefl Case ; --- Implicit subject of embedded vp equals subject resp. object of matrix verb v:V2V: - - param Control = SubjC | ObjC | NoC ; -- NoC : verb without infinite vp-complement - -- The order of a sentence depends on whether it is used as a main -- clause, inverted, or subordinate. @@ -258,7 +254,7 @@ resource ResGer = ParamX ** open Prelude in { -- adv : Str ; -- die Frage [a von Max] -- HL: cannot be extracted a : Agr ; -- isLight : Bool ; -- light NPs come before negation in simple clauses (expensive) - -- isPron : Bool } ; -- needed to put accPron before datPron + -- isPron : Bool ; -- needed to put accPron before datPron w : Weight } ; mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun = @@ -546,22 +542,23 @@ resource ResGer = ParamX ** open Prelude in { } ; VP : Type = { - s : Verb ; -- HL 6/2019: - nn : Agr => Str * Str * Str * Str -- - a1 : Str ; -- adv before negation, adV - a2 : Str ; -- heute = adv - adj : Str ; -- adjectival complement ("ich finde dich schön") - isAux : Bool ; -- is a double infinitive - inf : {s:Str ; isAux:Bool ; ctrl:Control} ; -- infinitival complement of VV or V2V - ext : Str ; -- dass sie kommt - infExt : Str ; -- infinitival complements of inf - -- e.g. ich hoffe [ihr zu helfen] zu versuchen - subjc : Preposition -- case of subject + s : Verb ; -- HL 6/2019: + nn : Agr => Str * Str * Str * Str ; -- + a1 : Str ; -- was: adV inserted before negation, unused? + a2 : Str ; -- adverb + adj : Str ; -- adjectival complement of V(2)A, e.g. ich finde dich schön + isAux : Bool ; -- is a double infinitive?, e.g. müssen:VV, lassen:V2V + ext : Str ; -- sentential complement of V(2)S, V(2)Q, e.g. dass|ob sie kommt + inf : {inpl: (Agr => Str)*Str ; -- infinitival complement of V(2)V HL 3/2022 + extr: (Agr => Str)} ; -- e.g. ihn [] versuchen (lasse) [, ihr zu helfen] + c1 : Preposition -- case of subject } ; - VPSlash = VP ** {c2 : Preposition ; - objCtrl : Bool } ; -- True = embedded reflexives agree with object + VPSlash = VP ** {c2 : Preposition ; objCtrl : Bool} ; -- HL 3/2019 objCtr added + + -- objCtrl distinguishes object-control from subject-control verb v:V2V in VP.s: + -- if True, reflexives in vp.inf and vp.nn have to agree with c2-object (added + -- by ComplSlash), else with subject (added by mkClause). useVP : VP -> VPC = \vp -> let @@ -604,11 +601,12 @@ resource ResGer = ParamX ** open Prelude in { Cond => vf True (wuerde a) vinf [] ; --# notpresent Pres => vf b (vfin b m t a) [] [] } ; - VPFinite m t Anter => case t of { --# notpresent - Pres | Past => vf True (hat m t a) vpart [] ; --# notpresent + VPFinite m t Anter => case t of { + Past => vf True (hat m t a) vpart [] ; --# notpresent Fut => vf True (wird m a) vpart haben ; --# notpresent - Cond => vf True (wuerde a) vpart haben --# notpresent - } ; --# notpresent + Cond => vf True (wuerde a) vpart haben ; --# notpresent + Pres => vf True (hat m t a) vpart [] + } ; VPImperat False => vf False (verb.s ! VImper (numberAgr a)) [] [] ; VPImperat True => vf False (verb.s ! VFin False (VPresSubj Pl P3)) [] [] ; VPInfinit Anter => vf True [] (vpart ++ haben) [] ; --# notpresent @@ -616,31 +614,23 @@ resource ResGer = ParamX ** open Prelude in { } } ; - predV : Verb -> VPSlash = predVGen False ; + predV : Verb -> VP = predVGen False ; predVc : Verb ** {c2 : Preposition} -> VPSlash = \v -> predV v ** {c2 = v.c2 ; objCtrl = False} ; - predVGen : Bool -> Verb -> VPSlash = \isAux, verb -> { - s = { - s = verb.s ; - prefix = verb.prefix ; - particle = verb.particle ; - aux = verb.aux ; - vtype = verb.vtype - } ; + predVGen : Bool -> Verb -> VP = \isAux, verb -> { + s = verb ; a1,a2 : Str = [] ; - nn : Agr => Str * Str * Str * Str * Str * Str = case verb.vtype of { - VAct => \\_ => <[],[],[],[],[],[]> ; - VRefl c => \\a => + nn : Agr => Str * Str * Str * Str = case verb.vtype of { + VAct => \\_ => <[],[],[],[]> ; + VRefl c => \\a => } ; isAux = isAux ; ---- - inf = {s=[]; isAux=True; ctrl=NoC} ; -- default infinitive complement - ext,infExt,adj : Str = [] ; -- (isAux=True => no endcomma) - subjc = PrepNom ; - -- Dummy values for subtyping. - c2 = PrepNom ; - objCtrl = False + -- default infinitival complement: + inf = {inpl = <\\_ => [], []>; extr = \\_ => []} ; + ext,adj : Str = [] ; + c1 = PrepNom } ; auxPerfect : Verb -> VForm => Str = \verb -> @@ -702,100 +692,109 @@ resource ResGer = ParamX ** open Prelude in { -- IL 24/04/2018 Fixing the scope of reflexives objAgr : { a : Agr } -> VP -> VP = \obj,vp -> vp ** { - nn = \\a => vp.nn ! obj.a } ; - -- HL: if reflexive only: + nn = \\a => vp.nn ! obj.a ; + inf = {inpl = <\\a => vp.inf.inpl.p1 ! obj.a, vp.inf.inpl.p2> ; -- HL 3/2022 + extr = \\a => vp.inf.extr ! obj.a} } ; -- HL 3/2022 -- Extending a verb phrase with new constituents. - insertObj : (Agr => Str) -> VPSlash -> VPSlash = \obj,vp -> -- obj:Comp A|Adv|CN - vp ** { nn = \\a => let vpnn = vp.nn ! a - in } ; + insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> -- obj:Comp A|Adv|CN + vp ** { nn = \\a => let vpnn = vp.nn ! a in + } ; insertObjc : (Agr => Str) -> VPSlash -> VPSlash = \obj,vp -> insertObj obj vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl } ; insertObjNP : NP -> Preposition -> VPSlash -> VPSlash = \np,prep,vp -> let c = case prep.c of { NPC cc => cc ; _ => Nom } ; - obj : Agr => Str = \\_ => appPrepNP prep np ; + obj = appPrepNP prep np ; in vp ** { - nn = \\a => -- HL 11/6/19: rough objNP order: (p5,p6 = splitInfExt) - let vpnn = vp.nn ! a in -- vfin < accPron < refl < (gen|dat)Pron < nonPronNP < neg < prepNP < vinf|comp -{- less expensive if isLight is removed from NPs: - case of { - -- (assuming v.c2=acc) nonPron: dat < acc|gen (acc < gen not enforced) - => -- - ; - => -- - ; - => -- - ; - => -- - ; - <_, True,_ > => -- - - } --} --- expensive: -- vfin < accPron < refl < (gen|dat)Pron < lightNP < neg < heavyNP|PP < vinf|comp - case of { - => -- - ; - => -- - ; + nn = \\a => + let vpnn = vp.nn ! a in + -- HL 11/6/19: rough object NP order (expensive): + -- vfin < accPron < refl < (gen|dat)Pron < lightNP < neg < heavyNP|PP < vinf|comp + case of { -- 2 * 3 * 4 = 24 cases + => -- + ; + => -- + ; => -- - ; - => -- (assuming v.c2=acc) nonPron: dat < acc|gen + ; + => -- (assuming v.c2=acc) nonPron: dat < acc|gen -- - ; + ; => -- - ; + ; => -- - ; + ; => -- - } + } } ; -- the ordering of objects of v:V3 (and v:V4) is also determined by Slash?V3 (and Slash?V4) insertObjRefl : VPSlash -> VPSlash = \vp -> -- HL 6/2019, to order reflPron < neg < prep+reflPron let prep = vp.c2 ; - b = notB prep.isPrep ; c = case prep.c of { NPC cc => cc ; _ => Acc } ; - obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! c ; + obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! c ; -- HL: to test ReflVP: reflPronSelf in vp ** { nn = \\a => let vpnn = vp.nn ! a in - case b of { - True => ; - False => } + case prep.isPrep of { + False => ; + True => } } ; - insertAdV : Str -> VP -> VP = \adv,vp -> vp ** { -- not used in RGL, so VP.a1 can be skipped + insertAdV : Str -> VP -> VP = \adv,vp -> vp ** { -- not used in Ger, so VP.a1 can be skipped a1 = adv ++ vp.a1 } ; -- cf. AdvVP(Slash),AdVVP(Slash) insertAdv : Str -> VP -> VP = \adv,vp -> vp ** { a2 = vp.a2 ++ adv } ; - insertExtrapos : Str -> VPSlash -> VPSlash = \ext,vp -> vp ** { + insertExtrapos : Str -> VP -> VP = \ext,vp -> vp ** { ext = vp.ext ++ ext } ; - insertInfExt : Str -> VPSlash -> VPSlash = \infExt,vp -> vp ** { - infExt = vp.infExt ++ infExt } ; + -- HL 3/2022: to do nested infinitival objects in ComplVV, SlashVV, SlashV2V + -- embed into = + embedInf : (Agr => Str) * Str -> (Agr => Str) * Str -> (Agr => Str) * Str = + \f,g -> <\\a => g.p1!a ++ f.p1!a, f.p2 ++ g.p2> ; - -- HL: to handle infExt in ComplVV and SlashVV, SlashV2V - insertInfExtraObj : (Agr => Str) -> VPSlash -> VPSlash = \objs,vp -> vp ** { - nn = \\a => let vpnn = vp.nn ! a in - - } ; - insertInfExtraInf : (Agr => Str) -> VPSlash -> VPSlash = \inf,vp -> vp ** { - nn = \\a => let vpnn = vp.nn ! a in - - } ; + -- Futur-II: (ich werde) ihn dir ++ haben ++ helfen lassen + insertInf : {inpl:(Agr => Str)*Str ; extr:(Agr => Str)} -> VP -> VP = + \inf,vp -> vp ** {inf = {inpl = embedInf inf.inpl vp.inf.inpl ; + extr = \\agr => vp.inf.extr!agr ++ inf.extr!agr}} ; - insertInf : {s:Str;isAux:Bool;ctrl:Control} -> VPSlash -> VPSlash = \inf,vp -> vp ** { - inf = {s = inf.s ++ vp.inf.s ; isAux = inf.isAux ; ctrl=inf.ctrl} } ; + glueInpl : (Agr => Str)*Str -> (Agr => Str) = + \inplace -> \\agr => (inplace.p1!agr ++ inplace.p2) ; - insertAdj : Str -> Str * Str -> Str -> VPSlash -> VPSlash = \adj,c,ext,vp -> vp ** { + -- HL 3/22: extract infzu-complement, leave inf-complement in-place + mkInf : Bool -> Anteriority -> Polarity -> VP -> + {inpl : (Agr => Str) * Str ; extr : (Agr => Str)} = + \isAux,ant,pol,vp -> + let + vpi = infVP isAux ant pol vp ; + topInpl = ; + emptyInpl : (Agr => Str) * Str = <\\_ => [], []> ; + comma = bindComma + in + case of { + -- 1: {s=will, inpl=<(sich, waschen) können>, extr = []} + => {inpl = embedInf vpi.inpl topInpl ; + extr = \\agr => vpi.extr!agr} ; + -- 2: {s=will; inpl=<[], versuchen>, extr = sich zu waschen} + => {inpl = topInpl ; + extr = \\agr => (glueInpl vpi.inpl)!agr ++ vpi.extr!agr} ; + -- 3: {s=wagt; inpl=<[], []>, extr = (sich, waschen) zu wollen} + => {inpl = emptyInpl ; + extr = let moved = embedInf vpi.inpl topInpl + in \\agr => comma ++ (glueInpl moved)!agr ++ vpi.extr!agr} ; + -- 4: {s=wagt, inpl=<[], []>, extr = zu versuchen, (sich zu waschen)} + => {inpl = emptyInpl ; + extr = \\agr => comma ++ (glueInpl topInpl)!agr ++ vpi.extr!agr} + } ; + + insertAdj : Str -> Str * Str -> Str -> VP -> VP = \adj,c,ext,vp -> vp ** { nn = \\a => let vpnn = vp.nn ! a in ; + vpnn.p3, vpnn.p4> ; adj = vp.adj ++ adj ++ c.p2 ; -- neugierig auf das Buch ext = vp.ext ++ ext} ; @@ -809,7 +808,8 @@ resource ResGer = ParamX ** open Prelude in { s : Mood => Tense => Anteriority => Polarity => Order => Str } ; - mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> let vps = useVP vp in { + mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> + let vps = useVP vp in { s = \\m,t,a,b,o => let ord = case o of { @@ -817,55 +817,44 @@ resource ResGer = ParamX ** open Prelude in { _ => False } ; verb = vps.s ! ord ! agr ! VPFinite m t a ; + haben = verb.inf2 ; neg = negation ! b ; obj1 = (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ; -- refl ++ pronouns ++ light nps obj2 = (vp.nn ! agr).p3 ; -- pp-objects and heavy nps obj3 = (vp.nn ! agr).p4 ++ vp.adj ++ vp.a2 ; -- pred.AP|CN|Adv, via useComp HL 6/2019 compl = obj1 ++ neg ++ obj2 ++ obj3 ; - -- leave inf-complement of +auxV(2)V in place, + infObjs = (vp.inf.inpl.p1)!agr ; + infPred = vp.inf.inpl.p2 ; + -- leave inf-complement of +auxV(2)V in place, -- extract infzu-complement of -auxV(2)V: (ComplVV, SlashV2V) - infExt : Str * Str = case vp.inf.isAux of - { True => <(vp.nn!agr).p6,[]> ; _ => <[],(vp.nn!agr).p6> } ; - extra = infExt.p2 ++ vp.ext ; - infCompls = -- () tun | ihn (es tun) lassen | ihm [es zu tun] versprechen - (vp.nn ! agr).p5 ++ infExt.p1 ++ vp.inf.s ; - comma = case orB vp.isAux (case vp.inf.ctrl of { NoC => True ; _ => False }) of { - True => [] ; _ => bindComma} ; - inf : Str = - case of { - => --# notpresent - -- haben () tun wollen | - -- ihn haben (es tun) lassen wollen () | - -- ihm haben () versprechen wollen (, es zu tun) - (vp.nn ! agr).p5 ++ verb.inf2 ++ infExt.p1 ++ vp.inf.s ++ verb.inf ; --# notpresent - <_, Anter,True> => --# notpresent - -- tun wollen [] | ihn (es tun) lassen wollen [] | - -- ihm () versprechen wollen [] (, es zu tun) - infCompls ++ verb.inf ++ verb.inf2 ; --# notpresent - => --# notpresent - infCompls ++ verb.inf ++ verb.inf2 ; --# notpresent - => --# notpresent - -- gebeten haben , es zu tun () | gebeten haben , ihn (es tun) zu lassen - verb.inf ++ verb.inf2 ++ comma ++ infCompls ; --# notpresent - _ => verb.inf2 ++ verb.inf ++ comma ++ infCompls } ; - inffin : Str = - case of { - -- ... wird|würde haben kommen wollen --# notpresent - => (vp.nn ! agr).p5 ++ verb.fin --# notpresent - ++ verb.inf2 ++ infExt.p1 ++ vp.inf.s ++ verb.inf ; --# notpresent - --# notpresent - => (vp.nn ! agr).p5 ++ infExt.p1 ++ verb.fin --# notpresent - ++ vp.inf.s ++ verb.inf ++ verb.inf2 ; -- double inf --# notpresent - <_, _ ,True> - => infCompls ++ verb.inf ++ verb.inf2 ++ verb.fin ; -- or just auxiliary vp - <_, _ ,False> - => verb.inf ++ verb.inf2 ++ verb.fin ++ comma ++ infCompls - } ; + infCompl : Str = case of { + => [] ; --# notpresent + _ => infObjs ++ infPred } ; + pred : {inf, infComplfin : Str} = case of { + => --# notpresent + {inf = infObjs ++ haben ++ infPred ++ verb.inf ; --# notpresent Duden 318 + infComplfin = -- es ++ wird ++ haben ++ tun ++ wollen --# notpresent + infObjs ++ verb.fin ++ haben ++ infPred ++ verb.inf} ; --# notpresent + <_,Anter,True> => --# notpresent + {inf = verb.inf ++ haben ; --# notpresent + infComplfin = -- es ++ wird/hat/hatte ++ tun ++ wollen --# notpresent + infObjs ++ verb.fin ++ infPred ++ verb.inf ++ haben} ; --# notpresent + => + {inf = verb.inf ++ haben ; + infComplfin = -- es zu tun ++ [] ++ [] ++ versucht + infCompl ++ verb.inf ++ haben ++ verb.fin} + ; --# notpresent + _ => --# notpresent + {inf = verb.inf ++ haben ; --# notpresent + infComplfin = -- es zu tun ++ versucht ++ [] ++ hat --# notpresent + infCompl ++ verb.inf ++ haben ++ verb.fin} --# notpresent + } ; + extra = vp.inf.extr!agr ++ vp.ext ; in - case o of { - Main => subj ++ verb.fin ++ compl ++ inf ++ extra ; - Inv => verb.fin ++ subj ++ compl ++ inf ++ extra ; - Sub => subj ++ compl ++ inffin ++ extra + case o of { + Main => subj ++ verb.fin ++ compl ++ infCompl ++ pred.inf ++ extra ; + Inv => verb.fin ++ subj ++ compl ++ infCompl ++ pred.inf ++ extra ; + Subj => subj ++ compl ++ pred.infComplfin ++ extra } } ; @@ -886,34 +875,60 @@ resource ResGer = ParamX ** open Prelude in { es wird nicht besser -} - infVP : Bool -> VP -> ((Agr => Str) * Str * Str * Str) = - \isAux, vp -> let vps = useVP vp in + infVP = overload { + infVP : Bool -> VP -> ((Agr => Str) * Str * Str * Str) + = infVP_orig ; -- from gf-3.9, + infVP : Bool -> Anteriority -> Polarity -> VP + -> { objs:(Agr => Str) ; pred:Str; inpl:(Agr=>Str)*Str ; extr:(Agr=>Str) } + = infVP_ant ; -- admit infinitive in Anter anteriority and Neg polarity + } ; + + infVP_orig : Bool -> VP -> ((Agr => Str) * Str * Str * Str) = + \isAux, vp -> let vps = useVP vp ; + infExt = vp.inf.extr ! agrP3 Sg -- HL 3/22 + in < \\agr => (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 ++ vp.a2, vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit Simul).inf, -- vp.a1 ! Pos - vp.inf.s, - vp.infExt ++ vp.ext + vp.inf.inpl.p2, -- ! HL + infExt ++ vp.ext > ; - useInfVP : Bool -> VP -> Str = \isAux,vp -> - let vpi = infVP isAux vp in - vpi.p1 ! agrP3 Sg ++ vpi.p3 ++ vpi.p2 ++ vpi.p4 ; + infVP_ant : Bool -> Anteriority -> Polarity -> VP -- HL 3/22 + -> { objs:(Agr => Str) ; pred:Str ; inpl:(Agr=>Str)*Str ; extr:(Agr=>Str) } = + \isAux, ant, pol, vp -> let vps = useVP vp in + { + objs = \\agr => (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ++ negation ! pol ++ (vp.nn ! agr).p3 + ++ vp.a2 ++ (vp.nn ! agr).p4 ; -- objects + predicative A|CN|NP + pred = vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit ant).inf ; + -- inplace and extracted parts of vp.inf: + inpl = vp.inf.inpl ; + extr = vp.inf.extr + } ; - infzuVP : Bool -> Control -> Anteriority -> Polarity -> VP -- HL - -> { objs:(Agr => Str) ; pred:{s:Str;isAux:Bool;ctrl:Control} ; inf:Str ; ext:Str } = - \isAux, ctrl, ant, pol, vp -> let vps = useVP vp in + infVPSlash : Bool -> Anteriority -> Polarity -> VPSlash -- HL 3/22 + -> { objs:(Agr => Str) ; pred:Str; inpl:(Agr=>Str)*Str ; extr:(Agr=>Str) } = + \isAux, ant, pol, vp -> let vps = useVP vp in { objs = \\agr => (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ++ negation ! pol ++ (vp.nn ! agr).p3 ++ vp.a2 ++ (vp.nn ! agr).p4 ; -- objects + predicative A|CN|NP - pred = { s = vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit ant).inf ; - isAux = vp.isAux ; ctrl = ctrl } ; - inf = vp.inf.s ; - ext = vp.ext - } ; + pred = vp.inf.inpl.p2 ++ vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit ant).inf ; + -- inplace and extracted parts of vp.inf: + inpl = ; -- move the predicate part to pred + extr = vp.inf.extr + } ** {c2 = vp.c2 ; objCtrl = vp.objCtrl} ; + + -- for CatGer.linref VP and Verb.embedVP: + useInfVP : Bool -> VP -> Str = \isAux,vp -> + -- let vpi = infVP isAux vp in + -- vpi.p1 ! agrP3 Sg ++ vpi.p3 ++ vpi.p2 ++ vpi.p4 ; + let vpi = infVP isAux Simul Pos vp ; -- HL 3/2022 + agr : Agr = (Ag Masc Sg P3) ; + glue : (Agr => Str)*Str -> Str = \i -> i.p1!agr ++ i.p2 + in + glue (embedInf vpi.inpl ) ++ vpi.extr!agr ++ vp.ext ; -- The nominative case is not used as reflexive, but defined here -- so that we can reuse this in personal pronouns. --- The missing Sg "ihrer" shows that a dependence on gender would --- be needed. reflPron : Agr => Case => Str = table { Ag _ Sg P1 => caselist "ich" "mich" "mir" "meiner" ; @@ -984,12 +999,10 @@ resource ResGer = ParamX ** open Prelude in { } ; -- Function that allows the construction of non-nominative subjects. - mkSubj : NP -> Preposition -> Str * Agr = \np, subjc -> + mkSubj : NP -> Preposition -> Str * Agr = \np, prep -> let - sub = subjc ; - agr = case sub.c of { NPC Nom => np.a ; _ => Ag Masc Sg P3 } ; - subj = appPrepNP sub np + agr = case prep.c of { NPC Nom => np.a ; _ => Ag Masc Sg P3 } ; + subj = appPrepNP prep np in ; } - diff --git a/src/german/SentenceGer.gf b/src/german/SentenceGer.gf index fc33fa22d..cf30c30c9 100644 --- a/src/german/SentenceGer.gf +++ b/src/german/SentenceGer.gf @@ -4,9 +4,9 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { lin - PredVP np vp = - let subj = mkSubj np vp.subjc - in mkClause subj.p1 subj.p2 vp ; + PredVP np vp = + let subj = mkSubj np vp.c1 + in mkClause subj.p1 subj.p2 vp ; {- applies verb's subject case to subject ; forces 3rd person sg agreement for any non-nom subjects --> @@ -26,16 +26,16 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { } ; agr = Ag Fem (numImp n) ps.p1 ; --- g does not matter verb = vps.s ! False ! agr ! VPImperat ps.p3 ; - inf = vp.inf.s ++ verb.inf ; -- HL .nn + inf = vp.inf.inpl.p2 ++ verb.inf ; -- HL .s/.inpl.p2 obj = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 in -- verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ negation ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext } ; - SlashVP np vp = - let subj = mkSubj np vp.subjc - in mkClause subj.p1 subj.p2 vp ** {c2 = vp.c2} ; + SlashVP np vp = + let subj = mkSubj np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent + in mkClause subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; -- reflexives in vp instantiated to np.a AdvSlash slash adv = { s = \\m,t,a,b,o => slash.s ! m ! t ! a ! b ! o ++ adv.s ; diff --git a/src/german/VerbGer.gf b/src/german/VerbGer.gf index 4981e3a47..7a25b1a04 100644 --- a/src/german/VerbGer.gf +++ b/src/german/VerbGer.gf @@ -15,37 +15,20 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { insertInf vpi.p2 ( insertObjc vpi.p1 vps))) ; -} - -- HL 7/19 - ComplVV v vp = -- will|wage (es ([]|zu) tun [] | ihn [es tun] ([]|zu) lassen + + ComplVV v vp = -- HL 3/22: leave inf-complement in-place, extract infzu-complement let - vps = predVGen v.isAux v ; - vpi = infzuVP v.isAux SubjC Simul Pos vp ; - -- { objs: ihm ; pred: []/zu versprechen, objInf: sich/es zu tun } - -- (ich) vfin:werde (ihm ([]/zu) versprechen) vinf:(wollen/gewagt haben) (, es zu tun) - -- (ich) vfin:werde (ihn (es tun) lassen)/[] vinf:(wollen/gewagt haben) []/(, ihn (es tun) zu lassen) - extInfzu = case of { => (vp.nn!(Ag Masc Sg P3)).p6 ; _ => []} ; - comma = case vp.inf.ctrl of { NoC => [] ; _ => bindComma} ; -- es (zu) tun - embeddedInf : Agr => Str = - case of { -- vv + vp + [embeddedInf] - -- will [es lesen] können | will ihn [es lesen] lassen - => \\agr => (vp.nn!agr).p5 ++ (vp.nn!agr).p6 ++ vpi.inf ; - -- will ihn [euch (extInfzu) bitten] lassen - => \\agr => (vp.nn!agr).p5 ++ vpi.inf ; -- ++ (vp.nn!agr).p6 => extInfzu - -- will es lesen [] | will ihn bitten [, es zu lesen] | will ihn bitten [, sie es lesen zu lassen] - => \\agr => comma ++ (vp.nn!agr).p5 ++ (vp.nn!agr).p6 ++ vpi.inf ; - -- will ihn bitten [, ihr zu helfen, es zu lesen] - => \\agr => comma ++ (vp.nn!agr).p5 ++ vpi.inf ++ (vp.nn!agr).p6 } + vps = predVGen v.isAux v ; -- e.g. will.isAux=True | wagt.isAux=False + inf = mkInf v.isAux Simul Pos vp in - insertExtrapos (extInfzu ++ vpi.ext) ( -- vps.ext <- vp's extracted embedded infzu + vp's object-sentence - insertInf vpi.pred ( -- vps.inf <- vp's infinite main verb - insertInfExtraObj vpi.objs ( -- vps.nn.p5 <- vp's object nps - insertInfExtraInf embeddedInf vps))) ; + insertExtrapos vp.ext ( + insertInf inf vps) ; ComplVS v s = insertExtrapos (comma ++ conjThat ++ s.s ! Sub) (predV v) ; ComplVQ v q = insertExtrapos (comma ++ q.s ! QIndir) (predV v) ; - ComplVA v ap = insertAdj (v.c2.s ++ ap.s ! APred) ap.c ap.ext (predV v) ; -- changed + ComplVA v ap = insertAdj (ap.s ! APred) ap.c ap.ext (predV v) ; SlashV2a v = (predVc v) ; @@ -53,9 +36,9 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { Slash3V3 v np = insertObjNP np v.c3 (predVc v) ; SlashV2S v s = - insertExtrapos (comma ++ conjThat ++ s.s ! Sub) (predVc v) ; + insertExtrapos (comma ++ conjThat ++ s.s ! Sub) (predV v) ** {c2 = v.c2; objCtrl = False} ; SlashV2Q v q = - insertExtrapos (comma ++ q.s ! QIndir) (predVc v) ; + insertExtrapos (comma ++ q.s ! QIndir) (predV v) ** {c2 = v.c2; objCtrl = False} ; {- SlashV2V v vp = let @@ -66,28 +49,26 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { insertInfExt vpi.p3 ( insertInf vpi.p2 ( insertObjc vpi.p1 vps))) ; + -} - SlashV2V v vp = -- jmdn bitten, (\agr => sich!agr das Buch zu merken) HL 7/19 + SlashV2V v vp = -- (jmdn) bitten, sich zu waschen | sich waschen lassen HL 7/19 let - vps = (predVGen v.isAux v) ** { c2 = v.c2 ; objCtrl = case v.ctrl of {ObjC => True ; _ => False}} ; - vpi = infzuVP v.isAux v.ctrl Simul Pos vp ; - comma : Str = case of { | <_,NoC> => [] ; _ => bindComma} ; - embeddedInf : Agr => Str = case vp.inf.isAux of { - True => \\agr => comma ++ (vp.nn!agr).p5 ++ (vp.nn!agr).p6 ++ vpi.inf ; -- ihn es lesen (zu) lassen - False => \\agr => comma ++ (vp.nn!agr).p5 ++ vpi.inf ++ (vp.nn!agr).p6 } -- ihn (zu) bitten , es zu lesen + vps = predVGen v.isAux v ; -- e.g. verspricht|bittet.isAux=False | läßt.isAux=True + inf = mkInf v.isAux Simul Pos vp in - insertExtrapos vpi.ext ( -- vps.ext <- vp's object-sentence ++ extractedInfzu? - insertInf vpi.pred ( -- vps.inf <- vp's infinite main verb - insertInfExtraObj vpi.objs ( -- vps.nn.p5 <- vp's object nps - insertInfExtraInf embeddedInf vps))) ; + insertExtrapos vp.ext ( + insertInf inf vps) ** {c2 = v.c2 ; objCtrl = v.objCtrl} ; SlashV2A v ap = - insertAdj (ap.s ! APred) ap.c ap.ext (predVc v) ; + insertAdj (ap.s ! APred) ap.c ap.ext (predV v) ** {c2 = v.c2; objCtrl = False} ; ComplSlash vps np = - let vp = insertObjNP np vps.c2 vps ; - -- IL 24/04/2018 force reflexive in the VPSlash to take the agreement of np. - in case vps.objCtrl of { True => objAgr np vp ; _ => vp } ; + -- IL 24/04/2018 force reflexive in the VPSlash to take the agreement of np. + -- HL 3/22 better before inserting np, using objCtrl + let vp = case vps.objCtrl of { True => objAgr np vps ; _ => vps } + ** { c2 = vps.c2 ; objCtrl = vps.objCtrl } ; + in insertObjNP np vps.c2 vp ; + {- SlashVV v vp = let @@ -95,26 +76,34 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { vps = predVGen v.isAux v ** {c2 = vp.c2 } ; in vps ** insertExtrapos vpi.p3 ( - insertInf {s=vpi.p2;isAux=vp.isAux;ctrl=SubjC} ( -- insertInf vpi.p2 ( + insertInf vpi.p2 ( insertObj vpi.p1 vps)) ; -} - SlashVV v vp = -- will|hoffe ((zu) lesen | ihr (zu) geben | (zu) bitten, es zu lesen) + + -- SlashVV v vps is like ComplVV v vp, but infinite vps should not be extracted + SlashVV v vp = -- HL 3/2022 let - vps = (predVGen v.isAux v) ** { c2 = vp.c2 } ; - vpi = infzuVP v.isAux SubjC Simul Pos vp ; -- (zu) (lesen | ihr geben | bitten, es zu lesen) - comma : Str = case of { | <_,NoC> => [] ; _ => bindComma} ; - embeddedInf : Agr => Str = case vp.inf.isAux of { - True => \\agr => comma ++ (vp.nn!agr).p5 ++ (vp.nn!agr).p6 ++ vpi.inf ; -- es lesen (zu) lassen - False => \\agr => comma ++ (vp.nn!agr).p5 ++ vpi.inf ++ (vp.nn!agr).p6 } -- (zu) bitten, es zu lesen + vps = predVGen v.isAux v ; -- e.g. will.isAux=True | wagt.isAux=False + vpi = infVPSlash v.isAux Simul Pos vp ; -- differs from infVP ! + inf : {inpl: (Agr => Str) * Str ; extr : (Agr => Str)} = + let + topInpl = ; + emptyInpl : (Agr => Str) * Str = <\\_ => [], []> ; + in + case of { + -- wagt lesen zu wollen + => {inpl = emptyInpl ; + extr = let moved = (embedInf vpi.inpl topInpl) + in \\agr => (glueInpl moved)!agr ++ (vpi.extr!agr)} ; + _ => -- wagt zu lesen zu versuchen + -- will lesen können | will zu lesen wagen + {inpl = embedInf vpi.inpl topInpl ; extr = vpi.extr} + } ; in - insertExtrapos vpi.ext ( -- vps.ext <- vp's object-sentence ++ extractedInfzu? - insertInf vpi.pred ( -- vps.inf <- vp's infinite main verb - insertInfExtraObj vpi.objs ( -- vps.nn.p5 <- vp's object nps - insertInfExtraInf embeddedInf vps))) ; + insertExtrapos vp.ext ( + insertInf inf vps) ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}; --- {- HL 8/19: this slightly modified SlashV2VNP is expensive even with NP.w:Weight - - -- order of embedded objects wrong: +{- -- order of embedded objects wrong: -- Lang> p "the woman that you beg me to listen to" | l -- the woman that you beg me to listen to -- die Frau , der ihr mich zuzuhören bittet @@ -123,19 +112,25 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { SlashV2VNP v np vp = let vpi = infVP v.isAux vp ; - vps = predVGen v.isAux v ** {c2 = vp.c2} ; -- objCtrl = ? + vps = predVGen v.isAux v ** {c2 = vp.c2} ; in vps ** insertExtrapos vpi.p3 ( - insertInf {s=vpi.p2;isAux=v.isAux;ctrl=v.ctrl} ( -- insertInf vpi.p2 + insertInf vpi.p2 ( insertObj vpi.p1 ( insertObj (\\_ => appPrepNP v.c2 np) vps))) ; - -- HL: version with infzuVP in tests/german/TestLangGer.gf, too expensive +-} + -- expensive: + SlashV2VNP 503.884.800 (2880,540), reaches memory limit with SlashVV + -- does not work for nested uses: the nn-levels are confused HL 3/22 + + SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 + insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; + UseComp comp = insertExtrapos comp.ext (insertObj comp.s (predV sein_V)) ; -- agr not used -- adj slot not used here for e.g. "ich bin alt" but same behaviour as NPs? - -- "ich bin nicht alt" "ich bin nicht Doris" + -- "ich bin nicht alt" "ich bin nicht Doris" UseCopula = predV sein_V ; @@ -162,7 +157,10 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { -- (\\k => usePrepC k (\c -> reflPron ! a ! c))) vp ; ReflVP vp = insertObjRefl vp ; -- HL, 19/06/2019 - PassV2 v = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) ; + PassV2 v = -- acc object -> nom subject; all others: same PCase + let c = case of { + => NPC Nom ; _ => v.c2.c} + in insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) ** { c1 = v.c2 ** {c = c} } ; {- HL: The construction VPSlashPrep : VP -> Prep -> VPSlash does not exist in German. In abstract/Verb.gf, the example diff --git a/tests/german/TestLang.gf b/tests/german/TestLang.gf index 9991d5da3..107765a8b 100644 --- a/tests/german/TestLang.gf +++ b/tests/german/TestLang.gf @@ -1,7 +1,7 @@ abstract TestLang = - Grammar, + Grammar - [SlashVP, RelSlash], TestLexiconGerAbs --- , Construction + , Construction ** { flags startcat=Phr ; @@ -32,4 +32,12 @@ abstract TestLang = Pass2V3 : V3 -> NP -> VP ; -- uns erklärt werden ; Eng give_V3[indir,dir]: we are given the book Pass2V4 : V4 -> NP -> VPSlash ; -- bei dir (für Gold) gekauft werden + + cat + ClauseSlash ; + + fun + RelSlash : RP -> ClauseSlash -> RCl ; + SlashVP : NP -> VPSlash -> ClauseSlash ; + } ; diff --git a/tests/german/TestLangEng.gf b/tests/german/TestLangEng.gf index 794c64896..9940ada8e 100644 --- a/tests/german/TestLangEng.gf +++ b/tests/german/TestLangEng.gf @@ -4,7 +4,7 @@ concrete TestLangEng of TestLang = GrammarEng , TestLexiconEng --- , ConstructionEng + , ConstructionEng ** open (R=ResEng), (P=ParadigmsEng), Prelude, (E=ExtendEng) in { diff --git a/tests/german/TestLangGer.gf b/tests/german/TestLangGer.gf index fb282e1d7..f25e2946f 100644 --- a/tests/german/TestLangGer.gf +++ b/tests/german/TestLangGer.gf @@ -2,9 +2,9 @@ -- use the modified files in gf-rgl/src/german concrete TestLangGer of TestLang = - GrammarGer - [PassV2] -- to improve these ,ComplVV,SlashVV,SlashV2V,SlashV2VNP - , TestLexiconGer - [helfen_V2V, warnen_V2V, versprechen_dat_V2V, lassen_V2V] --- , ConstructionGer -- needs SlashV2VNP of VerbGer + GrammarGer - [SlashVP, RelSlash] + , TestLexiconGer + , ConstructionGer ** open ResGer,Prelude,(P=ParadigmsGer) in { flags startcat = Phr ; unlexer = text ; lexer = text ; @@ -27,147 +27,221 @@ concrete TestLangGer of TestLang = ReflVPSlash v3 = -- reflexive use of v:V3, untested (insertObjRefl (predVc v3) ** {c2 = v3.c3}); - PassV2 v = -- insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) ; - let c = case of { - => NPC Nom ; _ => v.c2.c} -- acc object -> nom; all others: same PCase - in insertObjc (\\_ => v.s ! VPastPart APred) (predV werdenPass) ** { subjc = v.c2 ** {c = c} } ; - - PassV2Q v q = + PassV2Q v q = let c = case of { => NPC Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject - vp = insertObjc (\\_ => v.s ! VPastPart APred) (predV werdenPass) - ** { subjc = v.c2 ** {c = c} } + vp = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) + ** { c1 = v.c2 ** {c = c} } in insertExtrapos (bindComma ++ q.s ! QIndir) vp ; - PassV2S v s = + PassV2S v s = let c = case of { => NPC Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject - vp = insertObjc (\\_ => v.s ! VPastPart APred) (predV werdenPass) - ** { subjc = v.c2 ** {c = c} } + vp = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) + ** { c1 = v.c2 ** {c = c} } in insertExtrapos (bindComma ++ conjThat ++ s.s ! Sub) vp ; PassV2V v vp = - let c = case of { + let + inf = mkInf v.isAux Simul Pos vp ; -- ok for v.isAux=False, v.c2.c=Acc + c = case of { -- v.objCtrl=True HL 3/22 => NPC Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject - vp2 = insertObjc (\\_ => v.s ! VPastPart APred) (predV werdenPass) - ** { subjc = v.c2 ** {c = c} } - in insertExtrapos (bindComma ++ (useInfVP False vp)) vp2 ; -- misses subject agr for vp = ReflVP vps -{- + vp2 = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) + ** { c1 = v.c2 ** {c = c} } ; + in insertInf inf vp2 ; -- v=lassen needs in-place inf instead + PassVPSlash vp = let c = case of { - => NPC Nom ; _ => vp.c2.c} - in insertObjc (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) - ** {ext = vp.ext ; subjc = vp.c2 ** {c = c}} ; - -- regulates passivised object: accusative objects -> nom; all others: same case - -- this also gives "mit dir wird gerechnet" ; - -- the alternative linearisation ("es wird mit dir gerechnet") is not implemented - -- HL: does not work for vp = (Slash2V3 v np): uns wird den Beweis erklärt - -- vp = (SlashV2V v2v reflVP): wir werden gebeten, uns zu fragen , ob S + => NPC Nom ; _ => vp.c2.c} ; + ctrl = case vp.objCtrl of { True => False ; _ => True } -- always False? + in -- insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass ** {c1 = vp.c2 ** {c = c}}) + insertObj (\\_ => vp.s.s ! (VPastPart APred)) + (predV werdenPass ** {nn = vp.nn ; c1 = vp.c2 ** {c = c}}) + ** {ext = vp.ext ; inf = vp.inf ; c2 =vp.c2 ; objCtrl = ctrl } ; -- c2 ? + -- Scharolta: passivised object: acc object -> nom subject; all others: same case/prep + -- HL: does not work for vp = (Slash2V3 v np): uns wird *den Beweis erklärt + -- 3/22 works for vp = (SlashV2V v2v reflVP): wir werden gebeten, uns zu waschen + PastPartAP vp = { s = \\af => (vp.nn ! agrP3 Sg).p1 ++ (vp.nn ! agrP3 Sg).p2 ++ (vp.nn ! agrP3 Sg).p3 ++ (vp.nn ! agrP3 Sg).p4 ++ vp.adj ++ vp.a2 - ++ vp.inf.s ++ vp.infExt ++ vp.s.s ! VPastPart af ; + ++ vp.inf.inpl.p2 ++ vp.s.s ! VPastPart af ; isPre = True ; c = <[],[]> ; adj = [] ; - ext = vp.ext + ext = (vp.inf.extr ! agrP3 Sg) ++ vp.ext -- HL 5/4/2022 } ; --} + Pass2V3 v np = -- HL 7/19: making the (active) direct object to the (passive) subject - let vps = insertObjc (\\_ => (v.s ! VPastPart APred)) (predV werdenPass) - ** { subjc = PrepNom ; c2 = v.c3 } - in insertObjNP np vps.c2 vps ; + let vps = insertObj (\\_ => (v.s ! VPastPart APred)) (predV werdenPass) + ** { c1 = PrepNom ; c2 = v.c3 } + in insertObjNP np vps.c2 (vps ** {objCtrl = False}); Pass3V3 v np = -- HL 7/19: making the (active) indirect object to the (passive) subject let bekommen : Verb = P.habenV (P.irregV "bekommen" "bekommt" "bekam" "bekäme" "bekommen") ; - vps = insertObjc (\\_ => (v.s ! VPastPart APred)) (predV bekommen) - ** { subjc = PrepNom ; c2 = v.c2 } - in insertObjNP np vps.c2 vps ; + vps = insertObj (\\_ => (v.s ! VPastPart APred)) (predV bekommen) + ** { c1 = PrepNom ; c2 = v.c2 } + in insertObjNP np vps.c2 (vps ** {objCtrl = False}); {- Pass2V4 v np = let vps = -- : VPSlashSlash = insertObj (\\_ => (v.s ! VPastPart APred)) (predV werdenPass) - ** { subjc = PrepNom ; c2 = v.c3 ; c3 = v.c4 } + ** { c1 = PrepNom ; c2 = v.c3 ; c3 = v.c4 } in (insertObjNP np vps.c3 vps) ; -- Todo: Pass?V2S, Pass?V2Q, PassVS, PassVQ Pass?V2V -} - SlashV2Vneg v vp = -- versprechen, (\agr => sich!agr es nicht zu merken) + SlashV2Vneg v vp = -- HL 3/22 let - vps = (predVGen v.isAux v) ** { c2 = v.c2 } ; --; ctrl = v.ctrl } ; - vpi = infzuVP v.isAux v.ctrl Simul Neg vp ; - comma = case orB vp.isAux (case vp.inf.ctrl of { NoC => True ; _ => False }) of {True => [] ; _ => bindComma} ; - embeddedInf : Agr => Str = case vp.inf.isAux of { - True => \\agr => comma ++ (vp.nn!agr).p5 ++ (vp.nn!agr).p6 ++ vpi.inf ; -- ihn es lesen (zu) lassen - False => \\agr => comma ++ (vp.nn!agr).p5 ++ vpi.inf ++ (vp.nn!agr).p6 } -- ihn (zu) bitten , es zu lesen - in - insertExtrapos vpi.ext ( - insertInf vpi.pred ( - insertInfExtraObj vpi.objs ( - insertInfExtraInf embeddedInf vps))) ; - - lin -- with param Control in ../../src/german/ParadigmsGer.gf - helfen_V2V = P.mkV2V (P.irregV "helfen" "hilft" "half" "hälfe" "geholfen") P.datPrep ; - warnen_V2V = P.mkV2V (P.regV "warnen") P.accPrep ; - versprechen_dat_V2V = - P.subjV2V (P.mkV2V (P.irregV "versprechen" "verspricht" "versprach" "verspräche" "versprochen") P.datPrep) ; - lassen_V2V = P.auxV2V (P.irregV "lassen" "lasst" "ließ" "ließe" "gelassen") P.accPrep ; -- lasse dich (*zu) arbeiten + vps = (predVGen v.isAux v) ; + inf = mkInf v.isAux Simul Neg vp + in + insertExtrapos vp.ext ( + insertInf inf vps) ** {c2 = v.c2 ; objCtrl = v.objCtrl} ; -- SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy -- -- (the book) that (she (begged:V2V me:NP (to buy ()):VPSlash):VPSlash):ClSlash --- very expensive: --- + SlashV2V 2332800 (6480,40) --- + SlashV2VNP 2267481600 (4320,270) vs. (1080,90) in VerbGer, 305460 msec --- Languages: TestLangGer --- 623657 msec -{- - SlashV2VNP v np vp = - let - vps = (predVGen v.isAux v) ** { c2 = vp.c2 } ; -- objCtrl = - vpi = infzuVP v.isAux v.ctrl Simul Pos vp ; - -- comma = case of { => [] ; <_,NoC> => [] ; _ => bindComma} ; - embeddedInf : Agr => Str = - \\agr => "[" ++ (vp.nn!agr).p5 ++ (vp.nn!agr).p6 ++ vpi.inf ++ "]"; - -- embeddedInf : Agr => Str = case vp.inf.isAux of { - -- True => \\agr => comma ++ (vp.nn!agr).p5 ++ (vp.nn!agr).p6 ++ vpi.inf ; -- ihn es lesen (zu) lassen - -- False => \\agr => comma ++ (vp.nn!agr).p5 ++ vpi.inf ++ (vp.nn!agr).p6 } -- ihn (zu) bitten , es zu lesen - in - insertExtrapos vpi.ext ( -- vps.ext <- vp's object-sentence ++ extractedInfzu? - insertInf vpi.pred ( -- vps.inf <- vp's infinite main verb - insertInfExtraObj vpi.objs ( -- vps.nn.p5 <- vp's object nps - insertInfExtraInf embeddedInf ( - insertObjNP np v.c2 vps )))) ; --} +-- 3/22 expensive: +-- i -v -src TestLangGer.gf +-- + ComplSlash 699840 (355680,532) +-- + SlashV2V 259200 (1440,20) +-- + SlashV2VNP 503884800 (77760,540) +-- 243273 msec + {- TestLang> p "the book that we beg her to promise him to read" | l the book that we beg her to promise him to read -das Buch , das wir sie bitten , ihn zu versprechen [ [ ] zu lesen ] +das Buch , das wir sie bitten , ihm zu versprechen , zu lesen TestLang> p "the book that we beg her to beg him to read" | l the book that we beg her to beg him to read -das Buch , das wir sie bitten , ihn zu bitten [ [ ] zu lesen ] +das Buch , das wir sie bitten , ihn zu bitten , zu lesen TestLang: DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (UsePron we_Pron) (SlashV2VNP versprechen_dat_V2V (UsePron she_Pron) (SlashV2a read_V2)))))) TestLangEng: the book that we promise her to read -TestLangGer: das Buch , dem wir ihr versprechen , zu lesen Bug: dem => das +TestLangGer: das Buch , das wir ihr versprechen , zu lesen TestLang> p "the book that we beg her to sell to him" | l the book that we beg her to sell to him -das Buch , das wir ihm sie bitten , zu verkaufen -=> das Buch , das wir sie bitten , ihm zu verkaufen +das Buch , das wir sie bitten , ihm zu verkaufen + +p -lang=Ger "das Kind , auf das wir ihn bitten , zu warten ," | l +the child that we beg him to wait for +das Kind , auf das wir ihn bitten , zu warten + +pied piping: ~~> das Buch , das ihm zu verkaufen wir sie bitten - ~~ das Buch , an das zu glauben wir sie bitten +~~> das Kind , auf das zu warten wir ihn bitten Wrong in gf-3.9 as well: Lang> p "the woman that we beg him to listen to" | l the woman that we beg him to listen to -die Frau , die wir ihn zuzuhören bitten (Bug: die => der) +die Frau , der wir ihn bitten , zuzuhören Lang> p "the book that we beg her to sell to him" | l the book that we beg her to sell to him -das Buch , das wir ihn sie zu verkaufen bitten (Bug: ihn sie => sie ihm) -=> das Buch, das wir sie bitten, ihm zu verkaufen +das Buch, das wir sie bitten, ihm zu verkaufen + +Test reflexive resolution: + +gr -tr (PredVP (UsePron ?) (ComplSlash (SlashV2V lassen_V2V (ReflVP (SlashV2a wash_V2))) (UsePron ?))) | l + -} + +-- Reimplementation of SlashVP: replace mkClause by mkClSlash to let reflexives agree +-- with object in relative clauses, if objCtrl = true. To save memory, use +-- ClauseSlash.s : ... => RelGenNum => Str instead of : ... => Agr => Str. +-- + SlashVP 699840gf: out of memory (requested 2097152 bytes) with Agr => Str +-- + SlashVP 699840 (2880,160) with RelGenNum => Str; |Agr| = 18, |RelGenNum| = 5. +-- Todo: replace other uses of ClSlash by ClauseSlash + + lincat + ClauseSlash = { + s : Mood => ResGer.Tense => Anteriority => Polarity => Order => RelGenNum => Str ; + c2 : Preposition + } ; + + lin + SlashVP np vp = + let subj = mkSubj np vp.c1 + in mkClSlash subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; + + RelSlash rp cls = lin RCl { + s = \\m,t,a,p,gn => + appPrep cls.c2 (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ++ + cls.s ! m ! t ! a ! p ! Sub ! gn ; + c = (prepC cls.c2.c).c + } ; +{- + QuestSlash ip slash = { + s = \\m,t,a,p => + let + cls = slash.s ! m ! t ! a ! p ; + who = appPrep slash.c2 (\\k => usePrepC k (\c -> ip.s ! c)) ; + in table { + QDir => who ++ cls ! Inv ; + QIndir => who ++ cls ! Sub + } + } ; +-} + + + oper + gnToAgr : RelGenNum -> Agr = \gn -> + case gn of {RGenNum (GSg g) => Ag g Sg P3 ; + RGenNum GPl => Ag Neutr Pl P3 ; + RSentence => Ag Neutr Sg P3} ; + + + mkClSlash : Str -> Agr -> ResGer.VPSlash -> ClauseSlash = \subj,agr,vp -> + let vps = useVP vp in lin ClauseSlash { + c2 = vp.c2 ; + s = \\m,t,a,b,o,gn => + let + ord = case o of { + Sub => True ; -- glue prefix to verb + _ => False + } ; + verb = vps.s ! ord ! agr ! VPFinite m t a ; + haben = verb.inf2 ; + neg = negation ! b ; + ag : Agr = case vp.objCtrl of {True => gnToAgr gn ; _ => agr} ; + obj1 = (vp.nn ! ag).p1 ++ (vp.nn ! ag).p2 ; -- refl ++ pronouns ++ light nps + obj2 = (vp.nn ! ag).p3 ; -- pp-objects and heavy nps + obj3 = (vp.nn ! ag).p4 ++ vp.adj ++ vp.a2 ; -- pred.AP|CN|Adv, via useComp HL 6/2019 + compl : Str = obj1 ++ obj2 ++ neg ++ obj3 ; + infObjs = (vp.inf.inpl.p1) ! ag ; + infPred = vp.inf.inpl.p2 ; + infCompl : Str = case of { + => [] ; _ => infObjs ++ infPred } ; + pred : {inf, infComplfin : Str} = case of { + => --# notpresent + {inf = infObjs ++ haben ++ infPred ++ verb.inf ; --# notpresent Duden 318 + infComplfin = -- es ++ wird ++ haben ++ tun ++ wollen --# notpresent + infObjs ++ verb.fin ++ haben ++ infPred ++ verb.inf} ; --# notpresent + <_,Anter,True> => --# notpresent + {inf = verb.inf ++ haben ; --# notpresent + infComplfin = -- es ++ wird/hat/hatte ++ tun ++ wollen --# notpresent + infObjs ++ verb.fin ++ infPred ++ verb.inf ++ haben} ; --# notpresent + => + {inf = verb.inf ++ haben ; + infComplfin = -- es zu tun ++ [] ++ [] ++ versucht + infCompl ++ verb.inf ++ haben ++ verb.fin} + ; --# notpresent + _ => --# notpresent + {inf = verb.inf ++ haben ; --# notpresent + infComplfin = -- es zu tun ++ versucht ++ [] ++ hat --# notpresent + infCompl ++ verb.inf ++ haben ++ verb.fin} --# notpresent + } ; + extra : Str = (vp.inf.extr) ! ag ++ vp.ext ; + in + case o of { + Main => subj ++ verb.fin ++ compl ++ infCompl ++ pred.inf ++ extra ; + Inv => verb.fin ++ subj ++ compl ++ infCompl ++ pred.inf ++ extra ; + Subj => subj ++ compl ++ pred.infComplfin ++ extra + } + } ; + } diff --git a/tests/german/TestLexiconGer.gf b/tests/german/TestLexiconGer.gf index abcdc03da..ed94e82aa 100644 --- a/tests/german/TestLexiconGer.gf +++ b/tests/german/TestLexiconGer.gf @@ -23,8 +23,8 @@ oper \v,p2,p3,p4 -> lin V4 (v ** { c2=p2 ; c3=p3 ; c4=p4 }) ; dirV4 : V -> Prep -> Prep -> V4 = \v,c,d -> mkV4 v accPrep c d ; -- control verbs - dirV2V : V -> V2V = \v -> mkV2V v ; - + dirV2V : V -> V2V = \v -> mkV2V v ; -- object control verb; + -- subjV2V v2v = subject-control verb lin aendern_rV = reflV (regV "ändern") accusative ; anstrengen_rV = reflV (prefixV "an" (regV "strengen")) accusative ; @@ -37,29 +37,37 @@ lin erklaeren_dat_V3 = mkV3 (irregV "erklären" "erklärt" "erklärte" "erklärte" "erklärt") ; anklagen_gen_V3 = dirV3 (prefixV "an" (regV "klagen")) genPrep ; - erinnern_an_V3 = dirV3 (irregV "erinnern" "erinnert" "erinnerte" "erinnerte" "erinnert") (mkPrep "an" accusative) ; + erinnern_an_V3 = dirV3 (irregV "erinnern" "erinnert" "erinnerte" + "erinnerte" "erinnert") (mkPrep "an" accusative) ; danken_dat_fuer_V3 = mkV3 (regV "danken") datPrep (mkPrep "für" accusative) ; - debattieren_mit_ueber_V3 = mkV3 (irregV "debattieren" "debattiert" "debattierte" "debattierte" "debattiert") mit_Prep (mkPrep "über" accusative) ; + debattieren_mit_ueber_V3 = mkV3 (irregV "debattieren" "debattiert" "debattierte" + "debattierte" "debattiert") mit_Prep (mkPrep "über" accusative) ; lehren_V3 = dirV3 (regV "lehren") accPrep ; - abschauen_bei_rV3 = reflV3 (prefixV "ab" (irregV "schauen" "schaut" "schaute" "schaute" "geschaut")) dative accPrep bei_Prep ; + abschauen_bei_rV3 = reflV3 (prefixV "ab" (irregV "schauen" "schaut" + "schaute" "schaute" "geschaut")) dative accPrep bei_Prep ; leihen_von_rV3 = reflV3 (irregV "leihen" "leiht" "lieh" "liehe" "geliehen") dative accPrep von_Prep ; - entschuldigen_bei_fuer_rV3 = - reflV3 (irregV "entschuldigen" "entschuldigt" "entschuldigte" "entschuldigte" "entschuldigt") accusative bei_Prep fuer_Prep ; + entschuldigen_bei_fuer_rV3 = reflV3 (irregV "entschuldigen" "entschuldigt" "entschuldigte" + "entschuldigte" "entschuldigt") accusative bei_Prep fuer_Prep ; raechen_am_fuer_rV3 = reflV3 (regV "rächen") accusative (mkPrep "an" dative) fuer_Prep ; kaufen_bei_fuer_V4 = dirV4 (regV "kaufen") bei_Prep fuer_Prep ; mieten_von_fuer_V4 = dirV4 (regV "mieten") von_Prep fuer_Prep ; neugierig_auf_A2 = mkA2 (mk3A "neugierig" "neugieriger" "neugierigste") (mkPrep "auf" accusative) ; - + + -- verbs with infinitival object (non-modal): wagen_VV = mkVV (regV "wagen") ; versuchen_VV = mkVV (irregV "versuchen" "versucht" "versuchte" "versuchte" "versucht") ; + -- object control verbs: helfen_V2V = mkV2V (irregV "helfen" "hilft" "half" "hälfe" "geholfen") datPrep ; warnen_V2V = dirV2V (regV "warnen") ; --- versprechen_dat_V2V = subjV2V (mkV2V (irregV "versprechen" "verspricht" "versprach" "verspräche" "versprochen") datPrep) ; - lassen_V2V = auxV2V (irregV "lassen" "lasst" "ließ" "ließe" "gelassen") accPrep ; -- lasse dich (*zu) arbeiten + lassen_V2V = auxV2V (irregV "lassen" "läßt" "ließ" "ließe" "gelassen") accPrep ; + -- lasse dich (*zu) arbeiten + -- subject control verb: + versprechen_dat_V2V = subjV2V (mkV2V (irregV "versprechen" "verspricht" + "versprach" "verspräche" "versprochen") datPrep) ; } diff --git a/tests/german/infinitives.lin.out b/tests/german/infinitives.lin.out index a96c65008..9ad4c208f 100644 --- a/tests/german/infinitives.lin.out +++ b/tests/german/infinitives.lin.out @@ -53,7 +53,7 @@ TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashVV want_VV (SlashV2a read_V2 TestLangGer: ich will das Buch lesen TestLangEng: I want to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashVV wagen_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich wage das Buch , zu lesen -- wrong +TestLangGer: ich wage das Buch zu lesen TestLangEng: I dare to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV must_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) TestLangGer: ich muss das Buch lesen @@ -68,22 +68,22 @@ TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashVV must_VV (SlashVV want_VV TestLangGer: ich muss das Buch lesen wollen TestLangEng: I must want to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashVV must_VV (SlashVV wagen_VV (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich muss das Buch wagen , zu lesen -- wrong +TestLangGer: ich muss das Buch zu lesen wagen TestLangEng: I must dare to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashVV want_VV (SlashVV wagen_VV (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich will das Buch wagen , zu lesen -- wrong +TestLangGer: ich will das Buch zu lesen wagen TestLangEng: I want to dare to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashVV wagen_VV (SlashVV want_VV (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich wage das Buch , lesen zu wollen -- wrong +TestLangGer: ich wage das Buch lesen zu wollen TestLangEng: I dare to want to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV must_VV (ComplSlash (SlashVV want_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) TestLangGer: ich muss das Buch lesen wollen TestLangEng: I must want to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV must_VV (ComplSlash (SlashVV wagen_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) -TestLangGer: ich muss das Buch wagen , zu lesen -- wrong +TestLangGer: ich muss das Buch wagen zu lesen -- wrong TestLangEng: I must dare to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashVV wagen_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) -TestLangGer: ich will das Buch wagen , zu lesen -- wrong +TestLangGer: ich will das Buch wagen zu lesen -- wrong TestLangEng: I want to dare to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV wagen_VV (ComplSlash (SlashVV want_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) TestLangGer: ich wage , das Buch lesen zu wollen @@ -101,22 +101,22 @@ TestLang: PredVP (UsePron i_Pron) (ComplVV wagen_VV (ComplVV want_VV (ComplSlash TestLangGer: ich wage , das Buch lesen zu wollen TestLangEng: I dare to want to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV must_VV (ComplSlash (SlashVV want_VV (SlashVV wagen_VV (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) -TestLangGer: ich muss das Buch wagen wollen , zu lesen -- wrong +TestLangGer: ich muss das Buch zu lesen wagen wollen TestLangEng: I must want to dare to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV must_VV (ComplVV want_VV (ComplSlash (SlashVV wagen_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N))))) -TestLangGer: ich muss das Buch wagen wollen , zu lesen -- wrong +TestLangGer: ich muss das Buch wagen wollen zu lesen -- wrong TestLangEng: I must want to dare to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV must_VV (ComplVV want_VV (ComplVV wagen_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))))) TestLangGer: ich muss wagen wollen , das Buch zu lesen TestLangEng: I must want to dare to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashVV must_VV (SlashVV wagen_VV (SlashVV want_VV (SlashV2a read_V2)))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich muss das Buch wagen , lesen zu wollen -- wrong +TestLangGer: ich muss das Buch wagen lesen zu wollen -- wrong TestLangEng: I must dare to want to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashVV must_VV (SlashVV want_VV (SlashVV wagen_VV (SlashV2a read_V2)))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich muss das Buch wagen , zu lesen wollen -- wrong +TestLangGer: ich muss das Buch zu lesen wagen wollen TestLangEng: I must want to dare to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV must_VV (ComplSlash (SlashVV wagen_VV (SlashVV want_VV (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) -TestLangGer: ich muss das Buch wagen , lesen zu wollen -- wrong +TestLangGer: ich muss das Buch wagen lesen zu wollen -- wrong TestLangEng: I must dare to want to read the book TestLang: PredVP (UsePron i_Pron) (ComplVV must_VV (ComplVV wagen_VV (ComplSlash (SlashVV want_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N))))) TestLangGer: ich muss wagen , das Buch lesen zu wollen @@ -149,43 +149,43 @@ TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V beg_V2V (ComplSlash (Sla TestLangGer: ich bitte ihn , ihm zu versprechen , das Buch zu lesen TestLangEng: I beg him to promise him to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2VNP lassen_V2V (UsePron he_Pron) (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich lasse das Buch ihn lesen -- wrong object order (3.9 SlashV2VNP) +TestLangGer: ich lasse ihn das Buch lesen TestLangEng: I let him read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2VNP beg_V2V (UsePron he_Pron) (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich bitte das Buch ihn , zu lesen -- wrong (SlashV2VNP) +TestLangGer: ich bitte ihn das Buch , zu lesen -- wrong (SlashV2VNP) TestLangEng: I beg him to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2VNP versprechen_dat_V2V (UsePron he_Pron) (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich verspreche das Buch ihm , zu lesen -- wrong (SlashV2VNP) +TestLangGer: ich verspreche ihm das Buch , zu lesen -- wrong (SlashV2VNP) TestLangEng: I promise him to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2VNP beg_V2V (DetNP (DetQuant DefArt NumPl)) (SlashV2VNP lassen_V2V (UsePron he_Pron) (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich bitte das Buch ihn die , zu lassen lesen -- wrong (SlahV2VNP) bitte die, ihn es lesen zu lassen +TestLangGer: ich bitte die das Buch , ihn lesen zu lassen -- wrong (SlahV2VNP) TestLangEng: I beg them to let him read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2VNP beg_V2V (UsePron they_Pron) (SlashV2VNP lassen_V2V (UsePron he_Pron) (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich bitte das Buch ihn sie , zu lassen lesen -- wrong (SlashV2VNP) +TestLangGer: ich bitte sie das Buch , ihn lesen zu lassen -- wrong (SlashV2VNP) TestLangEng: I beg them to let him read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V beg_V2V (ComplSlash (SlashV2VNP lassen_V2V (UsePron he_Pron) (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) (DetNP (DetQuant DefArt NumPl))) -TestLangGer: ich bitte die , das Buch ihn lesen zu lassen -- wrong obj order +TestLangGer: ich bitte die , ihn das Buch lesen zu lassen TestLangEng: I beg them to let him read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V beg_V2V (ComplSlash (SlashV2VNP lassen_V2V (UsePron he_Pron) (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) (UsePron they_Pron)) -TestLangGer: ich bitte sie , das Buch ihn lesen zu lassen -- wrong obj order +TestLangGer: ich bitte sie , ihn das Buch lesen zu lassen TestLangEng: I beg them to let him read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2VNP versprechen_dat_V2V (DetNP (DetQuant DefArt NumPl)) (SlashV2VNP beg_V2V (UsePron he_Pron) (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich verspreche das Buch ihn denen , zu bitten zu lesen -- wrong (SlashV2VNP gf-3.9)) +TestLangGer: ich verspreche denen das Buch , ihn zu bitten , zu lesen -- wrong (SlashV2VNP)) TestLangEng: I promise them to beg him to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2VNP versprechen_dat_V2V (UsePron they_Pron) (SlashV2VNP beg_V2V (UsePron he_Pron) (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich verspreche das Buch ihn ihnen , zu bitten zu lesen -- wrong (SlashV2VNP) +TestLangGer: ich verspreche ihnen das Buch , ihn zu bitten , zu lesen -- wrong (SlashV2VNP) TestLangEng: I promise them to beg him to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V versprechen_dat_V2V (ComplSlash (SlashV2VNP beg_V2V (UsePron he_Pron) (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) (DetNP (DetQuant DefArt NumPl))) -TestLangGer: ich verspreche denen , das Buch ihn zu bitten , zu lesen -- wrong obj order +TestLangGer: ich verspreche denen , ihn das Buch zu bitten , zu lesen TestLangEng: I promise them to beg him to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V versprechen_dat_V2V (ComplSlash (SlashV2VNP beg_V2V (UsePron he_Pron) (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) (UsePron they_Pron)) -TestLangGer: ich verspreche ihnen , das Buch ihn zu bitten , zu lesen -- wrong obj order +TestLangGer: ich verspreche ihnen , ihn das Buch zu bitten , zu lesen -- wrong TestLangEng: I promise them to beg him to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2VNP beg_V2V (UsePron he_Pron) (SlashV2VNP versprechen_dat_V2V (UsePron he_Pron) (SlashV2a read_V2))) (DetCN (DetQuant DefArt NumSg) (UseN book_N))) -TestLangGer: ich bitte das Buch ihm ihn , zu versprechen zu lesen -- wrong (SlashV2VNP) +TestLangGer: ich bitte ihn das Buch , ihm zu versprechen , zu lesen -- wrong (SlashV2VNP) TestLangEng: I beg him to promise him to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V beg_V2V (ComplSlash (SlashV2VNP versprechen_dat_V2V (UsePron he_Pron) (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))) (UsePron he_Pron)) -TestLangGer: ich bitte ihn , das Buch ihm zu versprechen , zu lesen -- wrong (SlashV2VNP) +TestLangGer: ich bitte ihn , ihm das Buch zu versprechen , zu lesen -- wrong (SlashV2VNP) TestLangEng: I beg him to promise him to read the book TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V beg_V2V (ReflVP (SlashV2a love_V2))) (UsePron youSg_Pron)) TestLangGer: ich bitte dich , dich zu lieben @@ -200,7 +200,7 @@ TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V versprechen_dat_V2V (Com TestLangGer: ich verspreche ihr , mich lieben zu wollen TestLangEng: I promise her to want to love herself -- wrong: myself TestLang: PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2V beg_V2V (ComplSlash (SlashV2Vneg versprechen_dat_V2V (ReflVP (SlashV2a hate_V2))) (UsePron youSg_Pron))) (UsePron she_Pron))) -TestLangGer: ich will sie bitten , dir zu versprechen , sich nicht zu hassen +TestLangGer: ich will sie bitten , dir zu versprechen , sich nicht zu hassen (uses SlashV2Vneg) TestLangEng: I want to beg her to promise you not to hate yourself -- wrong: herself TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V versprechen_dat_V2V (ComplSlash (ReflVPSlash entschuldigen_bei_fuer_rV3) (UsePron it_Pron))) (UsePron she_Pron)) TestLangGer: ich verspreche ihr , mich bei mir für es zu entschuldigen @@ -209,7 +209,7 @@ TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V versprechen_dat_V2V (Com TestLangGer: ich verspreche uns , es mir zu geben TestLangEng: I promise us to give it itself -- wrong: myself TestLang: PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2V versprechen_dat_V2V (ComplSlash (SlashV2Vneg beg_V2V (ReflVP (SlashV2a hate_V2))) (UsePron youSg_Pron))) (UsePron she_Pron))) -TestLangGer: ich will ihr versprechen , dich zu bitten , dich nicht zu hassen +TestLangGer: ich will ihr versprechen , dich zu bitten , dich nicht zu hassen -- SlashV2Vneg TestLangEng: I want to promise her to beg you to not hate yourself TestLang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V beg_V2V (ComplSlash (ReflVPSlash entschuldigen_bei_fuer_rV3) (UsePron it_Pron))) (UsePron youSg_Pron)) TestLangGer: ich bitte dich , dich bei dir für es zu entschuldigen @@ -227,7 +227,7 @@ TestLang: DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPas TestLangGer: das Buch , das wir nicht lesen mussten TestLangEng: the book that we hadn't to read TestLang: DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PNeg (RelSlash IdRP (SlashVP (UsePron we_Pron) (SlashVV wagen_VV (SlashV2a read_V2)))))) -TestLangGer: das Buch , das wir nicht wagten , zu lesen +TestLangGer: das Buch , das wir nicht zu lesen wagten TestLangEng: the book that we didn't dare to read TestLang: DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PNeg (RelSlash IdRP (SlashVP (UsePron we_Pron) (SlashVV wagen_VV (Slash3V3 erklaeren_dat_V3 (UsePron she_Pron))))))) TestLangGer: das Buch , das wir nicht wagten , ihr zu erklären diff --git a/tests/german/vp-paradigm.gfs b/tests/german/vp-paradigm.gfs index b91ffc816..70382db8e 100644 --- a/tests/german/vp-paradigm.gfs +++ b/tests/german/vp-paradigm.gfs @@ -1,7 +1,7 @@ -- To create vp-paradigm.out, I used changes of 30/6/2019 (in git branch vp-paradigm): --- i ../../src/german/LangGer.gf +i ../../src/german/LangGer.gf -- Use gf --run < vp-paradigm.gfs > vp-paradigm.tmp to compare with gf-rgl. HL 3/7/2019 -i alltenses/LangGer.gfo +-- i alltenses/LangGer.gfo -- verb phrases with modal verb l -lang=Ger -table (PredVP (UsePron he_Pron) (ComplVV want_VV (UseV sleep_V))) @@ -19,3 +19,7 @@ l -table (PredVP (DetCN (DetQuant DefArt NumSg) (UseN book_N)) (PassV2 read_V2)) l PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (Slash3V3 send_V3 (DetCN (DetQuant DefArt NumSg) (UseN woman_N))) (DetCN (DetQuant DefArt NumSg) (UseN book_N)))))) NoVoc l PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (Slash3V3 send_V3 (UsePron she_Pron)) (UsePron it_Pron))))) NoVoc + +-- relative clause from object np is not extracted behind vpart: +l UseCl (TTAnt TPast AAnter) PNeg (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a know_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast AAnter) PPos (RelSlash IdRP (SlashVP (UsePron youPl_Pron) (SlashV2VNP beg_V2V (UsePron we_Pron) (AdvVPSlash (SlashV2a read_V2) today_Adv))))))))) +