From 27925cd4cee20dae49481d7f14eed8b5564ec7a0 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 15 Nov 2021 10:52:02 +0800 Subject: [PATCH 01/92] add idetQuant and pronouns to Malay RGL --- src/abstract/Lexicon.gf | 1 + src/malay/LexiconMay.gf | 5 +++-- src/malay/QuestionMay.gf | 14 +++++++++++++- src/malay/StructuralMay.gf | 12 ++++++------ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/abstract/Lexicon.gf b/src/abstract/Lexicon.gf index 07e40113..9dcf6f67 100644 --- a/src/abstract/Lexicon.gf +++ b/src/abstract/Lexicon.gf @@ -265,6 +265,7 @@ fun short_A : A ; silver_N : N ; sing_V : V ; + sing_V2 : V2 ; sister_N : N ; sit_V : V ; skin_N : N ; diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index e15b044f..f9f28d14 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -320,7 +320,8 @@ lin sell_V3 = mkV3 (mkV "jual" Meng) emptyPrep emptyPrep ; -- TODO -- lin shop_N = mkN "" ; -- lin short_A = mkA "" ; -- lin silver_N = mkN "" ; --- lin sing_V = mkV "" ; +lin sing_V = mkV "nyanyi" ; +lin sing_V2 = mkV2 "nyanyi" ; -- lin sister_N = mkN "" ; -- lin sit_V = mkV "" ; -- lin skin_N = mkN "" ; @@ -333,7 +334,7 @@ lin small_A = mkA "kecil" ; -- lin snake_N = mkN "" ; -- lin snow_N = mkN "" ; -- lin sock_N = mkN "" ; --- lin song_N = mkN "" ; +lin song_N = mkN "lagu" ; -- lin speak_V2 = mkV2 "" ; -- lin spit_V = mkV "" ; -- lin split_V2 = mkV2 "" ; diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index b7194dc6..3a1f0b2e 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -1,9 +1,21 @@ concrete QuestionMay of Question = CatMay ** open - Prelude, ResMay, ParadigmsMay, (VS=VerbMay), (NS=NounMay), (SS=StructuralMay) in { + Prelude, ResMay, ParadigmsMay, (VS=VerbMay), (NM=NounMay), (SS=StructuralMay) in { -- A question can be formed from a clause ('yes-no question') or -- with an interrogative. +-- Interrogative pronouns can be formed with interrogative +-- determiners, with or without a noun. +lin + -- : IDet -> CN -> IP ; -- which five songs + IdetCN idet cn = NM.DetCN idet cn ; + + -- : IDet -> IP ; -- which five + IdetIP idet = NM.DetNP idet ; + + -- : IQuant -> Num -> IDet ; -- which (five) + IdetQuant = NM.DetQuant ; + {- lin -- : Cl -> QCl ; diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 6dcb4417..275137d7 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -71,12 +71,12 @@ lin someSg_Det = lin no_Quant = -} lin that_Quant = mkQuant "itu" ; lin this_Quant = mkQuant "ini" ; -{-lin which_IQuant = +lin which_IQuant = mkQuant "apa" ; ----- -- NP - +{- lin everybody_NP = defNP "" N.NumPl ; lin everything_NP = defNP "" N.NumSg ; lin nobody_NP = mkVerb; "" @@ -118,14 +118,14 @@ lin with_Prep = mkPrep "dengan" ; -- Pron -- Pronouns are closed class, no constructor in ParadigmsMay. - -- it_Pron = +lin it_Pron = mkPron "dia" P3 ; lin i_Pron = mkPron "saya" P1 ; --- lin youPol_Pron = mkPron "" P3 ; --- lin youSg_Pron = +lin youPol_Pron = mkPron "kamu" P2 ; +lin youSg_Pron = mkPron "awak" P2 ; lin he_Pron = mkPron "dia" P3 ; lin she_Pron = mkPron "dia" P3 ; lin we_Pron = mkPron "kami" P1 ; --- lin youPl_Pron = +lin youPl_Pron = mkPron "kamu" P2; lin they_Pron = mkPron "mereka" P3 ; --lin whatPl_IP = ; From 7daf14378db007e2a4636e2f9acc6db7774b269e Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 15 Nov 2021 12:19:31 +0800 Subject: [PATCH 02/92] fix word order of question --- src/english/NounEng.gf | 2 +- src/malay/CatMay.gf | 4 ++-- src/malay/QuestionMay.gf | 20 ++++++++++++++------ src/malay/ResMay.gf | 24 ++++++++++++++++++++++-- src/malay/StructuralMay.gf | 11 +++++++---- 5 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/english/NounEng.gf b/src/english/NounEng.gf index 7b254250..848b2196 100644 --- a/src/english/NounEng.gf +++ b/src/english/NounEng.gf @@ -56,7 +56,7 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in { DetNP det = { -- s = case det.hasNum of {True => \\_ => det.s ; _ => \\c => det.sp ! c} ; - s = det.sp ! Neutr ! False ; + s = \\c => det.sp ! Neutr ! False ! c ++ "whatevr" ; a = agrP3 det.n } ; diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 35478cb2..4496f52b 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -25,8 +25,8 @@ concrete CatMay of Cat = CommonX ** open ResMay, Prelude in { QCl = ResMay.Clause ; IComp = SS ; -- interrogative complement of copula e.g. "where" IDet = ResMay.Determiner ; -- interrogative determiner e.g. "how many" - IQuant = ResMay.Quant ; -- interrogative quantifier e.g. "which" - IP = ResMay.NounPhrase ; -- interrogative pronoun e.g. "who" + IQuant = ResMay.IQuant ; -- interrogative quantifier e.g. "which" + IP = ResMay.IPhrase ; -- interrogative pronoun e.g. "who" --2 Subord clauses and pronouns diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index 3a1f0b2e..48757061 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -8,13 +8,24 @@ concrete QuestionMay of Question = CatMay ** open -- determiners, with or without a noun. lin -- : IDet -> CN -> IP ; -- which five songs - IdetCN idet cn = NM.DetCN idet cn ; + IdetCN idet cn = NM.DetCN idet cn ** {sp = idet.sp} ; -- : IDet -> IP ; -- which five - IdetIP idet = NM.DetNP idet ; + IdetIP idet = NM.DetNP idet ** {sp = idet.sp}; -- : IQuant -> Num -> IDet ; -- which (five) - IdetQuant = NM.DetQuant ; + IdetQuant iquant num = iquant ** { + pr = num.s ++ case iquant.isPre of {True => iquant.s ; False => [] } ; + -- if isPre is True, then: "berapa kucing" + s = case iquant.isPre of { False => iquant.s ; True => [] }; + -- if isPre is False, use s: "kucing berapa" + n = num.n + } ; + + -- : IP -> ClSlash -> QCl ; -- whom does John love + QuestSlash ip cls = cls ** { + pred = \\vf,pol => cls.pred ! vf ! pol ++ ip.s ! Bare + } ; {- lin @@ -24,9 +35,6 @@ lin -- : IP -> VP -> QCl ; QuestVP ip vp = - -- : IP -> ClSlash -> QCl ; -- whom does John love - QuestSlash ip cls = - -- : IAdv -> Cl -> QCl ; -- why does John walk QuestIAdv iadv cls = diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 447726d4..99629be9 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -50,6 +50,10 @@ oper empty : Str ; -- need to avoid GF being silly. See https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#metavariables-or-those-question-marks-that-appear-when-parsing } ; + IPhrase : Type = NounPhrase ** { + sp : NForm => Str ; -- standalone berapa banyak kucing + } ; + emptyNP : NounPhrase = { s = \\_ => [] ; a = NotPron ; @@ -60,11 +64,15 @@ oper -- Det, Quant, Card, Ord Quant : Type = { - s : Str ; - sp : NForm => Str ; + s : Str ; -- quantifier in a context, eg. 'berapa (kucing)' + sp : NForm => Str ; -- a standalone, eg. '(kucing) berapa banyak' poss : Possession ; } ; + IQuant : Type = Quant ** { + isPre : Bool ; + } ; + Determiner : Type = Quant ** { pr : Str ; -- prefix for numbers n : NumType ; -- number as in 5 (noun in singular), Sg or Pl @@ -102,6 +110,18 @@ oper sp = \\_ => str } ; + mkDet : Str -> Number -> Determiner = \str, num -> mkQuant str ** { + pr = "" ; + n = NoNum num ; + } ; + + mkIdet : Str -> Number -> Bool -> Determiner = \str, num, isPre -> mkDet str num ** { + pr = case isPre of {True => str ; False => [] } ; + -- if isPre is True, then: "berapa kucing" + s = case isPre of { False => str ; True => [] }; + + } ; + -------------------------------------------------------------------------------- -- Prepositions diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 275137d7..23013531 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -52,9 +52,9 @@ lin and_Conj = {s2 = "dan" ; s1 = [] ; n = Pl} ; ----------------- -- *Det and Quant -{- -lin how8many_IDet = ; +lin how8many_IDet = mkIdet "berapa banyak" Pl True; +{-} lin all_Predet = {s = ""} ; lin not_Predet = { s = "" } ; lin only_Predet = { s = "" } ; @@ -71,7 +71,7 @@ lin someSg_Det = lin no_Quant = -} lin that_Quant = mkQuant "itu" ; lin this_Quant = mkQuant "ini" ; -lin which_IQuant = mkQuant "apa" ; +lin which_IQuant = mkQuant "apa" ** {isPre = False} ; ----- @@ -154,7 +154,10 @@ lin language_title_Utt = ss "bahasa Melayu" ; ------- -- Verb ---lin have_V2 = mkV2 have_V ; +lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** { + s = \\_ => "ada" ; + passive = "diadakan" ; +} ; -- lin can8know_VV = can_VV ; -- can (capacity) -- lin can_VV = mkVV "" ; -- can (possibility) -- lin must_VV = mkVV "" ; From 4394c8f9792df9009d57a6a2fe0e16cfd29b48f5 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 15 Nov 2021 13:49:39 +0800 Subject: [PATCH 03/92] 'how many' has correct standalone form and plural noun --- src/malay/PhraseMay.gf | 2 +- src/malay/QuestionMay.gf | 4 +++- src/malay/ResMay.gf | 3 ++- src/malay/StructuralMay.gf | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/malay/PhraseMay.gf b/src/malay/PhraseMay.gf index 0b51c308..cb594393 100644 --- a/src/malay/PhraseMay.gf +++ b/src/malay/PhraseMay.gf @@ -7,12 +7,12 @@ concrete PhraseMay of Phrase = CatMay ** open Prelude, ResMay in { UttQS qs = qs ; UttIAdv iadv = iadv ; UttNP np = {s = np.s ! Bare} ; + UttIP ip = {s = ip.sp ! NF Sg Bare} ; {- UttImpSg pol imp = UttImpPl pol imp = UttImpPol = UttImpSg ; - UttIP ip = {s = ip.s ! } ; UttVP vp = {s = } ; UttAdv adv = {s = } ; UttCN n = {s = } ; diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index 48757061..8c1d6f6e 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -8,7 +8,9 @@ concrete QuestionMay of Question = CatMay ** open -- determiners, with or without a noun. lin -- : IDet -> CN -> IP ; -- which five songs - IdetCN idet cn = NM.DetCN idet cn ** {sp = idet.sp} ; + IdetCN idet cn = NM.DetCN idet cn ** { + sp = \\nf => idet.sp ! nf ++ cn.s ! nf + } ; -- : IDet -> IP ; -- which five IdetIP idet = NM.DetNP idet ** {sp = idet.sp}; diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 99629be9..9923b3a8 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -115,11 +115,12 @@ oper n = NoNum num ; } ; - mkIdet : Str -> Number -> Bool -> Determiner = \str, num, isPre -> mkDet str num ** { + mkIdet : Str -> Str -> Number -> Bool -> Determiner = \str, standalone, num, isPre -> mkDet str num ** { pr = case isPre of {True => str ; False => [] } ; -- if isPre is True, then: "berapa kucing" s = case isPre of { False => str ; True => [] }; + sp = \\_ => standalone ; } ; -------------------------------------------------------------------------------- diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 23013531..5b05f2ca 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -53,7 +53,7 @@ lin and_Conj = {s2 = "dan" ; s1 = [] ; n = Pl} ; -- *Det and Quant -lin how8many_IDet = mkIdet "berapa banyak" Pl True; +lin how8many_IDet = mkIdet "berapa" "berapa banyak" Sg True; {-} lin all_Predet = {s = ""} ; lin not_Predet = { s = "" } ; From b086b774bfb2d34dbdf2a8fe5ccbb1b742579165 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 15 Nov 2021 14:01:16 +0800 Subject: [PATCH 04/92] correct verb form for like --- src/malay/LexiconMay.gf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index f9f28d14..f2cf96d1 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -209,7 +209,10 @@ lin learn_V2 = mkV2 (prefixV (mkV "ajar" Ber)) emptyPrep ; -- lin leave_V2 = mkV2 "" ; -- lin leg_N = mkN "" ; -- lin lie_V = mkV "" ; -lin like_V2 = mkV2 "suka" ; +lin like_V2 = let like' : V2 = mkV2 "suka" in like' ** { + s = \\_ => "suka" ; + passive = "disukai" ; +} ; -- lin listen_V2 = mkV2 "" ; -- lin live_V = mkV ""; -- lin liver_N = mkN "" ; From 3770caad33f1a6e384f132fe40ed91f273815fa0 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 17 Nov 2021 11:58:42 +0800 Subject: [PATCH 05/92] add do you teach the cat in Malay --- src/malay/QuestionMay.gf | 26 ++++++++++++++++++++++++-- src/malay/SentenceMay.gf | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index 8c1d6f6e..79f32cfb 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -29,10 +29,32 @@ lin pred = \\vf,pol => cls.pred ! vf ! pol ++ ip.s ! Bare } ; + -- : Subj -> Pred -> QCl ; + -- QuestCl cl = cl ** { + -- pred = \\vf,pol => cl.pred ! vf ! pol + -- }; + QuestCl cl = cl ** { + subj = "adakah" ++ cl.subj; + } ; + + +{- ---- + s = \\t,a,p => + let + cl = oldClause slash ; + cls : Direct -> Str = + \d -> cl.s ! d ! t ! a ! p ! Indic ; +---- \d -> cl.s ! ip.a ! d ! t ! a ! p ! Indic ; + who = slash.c2.s ++ ip.s ! slash.c2.c + in table { + QDir => who ++ cls DInv ; + QIndir => who ++ cls DDir + } +-} + {- lin - -- : Cl -> QCl ; - QuestCl = + -- : IP -> VP -> QCl ; QuestVP ip vp = diff --git a/src/malay/SentenceMay.gf b/src/malay/SentenceMay.gf index 28a39f11..1222e02e 100644 --- a/src/malay/SentenceMay.gf +++ b/src/malay/SentenceMay.gf @@ -56,7 +56,7 @@ lin -- : Temp -> Pol -> QCl -> QS ; UseQCl t p cl = { - s = cl.subj ++ t.s ++ p.s ++ cl.pred ! Active ! p.p ; + s = t.s ++ p.s ++ cl.subj ++ cl.pred ! Active ! p.p ; } ; -- : Temp -> Pol -> RCl -> RS ; From 82a74d84be1b0457e3c6a1d9d97e9a5c6d314715 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 17 Nov 2021 14:45:25 +0800 Subject: [PATCH 06/92] add test for questions in malay --- src/malay/unittest/questions.gftest | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/malay/unittest/questions.gftest diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest new file mode 100644 index 00000000..9320f24a --- /dev/null +++ b/src/malay/unittest/questions.gftest @@ -0,0 +1,23 @@ +Lang: IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n5)))))))) (UseN song_N) +LangEng: which five songs +LangMay: lima lagu apa + +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumPl) (UseN song_N)) (SlashVP (UsePron youPl_Pron) (SlashV2a like_V2))))) NoVoc +LangEng: which songs do you like +LangMay: kamu suka lagu-lagu apa + +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestSlash (IdetCN how8many_IDet (UseN cat_N)) (SlashVP (UsePron youPl_Pron) (SlashV2a have_V2))))) NoVoc +LangEng: how many cats do you have +LangMay: kamu ada berapa kucing + +Lang: PhrUtt NoPConj (UttIP (IdetCN how8many_IDet (UseN cat_N))) NoVoc +LangEng: how many cats +LangMay: berapa banyak kucing + +Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestCl (PredVP (UsePron youSg_Pron) (ComplSlash (SlashV2a teach_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))))) +LangEng: do you teach the cat +LangMay: adakah awak mengajar kucing + +Lang: UseQCl (TTAnt TPres ASimul) PNeg (QuestCl (PredVP (UsePron youSg_Pron) (ComplSlash (SlashV2a teach_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))))) +LangEng: don't you teach the cat +LangMay: adakah awak mengajar kucing From 7c1de7ba23aa8570811e023dce9c3da2c4e757a7 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Thu, 25 Nov 2021 18:00:46 +0800 Subject: [PATCH 07/92] do you not teach the cat in malay --- src/malay/unittest/questions.gftest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest index 9320f24a..1a30cb38 100644 --- a/src/malay/unittest/questions.gftest +++ b/src/malay/unittest/questions.gftest @@ -20,4 +20,4 @@ LangMay: adakah awak mengajar kucing Lang: UseQCl (TTAnt TPres ASimul) PNeg (QuestCl (PredVP (UsePron youSg_Pron) (ComplSlash (SlashV2a teach_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))))) LangEng: don't you teach the cat -LangMay: adakah awak mengajar kucing +LangMay: adakah awak tidak mengajar kucing From 984c8deb34f335d7005e524a775058ababd5f89d Mon Sep 17 00:00:00 2001 From: Meowyam Date: Tue, 21 Dec 2021 18:11:20 +0800 Subject: [PATCH 08/92] QuestIAdv --- src/malay/QuestionMay.gf | 24 ++++++++++++--- src/malay/ResMay.gf | 47 +++++++++++++++++++++++++++++ src/malay/StructuralMay.gf | 5 +-- src/malay/unittest/questions.gftest | 12 ++++++++ 4 files changed, 82 insertions(+), 6 deletions(-) diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index 79f32cfb..8ec8a316 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -37,6 +37,26 @@ lin subj = "adakah" ++ cl.subj; } ; + -- missing record fields: pred type of vp + + -- : IP -> VP -> QCl ; + -- expected: ParamMay.VForm => ParamX.Polarity => Str + -- inferred: {s : ParamMay.VForm => ParamX.Polarity => Str} + + QuestVP ip cl = cl ** { + pred = \\vf,pol => cl.s ! vf ! pol; + subj = ip.s ! Bare ; + }; + + -- : IAdv -> Cl -> QCl ; -- why does John walk + QuestIAdv iadv cls = { + pred = \\vf,pol => cls.pred ! vf ! pol ++ iadv.s; + subj = cls.subj ; + } ; + + -- { + -- pred = \\vf,pol => ip.s ++ vp.s ! vf ! pol; + -- } ; {- ---- s = \\t,a,p => @@ -56,11 +76,7 @@ lin lin - -- : IP -> VP -> QCl ; - QuestVP ip vp = - -- : IAdv -> Cl -> QCl ; -- why does John walk - QuestIAdv iadv cls = -- : IComp -> NP -> QCl ; -- where is John? diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 9923b3a8..0aaff5fb 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -105,6 +105,15 @@ oper poss = Bare ; } ; + -- \\vf,pol, => + -- let + -- verb : Str = joinVP vp tense ant pol agr ; + -- obj : Str = vp.s2 ! agr ; + -- in case ord of { + -- ODir => subj ++ verb ++ obj ; -- Ġanni jiekol ħut + -- OQuest => verb ++ obj ++ subj -- jiekol ħut Ġanni ? + -- } + mkQuant : Str -> Quant = \str -> baseQuant ** { s = str ; sp = \\_ => str @@ -123,6 +132,12 @@ oper sp = \\_ => standalone ; } ; + + + -- 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 ; + -------------------------------------------------------------------------------- -- Prepositions @@ -265,6 +280,38 @@ oper predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps -> predVP np ** {c2 = vps.c2} ; + -- mkClause : Str -> NounPhrase -> VPSlash -> Clause = \str,np,vp -> { + -- subj = str ++ np.s ! Bare; + -- pred = vp.s + -- } ; + + + -- mkClause : Str -> IPhrase -> VerbPhrase -> Clause = \str,ip,vp -> { + -- subj = ip.s ! Bare ; + -- pred = vp.s ; + -- } ; + + + -- baseQuant : Quant = { + -- s = [] ; + -- sp = \\_ => [] ; + -- poss = Bare ; + -- } ; + + -- -- \\vf,pol, => + -- -- let + -- -- verb : Str = joinVP vp tense ant pol agr ; + -- -- obj : Str = vp.s2 ! agr ; + -- -- in case ord of { + -- -- ODir => subj ++ verb ++ obj ; -- Ġanni jiekol ħut + -- -- OQuest => verb ++ obj ++ subj -- jiekol ħut Ġanni ? + -- -- } + + -- mkQuant : Str -> Quant = \str -> baseQuant ** { + -- s = str ; + -- sp = \\_ => str + -- } ; + -------------------------------------------------------------------------------- -- linrefs diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 5b05f2ca..e0dcc8dc 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -19,7 +19,9 @@ lin how_IAdv = ss "" : lin how8much_IAdv = ss "" ; lin when_IAdv = ss "" ; -lin where_IAdv = ss "" : +-} +lin where_IAdv = ss "mana" ; +{- lin why_IAdv = ss "" : lin always_AdV = ss "" ; @@ -73,7 +75,6 @@ lin that_Quant = mkQuant "itu" ; lin this_Quant = mkQuant "ini" ; lin which_IQuant = mkQuant "apa" ** {isPre = False} ; - ----- -- NP {- diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest index 1a30cb38..8272195f 100644 --- a/src/malay/unittest/questions.gftest +++ b/src/malay/unittest/questions.gftest @@ -21,3 +21,15 @@ LangMay: adakah awak mengajar kucing Lang: UseQCl (TTAnt TPres ASimul) PNeg (QuestCl (PredVP (UsePron youSg_Pron) (ComplSlash (SlashV2a teach_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))))) LangEng: don't you teach the cat LangMay: adakah awak tidak mengajar kucing + +# Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP whoSg_IP (ComplVV want_VV (UseV go_V))) +# LangEng: who wants to go +# LangMay: Siapa mahu pergi + +Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP (IdetCN (IdetQuant which_IQuant NumSg) (UseN cat_N)) (ComplSlash (SlashV2a teach_V2) (UsePron he_Pron))) +LangEng: which cat teaches him +LangMay: kucing apa mengajar dia + +Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv where_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))) +LangEng: where did you go +LangMay: awak pergi mana \ No newline at end of file From c61fe0c314d7bec5712a0f5d9c28ac35766bc68a Mon Sep 17 00:00:00 2001 From: Meowyam Date: Thu, 30 Dec 2021 23:19:38 +0800 Subject: [PATCH 09/92] fixed QuestIAdv --- src/malay/QuestionMay.gf | 2 +- src/malay/ResMay.gf | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index 8ec8a316..880dec22 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -50,7 +50,7 @@ lin -- : IAdv -> Cl -> QCl ; -- why does John walk QuestIAdv iadv cls = { - pred = \\vf,pol => cls.pred ! vf ! pol ++ iadv.s; + pred = \\vf,pol => cls.pred ! Root ! pol ++ iadv.s; subj = cls.subj ; } ; diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 0aaff5fb..ed4b6c06 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -133,7 +133,6 @@ 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 ; From 6459c07548258db6f41336d474769a4cb00153c8 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 3 Jan 2022 14:00:43 +0800 Subject: [PATCH 10/92] why did you go --- src/malay/CatMay.gf | 3 ++- src/malay/GrammarMay.gf | 4 ++-- src/malay/QuestionMay.gf | 10 ++++++++-- src/malay/ResMay.gf | 8 +++++++- src/malay/StructuralMay.gf | 5 +++-- src/malay/unittest/questions.gftest | 6 +++++- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 4496f52b..3970520c 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -1,4 +1,4 @@ -concrete CatMay of Cat = CommonX ** open ResMay, Prelude in { +concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { flags optimize=all_subs ; @@ -27,6 +27,7 @@ concrete CatMay of Cat = CommonX ** open ResMay, Prelude in { IDet = ResMay.Determiner ; -- interrogative determiner e.g. "how many" IQuant = ResMay.IQuant ; -- interrogative quantifier e.g. "which" IP = ResMay.IPhrase ; -- interrogative pronoun e.g. "who" + IAdv = ResMay.IAdv ; --2 Subord clauses and pronouns diff --git a/src/malay/GrammarMay.gf b/src/malay/GrammarMay.gf index 024f6953..9c643f4b 100644 --- a/src/malay/GrammarMay.gf +++ b/src/malay/GrammarMay.gf @@ -9,10 +9,10 @@ concrete GrammarMay of Grammar = RelativeMay, ConjunctionMay, PhraseMay, - TextX, + TextX - [IAdv], StructuralMay, IdiomMay, - TenseX - [AAnter, TFut, TCond] + TenseX - [AAnter, TFut, TCond, IAdv] ** open ParamX in { flags startcat = Phr ; diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index 880dec22..f6f545fb 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -50,10 +50,16 @@ lin -- : IAdv -> Cl -> QCl ; -- why does John walk QuestIAdv iadv cls = { - pred = \\vf,pol => cls.pred ! Root ! pol ++ iadv.s; - subj = cls.subj ; + subj = case iadv.isPre of { + True => iadv.s ++ cls.subj ; False => cls.subj + } ; + pred = \\vf,pol => case iadv.isPre of { + True => cls.pred ! Root ! pol ; + False => cls.pred ! Root ! pol ++ iadv.s + } ; } ; +-- \\vf,pol,posadv => -- { -- pred = \\vf,pol => ip.s ++ vp.s ! vf ! pol; -- } ; diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index ed4b6c06..30fed90f 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -222,7 +222,13 @@ oper ------------------ -- Adv - Adverb : Type = SS ; + Adverb : Type = { + s : Str; + } ; + + IAdv : Type = Adverb ** { + isPre : Bool ; + } ; ------------------ -- VP diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index e0dcc8dc..057909bf 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -20,9 +20,10 @@ lin how_IAdv = ss "" : lin how8much_IAdv = ss "" ; lin when_IAdv = ss "" ; -} -lin where_IAdv = ss "mana" ; +lin where_IAdv = { s = "mana"; isPre = False } ; +lin why_IAdv = {s = "mengapa"; isPre = True } ; {- -lin why_IAdv = ss "" : + lin always_AdV = ss "" ; diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest index 8272195f..f80996b4 100644 --- a/src/malay/unittest/questions.gftest +++ b/src/malay/unittest/questions.gftest @@ -32,4 +32,8 @@ LangMay: kucing apa mengajar dia Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv where_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))) LangEng: where did you go -LangMay: awak pergi mana \ No newline at end of file +LangMay: awak pergi mana + +Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))) +LangEng: why did you go +LangMay: mengapa awak pergi \ No newline at end of file From 0abf88324eaa43a0d440b185f7bc14e26b6bf421 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 3 Jan 2022 14:07:09 +0800 Subject: [PATCH 11/92] changed wanita to perempuan for woman --- src/malay/LexiconMay.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index f2cf96d1..7f322ec4 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -411,7 +411,7 @@ lin walk_V = mkV "jalan" ; -- lin wine_N = mkN "" ; -- lin wing_N = mkN "" ; -- lin wipe_V2 = mkV2 "" ; -lin woman_N = mkN "wanita" ; +lin woman_N = mkN "perempuan" ; -- lin wonder_VQ = mkVQ "" ; -- lin wood_N = mkN "" ; -- lin worm_N = mkN "" ; From 4a892e646cb7ca53c4b4f3f9a8f3cb36eccb51f3 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 3 Jan 2022 14:08:32 +0800 Subject: [PATCH 12/92] add see_V2 to malay lexicon --- src/malay/LexiconMay.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index 7f322ec4..b17c7753 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -309,7 +309,7 @@ lin school_N = mkN "sekolah" ; lin science_N = mkN "sains" ; -- lin scratch_V2 = mkV2 "" ; -- lin sea_N = mkN "" ; --- lin see_V2 = mkV2 "" ; +lin see_V2 = mkV2 "lihat" ; -- lin seed_N = mkN "" ; -- lin seek_V2 = mkV2 "" ; lin sell_V3 = mkV3 (mkV "jual" Meng) emptyPrep emptyPrep ; -- TODO From 7704f6a18cea80a8511ad9b3a7e57db6348c6e4b Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 3 Jan 2022 21:39:01 +0800 Subject: [PATCH 13/92] changed which from apa to yang mana, which is more correct --- src/malay/StructuralMay.gf | 5 ++--- src/malay/unittest/questions.gftest | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 057909bf..e9db991f 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -74,7 +74,7 @@ lin someSg_Det = lin no_Quant = -} lin that_Quant = mkQuant "itu" ; lin this_Quant = mkQuant "ini" ; -lin which_IQuant = mkQuant "apa" ** {isPre = False} ; +lin which_IQuant = mkQuant "yang mana" ** {isPre = False} ; ----- -- NP @@ -115,7 +115,6 @@ lin to_Prep = mkPrep "ke" ; lin with_Prep = mkPrep "dengan" ; -- lin without_Prep = mkPrep "" ; - ------- -- Pron @@ -141,7 +140,7 @@ lin they_Pron = mkPron "mereka" P3 ; -- lin although_Subj = -- lin because_Subj = lin if_Subj = ss "sekiranya" ; --- lin that_Subj = +lin that_Subj = ss "yang" ; lin when_Subj = ss "kalau" ; diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest index f80996b4..b5e654df 100644 --- a/src/malay/unittest/questions.gftest +++ b/src/malay/unittest/questions.gftest @@ -1,10 +1,10 @@ Lang: IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n5)))))))) (UseN song_N) LangEng: which five songs -LangMay: lima lagu apa +LangMay: lima lagu yang mana Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumPl) (UseN song_N)) (SlashVP (UsePron youPl_Pron) (SlashV2a like_V2))))) NoVoc LangEng: which songs do you like -LangMay: kamu suka lagu-lagu apa +LangMay: kamu suka lagu-lagu yang mana Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestSlash (IdetCN how8many_IDet (UseN cat_N)) (SlashVP (UsePron youPl_Pron) (SlashV2a have_V2))))) NoVoc LangEng: how many cats do you have @@ -28,7 +28,7 @@ LangMay: adakah awak tidak mengajar kucing Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP (IdetCN (IdetQuant which_IQuant NumSg) (UseN cat_N)) (ComplSlash (SlashV2a teach_V2) (UsePron he_Pron))) LangEng: which cat teaches him -LangMay: kucing apa mengajar dia +LangMay: kucing yang mana mengajar dia Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv where_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))) LangEng: where did you go @@ -36,4 +36,13 @@ LangMay: awak pergi mana Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))) LangEng: why did you go -LangMay: mengapa awak pergi \ No newline at end of file +LangMay: mengapa awak pergi + +Lang: UseQCl (TTAnt TPast ASimul) PNeg (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))) +LangEng: why didn't you go +LangMay: mengapa awak tidak pergi + +-- With ComplSlash: Wh-word is the object +Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN woman_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a see_V2))) +LangEng: which woman did you see +LangMay : awak melihat perempuan yang mana \ No newline at end of file From 83a16737dc6267294e8b584316838e340b40fcc5 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Tue, 4 Jan 2022 13:16:26 +0800 Subject: [PATCH 14/92] add whoSg_IP --- src/malay/ResMay.gf | 7 +++++++ src/malay/StructuralMay.gf | 4 +++- src/malay/unittest/questions.gftest | 15 ++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 30fed90f..8c82ac27 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -60,6 +60,13 @@ oper empty = [] } ; + mkIP : Str -> IPhrase = \str -> { + s = \\_ => str ; + a = NotPron ; + empty = [] ; + sp = \\_ => str ; + } ; + -------------------------------------------------------------------------------- -- Det, Quant, Card, Ord diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index e9db991f..3d5ad4e9 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -132,8 +132,10 @@ lin they_Pron = mkPron "mereka" P3 ; --lin whatPl_IP = ; --lin whatSg_IP = : --lin whoPl_IP = ; ---lin whoSg_IP = ; +lin whoSg_IP = mkIP "siapa"; +-- expected: {s : ParamMay.Possession => Str; a : ParamMay.NPAgr; +-- empty : Str; sp : ParamMay.NForm => Str} ------- -- Subj diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest index b5e654df..6b37f404 100644 --- a/src/malay/unittest/questions.gftest +++ b/src/malay/unittest/questions.gftest @@ -22,10 +22,6 @@ Lang: UseQCl (TTAnt TPres ASimul) PNeg (QuestCl (PredVP (UsePron youSg_Pron) (Co LangEng: don't you teach the cat LangMay: adakah awak tidak mengajar kucing -# Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP whoSg_IP (ComplVV want_VV (UseV go_V))) -# LangEng: who wants to go -# LangMay: Siapa mahu pergi - Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP (IdetCN (IdetQuant which_IQuant NumSg) (UseN cat_N)) (ComplSlash (SlashV2a teach_V2) (UsePron he_Pron))) LangEng: which cat teaches him LangMay: kucing yang mana mengajar dia @@ -45,4 +41,13 @@ LangMay: mengapa awak tidak pergi -- With ComplSlash: Wh-word is the object Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN woman_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a see_V2))) LangEng: which woman did you see -LangMay : awak melihat perempuan yang mana \ No newline at end of file +LangMay : awak melihat perempuan yang mana + +# -- should be to whom did mother give the meat +# Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whoSg_IP (SlashVP (MassNP (UseN2 mother_N2)) (Slash3V3 give_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))) +# LangEng: whom did mother give the meat +# LangMay: + +Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP whoSg_IP (ComplVV want_VV (UseV go_V))) +LangEng: who wants to go +LangMay: siapa mahu pergi From 664164e8c1d430c1ff73d3eeb4feaff4c6ea3241 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 5 Jan 2022 13:26:10 +0800 Subject: [PATCH 15/92] add QuestIComp --- src/malay/CatMay.gf | 2 +- src/malay/QuestionMay.gf | 13 ++++++++++--- src/malay/unittest/questions.gftest | 5 ++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 3970520c..7f3200d5 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -23,7 +23,7 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { -- Constructed in QuestionMay. QCl = ResMay.Clause ; - IComp = SS ; -- interrogative complement of copula e.g. "where" + IComp = {s: Str} ; -- interrogative complement of copula e.g. "where" IDet = ResMay.Determiner ; -- interrogative determiner e.g. "how many" IQuant = ResMay.IQuant ; -- interrogative quantifier e.g. "which" IP = ResMay.IPhrase ; -- interrogative pronoun e.g. "who" diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index f6f545fb..e0d3a149 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -59,6 +59,16 @@ lin } ; } ; + + -- : IP -> IComp ; + CompIP ip = {s = ip.s ! Bare } ; -- who (is it) + + -- : IComp -> NP -> QCl ; -- where is John? + QuestIComp icomp np = { + pred = \\vf,pol => np.s ! Bare ; + subj = icomp.s ; + } ; + -- \\vf,pol,posadv => -- { -- pred = \\vf,pol => ip.s ++ vp.s ! vf ! pol; @@ -122,9 +132,6 @@ lin -- : IAdv -> IComp ; CompIAdv iadv = iadv ; -- where (is it) - -- : IP -> IComp ; - CompIP ip = {s = ip.s ! Abs} ; -- who (is it) - -- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest index 6b37f404..afadc31a 100644 --- a/src/malay/unittest/questions.gftest +++ b/src/malay/unittest/questions.gftest @@ -38,7 +38,6 @@ Lang: UseQCl (TTAnt TPast ASimul) PNeg (QuestIAdv why_IAdv (PredVP (UsePron youS LangEng: why didn't you go LangMay: mengapa awak tidak pergi --- With ComplSlash: Wh-word is the object Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN woman_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a see_V2))) LangEng: which woman did you see LangMay : awak melihat perempuan yang mana @@ -51,3 +50,7 @@ LangMay : awak melihat perempuan yang mana Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP whoSg_IP (ComplVV want_VV (UseV go_V))) LangEng: who wants to go LangMay: siapa mahu pergi + +Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestIComp (CompIP whoSg_IP) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))) +LangEng: who is the cat +LangMay: siapa kucing \ No newline at end of file From 9d56ac6feecb72dab4ae118fb6854d4685762b11 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 12 Jan 2022 15:20:26 +0800 Subject: [PATCH 16/92] monosyllable prefix --- src/malay/AdjectiveMay.gf | 2 +- src/malay/LexiconMay.gf | 6 +++--- src/malay/ParamMay.gf | 4 ++++ src/malay/QuestionMay.gf | 4 ++-- src/malay/ResMay.gf | 3 +++ src/malay/StructuralMay.gf | 6 +++--- src/malay/VerbMay.gf | 14 +++++++++++++- src/malay/unittest/questions.gftest | 6 +++++- 8 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/malay/AdjectiveMay.gf b/src/malay/AdjectiveMay.gf index af6b454c..be7c198f 100644 --- a/src/malay/AdjectiveMay.gf +++ b/src/malay/AdjectiveMay.gf @@ -6,7 +6,7 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in { -- : A -> AP ; PositA a = a ** { - compar = [] ; + compar = a.s ; } ; -- : A -> NP -> AP ; diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index b17c7753..e3344258 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -33,7 +33,7 @@ lin beautiful_A = mkA "cantik" ; -- lin bike_N = mkN "" ; -- lin bird_N = mkN "" ; -- lin bite_V2 = mkV2 "" ; --- lin black_A = mkA "" ; +lin black_A = mkA "hitam" ; -- lin blood_N = mkN "" ; -- lin blow_V = mkV "" ; -- lin blue_A = mkA "" ; @@ -230,7 +230,7 @@ lin man_N = mkN "lelaki" ; -- lin meat_N = mkN "" ; lin milk_N = mkN "susu" ; -- lin moon_N = mkN "" ; --- lin mother_N2 = mkN2 "" ; +lin mother_N2 = mkN2 "ibu" ; -- lin mountain_N = mkN "" ; -- lin mouth_N = mkN "" ; -- lin music_N = mkN "" ; @@ -256,7 +256,7 @@ lin now_Adv = mkAdv "sekarang" ; -- lin oil_N = mkN "" ; lin old_A = mkA "tua" ; -- lin open_V2 = mkV2 "" ; --- lin paint_V2A = mkV2A "" ; +lin paint_V2A = mkV2 "cat" ; -- lin paper_N = mkN "" ; -- lin paris_PN = mkPN "Paris" ; -- lin peace_N = mkN "" ; diff --git a/src/malay/ParamMay.gf b/src/malay/ParamMay.gf index 9c3f28da..0eeb7de4 100644 --- a/src/malay/ParamMay.gf +++ b/src/malay/ParamMay.gf @@ -31,6 +31,8 @@ oper } ; prefixMeng : Str -> Str = \makan -> case makan of { + ? + ? + c => "menge" + makan ; + (#v|"g"|"h") + _ => "meng" + makan ; -- prefix meng: e.g. meng+atur "k" + enal @@ -49,6 +51,8 @@ oper "s" + alak => "meny" + alak ; -- replace s with meny + + ("r"|"l"|"w"|"y"|"m"|"n"|"ny"|"ng") + _ => "me" + makan ; -- prefix me diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index e0d3a149..ba6cab1a 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -54,8 +54,8 @@ lin True => iadv.s ++ cls.subj ; False => cls.subj } ; pred = \\vf,pol => case iadv.isPre of { - True => cls.pred ! Root ! pol ; - False => cls.pred ! Root ! pol ++ iadv.s + True => cls.pred ! iadv.vf ! pol ; + False => cls.pred ! iadv.vf ! pol ++ iadv.s } ; } ; diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 8c82ac27..45fc9ad7 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -67,6 +67,7 @@ oper sp = \\_ => str ; } ; + -------------------------------------------------------------------------------- -- Det, Quant, Card, Ord @@ -235,6 +236,7 @@ oper IAdv : Type = Adverb ** { isPre : Bool ; + vf : VForm ; } ; ------------------ @@ -256,6 +258,7 @@ oper s = \\vf,pol => nounneg pol ++ s ; } ; + verbneg : Polarity -> Str = \pol -> case pol of { Neg => "tidak" ; -- or "tak"? Pos => [] diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 3d5ad4e9..8f881ff8 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -15,13 +15,13 @@ lin very_AdA = mkAdA "" ; lin as_CAdv = { s = "" ; p = [] } ; lin less_CAdv = { s = "" ; p = [] } ; lin more_CAdv = { s = "" ; p = [] } ; -lin how_IAdv = ss "" : lin how8much_IAdv = ss "" ; lin when_IAdv = ss "" ; -} -lin where_IAdv = { s = "mana"; isPre = False } ; -lin why_IAdv = {s = "mengapa"; isPre = True } ; +lin how_IAdv = { s = "bagaimana"; isPre = True ; vf = Active } ; +lin where_IAdv = { s = "mana"; isPre = False ; vf = Root } ; +lin why_IAdv = {s = "mengapa"; isPre = True ; vf = Root } ; {- diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index d97fa932..b483102e 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -55,6 +55,15 @@ lin c2 = v3.c2 -- Now the VPSlash is missing only the direct object } ; + -- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp -> + -- insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ; + + SlashV2A v2 adj = useV { + s = \\vf => v2.s ! vf ++ adj.s; + } ** { + c2 = v2.c2 + } ; + {- -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good SlashV2S v2s s = @@ -70,7 +79,10 @@ lin -} -- : VPSlash -> NP -> VP ComplSlash vps np = vps ** { - s = \\vf,pol => vps.s ! vf ! pol ++ applyPrep vps.c2 np + s = \\vf,pol => + vps.s ! vf ! pol + ++ applyPrep vps.c2 np + -- s = \\vf,pol => vps.s ! vf ! pol ++ applyPrep vps.c2 np } ; -- : VV -> VPSlash -> VPSlash ; diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest index afadc31a..875614d3 100644 --- a/src/malay/unittest/questions.gftest +++ b/src/malay/unittest/questions.gftest @@ -53,4 +53,8 @@ LangMay: siapa mahu pergi Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestIComp (CompIP whoSg_IP) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))) LangEng: who is the cat -LangMay: siapa kucing \ No newline at end of file +LangMay: siapa kucing + +Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN2 mother_N2)) (ComplSlash (SlashV2A paint_V2A (PositA black_A)) (DetCN (DetQuant DefArt NumSg) (UseN house_N))))) +LangEng: how does your mother paint the house black +LangMay: bagaimana ibu awak mengecat rumah hitam \ No newline at end of file From f0b5a89fd48fb3a5aaa38235e4a334b9f3f66365 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 12 Jan 2022 17:17:10 +0800 Subject: [PATCH 17/92] add slash3v3 and SlashV2A --- src/malay/CatMay.gf | 2 +- src/malay/LexiconMay.gf | 4 ++-- src/malay/ParamMay.gf | 5 ++--- src/malay/ResMay.gf | 2 ++ src/malay/StructuralMay.gf | 2 +- src/malay/VerbMay.gf | 26 ++++++++++++++++++-------- src/malay/unittest/questions.gftest | 21 +++++++++++++++++---- 7 files changed, 43 insertions(+), 19 deletions(-) diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 7f3200d5..d1bc0ebb 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -108,7 +108,7 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { V2A, -- verb with NP and AP complement e.g. "paint" V2V, -- verb with NP and V complement e.g. "cause" - V2S, -- verb with NP and S complement e.g. "tell" + V2S, -- Reverb with NP and S complement e.g. "tell" V2Q, -- verb with NP and Q complement e.g. "ask" V2 = ResMay.Verb2 ; V3 = ResMay.Verb3 ; diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index e3344258..74d14c68 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -227,7 +227,7 @@ lin love_V2 = mkV2 "cinta" ; lin man_N = mkN "lelaki" ; -- lin married_A2 = mkA "" ; --- lin meat_N = mkN "" ; +lin meat_N = mkN "daging" ; lin milk_N = mkN "susu" ; -- lin moon_N = mkN "" ; lin mother_N2 = mkN2 "ibu" ; @@ -364,7 +364,7 @@ lin song_N = mkN "lagu" ; -- lin table_N = mkN "" ; -- lin tail_N = mkN "" ; --- lin talk_V3 = mkV3 "" ; +lin talk_V3 = mkV3 (mkV "cakap" Ber) (mkPrep "tentang") (mkPrep "dengan") ; lin teach_V2 = mkV2 "ajar" ; -- lin teacher_N = mkN "" ; -- lin television_N = mkN "" ; diff --git a/src/malay/ParamMay.gf b/src/malay/ParamMay.gf index 0eeb7de4..abe7164d 100644 --- a/src/malay/ParamMay.gf +++ b/src/malay/ParamMay.gf @@ -31,7 +31,8 @@ oper } ; prefixMeng : Str -> Str = \makan -> case makan of { - ? + ? + c => "menge" + makan ; + + ? + ? + ? => "menge" + makan ; (#v|"g"|"h") + _ => "meng" + makan ; -- prefix meng: e.g. meng+atur @@ -51,8 +52,6 @@ oper "s" + alak => "meny" + alak ; -- replace s with meny - - ("r"|"l"|"w"|"y"|"m"|"n"|"ny"|"ng") + _ => "me" + makan ; -- prefix me diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 45fc9ad7..b2c0d878 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -248,6 +248,7 @@ oper VPSlash : Type = VerbPhrase ** { c2 : Preposition ; + adjCompl : Str ; } ; useV : Verb -> VerbPhrase = \v -> v ** { @@ -295,6 +296,7 @@ oper predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps -> predVP np ** {c2 = vps.c2} ; + -- mkClause : Str -> NounPhrase -> VPSlash -> Clause = \str,np,vp -> { -- subj = str ++ np.s ! Bare; -- pred = vp.s diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 8f881ff8..862970fa 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -130,7 +130,7 @@ lin youPl_Pron = mkPron "kamu" P2; lin they_Pron = mkPron "mereka" P3 ; --lin whatPl_IP = ; ---lin whatSg_IP = : +lin whatSg_IP = mkIP "apa"; --lin whoPl_IP = ; lin whoSg_IP = mkIP "siapa"; diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index b483102e..3dbf8cba 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -38,30 +38,38 @@ lin -- : V2 -> VPSlash SlashV2a v2 = useV v2 ** { - c2 = v2.c2 + c2 = v2.c2 ; + adjCompl = [] } ; + -- : V3 -> NP -> VPSlash ; -- give it (to her) Slash2V3 v3 dobj = useV { s = \\vf => v3.s ! vf ++ applyPrep v3.c2 dobj + } ** { - c2 = v3.c3 -- Now the VPSlash is missing only the indirect object + c2 = v3.c3; -- Now the VPSlash is missing only the indirect object + adjCompl = [] } ; -- : V3 -> NP -> VPSlash ; -- give (it) to her Slash3V3 v3 iobj = useV { - s = \\vf => v3.s ! vf ++ iobj.s ! Bare -- applyPrep v3.c3 iobj -- TODO check if this works for all -- probably not + s = \\vf => v3.s ! vf ++ iobj.s ! Bare ++ applyPrep v3.c3 emptyNP; + --iobj.s ! Bare -- applyPrep v3.c3 iobj -- TODO check if this works for all -- probably not } ** { - c2 = v3.c2 -- Now the VPSlash is missing only the direct object + c2 = v3.c2 ;-- Now the VPSlash is missing only the direct object + adjCompl = [] + } ; -- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp -> -- insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ; SlashV2A v2 adj = useV { - s = \\vf => v2.s ! vf ++ adj.s; + s = \\vf => v2.s ! vf; } ** { - c2 = v2.c2 + c2 = v2.c2; + adjCompl = adj.s } ; {- @@ -81,14 +89,16 @@ lin ComplSlash vps np = vps ** { s = \\vf,pol => vps.s ! vf ! pol - ++ applyPrep vps.c2 np + ++ applyPrep vps.c2 np ++ vps.adjCompl -- s = \\vf,pol => vps.s ! vf ! pol ++ applyPrep vps.c2 np } ; + -- : VV -> VPSlash -> VPSlash ; SlashVV vv vps = ComplVV vv vps ** { c2 = vps.c2 ; -- like ComplVV except missing object - passive = vv.s ++ vps.passive + passive = vv.s ++ vps.passive; + adjCompl = vps.adjCompl ; } ; -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest index 875614d3..cdac74cf 100644 --- a/src/malay/unittest/questions.gftest +++ b/src/malay/unittest/questions.gftest @@ -43,9 +43,14 @@ LangEng: which woman did you see LangMay : awak melihat perempuan yang mana # -- should be to whom did mother give the meat -# Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whoSg_IP (SlashVP (MassNP (UseN2 mother_N2)) (Slash3V3 give_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))) -# LangEng: whom did mother give the meat -# LangMay: +Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whoSg_IP (SlashVP (MassNP (UseN2 mother_N2)) (Slash3V3 give_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))) +LangEng: whom did mother give the meat +LangMay: ibu memberi daging kepada siapa + +# -- should be to whom did mother talk the meat +Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whoSg_IP (SlashVP (MassNP (UseN2 mother_N2)) (Slash3V3 talk_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))) +LangEng: whom did mother talk about the meat to +LangMay: ibu bercakap daging dengan siapa Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP whoSg_IP (ComplVV want_VV (UseV go_V))) LangEng: who wants to go @@ -57,4 +62,12 @@ LangMay: siapa kucing Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN2 mother_N2)) (ComplSlash (SlashV2A paint_V2A (PositA black_A)) (DetCN (DetQuant DefArt NumSg) (UseN house_N))))) LangEng: how does your mother paint the house black -LangMay: bagaimana ibu awak mengecat rumah hitam \ No newline at end of file +LangMay: bagaimana ibu awak mengecat rumah hitam + +Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron she_Pron) (ComplSlash (SlashV2a eat_V2) (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))) +LangEng: why did she eat the meat +LangMay: mengapa dia makan daging + +Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN meat_N) (UseRCl (TTAnt TPast ASimul) PPos (RelVP IdRP (PassV2 eat_V2)))))))) +LangEng: what was the meat that was eaten +LangMay: apa daging yang dimakan \ No newline at end of file From 049bd8943ecf9c2cea82dcf0f3fbc554c06eaa52 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Thu, 20 Jan 2022 12:24:51 +0800 Subject: [PATCH 18/92] fix minor fixes for Malay RGL --- src/abstract/Lexicon.gf | 1 - src/english/NounEng.gf | 2 +- src/malay/AdjectiveMay.gf | 2 +- src/malay/AllMay.gf | 4 +++- src/malay/LexiconMay.gf | 1 - 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/abstract/Lexicon.gf b/src/abstract/Lexicon.gf index 9dcf6f67..07e40113 100644 --- a/src/abstract/Lexicon.gf +++ b/src/abstract/Lexicon.gf @@ -265,7 +265,6 @@ fun short_A : A ; silver_N : N ; sing_V : V ; - sing_V2 : V2 ; sister_N : N ; sit_V : V ; skin_N : N ; diff --git a/src/english/NounEng.gf b/src/english/NounEng.gf index 848b2196..af3cd446 100644 --- a/src/english/NounEng.gf +++ b/src/english/NounEng.gf @@ -56,7 +56,7 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in { DetNP det = { -- s = case det.hasNum of {True => \\_ => det.s ; _ => \\c => det.sp ! c} ; - s = \\c => det.sp ! Neutr ! False ! c ++ "whatevr" ; + s = \\c => det.sp ! Neutr ! False ! c ; a = agrP3 det.n } ; diff --git a/src/malay/AdjectiveMay.gf b/src/malay/AdjectiveMay.gf index be7c198f..af6b454c 100644 --- a/src/malay/AdjectiveMay.gf +++ b/src/malay/AdjectiveMay.gf @@ -6,7 +6,7 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in { -- : A -> AP ; PositA a = a ** { - compar = a.s ; + compar = [] ; } ; -- : A -> NP -> AP ; diff --git a/src/malay/AllMay.gf b/src/malay/AllMay.gf index b7b17611..c965d873 100644 --- a/src/malay/AllMay.gf +++ b/src/malay/AllMay.gf @@ -3,4 +3,6 @@ concrete AllMay of AllMayAbs = LangMay, ExtendMay - ** {} ; + ** { + lin sing_V2 = mkV2 "nyanyi" ; + } ; diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index 74d14c68..a74a89b8 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -324,7 +324,6 @@ lin sell_V3 = mkV3 (mkV "jual" Meng) emptyPrep emptyPrep ; -- TODO -- lin short_A = mkA "" ; -- lin silver_N = mkN "" ; lin sing_V = mkV "nyanyi" ; -lin sing_V2 = mkV2 "nyanyi" ; -- lin sister_N = mkN "" ; -- lin sit_V = mkV "" ; -- lin skin_N = mkN "" ; From 7f9a4dce2bb774e78187f799129055c45b8188c4 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Fri, 21 Jan 2022 15:16:50 +0800 Subject: [PATCH 19/92] switched kami to kita for inclusiveness --- src/malay/StructuralMay.gf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 862970fa..d41a0cd8 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -125,7 +125,8 @@ lin youPol_Pron = mkPron "kamu" P2 ; lin youSg_Pron = mkPron "awak" P2 ; lin he_Pron = mkPron "dia" P3 ; lin she_Pron = mkPron "dia" P3 ; -lin we_Pron = mkPron "kami" P1 ; +-- inclusive we +lin we_Pron = mkPron "kita" P1 ; lin youPl_Pron = mkPron "kamu" P2; lin they_Pron = mkPron "mereka" P3 ; From be36e65343103de0a9e5bdafe947872a91195f17 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 26 Jan 2022 19:22:42 +0800 Subject: [PATCH 20/92] added sing_V2 to AllMayAbs --- src/malay/AllMayAbs.gf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/malay/AllMayAbs.gf b/src/malay/AllMayAbs.gf index 7e95d86d..d909027d 100644 --- a/src/malay/AllMayAbs.gf +++ b/src/malay/AllMayAbs.gf @@ -3,4 +3,6 @@ abstract AllMayAbs = Lang, Extend - ** {} ; + ** { + fun sing_V2: V2; + } ; From c81edf3fbb8779e8f40ee558bcbb08eebe30dbcc Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 13 Dec 2021 14:06:29 +0100 Subject: [PATCH 21/92] remove dead code --- src/bulgarian/MorphoFunsBul.gf | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/bulgarian/MorphoFunsBul.gf b/src/bulgarian/MorphoFunsBul.gf index 3a44d715..bd4f9266 100644 --- a/src/bulgarian/MorphoFunsBul.gf +++ b/src/bulgarian/MorphoFunsBul.gf @@ -5,8 +5,8 @@ resource MorphoFunsBul = open Prelude, CatBul, MorphoBul - in { - flags coding=utf8 ; + in { + flags coding=utf8 ; oper @@ -57,12 +57,6 @@ oper dualV : VTable -> VTable -> V ; dualV imperf perf = { s = table {Imperf=>imperf; Perf=>perf}; - n = let v0 = init (imperf ! (VImperfect Sg P1)) + "н" - in (mkNoun (v0+"е") - (v0+"ия") - (v0+"ия") - (v0+"е") - ANeut).s; vtype = VNormal; lock_V=<> } ; @@ -72,12 +66,6 @@ oper singleV : VTable -> V ; singleV vtable = { s = \\_=>vtable; - n = let v0 = init (vtable ! (VImperfect Sg P1)) + "н" - in (mkNoun (v0+"е") - (v0+"ия") - (v0+"ия") - (v0+"е") - ANeut).s; vtype = VNormal; lock_V=<> } ; From 7da1cc310b741eb3aa1d6bde402fa413b92b58eb Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 14 Dec 2021 09:20:06 +0100 Subject: [PATCH 22/92] simplify the pattern in ia2e --- src/bulgarian/ResBul.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bulgarian/ResBul.gf b/src/bulgarian/ResBul.gf index bc1ff51e..1bebfa26 100644 --- a/src/bulgarian/ResBul.gf +++ b/src/bulgarian/ResBul.gf @@ -469,7 +469,7 @@ resource ResBul = ParamX ** open Prelude, Predef in { ia2e : Str -> Str = -- to be used when the next syllable has vowel different from "а","ъ","о" or "у" \s -> case s of { - x@(_*+_) + "я" + y@(("б"|"в"|"г"|"д"|"ж"|"з"|"к"|"л"|"м"|"н"|"п"|"р"|"с"|"т"|"ф"|"х"|"ц"|"ч"|"ш")*) + x + "я" + y@(["бвгджзклмнпрстфхцчш"]*) => x+"е"+y; _ => s }; From 0ee84ddb7d28971d9c21643d68230d9af2381175 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 20 Dec 2021 16:27:21 +0100 Subject: [PATCH 23/92] Add ExtendTur to the list of modules --- src/turkish/AllTur.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/turkish/AllTur.gf b/src/turkish/AllTur.gf index fb1524e2..343381bf 100644 --- a/src/turkish/AllTur.gf +++ b/src/turkish/AllTur.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../prelude concrete AllTur of AllTurAbs = - LangTur --- ,ExtendTur + LangTur, + ExtendTur ** {} ; From c8862b8ed851d199705d64cc71b3349ac1715304 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 11 Jan 2022 15:16:26 +0100 Subject: [PATCH 24/92] an optimization which would be relevant with the new compiler --- src/scandinavian/NounScand.gf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scandinavian/NounScand.gf b/src/scandinavian/NounScand.gf index a1df7488..450afbbc 100644 --- a/src/scandinavian/NounScand.gf +++ b/src/scandinavian/NounScand.gf @@ -13,9 +13,9 @@ incomplete concrete NounScand of Noun = let g = cn.g ; m = cn.isMod ; - dd = case of { - => DDef Indef ; - => d + dd = case of { + => DDef Indef ; + <_,d,_> => d } in { s = \\c => det.s ! m ! g ++ From 83a59f2757ff3c30d15d1f65965b89af108b0ee4 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Tue, 28 Dec 2021 11:20:08 +0100 Subject: [PATCH 25/92] fixed ParadigmsFre.mkA with 2 and 3 arguments, and commented out some uncompilable entries from DictFre --- src/french/DictFre.gf | 50 +++++++++++++++++++------------------- src/french/ParadigmsFre.gf | 22 +++++++++++++++-- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/french/DictFre.gf b/src/french/DictFre.gf index ed543f47..05b7b267 100644 --- a/src/french/DictFre.gf +++ b/src/french/DictFre.gf @@ -22189,7 +22189,7 @@ lin cretace_2_A = mkA "crétacé" "crétacée" ; lin crete_1_A = mkA "crêté" "crêtée" ; lin crete_1_N = mkN "crête" "crêtes" feminine ; lin creter_1_V = mkV "crêter" ; -lin creterse_1_V = mkV "crêterse" ; +--lin creterse_1_V = mkV "crêterse" ; lin cretification_1_N = mkN "crétification" "crétifications" feminine ; lin cretin_1_N = mkN "crétin" "crétins" masculine ; lin cretin_2_A = mkA "crétin" "crétine" ; @@ -23474,7 +23474,7 @@ lin debillarder_1_V = mkV "débillarder" ; lin debinage_1_N = mkN "débinage" "débinages" masculine ; lin debine_1_N = mkN "débine" "débines" feminine ; lin debiner_1_V = mkV "débiner" ; -lin debinerse_1_V = mkV "débinerse" ; +--lin debinerse_1_V = mkV "débinerse" ; lin debineur_1_N = mkN "débineur" "débineurs" masculine ; lin debineur_2_A = mkA "débineur" "débineuse" ; lin debineuse_1_N = mkN "débineuse" "débineuses" feminine ; @@ -23725,7 +23725,7 @@ lin decatissure_1_N = mkN "décatissure" "décatissures" feminine ; lin decave_1_N = mkN "décavé" "décavés" masculine ; lin decave_2_A = mkA "décavé" "décavée" ; lin decaver_1_V = mkV "décaver" ; -lin decaverse_1_V = mkV "décaverse" ; +--lin decaverse_1_V = mkV "décaverse" ; lin decede_1_A = mkA "décédé" "décédée" ; lin deceder_1_V = mkV "décéder" ; lin decelable_1_A = mkA "décelable" "décelable" ; @@ -24231,7 +24231,7 @@ lin deficiente_1_N = mkN "déficiente" "déficientes" feminine ; lin deficit_1_N = mkN "déficit" "déficits" masculine ; lin deficitaire_1_A = mkA "déficitaire" "déficitaire" ; lin defier_1_V = mkV "défier" ; -lin defierse_1_V = mkV "défierse" ; +--lin defierse_1_V = mkV "défierse" ; lin defiger_1_V = mkV "défiger" ; lin defiguration_1_N = mkN "défiguration" "défigurations" feminine ; lin defigure_1_A = mkA "défiguré" "défigurée" ; @@ -26106,7 +26106,7 @@ lin develoute_1_A = mkA "dévelouté" "déveloutée" ; lin develouter_1_V = mkV "dévelouter" ; lin devenir_1_N = mkN "devenir" "devenirs" masculine ; lin devenir_2_V = mkV "devenir" ; -lin deveniren_1_V = mkV "deveniren" ; +--lin deveniren_1_V = mkV "deveniren" ; lin deverbal_1_N = mkN "déverbal" "déverbaux" masculine ; lin devergondage_1_N = mkN "dévergondage" "dévergondages" masculine ; lin devergonde_1_A = mkA "dévergondé" "dévergondée" ; @@ -32656,7 +32656,7 @@ lin faire_1_V = mkV "faire" ; lin faire_part_1_N = mkN "faire-part" masculine ; lin faire_savoir_1_N = mkN "faire-savoir" masculine ; lin faire_valoir_1_N = mkN "faire-valoir" masculine ; -lin fairese_1_V = mkV "fairese" ; +--lin fairese_1_V = mkV "fairese" ; lin faisable_1_A = mkA "faisable" "faisable" ; lin faisan_1_N = mkN "faisan" "faisans" masculine ; lin faisances_1_N = mkN "faisances" feminine ; @@ -33496,7 +33496,7 @@ lin fichaise_1_N = mkN "fichaise" "fichaises" feminine ; lin fichant_1_A = mkA "fichant" "fichante" ; lin fichard_1_N = mkN "fichard" masculine ; lin fiche_1_N = mkN "fiche" "fiches" feminine ; -lin fiche_2_V = mkV "fiche" ; +--lin fiche_2_V = mkV "fiche" ; lin fiche_tricot_1_N = mkN "fiche-tricot" feminine ; lin ficher_1_V = mkV "ficher" ; lin fichet_1_N = mkN "fichet" "fichets" masculine ; @@ -34460,7 +34460,7 @@ lin formalisant_1_A = mkA "formalisant" ; lin formalisation_1_N = mkN "formalisation" "formalisations" feminine ; lin formalise_1_A = mkA "formalisé" ; lin formaliser_1_V = mkV "formaliser" ; -lin formaliserse_1_V = mkV "formaliserse" ; +--lin formaliserse_1_V = mkV "formaliserse" ; lin formalisme_1_N = mkN "formalisme" "formalismes" masculine ; lin formaliste_1_N = mkN "formaliste" "formalistes" feminine ; lin formaliste_2_N = mkN "formaliste" "formalistes" masculine ; @@ -39011,7 +39011,7 @@ lin haillonneux_1_A = mkA "haillonneux" "haillonneuse" ; lin haine_1_N = mkN "haine" "haines" feminine ; lin haineusement_1_Adv = mkAdv "haineusement" ; lin haineux_1_A = mkA "haineux" "haineuse" ; -lin hair_1_V = mkV "haïr" ; +----lin hair_1_V = conj2haïr "haïr ; lin haire_1_N = mkN "haire" "haires" feminine ; lin haissable_1_A = mkA "haïssable" "haïssable" ; lin haisseur_1_N = mkN "haïsseur" "haïsseurs" masculine ; @@ -49335,7 +49335,7 @@ lin macle_1_A = mkA "mâclé" ; lin macle_1_N = mkN "macle" "macles" feminine ; lin macler_1_V = mkV "macler" ; lin macler_1_V0 = mkV "mâcler" ; -lin maclerse_1_V = mkV "mâclerse" ; +--lin maclerse_1_V = mkV "mâclerse" ; lin maclotte_1_N = mkN "maclotte" "maclottes" feminine ; lin macon_1_N = mkN "maçon" "maçons" masculine ; lin macon_1_N0 = mkN "mâcon" "mâcons" masculine ; @@ -50186,7 +50186,7 @@ lin manierisme_1_N = mkN "maniérisme" "maniérismes" masculine ; lin manieriste_1_N = mkN "maniériste" "maniéristes" feminine ; lin manieriste_2_N = mkN "maniériste" "maniéristes" masculine ; lin manieriste_3_A = mkA "maniériste" "maniériste" ; -lin manierse_1_V = mkV "manierse" ; +--lin manierse_1_V = mkV "manierse" ; lin manieur_1_N = mkN "manieur" "manieurs" masculine ; lin manieuse_1_N = mkN "manieuse" "manieuses" feminine ; lin manif_1_N = mkN "manif" feminine ; @@ -50515,7 +50515,7 @@ lin marianisme_1_N = mkN "marianisme" masculine ; lin marianiste_1_N = mkN "marianiste" "marianistes" feminine ; lin marianiste_2_N = mkN "marianiste" "marianistes" masculine ; lin mariant_1_A = mkA "mariant" ; -lin marida_1_V = mkV "marida" ; +--lin marida_1_V = mkV "marida" ; lin marie_1_N = mkN "marié" "mariés" masculine ; lin marie_2_A = mkA "marié" "mariée" ; lin marie_couche_toi_la_1_N = mkN "marie-couche-toi-là" feminine ; @@ -59372,7 +59372,7 @@ lin ouiller_1_V = mkV "ouiller" ; lin ouillere_1_N = mkN "ouillère" "ouillères" feminine ; lin ouillette_1_N = mkN "ouillette" feminine ; lin ouilleur_1_N = mkN "ouilleur" masculine ; -lin ouir_1_V = mkV "ouïr" ; +----lin ouir_1_V = mkV "ouïr" ; lin ouistiti_1_N = mkN "ouistiti" "ouistitis" masculine ; lin oukase_1_N = (mkN "oukase" "oukases" masculine) | (mkN "ukase" "ukases" masculine) ; lin oulema_1_N = (mkN "ouléma" "oulémas" masculine) | (mkN "uléma" "ulémas" masculine) ; @@ -64173,7 +64173,7 @@ lin pignade_1_N = mkN "pignade" "pignades" feminine ; lin pigne_1_N = mkN "pigne" "pignes" feminine ; lin pigner_1_V = mkV "pigner" ; lin pignocher_1_V = mkV "pignocher" ; -lin pignocherse_1_V = mkV "pignocherse" ; +--lin pignocherse_1_V = mkV "pignocherse" ; lin pignocheur_1_N = mkN "pignocheur" "pignocheurs" masculine ; lin pignocheuse_1_N = mkN "pignocheuse" "pignocheuses" feminine ; lin pignolat_1_N = mkN "pignolat" masculine ; @@ -72813,7 +72813,7 @@ lin relaxe_1_N = mkN "relaxe" "relaxes" feminine ; lin relaxe_2_N = mkN "relaxe" "relaxes" masculine ; lin relaxe_3_A = mkA "relaxe" "relaxe" ; lin relaxer_1_V = mkV "relaxer" ; -lin relaxerse_1_V = mkV "relaxerse" ; +--lin relaxerse_1_V = mkV "relaxerse" ; lin relayer_1_V = mkV "relayer" ; lin relayeur_1_N = mkN "relayeur" "relayeurs" masculine ; lin relayeuse_1_N = mkN "relayeuse" "relayeuses" feminine ; @@ -73373,7 +73373,7 @@ lin repenti_2_A = mkA "repenti" "repentie" ; lin repentie_1_N = mkN "repentie" "repenties" feminine ; lin repentir_1_N = mkN "repentir" "repentirs" masculine ; lin repentir_2_V = mkV "repentir" ; -lin repentirse_1_V = mkV "repentirse" ; +--lin repentirse_1_V = mkV "repentirse" ; lin reperable_1_A = mkA "repérable" "repérable" ; lin reperage_1_N = mkN "repérage" "repérages" masculine ; lin repercer_1_V = mkV "repercer" ; @@ -73809,7 +73809,7 @@ lin ressourcer_1_V = mkV "ressourcer" ; lin ressouvenance_1_N = mkN "ressouvenance" "ressouvenances" feminine ; lin ressouvenir_1_N = mkN "ressouvenir" "ressouvenirs" masculine ; lin ressouvenir_2_V = mkV "ressouvenir" ; -lin ressouvenirse_1_V = mkV "ressouvenirse" ; +--lin ressouvenirse_1_V = mkV "ressouvenirse" ; lin ressuage_1_N = mkN "ressuage" "ressuages" masculine ; lin ressuer_1_V = mkV "ressuer" ; lin ressui_1_N = mkN "ressui" "ressuis" masculine ; @@ -74969,7 +74969,7 @@ lin rocheux_1_A = mkA "rocheux" "rocheuse" ; lin rochier_1_N = mkN "rochier" "rochiers" masculine ; lin rock_1_N = mkN "rock" "rocks" masculine ; lin rock_and_roll_1_N = mkN "rock" masculine ; -lin rock_and_roller_1_V = mkV "rock" ; +--lin rock_and_roller_1_V = mkV "rock" ; lin rock_and_roller_2_N = mkN "rock" masculine ; lin rock_n_roll_1_N = mkN "rock'n'roll" masculine ; lin rock_n_roller_1_V = mkV "rock'n'roller" ; @@ -77489,7 +77489,7 @@ lin se_chemer_1_V = reflV (mkV "chemer") ; lin se_compassionner_1_V = reflV (mkV "compassionner") ; lin se_condouloir_1_V = reflV (mkV "condouloir") ; lin se_conjouir_1_V = reflV (mkV "conjouir") ; -lin se_contrefiche_1_V = reflV (mkV "contrefiche") ; +--lin se_contrefiche_1_V = reflV (mkV "contrefiche") ; lin se_contreficher_1_V = reflV (mkV "contreficher") ; lin se_contrefoutre_1_V = reflV (mkV "contrefoutre") ; lin se_costumer_1_V = reflV (mkV "costumer") ; @@ -77559,7 +77559,7 @@ lin se_ensuivre_1_V = reflV (mkV "ensuivre") ; lin se_entabler_1_V = reflV (mkV "entabler") ; lin se_entaverner_1_V = reflV (mkV "entaverner") ; lin se_enticher_1_V = reflV (mkV "enticher") ; -lin se_entr_egorger_1_V = reflV (mkV "entr") ; +--lin se_entr_egorger_1_V = reflV (mkV "entr") ; lin se_entraider_1_V = reflV (mkV "entraider") ; lin se_entre_dechirer_1_V = reflV (mkV "entre") ; lin se_entre_devorer_1_V = reflV (mkV "entre") ; @@ -77591,7 +77591,7 @@ lin se_exorbiter_1_V = reflV (mkV "exorbiter") ; lin se_extravaser_1_V = reflV (mkV "extravaser") ; lin se_fistuliser_1_V = reflV (mkV "fistuliser") ; lin se_foliariser_1_V = reflV (mkV "foliariser") ; -lin se_frotti_frotter_1_V = reflV (mkV "frotti") ; +--lin se_frotti_frotter_1_V = reflV (mkV "frotti") ; lin se_gabeler_1_V = reflV (mkV "gabeler") ; lin se_gauchiser_1_V = reflV (mkV "gauchiser") ; lin se_gendarmer_1_V = reflV (mkV "gendarmer") ; @@ -77716,7 +77716,7 @@ lin se_revenger_1_V = reflV (mkV "revenger") ; lin se_rhinoceroser_1_V = reflV (mkV "rhinoceroser") ; lin se_ruinoter_1_V = reflV (mkV "ruinoter") ; lin se_serviliser_1_V = reflV (mkV "serviliser") ; -lin se_sous_venter_1_V = reflV (mkV "sous") ; +--lin se_sous_venter_1_V = reflV (mkV "sous") ; lin se_subdivisionner_1_V = reflV (mkV "subdivisionner") ; lin se_suicider_1_V = reflV (mkV "suicider") ; lin se_surficher_1_V = reflV (mkV "surficher") ; @@ -77727,7 +77727,7 @@ lin se_torsionner_1_V = reflV (mkV "torsionner") ; lin se_touffer_1_V = reflV (mkV "touffer") ; lin se_transsubstantialiser_1_V = reflV (mkV "transsubstantialiser") ; lin se_trisser_1_V = reflV (mkV "trisser") ; -lin se_ultra_condenser_1_V = reflV (mkV "ultra") ; +--lin se_ultra_condenser_1_V = reflV (mkV "ultra") ; lin se_vacher_1_V = reflV (mkV "vacher") ; lin se_vasculariser_1_V = reflV (mkV "vasculariser") ; lin se_veinuler_1_V = reflV (mkV "veinuler") ; @@ -80772,7 +80772,7 @@ lin souvenance_1_N = mkN "souvenance" "souvenances" feminine ; lin souvenant_1_A = mkA "souvenant" ; lin souvenir_1_N = mkN "souvenir" "souvenirs" masculine ; lin souvenir_2_V = mkV "souvenir" ; -lin souvenirse_1_V = mkV "souvenirse" ; +--lin souvenirse_1_V = mkV "souvenirse" ; lin souvent_1_Adv = mkAdv "souvent" ; lin souventefois_1_Adv = mkAdv "souventefois" ; lin souverain_1_N = mkN "souverain" "souverains" masculine ; @@ -86614,7 +86614,7 @@ lin toquarde_1_N = mkN "toquarde" feminine ; lin toque_1_A = mkA "toqué" "toquée" ; lin toque_1_N = mkN "toque" "toques" feminine ; lin toquer_1_V = mkV "toquer" ; -lin toquerse_1_V = mkV "toquerse" ; +--lin toquerse_1_V = mkV "toquerse" ; lin toquet_1_N = mkN "toquet" "toquets" masculine ; lin torche_1_A = mkA "torché" "torchée" ; lin torche_1_N = mkN "torche" "torches" feminine ; diff --git a/src/french/ParadigmsFre.gf b/src/french/ParadigmsFre.gf index 99facb46..e87fcd92 100644 --- a/src/french/ParadigmsFre.gf +++ b/src/french/ParadigmsFre.gf @@ -403,8 +403,26 @@ oper mkA = overload { mkA : Str -> A = regA ; - mkA : (sec,seche : Str) -> A = \sec,seche -> mk4A sec seche (sec + "s") (seche + "ment") ; - mkA : (banal,banale,banaux : Str) -> A = \sec,seche,secs -> mk4A sec seche secs (seche + "ment") ; + mkA : (sec,seche : Str) -> A = \sec,seche -> + let a = regA sec + in a ** { + s = table { + AF Fem Sg => seche ; + AF Fem Pl => seche + "s" ; + AA => case seche of { + _ + "ée" => init seche + "ment" ; + _ => seche + "ment" + } ; + c => a.s ! c + } + } ; + + mkA : (banal,banale,banaux : Str) -> A = \sec,seche,secs -> + let sechement : Str = case seche of { + _ + "ée" => init seche + "ment" ; + _ => seche + "ment" + } + in mk4A sec seche secs sechement ; mkA : (banal,banale,banaux,banalement : Str) -> A = mk4A ; mkA : (vieux,vieil,vieille,vieuxs,vieuxment : Str) -> A = mk5A ; mkA : A -> A -> A = mkADeg ; From 0c52f9cbedabc6080a4acec4972a1b3efc82555a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 19 Jan 2022 12:16:02 +0800 Subject: [PATCH 26/92] Recognise AllXxxAbs as abstract in unittest --- unittest/unittest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/unittest.py b/unittest/unittest.py index b7e8e478..c78a233a 100644 --- a/unittest/unittest.py +++ b/unittest/unittest.py @@ -92,7 +92,7 @@ def collect_testcases(testlines): elif ':' in line: lang, sentence = stripstrings(line.split(':', 1)) langfile = importfile(linenr, lang) - is_tree = '/abstract/' in langfile + is_tree = ('/abstract/' in langfile) or 'Abs' in langfile test.append((is_tree, linenr, lang, langfile, sentence)) else: error(linenr, "Ill-formatted line in test file:", line) From c2551f5766750089422a343018b52ec2ef343b03 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 19 Jan 2022 12:16:32 +0800 Subject: [PATCH 27/92] (Eng) Use AllEng in the English unit tests --- src/english/unittest/relative.gftest | 75 ++++++++++++++-------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/src/english/unittest/relative.gftest b/src/english/unittest/relative.gftest index a7d2bc23..6e1f5c04 100644 --- a/src/english/unittest/relative.gftest +++ b/src/english/unittest/relative.gftest @@ -1,29 +1,33 @@ -- IdRP: no difference between animate/inanimate -Lang: RelCN (UseN friend_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP everybody_NP (SlashV2a love_V2)))) -LangEng: friend that everybody loves +AllEngAbs: RelCN (UseN friend_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP everybody_NP (SlashV2a love_V2)))) +AllEng: friend that everybody loves -Lang: RelCN (UseN computer_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP everybody_NP (SlashV2a love_V2)))) -LangEng: computer that everybody loves +AllEngAbs: RelCN (UseN computer_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP everybody_NP (SlashV2a love_V2)))) +AllEng: computer that everybody loves -- IdRP possessive, RelVP -Lang: RelCN (UseN teacher_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP (FunRP possess_Prep (DetCN every_Det (UseN friend_N)) IdRP) (UseV run_V))) -LangEng: teacher whose every friend runs +AllEngAbs: RelCN (UseN teacher_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP (FunRP possess_Prep (DetCN every_Det (UseN friend_N)) IdRP) (UseV run_V))) +AllEng: teacher whose every friend runs -Lang: RelCN (UseN car_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP (FunRP possess_Prep (MassNP (UseN oil_N)) IdRP) (UseV run_V))) -LangEng: car whose oil runs +AllEngAbs: RelCN (UseN car_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP (FunRP possess_Prep (MassNP (UseN oil_N)) IdRP) (UseV run_V))) +AllEng: car whose oil runs -- IdRP possessive, RelSlash -Lang: RelNP (DetCN (DetQuant DefArt NumSg) (UseN boss_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (FunRP possess_Prep (MassNP (UseN computer_N)) IdRP) (SlashVP everybody_NP (SlashV2a love_V2)))) -LangEng: the boss , whose computer everybody loves +AllEngAbs: PredVP (RelNP (DetCN (DetQuant DefArt NumSg) (UseN boss_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (FunRP possess_Prep (MassNP (UseN computer_N)) IdRP) (SlashVP everybody_NP (SlashV2a love_V2))))) (UseComp (CompAdv here_Adv)) +AllEng: the boss , computer of which everybody loves , is here -Lang: RelNP (DetCN (DetQuant DefArt NumSg) (UseN restaurant_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (FunRP possess_Prep (MassNP (UseN fruit_N)) IdRP) (SlashVP everybody_NP (SlashV2a love_V2)))) -LangEng: the restaurant , whose fruit everybody loves +-- GenRP +AllEngAbs: PredVP (RelNP (DetCN (DetQuant DefArt NumSg) (UseN boss_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (GenRP NumSg (UseN computer_N)) (SlashVP everybody_NP (SlashV2a love_V2))))) (UseComp (CompAdv here_Adv)) +AllEng: the boss , whose computer everybody loves , is here + +AllEngAbs: PredVP (RelNP (DetCN (DetQuant DefArt NumSg) (UseN restaurant_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (GenRP NumSg (UseN fruit_N)) (SlashVP everybody_NP (SlashV2a love_V2))))) (UseComp (CompAdv here_Adv)) +AllEng: the restaurant , whose fruit everybody loves , is here -- Note that every instance of "of" is not possessive—with part_Prep, we get "beer, a glass of which I drink" -- unfortunately glass_N is not in lexicon, so I substituted words with others -Lang: RelNP (MassNP (UseN butter_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (FunRP part_Prep (DetCN (DetQuant IndefArt NumSg) (UseN stick_N)) IdRP) (SlashVP (UsePron i_Pron) (SlashV2a eat_V2)))) -LangEng: butter , a stick of which I eat +AllEngAbs: RelNP (MassNP (UseN butter_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (FunRP part_Prep (DetCN (DetQuant IndefArt NumSg) (UseN stick_N)) IdRP) (SlashVP (UsePron i_Pron) (SlashV2a eat_V2)))) +AllEng: butter , a stick of which I eat -- IdRP other, RelSlash -- RelVP really doesn't make sense–the preposition in FunRP looks like an object complement? @@ -38,16 +42,16 @@ LangEng: butter , a stick of which I eat -- Transitive verb + preposition in RP -- The RP is the whole [the best city in which] -Lang: RelNP (UsePN paris_PN) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP in_Prep (DetCN (DetQuantOrd DefArt NumSg (OrdSuperl good_A)) (UseN city_N)) IdRP) (SlashVP (UsePron i_Pron) (SlashV2a love_V2)))) -LangEng: Paris , the best city in which I have loved +AllEngAbs: RelNP (UsePN paris_PN) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP in_Prep (DetCN (DetQuantOrd DefArt NumSg (OrdSuperl good_A)) (UseN city_N)) IdRP) (SlashVP (UsePron i_Pron) (SlashV2a love_V2)))) +AllEng: Paris , the best city in which I have loved -- Intransitive verb + preposition in ClSlash -- The RP is just [that] -Lang: RelNP (UsePN paris_PN) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashPrep (PredVP (UsePron i_Pron) (UseV live_V)) in_Prep))) -LangEng: Paris , that I have lived in +AllEngAbs: RelNP (UsePN paris_PN) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashPrep (PredVP (UsePron i_Pron) (UseV live_V)) in_Prep))) +AllEng: Paris , that I have lived in -Lang: PredVP (UsePN paris_PN) (UseComp (CompNP (DetCN (DetQuantOrd DefArt NumSg (OrdSuperl good_A)) (RelCN (UseN city_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashPrep (PredVP (UsePron i_Pron) (UseV live_V)) in_Prep))))))) -LangEng: Paris is the best city that I have lived in +AllEngAbs: PredVP (UsePN paris_PN) (UseComp (CompNP (DetCN (DetQuantOrd DefArt NumSg (OrdSuperl good_A)) (RelCN (UseN city_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashPrep (PredVP (UsePron i_Pron) (UseV live_V)) in_Prep))))))) +AllEng: Paris is the best city that I have lived in -- to get "… city I have lived in", use Extend.EmptyRelSlash in place of RelSlash @@ -55,36 +59,33 @@ LangEng: Paris is the best city that I have lived in -- Now let's do complicated structures! -- FunRP + ditransitive verb. The whole string is the RS, and the substring [the first car to which] is the RP. -Lang: UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP to_Prep (DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN car_N)) IdRP) (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN oil_N))))) -LangEng: the first car to which I have given oil +AllEngAbs: UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP to_Prep (DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN car_N)) IdRP) (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN oil_N))))) +AllEng: the first car to which I have given oil -- IdRP + ditransitive verb. The whole string is now a NP, and RS is just a small part of it: [[that]:RP I have given oil]:RS -Lang: DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (RelCN (UseN car_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN oil_N))))))) -LangEng: the first car that I have given oil +AllEngAbs: DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (RelCN (UseN car_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN oil_N))))))) +AllEng: the first car that I have given oil -- IdRP + ditransitive verb, but the verb has an inherent preposition -Lang: DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (RelCN (UseN country_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (Slash2V3 sell_V3 (MassNP (UseN oil_N))))))) -LangEng: the first country that I have sold oil to +AllEngAbs: DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (RelCN (UseN country_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (Slash2V3 sell_V3 (MassNP (UseN oil_N))))))) +AllEng: the first country that I have sold oil to -- let's test with Slash3V3 for completeness' sake -Lang: DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (RelCN (UseN oil_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (Slash3V3 sell_V3 (DetCN (DetQuant IndefArt NumSg) (UseN country_N))))))) -LangEng: the first oil that I have sold to a country +AllEngAbs: DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (RelCN (UseN oil_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (Slash3V3 sell_V3 (DetCN (DetQuant IndefArt NumSg) (UseN country_N))))))) +AllEng: the first oil that I have sold to a country -- FunRP + ditransitive verb, now in a context -- Suppose that I have a car named John. Now the relative pronoun "which" is chosen after the noun "car". -Lang: RelNP (UsePN john_PN) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP to_Prep (DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN car_N)) IdRP) (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN oil_N)))))) -LangEng: John , the first car to which I have given oil +AllEngAbs: RelNP (UsePN john_PN) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP to_Prep (DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN car_N)) IdRP) (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN oil_N)))))) +AllEng: John , the first car to which I have given oil -- Suppose that I have a friend named John. Now the relative pronoun "who" is chosen after the noun "friend". -Lang: RelNP (UsePN john_PN) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP to_Prep (DetCN (DetQuantOrd (PossPron i_Pron) NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN friend_N)) IdRP) (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN beer_N)))))) -LangEng: John , my first friend to who I have given beer +AllEngAbs: RelNP (UsePN john_PN) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP to_Prep (DetCN (DetQuantOrd (PossPron i_Pron) NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN friend_N)) IdRP) (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN beer_N)))))) +AllEng: John , my first friend to who I have given beer -- If I really wanted to describe "John , my first friend […]", I would prefer using Extend.ApposNP to get a tree that makes more sense -- this doesn't linearise in core RGL, but here's the tree: --- ApposNP (UsePN john_PN) (DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (RelCN (UseN friend_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN beer_N)))))))) --- approximating with ApposCN (which doesn't add comma): - -Lang: ApposCN (UseN boy_N) (DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (RelCN (UseN friend_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN beer_N)))))))) -LangEng: boy the first friend that I have given beer \ No newline at end of file +AllEngAbs: ApposNP (UsePN john_PN) (DetCN (DetQuantOrd DefArt NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (RelCN (UseN friend_N) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (Slash2V3 give_V3 (MassNP (UseN beer_N)))))))) +AllEng: John , the first friend that I have given beer \ No newline at end of file From 475d0fb860f54655f337973af069ac459035cc2c Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 19 Jan 2022 14:51:49 +0800 Subject: [PATCH 28/92] (Eng) Undo the change in FunRP from #381 --- src/english/CatEng.gf | 2 -- src/english/ParadigmsEng.gf | 10 ++-------- src/english/RelativeEng.gf | 12 +++--------- src/english/StructuralEng.gf | 3 +-- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/english/CatEng.gf b/src/english/CatEng.gf index 09e96fc6..049210bc 100644 --- a/src/english/CatEng.gf +++ b/src/english/CatEng.gf @@ -89,8 +89,6 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in { Prep = { s : Str ; -- "with", "ago" isPre : Bool ; -- whether it's pre- or postposition: "with"=True, "ago"=False - isPoss : Bool ; -- whether it becomes "whose" in FunRP: "John, whose mother is wise" - empty : Str ; -- dummy empty string to avoid issues with parsing, if s field is replaced by "whose" in FunRP } ; CAdv = {s : Polarity => Str; p : Str} ; diff --git a/src/english/ParadigmsEng.gf b/src/english/ParadigmsEng.gf index 121a7758..c5f6727d 100644 --- a/src/english/ParadigmsEng.gf +++ b/src/english/ParadigmsEng.gf @@ -537,18 +537,12 @@ mkVoc s = lin Voc (ss s) ; mkPrep p = lin Prep { s = p ; -- the string: "with", "in front of" isPre = True ; -- default case: it is a preposition, not postposition - isPoss = False ; -- default case: not possessive (i.e. no change in FunRP) - empty = [] -- dummy field to prevent an issue with parsing. only relevant when isPoss=True, and FunRP overrides the s field with "whose". for explanation of the issue, see https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#metavariables-or-those-question-marks-that-appear-when-parsing } ; mkPost p = mkPrep p ** { isPre = False -- postposition: e.g. "ago" } ; noPrep = mkPrep [] ; - possPrep : Str -> Prep = \p -> mkPrep p ** { - isPoss = True -- for possessive, FunRP overrides the Prep's string with "whose": - } ; -- e.g. "whose mother" instead of "mother of which" - mk5V a b c d e = lin V (mkVerb a b c d e ** {s1 = []}) ; regV cry = @@ -622,7 +616,7 @@ mkVoc s = lin Voc (ss s) ; auxVV, infVV = \v -> lin VV { s = table { VVF vf => v.s ! vf ; - VVPresNeg => v.s ! VPres ++ "not" + VVPresNeg => v.s ! VPres ++ "not" ; VVPastNeg => v.s ! VPast ++ "not" --# notpresent } ; p = v.p ; @@ -701,7 +695,7 @@ mkVoc s = lin Voc (ss s) ; mkA : (fat,fatter : Str) -> A = \fat,fatter -> lin A (mkAdjective fat fatter (init fatter + "st") (adj2adv fat)) ; mkA : (good,better,best,well : Str) -> A = \a,b,c,d -> - lin A (mkAdjective a b c d) + lin A (mkAdjective a b c d) } ; invarA s = lin A { diff --git a/src/english/RelativeEng.gf b/src/english/RelativeEng.gf index 230c216e..512d6e1a 100644 --- a/src/english/RelativeEng.gf +++ b/src/english/RelativeEng.gf @@ -32,16 +32,10 @@ concrete RelativeEng of Relative = CatEng ** open ResEng, Prelude in { c = NPAcc } ; - -- John , whose every friend is right + -- a number, [the square of which] is 4 + -- For a construction like "John , [whose every friend] is right", use Extend.GenRP FunRP p np rp = { - s = \\c => - let npGender : Gender = (fromAgr np.a).g in - case p.isPoss of { - True => rp.s ! RC npGender NPNomPoss ++ -- whose - p.empty ++ -- empty string to avoid metavariables - np.s ! NCase Nom ; -- NP in nom: "whose every friend" - False => np.s ! NPAcc ++ p.s ++ rp.s ! RPrep npGender - } ; + s = \\c => np.s ! NPAcc ++ p.s ++ rp.s ! RPrep (fromAgr np.a).g ; a = RAg np.a } ; diff --git a/src/english/StructuralEng.gf b/src/english/StructuralEng.gf index d21413b3..206ef70a 100644 --- a/src/english/StructuralEng.gf +++ b/src/english/StructuralEng.gf @@ -99,7 +99,7 @@ concrete StructuralEng of Structural = CatEng ** otherwise_PConj = ss "otherwise" ; part_Prep = mkPrep "of" ; please_Voc = ss "please" ; - possess_Prep = possPrep "of" ; + possess_Prep = mkPrep "of" ; quite_Adv = mkAdv "quite" ; she_Pron = mkPron "she" "her" "her" "hers" singular P3 feminine ; so_AdA = mkAdA "so" ; @@ -159,4 +159,3 @@ concrete StructuralEng of Structural = CatEng ** lin language_title_Utt = ss "English" ; } - From 4720114c84ddb95c921c282e6ae571b2612c6d01 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 19 Jan 2022 14:52:08 +0800 Subject: [PATCH 29/92] (Eng) Update unit tests after reverting FunRP --- src/english/unittest/relative.gftest | 32 +++++++++++++++------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/english/unittest/relative.gftest b/src/english/unittest/relative.gftest index 6e1f5c04..3685450e 100644 --- a/src/english/unittest/relative.gftest +++ b/src/english/unittest/relative.gftest @@ -6,32 +6,32 @@ AllEngAbs: RelCN (UseN computer_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash I AllEng: computer that everybody loves --- IdRP possessive, RelVP -AllEngAbs: RelCN (UseN teacher_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP (FunRP possess_Prep (DetCN every_Det (UseN friend_N)) IdRP) (UseV run_V))) -AllEng: teacher whose every friend runs - -AllEngAbs: RelCN (UseN car_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP (FunRP possess_Prep (MassNP (UseN oil_N)) IdRP) (UseV run_V))) -AllEng: car whose oil runs - --- IdRP possessive, RelSlash +-- IdRP + possess_Prep, RelSlash AllEngAbs: PredVP (RelNP (DetCN (DetQuant DefArt NumSg) (UseN boss_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (FunRP possess_Prep (MassNP (UseN computer_N)) IdRP) (SlashVP everybody_NP (SlashV2a love_V2))))) (UseComp (CompAdv here_Adv)) AllEng: the boss , computer of which everybody loves , is here --- GenRP +-- IdRP + part_Prep, RelSlash +AllEngAbs: RelNP (MassNP (UseN butter_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (FunRP part_Prep (DetCN (DetQuant IndefArt NumSg) (UseN stick_N)) IdRP) (SlashVP (UsePron i_Pron) (SlashV2a eat_V2)))) +AllEng: butter , a stick of which I eat + +-- GenRP + RelVP +-- NB. with GenRP, can't parse "teacher whose every friend runs", because GenRP takes only a CN +AllEngAbs: RelCN (UseN teacher_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP (GenRP NumSg (UseN friend_N)) (UseV run_V))) +AllEng: teacher whose friend runs + +AllEngAbs: RelCN (UseN car_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP (GenRP NumSg (UseN oil_N)) (UseV run_V))) +AllEng: car whose oil runs + +-- GenRP + RelSlash AllEngAbs: PredVP (RelNP (DetCN (DetQuant DefArt NumSg) (UseN boss_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (GenRP NumSg (UseN computer_N)) (SlashVP everybody_NP (SlashV2a love_V2))))) (UseComp (CompAdv here_Adv)) AllEng: the boss , whose computer everybody loves , is here AllEngAbs: PredVP (RelNP (DetCN (DetQuant DefArt NumSg) (UseN restaurant_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (GenRP NumSg (UseN fruit_N)) (SlashVP everybody_NP (SlashV2a love_V2))))) (UseComp (CompAdv here_Adv)) AllEng: the restaurant , whose fruit everybody loves , is here --- Note that every instance of "of" is not possessive—with part_Prep, we get "beer, a glass of which I drink" --- unfortunately glass_N is not in lexicon, so I substituted words with others -AllEngAbs: RelNP (MassNP (UseN butter_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash (FunRP part_Prep (DetCN (DetQuant IndefArt NumSg) (UseN stick_N)) IdRP) (SlashVP (UsePron i_Pron) (SlashV2a eat_V2)))) -AllEng: butter , a stick of which I eat - -- IdRP other, RelSlash -- RelVP really doesn't make sense–the preposition in FunRP looks like an object complement? --- e.g. "Paris , the best city *in* which *I have lived* -- gap: "I have loved *in Paris* +-- e.g. "Paris , the best city *in* which *I have lived* -- gap: "I have lived *in Paris* -- for RelVP, the noun is a subject: -- e.g. "Paris , the best city ∅ which sleeps" -- no gap: "Paris sleeps" @@ -42,6 +42,8 @@ AllEng: butter , a stick of which I eat -- Transitive verb + preposition in RP -- The RP is the whole [the best city in which] +-- We can't even do "lived in", because because live_V is intransitive and RelSlash requires transitive. +-- So let's switch to love_V2 instead. AllEngAbs: RelNP (UsePN paris_PN) (UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP in_Prep (DetCN (DetQuantOrd DefArt NumSg (OrdSuperl good_A)) (UseN city_N)) IdRP) (SlashVP (UsePron i_Pron) (SlashV2a love_V2)))) AllEng: Paris , the best city in which I have loved From a435b6b8dc2d24d05655ae1c887130d9d3675c79 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 23 Jan 2022 18:26:35 +0800 Subject: [PATCH 30/92] (Ara) Add extend to AllAra --- src/arabic/AllAra.gf | 2 +- src/arabic/AllAraAbs.gf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arabic/AllAra.gf b/src/arabic/AllAra.gf index dc20a645..b2f369d3 100644 --- a/src/arabic/AllAra.gf +++ b/src/arabic/AllAra.gf @@ -1,3 +1,3 @@ --# -path=.:../abstract:../common:../api:../prelude -concrete AllAra of AllAraAbs = LangAra ; +concrete AllAra of AllAraAbs = LangAra, ExtendAra ; diff --git a/src/arabic/AllAraAbs.gf b/src/arabic/AllAraAbs.gf index 9889c81e..ef690c99 100644 --- a/src/arabic/AllAraAbs.gf +++ b/src/arabic/AllAraAbs.gf @@ -1,3 +1,3 @@ --# -path=.:../abstract:../common:prelude -abstract AllAraAbs = Lang ; +abstract AllAraAbs = Lang, Extend ; From d021ebd52759524afee5495f5fc50e8e9ba14504 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 23 Jan 2022 18:28:58 +0800 Subject: [PATCH 31/92] (Ara) Add GerundNP in ExtendAra --- src/arabic/ExtendAra.gf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/arabic/ExtendAra.gf b/src/arabic/ExtendAra.gf index 27868c96..782d5c39 100644 --- a/src/arabic/ExtendAra.gf +++ b/src/arabic/ExtendAra.gf @@ -6,7 +6,7 @@ concrete ExtendAra of Extend = EmptyRelSlash, PredAPVP, ComplDirectVS, ComplDirectVQ, -- because of Utt VPS, MkVPS, PredVPS, BaseVPS, ConsVPS, ConjVPS, - EmbedSSlash, AdjAsNP + EmbedSSlash, AdjAsNP, GerundNP ] with (Grammar=GrammarAra) ** open @@ -44,7 +44,7 @@ lin DetNPFem det = emptyNP ** {s = det.s ! NoHum ! Fem} ; -- : AP -> NP - AdjAsNP ap = + AdjAsNP ap = let adjAsN : Noun = { s = ap.s ! NoHum ! Masc ; s2 = emptyNTable ; @@ -59,6 +59,11 @@ lin -- : SSlash -> SC EmbedSSlash = Grammar.EmbedS ; + -- : VP -> NP + GerundNP vp = emptyNP ** { + s = \\_ => uttVP VPGer vp ! Masc ; -- NB. NP should inflect in case, but there are no cases for masdar in the inflection table of VP. If desired, can add here with BIND. /IL + } ; -- The Gender param here doesn't make a difference, because the VPGer in VP's inflection table doesn't have gender to start with. So we could equally well choose Fem too. + lincat VPS = {s : PerGenNum => Str} ; -- finite VP's with tense and polarity [VPS] = {s1,s2 : PerGenNum => Str} ; From 45d47afc36c9558385c88e662a5a4b1c08f97917 Mon Sep 17 00:00:00 2001 From: Yousef Almesbahi Date: Sun, 23 Jan 2022 19:11:19 +0800 Subject: [PATCH 32/92] Update unittest.py --- unittest/README.md | 2 ++ unittest/unittest.py | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/unittest/README.md b/unittest/README.md index 43069448..27f8b3a5 100644 --- a/unittest/README.md +++ b/unittest/README.md @@ -9,6 +9,8 @@ python path/to/unittest.py [-h] [-v] [--no-pmcfg] path/to/testfile.gftest (...) The script must be located in a sibling directory to the RGL `src` directory to work properly. +**Note:** On Windows use WSL (Windows Subsystem for Linux) to run `unittest.py` script, also replace the commented lines for Windows inside the script. + ## Test format The test file should look something like this: diff --git a/unittest/unittest.py b/unittest/unittest.py index c78a233a..3ef0bcce 100644 --- a/unittest/unittest.py +++ b/unittest/unittest.py @@ -16,6 +16,9 @@ import argparse from subprocess import Popen, PIPE from glob import glob +GF_PROCESS = 'gf -run' +## For WSL on windows replace the GF_PROCESS with following line +##GF_PROCESS = 'gf.exe -run' GRAMMARDIR = '../src' ENCODING = 'utf-8' @@ -161,7 +164,7 @@ def runtest(testlines, args): print() # calling GF from a subprocess: - command = 'gf -run'.split() + command = GF_PROCESS.split() gfinput = '\n'.join(gfscript) + '\n' gf = Popen(command, stdin=PIPE, stdout=PIPE) stdout, _stderr = gf.communicate(gfinput.encode(ENCODING)) @@ -182,7 +185,7 @@ def runtest(testlines, args): linenr, lang = alltrees.pop(0).split() if args.verbose: print('---+ line %s (%s), result from GF:' % (linenr, lang)) - for tree in alltrees: + for tree in alltrees: print(' |', tree) if len(alltrees) == 0 or gferror("\n".join(alltrees)): theerror = "\n".join(alltrees) if alltrees else "No parse trees found" @@ -195,7 +198,7 @@ def runtest(testlines, args): if besterrors > 0: for oldlinenr, oldlang, oldtrees in oldresults: if besttree not in oldtrees: - error(linenr, + error(linenr, "The result of line %s (%s):\n %s\n" "is not among the results of line %s (%s):\n %s" % (linenr, lang, besttree, oldlinenr, oldlang, "\n ".join(oldtrees))) From 336c297dc1649f8828cb20a7f63bbf44c8e48c77 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 21 Feb 2022 14:26:33 +0800 Subject: [PATCH 33/92] add relative functions, addition to lexicon, change of words for you and I --- src/malay/CatMay.gf | 4 +++ src/malay/LexiconMay.gf | 46 +++++++++++++----------- src/malay/QuestionMay.gf | 1 - src/malay/RelativeMay.gf | 15 ++++---- src/malay/StructuralMay.gf | 4 +-- src/malay/VerbMay.gf | 12 +++++-- src/malay/unittest/complements.gftest | 2 +- src/malay/unittest/numerals.gftest | 2 +- src/malay/unittest/pronouns.gftest | 14 ++++---- src/malay/unittest/questions.gftest | 16 ++++----- src/malay/unittest/relative.gftest | 23 ++++++------ src/malay/unittest/tenses.gftest | 4 +-- src/malay/unittest/verbal_affixes.gftest | 24 ++++++------- 13 files changed, 92 insertions(+), 75 deletions(-) diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index d1bc0ebb..9fcc721f 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -120,4 +120,8 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { N2 = ResMay.Noun2 ; N3 = ResMay.Noun3 ; PN = ResMay.PNoun ; + + linref + CN = \cn -> cn.s ! NF Sg Bare ++ cn.heavyMod; + } diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index a74a89b8..e3b6643f 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -4,29 +4,29 @@ concrete LexiconMay of Lexicon = CatMay ** ---- -- A --- lin add_V3 = mkV3 "" ; --- lin airplane_N = mkN "" ; +-- lin add_V3 = mkV3 "tambah" ; +lin airplane_N = mkN "kapal terbang" ; -- lin alas_Interj = mkInterj "" ; --- lin already_Adv = mkA "" ; --- lin animal_N = mkN "동물" ; --- lin answer_V2S = mkV2S "" ; --- lin apartment_N = mkN "" ; --- lin apple_N = mkN "" ; --- lin art_N = mkN "" ; --- lin ashes_N = mkN "" ; --- lin ask_V2Q = mkV2 "" ; +lin already_Adv = mkA "sudah" ; +lin animal_N = mkN "haiwan" ; +-- lin answer_V2S = mkV2S "jawab" ; +lin apartment_N = mkN "pangsapuri" ; +lin apple_N = mkN "epal" ; +lin art_N = mkN "seni" ; +lin ashes_N = mkN "abu" ; +lin ask_V2Q = mkV2 "tanya" ; ---- -- B --- lin baby_N = mkN "" ; --- lin back_N = mkN "" ; +lin baby_N = mkN "bayi" ; +lin back_N = mkN "belakang" ; -- lin bad_A = mkA "" ; --- lin bank_N = mkN "" ; +lin bank_N = mkN "bank" ; -- lin bark_N = mkN "" ; lin beautiful_A = mkA "cantik" ; --- lin become_VA = mkVA "" ; --- lin beer_N = mkN "" ; +-- lin become_VA = mkVA "jadi" ; +lin beer_N = mkN "bir" ; -- lin beg_V2V = mkV2 "" ; -- lin belly_N = mkN "" ; -- lin big_A = mkA "" ; @@ -34,7 +34,7 @@ lin beautiful_A = mkA "cantik" ; -- lin bird_N = mkN "" ; -- lin bite_V2 = mkV2 "" ; lin black_A = mkA "hitam" ; --- lin blood_N = mkN "" ; +lin blood_N = mkN "darah" ; -- lin blow_V = mkV "" ; -- lin blue_A = mkA "" ; -- lin boat_N = mkN "" ; @@ -95,7 +95,9 @@ lin come_V = mkV "datang" ; -- lin doctor_N = mkN "" ; lin dog_N = mkN "anjing" ; -- lin door_N = mkN "" ; -lin drink_V2 = mkV2 "minum" ; +lin drink_V2 = let drink' : V2 = mkV2 "minum" in drink' ** { + s = \\_ => "minum" ; +}; -- lin dry_A = mkA "" ; -- lin dull_A = mkA "" ; -- lin dust_N = mkN "" ; @@ -105,7 +107,9 @@ lin drink_V2 = mkV2 "minum" ; -- lin ear_N = mkN "" ; -- lin earth_N = mkN "" ; -lin eat_V2 = mkV2 "makan" ; +lin eat_V2 = let eat' : V2 = mkV2 "makan" in eat' ** { + s = \\_ => "makan" ; +}; -- lin egg_N = mkN "" ; -- lin empty_A = mkA "" ; -- lin enemy_N = mkN "" ; @@ -148,7 +152,7 @@ lin father_N2 = mkN2 "bapa" ; -- lin garden_N = mkN "" ; -- lin girl_N = mkN "" ; -lin give_V3 = mkV3 (mkV "beri" Meng) emptyPrep datPrep ; +lin give_V3 = mkV3 (mkV "beri" Meng) emptyPrep datPrep ; -- memberi for living and memberikan for nonliving -- lin glove_N = mkN "" ; lin go_V = mkV "pergi" ; -- lin gold_N = mkN "" ; @@ -204,7 +208,7 @@ lin king_N = mkN "raja" ; -- lin language_N = mkN "" ; -- lin laugh_V = mkV "" ; -- lin leaf_N = mkN "" ; -lin learn_V2 = mkV2 (prefixV (mkV "ajar" Ber)) emptyPrep ; +-- lin learn_V2 = mkV2 (prefixV (mkV "ajar" Ber)) emptyPrep ; -- lin leather_N = mkN "" ; -- lin leave_V2 = mkV2 "" ; -- lin leg_N = mkN "" ; @@ -312,7 +316,7 @@ lin science_N = mkN "sains" ; lin see_V2 = mkV2 "lihat" ; -- lin seed_N = mkN "" ; -- lin seek_V2 = mkV2 "" ; -lin sell_V3 = mkV3 (mkV "jual" Meng) emptyPrep emptyPrep ; -- TODO +-- lin sell_V3 = mkV3 (mkV "jual" Meng) emptyPrep emptyPrep ; -- TODO -- lin send_V3 = mkV3 "" ; -- lin sew_V = mkV "" ; -- lin sharp_A = mkA "" ; diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index ba6cab1a..9544c90b 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -59,7 +59,6 @@ lin } ; } ; - -- : IP -> IComp ; CompIP ip = {s = ip.s ! Bare } ; -- who (is it) diff --git a/src/malay/RelativeMay.gf b/src/malay/RelativeMay.gf index d9cc71a0..b060c6eb 100644 --- a/src/malay/RelativeMay.gf +++ b/src/malay/RelativeMay.gf @@ -3,33 +3,36 @@ concrete RelativeMay of Relative = CatMay ** open lin - -- : Cl -> RCl ; -- such that John loves her - -- RelCl cl = ; + -- : Cl -> RCl ; -- such that John loves her + -- RelCl cl = cl ** { + -- subj = cl.subj ; + -- pred = cl.pred ; + -- }; -- : RP -> VP -> RCl ; RelVP rp vp = { subj = rp.s ; - pred = \\per => vp.s ! Root ; + pred = \\per,pol => vp.s ! Active ! pol; } ; -- : RP -> ClSlash -> RCl ; -- who I went with RelSlash rp cls = { subj = rp.s -- yang - ++ cls.subj ; -- saya + ++ cls.subj ; -- aku pred = \\per,pol => let object : Str = case cls.c2.prepType of { OtherPrep => cls.c2.obj ! per ; -- depends on the head, not known yet _ => [] -- if the preposition is dir.obj or empty, no obj. pronoun } ; - in cls.pred ! Root ! pol -- ikut sama + in cls.pred ! Active ! pol -- ikut sama ++ object -- dengan+nya } ; -- : RP ; IdRP = {s = "yang"} ; - -- Mintz page 49: Saya jumpa orang /yang kaki+nya/ patah. + -- Mintz page 49: aku jumpa orang /yang kaki+nya/ patah. -- 'I met a man /whose foot/ was broken.' -- : Prep -> NP -> RP -> RP ; -- the mother of whom -- FunRP prep np rp = {} ; diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index d41a0cd8..670ce889 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -120,9 +120,9 @@ lin with_Prep = mkPrep "dengan" ; -- Pronouns are closed class, no constructor in ParadigmsMay. lin it_Pron = mkPron "dia" P3 ; -lin i_Pron = mkPron "saya" P1 ; +lin i_Pron = mkPron "aku" P1 ; lin youPol_Pron = mkPron "kamu" P2 ; -lin youSg_Pron = mkPron "awak" P2 ; +lin youSg_Pron = mkPron "kamu" P2 ; lin he_Pron = mkPron "dia" P3 ; lin she_Pron = mkPron "dia" P3 ; -- inclusive we diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index 3dbf8cba..b66e508f 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -16,7 +16,7 @@ lin -- : VV -> VP -> VP ; ComplVV vv vp = vp ** useV { - s = \\vf => vv.s ++ vp.s ! Root ! Pos + s = \\vf => vv.s ++ vp.s ! Active ! Pos } ; -- : VS -> S -> VP ; @@ -54,12 +54,11 @@ lin -- : V3 -> NP -> VPSlash ; -- give (it) to her Slash3V3 v3 iobj = useV { - s = \\vf => v3.s ! vf ++ iobj.s ! Bare ++ applyPrep v3.c3 emptyNP; + s = \\vf => v3.s ! vf ++ applyPrep v3.c3 emptyNP ++ iobj.s ! Bare; --iobj.s ! Bare -- applyPrep v3.c3 iobj -- TODO check if this works for all -- probably not } ** { c2 = v3.c2 ;-- Now the VPSlash is missing only the direct object adjCompl = [] - } ; -- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp -> @@ -101,6 +100,13 @@ lin adjCompl = vps.adjCompl ; } ; + -- SlashVV vv vp = vp ** useV { + -- s = \\vf => vv.s ++ vp.s ! Active ! Pos ; + -- c2 = vp.c2 ; + -- passive = vv.s ++ vp.passive; + -- adjCompl = vp.adjCompl ; + -- } ; + -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy -- SlashV2VNP v2v np vps = diff --git a/src/malay/unittest/complements.gftest b/src/malay/unittest/complements.gftest index cc437dd3..04cfc950 100644 --- a/src/malay/unittest/complements.gftest +++ b/src/malay/unittest/complements.gftest @@ -3,4 +3,4 @@ Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (ComplSlas LangMay: dia memberi kucing kepadaku Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (ComplSlash (Slash3V3 give_V3 (UsePron i_Pron)) (MassNP (UseN cat_N))))) -LangMay: dia memberi saya kucing +LangMay: dia memberi aku kucing diff --git a/src/malay/unittest/numerals.gftest b/src/malay/unittest/numerals.gftest index b6bc7744..cf6aa05b 100644 --- a/src/malay/unittest/numerals.gftest +++ b/src/malay/unittest/numerals.gftest @@ -8,4 +8,4 @@ LangMay: lima kucing ini Lang: DetCN (DetQuant (PossPron i_Pron) (NumCard (NumNumeral (num (pot2as3 (pot2 (pot0 n7))))))) (UseN cat_N) LangEng: my seven hundred cats -LangMay: tujuh ratus kucing saya +LangMay: tujuh ratus kucing aku diff --git a/src/malay/unittest/pronouns.gftest b/src/malay/unittest/pronouns.gftest index defa44a4..daededd0 100644 --- a/src/malay/unittest/pronouns.gftest +++ b/src/malay/unittest/pronouns.gftest @@ -14,18 +14,18 @@ LangMay: kucing-kucingku dengan orang itu -- to get "memukulnya", we need to define it in the entry of hit_V2 at the moment. -- if that should be variable on a more general level, let me know. Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a hit_V2) (UsePron he_Pron))) -LangMay: saya memukul dia +LangMay: aku memukul dia ------------- -- Possession -- 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))))) -LangMay: itu kucing saya +LangMay: itu kucing aku -- that cat is mine Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN cat_N)) (UseComp (CompNP (DetNP (DetQuant (PossPron i_Pron) NumSg))))) -LangMay: kucing itu saya +LangMay: kucing itu aku -- his/her cat is green Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron he_Pron) NumSg) (UseN cat_N)) (UseComp (CompAP (PositA green_A)))) @@ -33,14 +33,14 @@ LangMay: kucing dia hijau -- I read his/her book -- two variants, different trees Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant IndefArt NumSg) (PossNP (UseN book_N) (UsePron she_Pron))))) -LangMay: saya membaca bukunya +LangMay: aku membaca bukunya Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant (PossPron he_Pron) NumSg) (UseN book_N)))) -LangMay: saya membaca buku dia +LangMay: aku membaca buku dia -- 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))))))) -LangMay: saya membaca buku bapanya +LangMay: aku membaca buku bapanya -- Only the noun phrase Lang: MassNP (PossNP (UseN book_N) (UsePron he_Pron)) @@ -66,4 +66,4 @@ LangMay: kucingku dia Lang: DetCN (DetQuant (PossPron i_Pron) NumSg) (PossNP (UseN cat_N) (UsePron she_Pron)) LangEng: my cat of hers -LangMay: kucingnya saya +LangMay: kucingnya aku diff --git a/src/malay/unittest/questions.gftest b/src/malay/unittest/questions.gftest index cdac74cf..76c47836 100644 --- a/src/malay/unittest/questions.gftest +++ b/src/malay/unittest/questions.gftest @@ -16,11 +16,11 @@ LangMay: berapa banyak kucing Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestCl (PredVP (UsePron youSg_Pron) (ComplSlash (SlashV2a teach_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))))) LangEng: do you teach the cat -LangMay: adakah awak mengajar kucing +LangMay: adakah kamu mengajar kucing Lang: UseQCl (TTAnt TPres ASimul) PNeg (QuestCl (PredVP (UsePron youSg_Pron) (ComplSlash (SlashV2a teach_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))))) LangEng: don't you teach the cat -LangMay: adakah awak tidak mengajar kucing +LangMay: adakah kamu tidak mengajar kucing Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP (IdetCN (IdetQuant which_IQuant NumSg) (UseN cat_N)) (ComplSlash (SlashV2a teach_V2) (UsePron he_Pron))) LangEng: which cat teaches him @@ -28,19 +28,19 @@ LangMay: kucing yang mana mengajar dia Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv where_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))) LangEng: where did you go -LangMay: awak pergi mana +LangMay: kamu pergi mana Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))) LangEng: why did you go -LangMay: mengapa awak pergi +LangMay: mengapa kamu pergi Lang: UseQCl (TTAnt TPast ASimul) PNeg (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))) LangEng: why didn't you go -LangMay: mengapa awak tidak pergi +LangMay: mengapa kamu tidak pergi Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN woman_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a see_V2))) LangEng: which woman did you see -LangMay : awak melihat perempuan yang mana +LangMay : kamu melihat perempuan yang mana # -- should be to whom did mother give the meat Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whoSg_IP (SlashVP (MassNP (UseN2 mother_N2)) (Slash3V3 give_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))) @@ -50,7 +50,7 @@ LangMay: ibu memberi daging kepada siapa # -- should be to whom did mother talk the meat Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whoSg_IP (SlashVP (MassNP (UseN2 mother_N2)) (Slash3V3 talk_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))) LangEng: whom did mother talk about the meat to -LangMay: ibu bercakap daging dengan siapa +LangMay: ibu bercakap tentang daging dengan siapa Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP whoSg_IP (ComplVV want_VV (UseV go_V))) LangEng: who wants to go @@ -62,7 +62,7 @@ LangMay: siapa kucing Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN2 mother_N2)) (ComplSlash (SlashV2A paint_V2A (PositA black_A)) (DetCN (DetQuant DefArt NumSg) (UseN house_N))))) LangEng: how does your mother paint the house black -LangMay: bagaimana ibu awak mengecat rumah hitam +LangMay: bagaimana ibu kamu mengecat rumah hitam Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron she_Pron) (ComplSlash (SlashV2a eat_V2) (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))) LangEng: why did she eat the meat diff --git a/src/malay/unittest/relative.gftest b/src/malay/unittest/relative.gftest index 47b3b5fe..be6748d6 100644 --- a/src/malay/unittest/relative.gftest +++ b/src/malay/unittest/relative.gftest @@ -3,7 +3,7 @@ Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V)))) LangEng: a cat that walks -LangMay: kucing yang jalan +LangMay: kucing yang berjalan 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 @@ -17,7 +17,7 @@ LangMay: susu yang kucing minum -- We can find another RGL tree that produces the more natural variant. This tree produces this variant. Lang: DetCN (DetQuant DefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashPrep (PredVP (DetCN (DetQuant DefArt NumSg) (UseN dog_N)) (UseV walk_V)) with_Prep)))) LangEng: the cat that the dog walks with -LangMay: kucing yang anjing jalan dengannya +LangMay: kucing yang anjing berjalan dengannya -------------------------------------------------------------- -- Determiner placement @@ -25,30 +25,31 @@ LangMay: kucing yang anjing jalan dengannya -- TODO check 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 -LangMay: kucing ini yang jalan +LangMay: kucing ini yang berjalan 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 -LangMay: kucing saya yang minum susu +LangMay: kucing aku yang minum susu -- TODO verb form? 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 -LangMay: ini kucing yang jalan +LangMay: ini kucing yang berjalan -------------------------------------------------------------- -- Complex example: "the book that his/her father gave him/her" -- 1. His father gave him a book +-- should be "memberikan buku" as book is dead 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))) LangMay: bapanya memberi buku kepadanya -- 2. A book that her father gave her -- TODO: would it be better as "buku yang bapanya beri kepadanya"? (Or any other variation?) 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)))))) -LangMay: buku yang bapanya beri dia +LangMay: buku yang bapanya memberi kepada dia -- The preposition "kepada" comes from the definition of give_V3 in LexiconMay.gf. -- If "buku yang bapanya beri kepadanya" is correct in general, but sometimes @@ -61,14 +62,14 @@ LangMay: buku yang bapanya beri dia -- then we can do it in the resource grammar. -- I want to read the book that my father gave me --- TODO check: would "saya mahu baca buku yang bapaku beri kepadaku" be better? +-- TODO check: would "aku mahu baca buku yang bapaku beri kepadaku" be better? Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashVV want_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (ComplN2 father_N2 (UsePron i_Pron))) (Slash3V3 give_V3 (UsePron i_Pron))))))))) -LangMay: saya mahu baca buku yang bapaku beri saya +LangMay: aku mahu membaca buku yang bapaku memberi kepada aku -- I want to read the book that my father read Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashVV want_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (ComplN2 father_N2 (UsePron i_Pron))) (SlashV2a read_V2)))))))) -LangMay: saya mahu baca buku yang bapaku baca +LangMay: aku mahu membaca buku yang bapaku membaca --- bonus tree: we can also generate "bapa saya", not just "bapaku" +-- bonus tree: we can also generate "bapa aku", not just "bapaku" 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))))))))) -LangMay: saya mahu baca buku yang bapa saya baca \ No newline at end of file +LangMay: aku mahu membaca buku yang bapa aku membaca \ No newline at end of file diff --git a/src/malay/unittest/tenses.gftest b/src/malay/unittest/tenses.gftest index b0447dd1..df49f4e6 100644 --- a/src/malay/unittest/tenses.gftest +++ b/src/malay/unittest/tenses.gftest @@ -18,8 +18,8 @@ LangMay: kucing akan berjalan Lang: ExtAdvS (SubjS if_Subj (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron i_Pron) (UseV walk_V)))) (UseCl (TTAnt TCond ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseV walk_V))) LangEng: if I walked , the cat would walk -LangMay: sekiranya saya berjalan , kucing akan berjalan +LangMay: sekiranya aku berjalan , kucing akan berjalan 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 -LangMay: kalau saya berjalan , kucing akan berjalan +LangMay: kalau aku berjalan , kucing akan berjalan diff --git a/src/malay/unittest/verbal_affixes.gftest b/src/malay/unittest/verbal_affixes.gftest index 75359c63..7875f2c9 100644 --- a/src/malay/unittest/verbal_affixes.gftest +++ b/src/malay/unittest/verbal_affixes.gftest @@ -9,42 +9,42 @@ Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N)) (UseV walk_V))) LangEng: my cat walks -LangMay: kucing saya berjalan +LangMay: kucing aku berjalan -- As a verbal complement Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N)) (ComplVV want_VV (UseV walk_V)))) LangEng: my cat wants to walk -LangMay: kucing saya mahu jalan +LangMay: kucing aku mahu jalan -- Transitive verbs Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant this_Quant NumSg) (UseN book_N))))) LangEng: I read this book -LangMay: saya membaca buku ini +LangMay: aku membaca buku ini -- As a verbal complement Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant this_Quant NumSg) (UseN book_N)))))) LangEng: I want to read this book -LangMay: saya mahu baca buku ini +LangMay: aku mahu baca buku ini -- How about words like mengajar and belajar? Is the prefix more important here? Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplSlash (SlashV2a learn_V2) (MassNP (UseN science_N))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N)))))) LangEng: I learn science in the school -LangMay: saya belajar sains di sekolah +LangMay: aku belajar sains di sekolah Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplSlash (SlashV2a teach_V2) (MassNP (UseN science_N))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N)))))) LangEng: I teach science in the school -LangMay: saya mengajar sains di sekolah +LangMay: aku mengajar sains di sekolah -- The way the grammar is currently defined, we'd get the same output for both "I want to learn/study science". Is this correct, or should one or both of the verbs keep the ber/meng prefix in this context? Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a teach_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N)))))) LangEng: I want to teach science in the school -LangMay: saya mahu ajar sains di sekolah +LangMay: aku mahu ajar sains di sekolah Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a learn_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N)))))) LangEng: I want to learn science in the school -LangMay: saya mahu belajar sains di sekolah +LangMay: aku mahu belajar sains di sekolah -- How about interaction with passive? These sentences are very artificial, but imagine they made sense: Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant this_Quant NumSg) (UseN book_N)) (AdvVP (PassV2 learn_V2) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N))))))) NoVoc @@ -67,7 +67,7 @@ LangMay: kucing yang jalan -- In a context Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a buy_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V)))))))) LangEng: I buy a cat that walks -LangMay: saya membeli kucing yang jalan +LangMay: aku membeli kucing yang jalan -- Transitive verbs @@ -84,11 +84,11 @@ LangMay: susu yang kucing minum -- Both in context Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a buy_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a drink_V2) (MassNP (UseN milk_N)))))))))) LangEng: I buy a cat that drinks milk -LangMay: saya membeli kucing yang minum susu +LangMay: aku membeli kucing yang minum susu Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a buy_V2) (MassNP (RelCN (UseN milk_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)) (SlashV2a drink_V2))))))))) LangEng: I buy milk that a cat drinks -LangMay: saya membeli susu yang kucing minum +LangMay: aku membeli susu yang kucing minum ---------------------------------------- @@ -102,7 +102,7 @@ LangMay: hujan sekarang -- In a context Lang: UttS (AdvS (SubjS if_Subj (UseCl (TTAnt TPast ASimul) PNeg (ImpersCl (UseV rain_V0)))) (ExtAdvS now_Adv (UseCl (TTAnt TCond ASimul) PPos (PredVP (UsePron i_Pron) (UseV walk_V))))) LangEng: if it didn't rain now , I would walk -LangMay: sekiranya tidak hujan sekarang , saya akan berjalan +LangMay: sekiranya tidak hujan sekarang , aku akan berjalan ---------------------------------------- -- Imperative From ce9618b945cb516382cdbc8498e3fa34d3004309 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 21 Feb 2022 14:56:01 +0800 Subject: [PATCH 34/92] add linrefs for ClSlash and RCl --- src/malay/CatMay.gf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 9fcc721f..d564d2dd 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -123,5 +123,6 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { linref CN = \cn -> cn.s ! NF Sg Bare ++ cn.heavyMod; - + ClSlash = \cl -> cl.subj ++ cl.pred ! Root ! Pos ++ cl.c2.s; + RCl = \cl -> cl.subj ++ cl.pred ! P1 ! Pos; } From 066a9f6170f0d42b01302363c3f70d1493f76135 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 21 Feb 2022 16:14:53 +0800 Subject: [PATCH 35/92] fix active verb form for love --- src/malay/CatMay.gf | 1 + src/malay/LexiconMay.gf | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index d564d2dd..04dead49 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -125,4 +125,5 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { CN = \cn -> cn.s ! NF Sg Bare ++ cn.heavyMod; ClSlash = \cl -> cl.subj ++ cl.pred ! Root ! Pos ++ cl.c2.s; RCl = \cl -> cl.subj ++ cl.pred ! P1 ! Pos; + Cl = \cl -> cl.subj ++ cl.pred ! Active ! Pos; } diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index e3b6643f..f2eceaa4 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -224,7 +224,9 @@ lin long_A = mkA "panjang" ; -- lin lose_V2 = mkV2 "" ; -- lin louse_N = mkN "" ; -- lin love_N = mkN "" ; -lin love_V2 = mkV2 "cinta" ; +lin love_V2 = let love' : V2 = mkV2 "cinta" in love' ** { + s = \\_ => "mencintai" ; +} ; ---- -- M From 88ae0d50933a58bdb56559b331fb378d628b3d79 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 23 Feb 2022 15:09:03 +0800 Subject: [PATCH 36/92] add mkV4 to add suffix to some verbs; passive unit tests --- src/malay/LexiconMay.gf | 14 ++++++++------ src/malay/ParadigmsMay.gf | 6 ++++++ src/malay/ResMay.gf | 13 ++++++++++++- src/malay/unittest/passive.gftest | 14 +++++++++++--- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index f2eceaa4..f01645b7 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -44,7 +44,7 @@ lin blood_N = mkN "darah" ; lin book_N = mkN "buku" ; -- lin boy_N = mkN "" ; -- lin bread_N = mkN "" ; -lin break_V2 = mkV2 "patahkan" ; -- TODO figure out if -kan needs to be separated +lin break_V2 = mkV4 "patah" "kan"; -- TODO figure out if -kan needs to be separated -- lin breast_N = mkN "" ; -- lin breathe_V = mkV "" ; -- lin broad_A = mkA "" ; @@ -224,9 +224,11 @@ lin long_A = mkA "panjang" ; -- lin lose_V2 = mkV2 "" ; -- lin louse_N = mkN "" ; -- lin love_N = mkN "" ; -lin love_V2 = let love' : V2 = mkV2 "cinta" in love' ** { - s = \\_ => "mencintai" ; -} ; +-- lin love_V2 = let love' : V2 = mkV2 "cinta" in love' ** { +-- s = \\_ => "mencintai" ; +-- passive = "dicintai" ; +-- } ; +lin love_V2 = mkV4 "cinta" "i"; ---- -- M @@ -302,7 +304,7 @@ lin read_V2 = mkV2 "baca" ; -- lin round_A = mkA "" ; -- lin rub_V2 = mkV2 "" ; -- lin rubber_N = mkN "" ; --- lin rule_N = mkN "" ; +lin rule_N = mkN "peraturan" ; -- lin run_V = mkV "" ; ---- @@ -353,7 +355,7 @@ lin song_N = mkN "lagu" ; -- lin steel_N = mkN "" ; -- lin stick_N = mkN "" ; -- lin stone_N = mkN "" ; --- lin stop_V = mkV "" ; +lin stop_V = mkV "henti" ; -- lin stove_N = mkN "" ; -- lin straight_A = mkA "" ; -- lin student_N = mkN "" ; diff --git a/src/malay/ParadigmsMay.gf b/src/malay/ParadigmsMay.gf index 4e8cd867..2df74b94 100644 --- a/src/malay/ParadigmsMay.gf +++ b/src/malay/ParadigmsMay.gf @@ -133,6 +133,12 @@ oper lin V3 (mkVerb3 v p q) } ; + mkV4 = overload { + mkV4 : Str -> Str -> V2 = \v2,str -> + lin V2 (mkVerb4 (mkVerb v2 Meng) dirPrep str) ; + mkV4 : V -> Prep -> Str -> V2 = \v,p,str -> lin V2 (mkVerb4 v p str) + } ; + mkVV = overload { mkVV : Str -> VV = \vv -> lin VV (ss vv) } ; diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index b2c0d878..b3b26586 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -209,6 +209,11 @@ oper c3 : Preposition } ; + Verb4 : Type = Verb ** { + c2 : Preposition ; + passive : Str + } ; + -- VV : Type = Verb ** {vvtype : VVForm} ; mkVerb : Str -> Prefix -> Verb = \str,p -> { @@ -220,12 +225,18 @@ oper mkVerb2 : Verb -> Preposition -> Verb2 = \v,pr -> v ** { c2 = pr ; - passive = "di" + v.s ! Root -- TODO check + passive = "di" + v.s ! Root } ; mkVerb3 : Verb -> (p,q : Preposition) -> Verb3 = \v,p,q -> mkVerb2 v p ** {c3 = q} ; + mkVerb4 : Verb -> Preposition -> Str -> Verb4 = \v,pr,str -> v ** { + s = \\_ => v.s ! Active + str; + c2 = pr ; + passive = "di" + v.s ! Root + str + } ; + copula : Verb = {s = \\_ => "ada"} ; -- TODO ------------------ -- Adv diff --git a/src/malay/unittest/passive.gftest b/src/malay/unittest/passive.gftest index 4b69b4a3..d0df9e0f 100644 --- a/src/malay/unittest/passive.gftest +++ b/src/malay/unittest/passive.gftest @@ -1,11 +1,19 @@ Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN dog_N)) (PassV2 love_V2)) LangEng: that dog is loved -LangMay: anjing itu dicinta +LangMay: anjing itu dicintai Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN dog_N)) (PassV2 love_V2)) LangEng: that dog isn't loved -LangMay: anjing itu tidak dicinta +LangMay: anjing itu tidak dicintai Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN dog_N)) (ComplVV want_VV (PassV2 love_V2))) LangEng: that dog doesn't want to be loved -LangMay: anjing itu tidak mahu dicinta \ No newline at end of file +LangMay: anjing itu tidak mahu dicintai + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN book_N)) (PassV2 read_V2)) +LangEng: that book is read +LangMay: buku itu dibaca + +Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN book_N)) (AdvVP (PassV2 read_V2) (PrepNP to_Prep (UsePron youSg_Pron)))) +LangEng: that book is read to you +LangMay: buku itu dibacakan kepada kamu \ No newline at end of file From 9fa07fb22dcfc258e615519e5e864c7fc96e6b00 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Mon, 21 Mar 2022 17:28:45 +0800 Subject: [PATCH 37/92] working tests for verbal affixes and tenses, add kepada (to a person), initial groundwork for animacy, numerals --- src/malay/AdjectiveMay.gf | 2 ++ src/malay/AdverbMay.gf | 2 ++ src/malay/CatMay.gf | 6 ++++ src/malay/LexiconMay.gf | 6 ++-- src/malay/NounMay.gf | 35 ++++++++++++++++-------- src/malay/NumeralMay.gf | 1 + src/malay/ParadigmsMay.gf | 1 + src/malay/ParamMay.gf | 6 ++++ src/malay/ResMay.gf | 3 ++ src/malay/StructuralMay.gf | 13 ++++++++- src/malay/unittest/numerals.gftest | 28 +++++++++++++++++++ src/malay/unittest/tenses.gftest | 3 ++ src/malay/unittest/verbal_affixes.gftest | 11 ++++---- 13 files changed, 96 insertions(+), 21 deletions(-) diff --git a/src/malay/AdjectiveMay.gf b/src/malay/AdjectiveMay.gf index af6b454c..2df3e73a 100644 --- a/src/malay/AdjectiveMay.gf +++ b/src/malay/AdjectiveMay.gf @@ -39,6 +39,8 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in { -- AdjOrd ord = ord ** { -- compar = [] -- } ; + -- AdjOrd : Ord -> AP = + AdjOrd ord = ord ; -- Sentence and question complements defined for all adjectival -- phrases, although the semantics is only clear for some adjectives. diff --git a/src/malay/AdverbMay.gf b/src/malay/AdverbMay.gf index 36458f82..d7b65fd7 100644 --- a/src/malay/AdverbMay.gf +++ b/src/malay/AdverbMay.gf @@ -13,6 +13,8 @@ lin -- : Prep -> NP -> Adv ; PrepNP prep np = {s = applyPrep prep np} ; + -- PrepNP to_Prep (UsePron youSg_Pron) + -- Adverbs can be modified by 'adadjectives', just like adjectives. --AdAdv : AdA -> Adv -> Adv ; -- very quickly diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 04dead49..61ca8867 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -126,4 +126,10 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { ClSlash = \cl -> cl.subj ++ cl.pred ! Root ! Pos ++ cl.c2.s; RCl = \cl -> cl.subj ++ cl.pred ! P1 ! Pos; Cl = \cl -> cl.subj ++ cl.pred ! Active ! Pos; + Det = linDet ; } + +-- Determiner : Type = Quant ** { +-- pr : Str ; -- prefix for numbers +-- n : NumType ; -- number as in 5 (noun in singular), Sg or Pl +-- } ; \ No newline at end of file diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index f01645b7..76552b4e 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -19,7 +19,7 @@ lin ask_V2Q = mkV2 "tanya" ; ---- -- B -lin baby_N = mkN "bayi" ; +lin baby_N = mkN "bayi" Animate ; lin back_N = mkN "belakang" ; -- lin bad_A = mkA "" ; lin bank_N = mkN "bank" ; @@ -29,7 +29,7 @@ lin beautiful_A = mkA "cantik" ; lin beer_N = mkN "bir" ; -- lin beg_V2V = mkV2 "" ; -- lin belly_N = mkN "" ; --- lin big_A = mkA "" ; +lin big_A = mkA "besar" ; -- lin bike_N = mkN "" ; -- lin bird_N = mkN "" ; -- lin bite_V2 = mkV2 "" ; @@ -208,7 +208,7 @@ lin king_N = mkN "raja" ; -- lin language_N = mkN "" ; -- lin laugh_V = mkV "" ; -- lin leaf_N = mkN "" ; --- lin learn_V2 = mkV2 (prefixV (mkV "ajar" Ber)) emptyPrep ; +lin learn_V2 = mkV2 (prefixV (mkV "ajar" Ber)) emptyPrep ; -- lin leather_N = mkN "" ; -- lin leave_V2 = mkV2 "" ; -- lin leg_N = mkN "" ; diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index 2bfed1f7..3f3b4966 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -51,7 +51,7 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { -- : Det -> NP ; DetNP det = emptyNP ** { - s = \\_ => det.s ; + s = \\_ => linDet det ; } ; -- MassNP : CN -> NP ; @@ -71,10 +71,12 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { n = num.n } ; - -- : Quant -> Num -> Ord -> Det ; -- these five best - -- DetQuantOrd quant num ord = - -- let theseFive = DetQuant quant num in theseFive ** { - -- } ; + -- : Quant -> Num -> Ord -> Det ; + DetQuantOrd quant num ord = quant ** { + pr = num.s ; + n = num.n ; + s = ord.s ++ quant.s ; + } ; -- Whether the resulting determiner is singular or plural depends on the -- cardinal. @@ -107,18 +109,21 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { OrdDigits digs = digs ** { s = digs.s ! NOrd } ; -} -- : Numeral -> Ord ; - -- OrdNumeral num = num ** { - -- s = \\_ => num.ord - -- } ; + OrdNumeral num = { + s = num.ord + } ; -- : A -> Ord ; - -- OrdSuperl a = { - -- } ; + OrdSuperl a = { + s = "ter" ++ BIND ++ a.s + } ; -- One can combine a numeral and a superlative. -- : Numeral -> A -> Ord ; -- third largest - -- OrdNumeralSuperl num a = num ** { } ; + OrdNumeralSuperl num a = { + s = num.ord ++ "ter" ++ BIND ++ a.s + } ; -- : Quant DefArt = mkQuant [] ; @@ -199,6 +204,14 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { } } ; + + -- : Det -> NP -> NP ; + CountNP det np = np ** + { + s = \\pos => "ke" ++ BIND ++ linDet det ++ BIND ++ "-" ++ BIND ++ linDet det ++ np.s ! pos; + } ; -- Nonsense for DefArt or IndefArt + + -- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples -- PartNP cn np = cn ** { -- } ; diff --git a/src/malay/NumeralMay.gf b/src/malay/NumeralMay.gf index 1367a5ed..a0d39193 100644 --- a/src/malay/NumeralMay.gf +++ b/src/malay/NumeralMay.gf @@ -96,6 +96,7 @@ oper } ; -- To make Sub* funs directly from a string. + -- ordnumeral from here mkNum : Str -> LinNumber = \s -> { n = Pl ; s = \\_ => s ; -- Indep vs. Attrib only matters for number 1 diff --git a/src/malay/ParadigmsMay.gf b/src/malay/ParadigmsMay.gf index 2df74b94..5a1732e1 100644 --- a/src/malay/ParadigmsMay.gf +++ b/src/malay/ParadigmsMay.gf @@ -93,6 +93,7 @@ oper mkN = overload { mkN : Str -> N = \s -> lin N (mkNoun s) ; + mkN : Str -> Animacy -> N = \s,a -> lin N (mkNoun s) ; } ; diff --git a/src/malay/ParamMay.gf b/src/malay/ParamMay.gf index abe7164d..95212a54 100644 --- a/src/malay/ParamMay.gf +++ b/src/malay/ParamMay.gf @@ -85,6 +85,8 @@ param NPAgr = NotPron | IsPron Person ; + Animacy = Animate | Inanimate ; + oper poss2str : Possession -> Str = \p -> case p of { Bare => [] ; @@ -130,6 +132,10 @@ param param PrepType = DirObj | EmptyPrep | OtherPrep ; + +-------------------------------------------------------------------------------- +-- Adverbs + -------------------------------------------------------------------------------- -- Verbs param diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index b3b26586..66e9da43 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -81,6 +81,9 @@ oper isPre : Bool ; } ; + linDet : Determiner -> Str = \det -> det.pr ++ det.s ; + +-- add field in determiner for kedua-dua numbers Determiner : Type = Quant ** { pr : Str ; -- prefix for numbers n : NumType ; -- number as in 5 (noun in singular), Sg or Pl diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 670ce889..ff737ef3 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -110,7 +110,18 @@ lin in_Prep = mkPrep "di" ; -- lin part_Prep = mkPrep ; lin possess_Prep = mkPrep [] ; -- TODO check Mintz p. 39-40, 2.2.1.2 -- lin through_Prep = mkPrep ; -lin to_Prep = mkPrep "ke" ; +-- lin to_Prep = mkPrep "ke" ; +lin to_Prep = + let ke : Preposition = mkPrep "ke"; + kepada : Preposition = mkPrep "kepada" ; + in ke ** { + obj = kepada.obj + } ; + +-- lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** { +-- s = \\_ => "ada" ; +-- passive = "diadakan" ; +-- } ; -- lin under_Prep = mkPrep "" ; lin with_Prep = mkPrep "dengan" ; -- lin without_Prep = mkPrep "" ; diff --git a/src/malay/unittest/numerals.gftest b/src/malay/unittest/numerals.gftest index cf6aa05b..97472829 100644 --- a/src/malay/unittest/numerals.gftest +++ b/src/malay/unittest/numerals.gftest @@ -9,3 +9,31 @@ LangMay: lima kucing ini Lang: DetCN (DetQuant (PossPron i_Pron) (NumCard (NumNumeral (num (pot2as3 (pot2 (pot0 n7))))))) (UseN cat_N) LangEng: my seven hundred cats LangMay: tujuh ratus kucing aku + +Lang: AdjCN (AdjOrd (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (UseN cat_N) +LangEng: second cat +LangMay: kucing kedua + +Lang: DetQuantOrd IndefArt NumPl (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))) +LangEng: second +LangMay: kedua + +Lang: UttNP (DetCN (DetQuantOrd (PossPron i_Pron) NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (UseN cat_N)) +LangEng: my second cat +LangMay: kucing kedua aku + +Lang: UttNP (DetCN (DetQuantOrd (PossPron i_Pron) (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (UseN cat_N)) +LangEng: my two second cats +LangMay: dua kucing kedua aku + +Lang: CountNP (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (DetCN (DetQuant (PossPron i_Pron) NumPl) (UseN cat_N)) +LangEng: two of my cats +LangMay: kedua-dua kucing aku + +Lang: MassNP (AdjCN (AdjOrd (OrdNumeralSuperl (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))) big_A)) (UseN cat_N)) +LangEng: third biggest cat +LangMay: kucing ketiga terbesar + +Lang: MassNP (AdjCN (AdjOrd (OrdSuperl big_A)) (UseN cat_N)) +LangEng: biggest cat +LangMay: kucing terbesar \ No newline at end of file diff --git a/src/malay/unittest/tenses.gftest b/src/malay/unittest/tenses.gftest index df49f4e6..51ef0bf6 100644 --- a/src/malay/unittest/tenses.gftest +++ b/src/malay/unittest/tenses.gftest @@ -23,3 +23,6 @@ LangMay: sekiranya aku berjalan , kucing akan berjalan 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 LangMay: kalau aku berjalan , kucing akan berjalan + +--- + diff --git a/src/malay/unittest/verbal_affixes.gftest b/src/malay/unittest/verbal_affixes.gftest index 7875f2c9..7fecec8d 100644 --- a/src/malay/unittest/verbal_affixes.gftest +++ b/src/malay/unittest/verbal_affixes.gftest @@ -14,7 +14,7 @@ LangMay: kucing aku berjalan -- As a verbal complement Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N)) (ComplVV want_VV (UseV walk_V)))) LangEng: my cat wants to walk -LangMay: kucing aku mahu jalan +LangMay: kucing aku mahu berjalan -- Transitive verbs @@ -25,7 +25,7 @@ LangMay: aku membaca buku ini -- As a verbal complement Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant this_Quant NumSg) (UseN book_N)))))) LangEng: I want to read this book -LangMay: aku mahu baca buku ini +LangMay: aku mahu membaca buku ini -- How about words like mengajar and belajar? Is the prefix more important here? @@ -37,10 +37,9 @@ Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (Com LangEng: I teach science in the school LangMay: aku mengajar sains di sekolah --- The way the grammar is currently defined, we'd get the same output for both "I want to learn/study science". Is this correct, or should one or both of the verbs keep the ber/meng prefix in this context? Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a teach_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N)))))) LangEng: I want to teach science in the school -LangMay: aku mahu ajar sains di sekolah +LangMay: aku mahu mengajar sains di sekolah Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a learn_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N)))))) LangEng: I want to learn science in the school @@ -62,12 +61,12 @@ LangMay: buku ini diajar di sekolah Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V)))) LangEng: a cat that walks -LangMay: kucing yang jalan +LangMay: kucing yang berjalan -- In a context Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a buy_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V)))))))) LangEng: I buy a cat that walks -LangMay: aku membeli kucing yang jalan +LangMay: aku membeli kucing yang berjalan -- Transitive verbs From bf33191c88a623396baeca3f508918e69652e994 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 30 Mar 2022 17:13:03 +0800 Subject: [PATCH 38/92] add kedua-dua (the two, etc.) to Det --- src/malay/NounMay.gf | 6 ++++-- src/malay/QuestionMay.gf | 3 ++- src/malay/ResMay.gf | 8 +++++--- src/malay/StructuralMay.gf | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index 3f3b4966..65a33612 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -68,7 +68,8 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { DetQuant quant num = quant ** { pr = num.s ; -- if it's not a number or digit, num.s is empty s = quant.s ; - n = num.n + n = num.n ; + count = "ke" ++ BIND ++ num.s ++ BIND ++ "-" ++ BIND ++ num.s; } ; -- : Quant -> Num -> Ord -> Det ; @@ -76,6 +77,7 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { pr = num.s ; n = num.n ; s = ord.s ++ quant.s ; + count = "" ; } ; -- Whether the resulting determiner is singular or plural depends on the @@ -208,7 +210,7 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { -- : Det -> NP -> NP ; CountNP det np = np ** { - s = \\pos => "ke" ++ BIND ++ linDet det ++ BIND ++ "-" ++ BIND ++ linDet det ++ np.s ! pos; + s = \\pos => det.count ++ np.s ! pos; } ; -- Nonsense for DefArt or IndefArt diff --git a/src/malay/QuestionMay.gf b/src/malay/QuestionMay.gf index 9544c90b..17d03521 100644 --- a/src/malay/QuestionMay.gf +++ b/src/malay/QuestionMay.gf @@ -21,7 +21,8 @@ lin -- if isPre is True, then: "berapa kucing" s = case iquant.isPre of { False => iquant.s ; True => [] }; -- if isPre is False, use s: "kucing berapa" - n = num.n + n = num.n ; + count = "" ; } ; -- : IP -> ClSlash -> QCl ; -- whom does John love diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 66e9da43..4487d40f 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -87,6 +87,7 @@ oper Determiner : Type = Quant ** { pr : Str ; -- prefix for numbers n : NumType ; -- number as in 5 (noun in singular), Sg or Pl + count: Str ; } ; CardNum : Type = { @@ -130,16 +131,17 @@ oper sp = \\_ => str } ; - mkDet : Str -> Number -> Determiner = \str, num -> mkQuant str ** { + mkDet : Str -> Str -> Number -> Determiner = \cnt, str, num -> mkQuant str ** { pr = "" ; n = NoNum num ; + count = "" ; } ; - mkIdet : Str -> Str -> Number -> Bool -> Determiner = \str, standalone, num, isPre -> mkDet str num ** { + mkIdet : Str -> Str -> Str -> Number -> Bool -> Determiner = \cnt, str, standalone, num, isPre -> mkDet cnt str num ** { pr = case isPre of {True => str ; False => [] } ; -- if isPre is True, then: "berapa kucing" s = case isPre of { False => str ; True => [] }; - + count = cnt ; sp = \\_ => standalone ; } ; diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index ff737ef3..a2cb1cb7 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -56,7 +56,7 @@ lin and_Conj = {s2 = "dan" ; s1 = [] ; n = Pl} ; -- *Det and Quant -lin how8many_IDet = mkIdet "berapa" "berapa banyak" Sg True; +lin how8many_IDet = mkIdet "berapa" "berapa banyak" "" Sg True; {-} lin all_Predet = {s = ""} ; lin not_Predet = { s = "" } ; From 1d033679f2fd5e20cf1094e2eb23e0d79cf851c6 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 30 Mar 2022 22:44:53 +0800 Subject: [PATCH 39/92] basic imperatif --- src/malay/LexiconMay.gf | 6 +++--- src/malay/PhraseMay.gf | 1 + src/malay/ResMay.gf | 6 ++++++ src/malay/SentenceMay.gf | 9 ++++++++- src/malay/unittest/verbal_affixes.gftest | 4 +++- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index 76552b4e..e3aa111d 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -94,7 +94,7 @@ lin come_V = mkV "datang" ; -- lin do_V2 = lin V2 egin_V ; -- lin doctor_N = mkN "" ; lin dog_N = mkN "anjing" ; --- lin door_N = mkN "" ; +lin door_N = mkN "pintu" ; lin drink_V2 = let drink' : V2 = mkV2 "minum" in drink' ** { s = \\_ => "minum" ; }; @@ -263,7 +263,7 @@ lin now_Adv = mkAdv "sekarang" ; -- lin oil_N = mkN "" ; lin old_A = mkA "tua" ; --- lin open_V2 = mkV2 "" ; +lin open_V2 = mkV2 "buka" ; lin paint_V2A = mkV2 "cat" ; -- lin paper_N = mkN "" ; -- lin paris_PN = mkPN "Paris" ; @@ -422,7 +422,7 @@ lin woman_N = mkN "perempuan" ; -- lin wonder_VQ = mkVQ "" ; -- lin wood_N = mkN "" ; -- lin worm_N = mkN "" ; --- lin write_V2 = mkV2 "" ; +lin write_V2 = mkV2 "tulis" ; -- lin year_N = mkN "" ; -- lin yellow_A = mkA "" ; lin young_A = mkA "muda" ; diff --git a/src/malay/PhraseMay.gf b/src/malay/PhraseMay.gf index cb594393..3a1fb5b2 100644 --- a/src/malay/PhraseMay.gf +++ b/src/malay/PhraseMay.gf @@ -8,6 +8,7 @@ concrete PhraseMay of Phrase = CatMay ** open Prelude, ResMay in { UttIAdv iadv = iadv ; UttNP np = {s = np.s ! Bare} ; UttIP ip = {s = ip.sp ! NF Sg Bare} ; + UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ; {- UttImpSg pol imp = UttImpPl pol imp = diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 4487d40f..047bf7c4 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -275,6 +275,7 @@ oper s = \\vf,pol => nounneg pol ++ s ; } ; +-- https://www.reddit.com/r/indonesian/comments/gsizsv/when_to_use_tidak_bukan_jangan_belum/ verbneg : Polarity -> Str = \pol -> case pol of { Neg => "tidak" ; -- or "tak"? @@ -285,6 +286,11 @@ oper Neg => "bukan" ; Pos => [] } ; + + impneg : Polarity -> Str = \pol -> case pol of { + Neg => "jangan" ; + Pos => [] + } ; -------------------------------------------------------------------------------- -- Cl, S diff --git a/src/malay/SentenceMay.gf b/src/malay/SentenceMay.gf index 1222e02e..e6d827b2 100644 --- a/src/malay/SentenceMay.gf +++ b/src/malay/SentenceMay.gf @@ -24,6 +24,13 @@ lin -- : Cl -> Prep -> ClSlash ; -- (with whom) he walks SlashPrep cl prep = cl ** {c2 = prep} ; + +--2 Imperatives + -- : VP -> Imp ; + ImpVP vp = { + s = \\num,pol => vp.s ! Root ! pol + } ; + {- -- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves SlashVS np vs ss = {} ; @@ -34,7 +41,7 @@ lin --2 Imperatives -- : VP -> Imp ; - ImpVP vp = {s = \\num,pol => linVP (VImp num pol) Statement vp} ; + -- ImpVP vp = {s = \\num,pol => linVP (VImp num pol) Statement vp} ; --2 Embedded sentences diff --git a/src/malay/unittest/verbal_affixes.gftest b/src/malay/unittest/verbal_affixes.gftest index 7fecec8d..d36f9be6 100644 --- a/src/malay/unittest/verbal_affixes.gftest +++ b/src/malay/unittest/verbal_affixes.gftest @@ -106,6 +106,8 @@ LangMay: sekiranya tidak hujan sekarang , aku akan berjalan ---------------------------------------- -- Imperative - +Lang: UttImpSg PPos (ImpVP (ComplSlash (SlashV2a open_V2) (DetCN (DetQuant DefArt NumSg) (UseN door_N)))) +LangEng: open the door +LangMay: buka pintu ---------------------------------------- -- Questions From ffd1f28b4262549a20aa1d7fdd69756f15ebee46 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 30 Mar 2022 23:32:08 +0800 Subject: [PATCH 40/92] negative imperative --- src/malay/SentenceMay.gf | 5 ++++- src/malay/unittest/verbal_affixes.gftest | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/malay/SentenceMay.gf b/src/malay/SentenceMay.gf index e6d827b2..d27c3f8e 100644 --- a/src/malay/SentenceMay.gf +++ b/src/malay/SentenceMay.gf @@ -28,7 +28,10 @@ lin --2 Imperatives -- : VP -> Imp ; ImpVP vp = { - s = \\num,pol => vp.s ! Root ! pol + s = \\num,pol => case pol of { + Neg => "jangan" ++ vp.s ! Root ! Pos; + Pos => vp.s ! Root ! Pos + } } ; {- diff --git a/src/malay/unittest/verbal_affixes.gftest b/src/malay/unittest/verbal_affixes.gftest index d36f9be6..9e06ad3d 100644 --- a/src/malay/unittest/verbal_affixes.gftest +++ b/src/malay/unittest/verbal_affixes.gftest @@ -109,5 +109,9 @@ LangMay: sekiranya tidak hujan sekarang , aku akan berjalan Lang: UttImpSg PPos (ImpVP (ComplSlash (SlashV2a open_V2) (DetCN (DetQuant DefArt NumSg) (UseN door_N)))) LangEng: open the door LangMay: buka pintu + +Lang: UttImpSg PNeg (ImpVP (ComplSlash (SlashV2a open_V2) (DetCN (DetQuant DefArt NumSg) (UseN door_N)))) +LangEng: don't open the door +LangMay: jangan buka pintu ---------------------------------------- -- Questions From 916cca5d22cc5c66a12915ed4c9f8f80e872ca29 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 41/92] 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 95c15233..f44c7a3d 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 dd05feeac02199560b54b5208582d08295b4ef69 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 42/92] 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 00000000..1d9f4c6f --- /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 5679eeb1fbfd10e998e23d4a0276ea3a5985a57b 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 43/92] 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 00000000..4fbfc9a8 --- /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 42a6de980346686e06985b6129c4f7ef0b5731c1 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 44/92] 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 61c2fa60..4befaaf4 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 e30a8794..08804798 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 cf9e2cdd7f8c9e004ff665f28b2e707d8165140f 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 45/92] 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 4befaaf4..87a2c6eb 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 dd5b34492a816621e1dcff8f9b9f20543907c1ed 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 46/92] 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 87a2c6eb..5098f5ed 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 8a50ddd9..557d2985 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 e507667a..f5607d85 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 ef76c9ee..9ac20f48 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 cba1a092..e745e3b4 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 1296b2af..3468e7e9 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 4a4a330b..234056e2 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 6ec08c2f..a04c87c5 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 51b3787d..66f85995 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 08804798..9b6a6494 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 013ee199..be6bed53 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 40caeea67f3245ff00bb563d5c8f26c70d91c547 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 47/92] 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 00000000..3068c2dc --- /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 e1130eb279756067272c9502d82dafebaf9cd589 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 48/92] 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 00000000..ff2077a2 --- /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 8495ed2f064548d842c4f5a5975ff6a209958b1b 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 49/92] 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 00000000..3a2e5c88 --- /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 27073a6c0ccd53106b09037ed1e3636c93d303c2 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 50/92] 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 234056e2..a9a18076 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 cc4aef88f9f3c2a1affdc5b33d913ba6a6e82388 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 51/92] 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 00000000..37f6c4bd --- /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 e853942d43fb20ee3ba4d93bf3fa153bbd61bfb7 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 52/92] 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 00000000..e281ab5d --- /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 bd060578d68596a6f4ae9d4f39c349b8300c4c61 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 53/92] =?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 e745e3b4..d025ed0f 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 7dac7341..8037d4d4 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 9b6a6494..3c1cf390 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 f2c196c0..b0370206 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 95bc972f44a2777d0c08c8738e11953c796e5333 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 54/92] 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 557d2985..206b14d5 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 679846ce..a046e755 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 f5607d85..2dc17731 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 d025ed0f..689432d3 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 9a9d4d10..6b803ac7 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 a04c87c5..eec89b92 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 66f85995..4f181342 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 3c1cf390..9ed6c7a5 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 65d8ae4d..9e9e1f38 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 2fc84c74..fd9b53ef 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 69457d54..264e5bee 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 be6bed53..9c0503d4 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 e281ab5d..024012a0 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 00000000..e94f6a1d --- /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 5aff25b37f4ec881f6191a5f6fdc65b0594728ff 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 55/92] =?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 8037d4d4..d190869d 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 e94f6a1d..6a7110fa 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 f9a633ea520309b37bec1713f55dba5f1dd1b64b 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 56/92] 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 1d9f4c6f..f78c4144 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 c0daf6d0bac69e1e6bf236a06bf1d4d6c1aa5930 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 57/92] 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 5098f5ed..ab17134a 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 65ddced771283fbf073896c5be5da5c365269ce1 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 58/92] 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 00000000..1d697bba --- /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 83fed4e81297755167f4ccd875aa9d00eab9f52e 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 59/92] 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 00000000..9927b82c --- /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 4db945a500d3570bc561f6f2fce5cae1ed4c913a 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 60/92] 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 00000000..137e670a --- /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 828ea2545c85b7324e4b59472423be99ebc9a317 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 61/92] 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 fd9b53ef..40cf45cf 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 bf213bf77e706daa96baa52d12c9675fe00c9b86 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 62/92] 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 137e670a..2a15d0cb 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 9400e0ed21286a287f8b16aa5644d464caa25f4c 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 63/92] 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 9927b82c..e85c43fa 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 184497284d5881a914f675a4233cf69337aaef5c 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 64/92] 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 00000000..842d9c90 --- /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 7fe4fd01f5c4b7658a463062f981d3ba8e705f04 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 65/92] (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 7b574b34..fb55ff6d 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 e011bab4..625bd231 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 0245dc2d5940f6b9f1eb09bf502547ff08e12955 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 7 Apr 2022 10:03:14 +0800 Subject: [PATCH 66/92] (Eng) minor cleanup,change date format in comments --- src/english/ResEng.gf | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/src/english/ResEng.gf b/src/english/ResEng.gf index f6965740..7ea45ee4 100644 --- a/src/english/ResEng.gf +++ b/src/english/ResEng.gf @@ -159,12 +159,12 @@ param s = table { AAdj Posit c => adjCompar.s ! AAdj Posit c ; AAdv => adjCompar.s ! AAdv ; - _ => nonExist } ; -- IL 06/2021. Replace with an actual string, if this causes problems. + _ => nonExist } ; -- IL 2021-06. Replace with an actual string, if this causes problems. isMost = True } ; _ => adjCompar } ; - -- IL 06/2021: remove "more" and "most" from A & A2's inflection table + -- IL 2021-06: remove "more" and "most" from A & A2's inflection table getCompar : Case -> Adjective -> Str = \c,a -> case a.isMost of { True => "more" ++ a.s ! AAdj Posit c ; False => a.s ! AAdj Compar c @@ -395,7 +395,7 @@ param False => {aux = x ; adv = "not" ; fin = [] ; inf = z} } ; -{- IL 24/04/2018 To fix scope of reflexives: +{- IL 2018-04 To fix scope of reflexives: a) ComplSlash ( … ReflVP … ) X: reflexive should agree with X LangEng> l PredVP (UsePron i_Pron) (ComplSlash (SlashV2V beg_V2V (ReflVP (SlashV2a like_V2))) (UsePron he_Pron)) I beg him to like /himself/ @@ -421,42 +421,22 @@ param insertExtra obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ; --- AR 7/3/2013 move the particle after the object - insertObjPartLast : (Agr => Str) -> VP -> VP = \obj,vp -> { - s = vp.s ; + insertObjPartLast : (Agr => Str) -> VP -> VP = \obj,vp -> vp ** { p = [] ; -- remove particle from here - prp = vp.prp ; - ptp = vp.ptp ; - inf = vp.inf ; - ad = vp.ad ; s2 = \\a => obj ! a ++ vp.s2 ! a ++ vp.p ; -- and put it here ; corresponds to insertObjPre isSimple = False ; - ext = vp.ext } ; --- The adverb should be before the finite verb. insertAdV : Str -> VP -> VP = \ad -> insertAdVAgr (\\_ => ad) ; - insertAdVAgr : (Agr => Str) -> VP -> VP = \ad,vp -> { - s = vp.s ; - p = vp.p ; - prp = vp.prp ; - ptp = vp.ptp ; - inf = vp.inf ; + insertAdVAgr : (Agr => Str) -> VP -> VP = \ad,vp -> vp ** { ad = \\a => vp.ad ! a ++ ad ! a ; - s2 = \\a => vp.s2 ! a ; isSimple = False ; - ext = vp.ext } ; - insertExtra : Str -> VP -> VP = \e,vp -> { - s = vp.s ; - p = vp.p ; - prp = vp.prp ; - ptp = vp.ptp ; - inf = vp.inf ; - ad = vp.ad ; - s2 = vp.s2 ; + insertExtra : Str -> VP -> VP = \e,vp -> vp ** { isSimple = False ; ext = vp.ext ++ e --- there should be at most one, one might think; but: I would say that it will be raining if I saw clouds } ; @@ -523,7 +503,7 @@ param haveContr = agrVerb (cBind "s") (cBind "ve") ; haventContr = agrVerb (cBind "s not") (cBind "ve not") ; - Aux = { + Aux : Type = { pres : Polarity => Agr => Str ; contr : Polarity => Agr => Str ; -- contracted forms past : Polarity => Agr => Str ; --# notpresent From d35a709eb77cd25d027fe4b53f33ca7e6623a680 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 7 Apr 2022 10:20:26 +0800 Subject: [PATCH 67/92] (Eng) Move VP's inflection table into Cl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Replaces 1300 fields with 50 fields + one new 2-valued parameter * Only construct the full table with Tense,Ant,Pol… in Cl --- src/english/ExtendEng.gf | 18 ++--- src/english/ExtraEng.gf | 24 +++---- src/english/IdiomEng.gf | 1 - src/english/ResEng.gf | 143 +++++++++++++++++++++++++++------------ 4 files changed, 118 insertions(+), 68 deletions(-) diff --git a/src/english/ExtendEng.gf b/src/english/ExtendEng.gf index 44f944fd..c2560268 100644 --- a/src/english/ExtendEng.gf +++ b/src/english/ExtendEng.gf @@ -185,7 +185,7 @@ concrete ExtendEng of Extend = mkVPS : Temp -> Pol -> VP -> VPS = \t,p,vp -> lin VPS { s = \\o,a => let - verb = vp.s ! t.t ! t.a ! p.p ! o ! a ; -- choice of Order determines aux or not + verb = mkVerbForms a vp ! t.t ! t.a ! p.p ! o ! a ; -- choice of Order determines aux or not compl = vp.s2 ! a ++ vp.ext in {fin = verb.aux ++ t.s ++ p.s ; inf = verb.adv ++ vp.ad ! a ++ verb.fin ++ verb.inf ++ vp.p ++ compl} ; @@ -288,16 +288,12 @@ lin BaseImp = twoTable2 CPolarity ImpForm ; let be = predAux auxBe ; ppt = vps.ptp - in { - s = be.s ; - p = [] ; - prp = be.prp ; - ptp = be.ptp ; - inf = be.inf ; - ad = \\_ => [] ; - s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent - isSimple = False ; - ext = vps.ext + in be ** { + p = [] ; + ad = \\_ => [] ; + s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent + isSimple = False ; + ext = vps.ext } ; lin diff --git a/src/english/ExtraEng.gf b/src/english/ExtraEng.gf index 248fb666..24e5bd63 100644 --- a/src/english/ExtraEng.gf +++ b/src/english/ExtraEng.gf @@ -75,7 +75,7 @@ concrete ExtraEng of ExtraEngAbs = CatEng ** MkVPS t p vp = { s = \\a => let - verb = vp.s ! t.t ! t.a ! p.p ! oDir ! a ; + verb = mkVerbForms a vp ! t.t ! t.a ! p.p ! oDir ! a ; verbf = verb.aux ++ verb.adv ++ verb.fin ++ verb.inf ; in t.s ++ p.s ++ vp.ad ! a ++ verbf ++ vp.p ++ vp.s2 ! a ++ vp.ext } ; @@ -180,17 +180,13 @@ lin let be = predAux auxBe ; ppt = vps.ptp - in { - s = be.s ; - p = [] ; - prp = be.prp ; - ptp = be.ptp ; - inf = be.inf ; - ad = \\_ => [] ; - s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent - isSimple = False ; - ext = vps.ext - } ; + in be ** { + p = [] ; + ad = \\_ => [] ; + s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent + isSimple = False ; + ext = vps.ext + } ; lin PassVPSlash vps = passVPSlash vps [] ; @@ -242,7 +238,7 @@ lin let subj = np.s ! npNom ; agr = np.a ; - verb = vp.s ! t ! a ! b ! o ! agr ; + verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ; compl = vp.s2 ! agr in case o of { @@ -256,7 +252,7 @@ lin let subj = np.s ! npNom ; agr = np.a ; - verb = vp.s ! t ! a ! b ! o ! agr ; + verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ; compl = vp.s2 ! agr in case o of { diff --git a/src/english/IdiomEng.gf b/src/english/IdiomEng.gf index eefc0307..be0fd811 100644 --- a/src/english/IdiomEng.gf +++ b/src/english/IdiomEng.gf @@ -44,4 +44,3 @@ concrete IdiomEng of Idiom = CatEng ** open Prelude, ResEng in { } ; } - diff --git a/src/english/ResEng.gf b/src/english/ResEng.gf index 7ea45ee4..1257ca98 100644 --- a/src/english/ResEng.gf +++ b/src/english/ResEng.gf @@ -252,18 +252,59 @@ param Tense => Anteriority => CPolarity => Order => Agr => {aux, adv, fin, inf : Str} ; -- would, not, sleeps, slept - VP : Type = { - s : VerbForms ; - p : Str ; -- verb particle - prp : Str ; -- present participle - ptp : Str ; -- past participle - inf : Str ; -- the infinitive form ; VerbForms would be the logical place - ad : Agr => Str ; -- sentence adverb (can be Xself, hence Agr) - s2 : Agr => Str ; -- complement - ext : Str ; -- extreposed field such as S, QS, VP - isSimple : Bool -- regulates the place of participle used as adjective - } ; +{- IL 2022-04: reduce the fields in VP and make the grammar better suited for morphological analysis + All verbs except auxiliaries only need 6 forms inside VP, and other forms can be built in PredVP. + Auxiliaries need more forms. So we make VP an extension of Aux, and add a parameter that tells + which strategy to use when building a Cl: use the 4 forms, or use the fields in Aux. + (If we treat auxiliaries as normal verbs, we get "you don't be __" for "you aren't __".) + If we didn't care about morphological lexicon, we could just fill the Aux fields for all verbs: + morphologically distinct forms like "can't" for auxiliaries, and periphrastic constructions + like "doesn't sing/eat/play" for other verbs. However, then morphologically analysing the word + "doesn't" returns every single function that constructs a VP, which clutters morpho analysis. + + So we use two sets of fields and a parameter for which strategy to choose in PredVP. This results + in significantly fewer fields than previously, and is better for morphological analysis. +-} + VP : Type = { + -- The common parts + p : Str ; -- verb particle + ad : Agr => Str ; -- sentence adverb (can be Xself, hence Agr) + s2 : Agr => Str ; -- complement + ext : Str ; -- extreposed field such as S, QS, VP + prp : Str ; -- present participle + ptp : Str ; -- past participle + inf : Str ; -- the infinitive form + isSimple : Bool ; -- regulates the place of participle used as adjective + + -- The variable parts, depending on whether the main verb of the VP is auxiliary or not + isAux : Bool ; + auxForms : { -- nonExist when isAux=False + past, --# notpresent + contr, + pres : Polarity => Agr => Str ; + } ; + nonAuxForms : { -- nonExist when isAux=True + pres : Agr => Str ; -- sing/sings ; can be streamlined into two forms if needed + past : Str ; --# notpresent + } + } ; + + -- called from mkClause, when we finally put together all forms for a Cl + mkVerbForms : Agr -> VP -> VerbForms = \agr,vp -> case vp.isAux of { + True => + let aux : Aux = vp.auxForms ** { + inf = vp.inf ; + ppart = vp.ptp ; + prpart = vp.prp } ; + in auxVerbForms aux ; + False => + let fin : Str = vp.nonAuxForms.pres ! agr ; + inf : Str = vp.inf ; + part : Str = vp.ptp ; + in nonAuxVerbForms fin inf part + vp.nonAuxForms.past --# notpresent + } ; SlashVP = VP ** {c2 : Str ; gapInMiddle : Bool; @@ -276,20 +317,57 @@ param cBind : Str -> Str = \s -> Predef.BIND ++ ("'" + s) ; predV : Verb -> VP = \verb -> { - s = \\t,ant,b,ord,agr => - let - inf = verb.s ! VInf ; - fin = presVerb verb agr ; - part = verb.s ! VPPart ; - in - case of { + p = verb.p ; -- Common to all verbs + prp = verb.s ! VPresPart ; + ptp = verb.s ! VPPart ; + inf = verb.s ! VInf ; + ad = \\_ => [] ; + ext = [] ; + isSimple = True ; ---- but really depends on whether p == [] + s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] ; + + isAux = False ; -- Specific to non-Aux verbs + auxForms = { + contr, + past, --# notpresent + pres = \\_,_ => nonExist} ; + nonAuxForms = { + pres = \\agr => presVerb verb agr ; + past = verb.s ! VPast ; --# notpresent + } + } ; + + predAux : Aux -> VP = \aux -> { + p = [] ; -- Common to all verbs + prp = aux.prpart ; + ptp = aux.ppart ; + inf = aux.inf ; + ad = \\_ => [] ; + ext = [] ; + isSimple = True ; + s2 = \\_ => [] ; + + isAux = True ; -- Specific to Aux verbs + auxForms = aux ; + nonAuxForms = { + past = nonExist ; --# notpresent + pres = \\_ => nonExist} + } ; + + nonAuxVerbForms : (fin,inf,part : Str) -> + (past : Str) -> --# notpresent + VerbForms = \fin,inf,part + ,past --# notpresent + -> + \\tns,ant,pol,ord,agr => + case of { => vff fin [] ; => vf (does agr) inf ; => vf (haveContr agr) part ; --# notpresent => vf (have agr) part ; --# notpresent => vfn c (haveContr agr) (haventContr agr) part ; --# notpresent => vfn c (have agr) (havent agr) part ; --# notpresent - => vff (verb.s ! VPast) [] ; --# notpresent + => vff past [] ; --# notpresent => vf "did" inf ; --# notpresent => vfn c "did" "didn't" inf ; --# notpresent => vf (cBind "d") part ; --# notpresent @@ -314,18 +392,9 @@ param => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent => vfn c (does agr) (doesnt agr) inf } ; - p = verb.p ; - prp = verb.s ! VPresPart ; - ptp = verb.s ! VPPart ; - inf = verb.s ! VInf ; - ad = \\_ => [] ; - ext = [] ; - isSimple = True ; ---- but really depends on whether p == [] - s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] - } ; - predAux : Aux -> VP = \verb -> { - s = \\t,ant,cb,ord,agr => + auxVerbForms : Aux -> VerbForms = \verb -> + \\t,ant,cb,ord,agr => let b = case cb of { CPos => Pos ; @@ -371,17 +440,7 @@ param => vf fin [] ; => vfn c cfinp fin [] ; => vfn c finp fin [] - - } ; - p = [] ; - prp = verb.prpart ; - ptp = verb.ppart ; - inf = verb.inf ; - ad = \\_ => [] ; - ext = [] ; - isSimple = True ; - s2 = \\_ => [] - } ; + } ; vff : Str -> Str -> {aux, adv, fin, inf : Str} = \x,y -> {aux = [] ; adv = [] ; fin = x ; inf = y} ; @@ -569,7 +628,7 @@ param \subj,agr,vp -> { s = \\t,a,b,o => let - verb = vp.s ! t ! a ! b ! o ! agr ; + verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ; compl = vp.s2 ! agr ++ vp.ext in case o of { From d14de723d059cf24ea18870ac28a0d0b5426f26f Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 27 Apr 2022 11:40:04 +0800 Subject: [PATCH 68/92] imppol for malay --- src/malay/ParamMay.gf | 1 + src/malay/PhraseMay.gf | 1 + src/malay/ResMay.gf | 3 ++- src/malay/SentenceMay.gf | 4 ++-- src/malay/unittest/verbal_affixes.gftest | 4 ++++ 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/malay/ParamMay.gf b/src/malay/ParamMay.gf index 95212a54..0c153302 100644 --- a/src/malay/ParamMay.gf +++ b/src/malay/ParamMay.gf @@ -142,6 +142,7 @@ param VForm = Root -- infinitive, imperative, … | Active + | Imperative ; Prefix = diff --git a/src/malay/PhraseMay.gf b/src/malay/PhraseMay.gf index 3a1fb5b2..3e7c99e4 100644 --- a/src/malay/PhraseMay.gf +++ b/src/malay/PhraseMay.gf @@ -9,6 +9,7 @@ concrete PhraseMay of Phrase = CatMay ** open Prelude, ResMay in { UttNP np = {s = np.s ! Bare} ; UttIP ip = {s = ip.sp ! NF Sg Bare} ; UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ; + UttImpPol pol imp = {s = pol.s ++ imp.s ! Sg ! pol.p} ; {- UttImpSg pol imp = UttImpPl pol imp = diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 047bf7c4..d70c8f55 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -224,7 +224,8 @@ oper mkVerb : Str -> Prefix -> Verb = \str,p -> { s = table { Root => str ; - Active => prefix p str + Active => prefix p str ; + Imperative => str ++ BIND ++ "kan" } } ; diff --git a/src/malay/SentenceMay.gf b/src/malay/SentenceMay.gf index d27c3f8e..e9075f17 100644 --- a/src/malay/SentenceMay.gf +++ b/src/malay/SentenceMay.gf @@ -29,8 +29,8 @@ lin -- : VP -> Imp ; ImpVP vp = { s = \\num,pol => case pol of { - Neg => "jangan" ++ vp.s ! Root ! Pos; - Pos => vp.s ! Root ! Pos + Neg => "jangan" ++ vp.s ! Imperative ! Pos; + Pos => vp.s ! Imperative ! Pos } } ; diff --git a/src/malay/unittest/verbal_affixes.gftest b/src/malay/unittest/verbal_affixes.gftest index 9e06ad3d..26e1c5df 100644 --- a/src/malay/unittest/verbal_affixes.gftest +++ b/src/malay/unittest/verbal_affixes.gftest @@ -113,5 +113,9 @@ LangMay: buka pintu Lang: UttImpSg PNeg (ImpVP (ComplSlash (SlashV2a open_V2) (DetCN (DetQuant DefArt NumSg) (UseN door_N)))) LangEng: don't open the door LangMay: jangan buka pintu + +Lang: UttImpPol PPos (ImpVP (ComplSlash (SlashV2a open_V2) (DetCN (DetQuant DefArt NumSg) (UseN door_N)))) +LangEng: open the door +LangMay: bukakan pintu ---------------------------------------- -- Questions From 46509b93a3730a9735bd9263aa636e975c76424e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 12 Apr 2022 19:01:08 +0800 Subject: [PATCH 69/92] (Est) Keep non-finite forms non-finite in PassV2 TODO: restructure VP so we retain non-finite passive forms --- src/estonian/ResEst.gf | 6 ++++++ src/estonian/VerbEst.gf | 22 ++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index 6418b9a2..0b72ab54 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -163,6 +163,12 @@ param in preOrPost co.isPre co.s nps ; + -- Used for passive; c2 of V2/VPSlash becomes sc of VP + compl2subjcase : Compl -> NPForm = \compl -> + case compl.c of { + NPCase Gen => NPCase Nom ; -- valisin koera -> koer valitakse + _ => compl.c -- rääkisin koerale -> koerale räägitakse + } ; -- For $Verb$. Verb : Type = { diff --git a/src/estonian/VerbEst.gf b/src/estonian/VerbEst.gf index 8c84e22f..7f54194a 100644 --- a/src/estonian/VerbEst.gf +++ b/src/estonian/VerbEst.gf @@ -79,20 +79,14 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { ReflVP v = insertObjPre (\\fin,b,agr => appCompl fin b v.c2 (reflPron agr)) v ; - PassV2 v = - let - vp = predV v ; - subjCase = case v.c2.c of { --this is probably a reason to not get rid of NPAcc; TODO check - NPCase Gen => NPCase Nom ; --valisin koera -> koer valitakse - _ => v.c2.c --rääkisin koerale -> koerale räägitakse - } - in { - s = \\_ => vp.s ! VIPass Pres ; - s2 = \\_,_,_ => [] ; - adv = [] ; - p = vp.p ; - ext = vp.ext ; - sc = subjCase -- koer valitakse ; koerale räägitakse + PassV2 v = + let vp = predV v in vp ** { + s = \\vf => case vf of { + VIFin t => vp.s ! VIPass t ; + -- VIImper => v.s ! ImperPass ; -- TODO: include these forms from V into VP + -- VIPresPart => v.s ! PresPart Pass ; + x => vp.s ! x } ; + sc = compl2subjcase v.c2 -- koer valitakse ; koerale räägitakse } ; ----b UseVS, UseVQ = \v -> v ** {c2 = {s = [] ; c = NPAcc ; isPre = True}} ; From 41d4b7fabd2953a7b18dca48e433255b12a226e2 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 12 Apr 2022 19:03:01 +0800 Subject: [PATCH 70/92] (Est) Add DAP + funs that use/produce it --- src/estonian/CatEst.gf | 2 +- src/estonian/NounEst.gf | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index a91a245e..57b891d0 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -50,7 +50,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { CN = {s : NForm => Str} ; Pron = {s : NPForm => Str ; a : Agr} ; NP = {s : NPForm => Str ; a : Agr ; isPron : Bool} ; - Det = { + DAP, Det = { s : Case => Str ; -- minun kolme sp : Case => Str ; -- se (substantival form) n : Number ; -- Pl (agreement feature for verb) diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index a2167f41..2d873ab6 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -106,6 +106,21 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in isDef = quant.isDef } ; + DetDAP det = det ; + + AdjDAP dap ap = dap ** { + s = \\c => dap.s ! c ++ + case ap.infl of { + Regular => ap.s ! True ! NCase dap.n c ; + _ => ap.s ! True ! NCase dap.n Nom ---- participle + } ; + sp = \\c => dap.sp ! c ++ + case ap.infl of { + Regular => ap.s ! True ! NCase dap.n c ; + _ => ap.s ! True ! NCase dap.n Nom ---- participle + } ; + } ; + PossPron p = { s,sp = \\_,_ => p.s ! NPCase Gen ; isNum = False ; From 5eb333ce6aa8a8f4ea63073a99cef9dcd1089d6f Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 12 Apr 2022 19:03:22 +0800 Subject: [PATCH 71/92] (Est) New linearisations in ExtendEst --- src/estonian/ExtendEst.gf | 611 +++++++++++++++++++++++--------------- 1 file changed, 376 insertions(+), 235 deletions(-) diff --git a/src/estonian/ExtendEst.gf b/src/estonian/ExtendEst.gf index 42551d19..1103c5b7 100644 --- a/src/estonian/ExtendEst.gf +++ b/src/estonian/ExtendEst.gf @@ -3,19 +3,29 @@ concrete ExtendEst of Extend = CatEst ** ExtendFunctor - [ - VPS, ListVPS, VPI, ListVPI, VPS2, ListVPS2, VPI2, ListVPI2, RNP, RNPList, - AdAdV, AdjAsCN, AdjAsNP, ApposNP, - BaseVPS, ConsVPS, BaseVPI, ConsVPI, BaseVPS2, ConsVPS2, BaseVPI2, ConsVPI2, - MkVPS, ConjVPS, PredVPS, MkVPI, ConjVPI, ComplVPIVV, - MkVPS2, ConjVPS2, ComplVPS2, MkVPI2, ConjVPI2, ComplVPI2, - Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, ByVP, CompBareCN, - CompIQuant, CompQS, CompS, CompVP, ComplBareVS, ComplGenVV, ComplSlashPartLast, ComplVPSVV, CompoundAP, - CompoundN, ConjRNP, ConjVPS, ConsVPS, Cons_nr_RNP, Cons_rr_RNP, DetNPFem, EmbedPresPart, - ExistsNP, FocusAP, FocusAdV, FocusAdv, FocusObj, FrontExtPredVP, GenIP, GenModIP, GenModNP, GenNP, GenRP, - GerundAdv, GerundCN, GerundNP, IAdvAdv, ICompAP, InOrderToVP, InvFrontExtPredVP, MkVPS, NominalizeVPSlashNP, - PassAgentVPSlash, PassVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, PredVPS, PredVPSVV, PredetRNP, PrepCN, - PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, - UncontractedNeg, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, MkVPS2 + -- Extensions of VP + VPS, ListVPS, VPI, ListVPI, VPS2, ListVPS2, VPI2, ListVPI2, + MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, QuestVPS, SQuestVPS, RelVPS, + MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, + MkVPS2, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, ReflVPS2, + MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2, + + -- Reflexives + RNP, RNPList, Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, ConjRNP, Cons_nr_RNP, Cons_rr_RNP, PredetRNP, ReflRNP, ReflPoss, ReflPron, + + -- Rest in alphabetical order + AdAdV, AdjAsCN, AdjAsNP, ApposNP, AdvIsNP, A2VPSlash, ByVP, + CardCNCard, CompBareCN, CompIQuant, CompQS, CompS, CompVP, + ComplBareVS, ComplGenVV, ComplSlashPartLast, ComplVPSVV, CompoundAP, CompoundN, + EmbedPresPart, EmbedSSlash, EmptyRelSlash, ExistsNP, ExistCN, ExistMassCN, ExistPluralCN, + FocusAP, FocusAdV, FocusAdv, FocusObj, FrontComplDirectVQ, FrontComplDirectVS, + GenIP, GenModIP, GenModNP, GenNP, GenRP, GerundAdv, GerundCN, GerundNP, + IAdvAdv, ICompAP, InOrderToVP, N2VPSlash, NominalizeVPSlashNP, + PassAgentVPSlash, PassVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, + PredAPVP, PredIAdvVP, PredVPSVV, PresPartAP, PrepCN, ProDrop, ProgrVPSlash, PurposeVP, + SlashBareV2S, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP + + ] with (Grammar = GrammarEst) ** @@ -24,264 +34,395 @@ concrete ExtendEst of Extend = GrammarEst, ResEst, (R=ResEst), + (X=ExtraEst), IdiomEst, Coordination, Prelude, MorphoEst, LexiconEst, - ParadigmsEst in { + ParadigmsEst in { + +--------------------------------- +-- VPS, VPI, VPS2 + list versions + lincat + VPS = X.VPS ; + [VPS] = X.ListVPS ; + VPI = X.VPI ; + [VPI] = X.ListVPI ; + VPS2 = X.VPS ** {c2 : Compl} ; + [VPS2] = X.ListVPS ** {c2 : Compl} ; + VPI2 = X.VPI ** {c2 : Compl} ; + [VPI2] = X.ListVPI ** {c2 : Compl} ; lin - -- : NP -> Quant ; -- this man's - GenNP np = { + MkVPS = X.MkVPS ; + BaseVPS = X.BaseVPS ; + ConsVPS = X.ConsVPS ; + ConjVPS = X.ConjVPS ; + + PredVPS = X.PredVPS ; + -- QuestVPS + -- SQuestVPS + -- RelVPS + + MkVPI = X.MkVPI ; + BaseVPI = X.BaseVPI ; + ConsVPI = X.ConsVPI ; + ConjVPI = X.ConjVPI ; + ComplVPIVV = X.ComplVPIVV ; + + MkVPS2 t p vps = MkVPS t p vps ** {c2 = vps.c2} ; +-- BaseVPS2, ConsVPS2, ConjVPS2, + + ComplVPS2 v np = lin VPS (v ** { + -- TODO: param to record whether it's pos or neg, so we get right form of np + s = \\agr => v.s ! agr ++ appCompl True Pos v.c2 np ; + }) ; + +-- ReflVPS2 v rnp = +-- MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2, + +--------------------------------- +-- RNP + all related funs + + lincat + RNP = {s : Agr => NPForm => Str} ; + RNPList = {s1,s2 : Agr => NPForm => Str} ; + + oper + rnp2np : Agr -> RNP -> NP = \agr,rnp -> lin NP { + a = agr ; + s = rnp.s ! agr ; + isPron = False ; -- ?? + } ; + + lin + -- : VPSlash -> RNP -> VP ; -- support my family and myself + ReflRNP vps rnp = insertObj (\\b,p,a => appCompl True Pos vps.c2 (rnp2np a rnp)) vps ; + + -- : RNP + ReflPron = {s = \\agr,npf => (reflPron agr).s ! npf} ; + + -- : Num -> CN -> RNP ; -- my car(s) + ReflPoss num cn = { + s = \\a,npf => possPron ! a ++ num.s ! Sg ! Nom ++ + case npf of { + NPCase c => cn.s ! NCase num.n c ; + NPAcc => cn.s ! NCase num.n Gen } ; + } ; + + PredetRNP predet rnp = { + s = \\a,c => case a of { + Ag n p => predet.s ! n ! c ++ rnp.s ! a ! c ; + AgPol => predet.s ! Pl ! c ++ rnp.s ! a ! c } + } ; + + ConjRNP conj rpns = conjunctDistrTable2 Agr NPForm conj rpns ; + + Base_rr_RNP x y = twoTable2 Agr NPForm x y ; + Base_nr_RNP x y = twoTable2 Agr NPForm {s = \\a => x.s} y ; + Base_rn_RNP x y = twoTable2 Agr NPForm x {s = \\a => y.s} ; + Cons_rr_RNP x xs = consrTable2 Agr NPForm comma x xs ; + Cons_nr_RNP x xs = consrTable2 Agr NPForm comma {s = \\a => x.s} xs ; + +{- + -- : Pron -> Num -> CN -> RNP -> NP ; -- his abandonment of his wife and children + PossPronRNP pron num cn rnp = + + -- : NP -> Prep -> RNP -> RNP ; -- a dispute with his wife + AdvRAP adv rp = + + -- : VP -> Prep -> RNP -> VP ; -- lectured about her travels + AdvRNP adv rp = + + -- : AP -> Prep -> RNP -> AP ; -- adamant in his refusal + AdvRVP adv rp = + -} + + oper + possPron : Agr => Str = table { + Ag Sg P1 => "minu" ; + Ag Sg P2 => "sinu" ; + Ag Sg P3 => "tema" ; + Ag Pl P1 => "meie" ; + Ag Pl P2 => "teie" ; + Ag Pl P3 => "nende" ; + AgPol => "teie" + } ; + + +--------------------------------- +-- A - B + lin + + + AdAdV ad adv = AdAdv ad adv ; + + -- : AP -> CN ; -- a green one ; en grön (Swe) + AdjAsCN ap = {s = ap.s ! True} ; -- True = attributive ; False = predicative + + -- : AP -> NP + AdjAsNP ap = MassNP (AdjAsCN ap) ; + + -- : NP -> NP -> NP + ApposNP np1 np2 = np2 ** { + s = \\nf => np1.s ! nf ++ np2.s ! nf ; -- comma or not? + } ; + + -- : Adv -> NP -> Cl ; -- here is the tree / here are the trees + AdvIsNP adv np = mkClause (\_ -> adv.s) (agrP3 Sg) (UseComp (CompNP np)) ; + + -- : A2 -> VPSlash + A2VPSlash a2 = UseComp (CompAP (UseA2 a2)) ** {c2 = a2.c2} ; + + -- : VP -> Adv ; + ByVP vp = {s = vp2adv vp True (VIInf InfDes)} ; + +--------------------------------- +-- C + + lin + + -- : VS -> S -> VP ; + ComplBareVS v s = insertExtrapos s.s (predV v) ; + + -- : N -> N -> N ; -- control system / controls system / control-system + CompoundN noun cn = cn ** { + s = \\nf => noun.s ! NCase Sg Gen ++ BIND ++ cn.s ! nf + } ; + + -- : N -> A -> AP ; -- language independent / language-independent + CompoundAP n a = PositA (a ** {s = \\d,af => n.s ! NCase Sg Nom ++ BIND ++ a.s ! d ! af}) ; + + -- : VS -> Utt -> VP ; -- say: "today" + ComplDirectVS vs utt = insertExtrapos (BIND ++ ":" ++ utt.s) (predV vs) ; + + -- : VQ -> Utt -> VP ; -- ask: "when" + ComplDirectVQ vq utt = insertExtrapos (BIND ++ ":" ++ utt.s) (predV vq) ; + + -- : S -> Comp ; -- (the fact is) that she sleeps + CompS s = {s = \\_ => "et" ++ s.s} ; + + -- : QS -> Comp ; -- (the question is) who sleeps + CompQS qs = {s = \\_ => qs.s } ; + + -- : Ant -> Pol -> VP -> Comp ; -- (she is) to go + CompVP ant pol vp = {s = \\a => infVPAnt ant.a (NPCase Nom) pol.p a vp InfDa } ; + + + -- ComplGenVV v a p vp = insertObj (\\agr => a.s ++ p.s ++ infVP v.typ vp a.a p.p agr) + -- (predVV v) ; + + -- ComplSlashPartLast vps np = {} ; --- AR 7/3/2013 + +--------------------------------- +-- E - F + + lin + + {- TODO: need to change VP to get EmbedPresPart and various Gerunds to work: + 1) Add "mine" form into VP (or switch to a BIND solution and just add a stem) + 2) Change s2 in VP so that we can manipulate the complement to be in genitive! + + -- : VP -> SC ; -- looking at Mary (is fun) / filmide vaatamine (on tore) + EmbedPresPart vp = + let vpGen = vp ; --** { s2 = \\_,_,_ => vp.s2 ! True ! Pos ! } + {s = vp2adv vp True VI } ; + -} + + EmbedSSlash s = {s = s.s ++ s.c2.s} ; + + -- : ClSlash -> RCl ; -- he lives in + EmptyRelSlash cls = { + s = \\t,a,p,_ => cls.s ! t ! a ! p ++ cls.c2.s ; + c = NPCase Nom + } ; + + -- : CN -> Cl ; -- there is a car / there is no car ; there is beer / there is no beer ; there are + -- TODO: these all use the literal "exist" verb. Does Estonian have a construction for "there is"? + ExistCN, ExistMassCN = \cn -> ExistsNP (MassNP cn) ; + ExistPluralCN cn = ExistsNP (DetCN (DetQuant IndefArt NumPl) cn) ; + + -- : NP -> Cl ; -- there exists a number / there exist numbers + ExistsNP = IdiomEst.ExistNP ; + + -- : AP -> NP -> Utt ; -- green was the tree + FocusAP ap np = + let pred : VP = UseComp (CompNP np) ; + subj : NP = AdjAsNP ap ; + cl : Cl = PredVP subj pred ; + in UttS (UseCl (TTAnt TPres ASimul) PPos cl) ; -- use AdvIsNP for similar construction but that returns a Cl instead + + -- : Ad[vV] -> S -> Utt -- today I will sleep + FocusAdV, FocusAdv = \adv,s -> cc2 adv s ; + + -- : NP -> SSlash -> Utt ; -- her I love + FocusObj np sslash = {s = appCompl True Pos sslash.c2 np ++ sslash.s} ; + + + -- : NP -> VS -> Utt -> Cl ; -- "I am here", she said + FrontComplDirectVS np vs utt = + let cl : Cl = PredVP np (UseV vs) ; + in cl ** {s = \\t,a,p,o => utt.s ++ bindComma ++ cl.s ! t ! a ! p ! o} ; + + -- : NP -> VQ -> Utt -> Cl ; -- "where", she asked + FrontComplDirectVQ np vq utt = + let cl : Cl = PredVP np (UseV vq) ; + in cl ** {s = \\t,a,p,o => utt.s ++ bindComma ++ cl.s ! t ! a ! p ! o} ; + + +--------------------------------- +-- G + + lin + -- : NP -> Quant ; -- this man's + GenNP np = { s,sp = \\_,_ => np.s ! NPCase Gen ; isNum = False ; isDef = True ; - isNeg = False - } ; + isNeg = False + } ; - -- : IP -> IQuant ; -- whose - GenIP ip = { s = \\_,_ => ip.s ! NPCase Gen } ; + -- : IP -> IQuant ; -- whose + GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ; - -- : Num -> CN -> RP ; -- whose car - GenRP num cn = { - s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ; - a = RNoAg - } ; + -- : Num -> CN -> RP ; -- whose car + GenRP num cn = { + s = \\n,c => let k = npform2case num.n c + in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ; + a = RNoAg + } ; -- In case the first two are not available, the following applications should in any case be. - -- : Num -> NP -> CN -> NP ; -- this man's car(s) - GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ; + -- : Num -> NP -> CN -> NP ; -- this man's car(s) + GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ; - -- : Num -> IP -> CN -> IP ; -- whose car(s) - GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ; + -- : Num -> IP -> CN -> IP ; -- whose car(s) + GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ; -{- + -- : VP -> Adv + GerundAdv vp = {s = vp2adv vp True (VIInf InfDes)} ; + -- : VP -> CN -- publishing of the document (can get a determiner) +-- GerundCN vp = {} ; - lincat - VPS = {s : Agr => Str} ; - [VPS] = {s1,s2 : Agr => Str} ; - VPI = {s : VVType => Agr => Str} ; - [VPI] = {s1,s2 : VVType => Agr => Str} ; + -- : VP -> NP -- publishing the document (by nature definite) +-- GerundNP vp = {} ; - lin - BaseVPS = twoTable Agr ; - ConsVPS = consrTable Agr comma ; - - BaseVPI = twoTable2 VVType Agr ; - ConsVPI = consrTable2 VVType Agr comma ; - - MkVPS t p vp = mkVPS (lin Temp t) (lin Pol p) (lin VP vp) ; - ConjVPS c xs = conjunctDistrTable Agr c xs ; - PredVPS np vps = {s = np.s ! npNom ++ vps.s ! np.a} ; - - - MkVPI vp = mkVPI (lin VP vp) ; - ConjVPI c xs = conjunctDistrTable2 VVType Agr c xs ; - ComplVPIVV vv vpi = insertObj (\\a => vpi.s ! vv.typ ! a) (predVV vv) ; - - --------- two-place verb conjunction - - lincat - VPS2 = {s : Agr => Str ; c2 : Str} ; - [VPS2] = {s1,s2 : Agr => Str ; c2 : Str} ; - VPI2 = {s : VVType => Agr => Str ; c2 : Str} ; - [VPI2] = {s1,s2 : VVType => Agr => Str ; c2 : Str} ; - - lin - MkVPS2 t p vpsl = mkVPS (lin Temp t) (lin Pol p) (lin VP vpsl) ** {c2 = vpsl.c2} ; - MkVPI2 vpsl = mkVPI (lin VP vpsl) ** {c2 = vpsl.c2} ; - - BaseVPS2 x y = twoTable Agr x y ** {c2 = y.c2} ; ---- just remembering the prep of the latter verb - ConsVPS2 x xs = consrTable Agr comma x xs ** {c2 = xs.c2} ; - - BaseVPI2 x y = twoTable2 VVType Agr x y ** {c2 = y.c2} ; ---- just remembering the prep of the latter verb - ConsVPI2 x xs = consrTable2 VVType Agr comma x xs ** {c2 = xs.c2} ; - - - ConjVPS2 c xs = conjunctDistrTable Agr c xs ** {c2 = xs.c2} ; - ConjVPI2 c xs = conjunctDistrTable2 VVType Agr c xs ** {c2 = xs.c2} ; - - - ComplVPS2 vps2 np = {} ; - ComplVPI2 vpi2 np = {} ; - - oper - mkVPS : Temp -> Pol -> VP -> VPS = \t,p,vp -> lin VPS {} ; - - mkVPI : VP -> VPI = \vp -> lin VPI {} ; - ------ --} - -lin - -- : AP -> IComp ; -- "how old" - ICompAP ap = icompAP "kui" ap ; - - -- : Adv -> IAdv ; -- "how often" - IAdvAdv adv = { s = "kui" ++ adv.s } ; - - -- : VP -> AP ; -- (the man) looking at Mary / filme vaatav (mees) - PresPartAP vp = { - s = \\_,_ => vp2adv vp True VIPresPart ; - infl = Invariable - } ; - -{- TODO: need to change VP to get the following 3 functions to work properly: - 1) Add "mine" form into VP (or switch to a BIND solution and just add a stem) - 2) Change s2 in VP so that we can manipulate the complement to be in genitive! - -- : VP -> SC ; -- looking at Mary (is fun) / filmide vaatamine (on tore) - EmbedPresPart vp = - let vpGen = vp ; --** { s2 = \\_,_,_ => vp.s2 ! True ! Pos ! } - {s = vp2adv vp True VI } ; - - -- : VP -> CN -- publishing of the document (can get a determiner) - GerundCN vp = {} ; - - -- : VP -> NP -- publishing the document (by nature definite) - GerundNP vp = {} ; --} - - -- : VPSlash -> AP ; -- täna leitud - PastPartAP vp = { - s = \\_,_ => vp2adv vp True (VIPass Past) ; - infl = Invariable } ; - - -- : VPSlash -> NP -> AP -- hobisukeldujate poolt leitud (süvaveepomm) - PastPartAgentAP vp np = { - s = \\_,_ => np.s ! NPCase Gen ++ "poolt" - ++ vp2adv vp True (VIPass Past) ; - infl = Invariable } ; - - -- : VP -> Adv - GerundAdv vp = - { s = vp2adv vp True (VIInf InfDes) } ; - - WithoutVP vp = -- ilma raamatut nägemata - { s = "ilma" ++ vp2adv vp False (VIInf InfMata) } ; - - InOrderToVP vp = -- et raamatut paremini näha - { s = "et" ++ vp2adv vp True (VIInf InfDa) } ; - - ByVP vp = - { s = vp2adv vp True (VIInf InfDes) } ; - -oper - vp2adv : R.VP -> Bool -> VIForm -> Str = \vp,sentIsPos,vif -> - vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut - ++ vp.adv -- paremini - ++ vp.p -- ära - ++ (vp.s ! vif ! Simul ! Pos ! agrP3 Sg).fin -- tunda/tundes/tundmata/... - ++ vp.ext ; - -lin -{- - - NominalizeVPSlashNP vpslash np = {} ; - PassVPSlash vps = passVPSlash (lin VPS vps) [] ; - PassAgentVPSlash vps np = passVPSlash (lin VPS vps) ("by" ++ np.s ! NPAcc) ; - - --- AR 7/3/2013 - ComplSlashPartLast vps np = {} ; --} - -- : NP -> Cl ; -- there exists a number / there exist numbers - ExistsNP = IdiomEst.ExistNP ; - -{- - ComplBareVS v s = insertExtra s.s (predV v) ; - SlashBareV2S v s = insertExtrac s.s (predVc v) ; --} - - -- : N -> N -> N ; -- control system / controls system / control-system - CompoundN noun cn = lin N { - s = \\nf => noun.s ! NCase Sg Gen ++ BIND ++ cn.s ! nf - } ; -{- - -- : N -> A -> AP ; -- language independent / language-independent - CompoundAP noun adj = {} ; - - -- : VS -> Utt -> VP ; -- say: "today" - ComplDirectVS vs utt = {} ; - -- : VQ -> Utt -> VP ; -- ask: "when" - ComplDirectVQ vq utt = {} ; - - -- : NP -> VS -> Utt -> Cl ; -- "I am here", she said - FrontComplDirectVS np vs utt = {} ; - -- : NP -> VQ -> Utt -> Cl ; -- "where", she asked - FrontComplDirectVQ np vq utt = {} ; --} - - -- : AP -> VP -> Cl ; -- it is good to walk / on hea kõndida - PredAPVP ap vp = - let heaOllaVP : VP = insertObj (\\_,_ => ap.s) vp ; -- puts AP into the s2 field - heaOllaComp : Comp = CompVP ASimul PPos heaOlla ; -- chooses InfDa, fixes word order - heaOlla : VP = UseComp heaOllaComp -- looks silly, but I want to reuse the abstract syntax funs :-P - in existClause noSubj (agrP3 Sg) heaOlla ; - -oper -testCl = PredAPVP (PositA good_A) (UseV walk_V) ; +--------------------------------- +-- I - N lin - -- : AP -> CN ; -- a green one ; en grön (Swe) - AdjAsCN ap = { s = ap.s ! True } ; -- True = it's a modifier, not a predicate + -- : AP -> IComp ; -- "how old" + ICompAP ap = icompAP "kui" ap ; - AdjAsNP ap = { - s = table { NPCase c => ap.s ! True ! NCase Sg c ; - NPAcc => ap.s ! True ! NCase Sg Gen } ; - a = agrP3 Sg ; - isPron = False - } ; -{- - lincat - RNP = {s : Agr => Str} ; - RNPList = {s1,s2 : Agr => Str} ; + -- : Adv -> IAdv ; -- "how often" + IAdvAdv adv = { s = "kui" ++ adv.s } ; - lin - ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ; + -- : VP -> Adv + InOrderToVP vp = -- et raamatut paremini näha + { s = "et" ++ vp2adv vp True (VIInf InfDa) } ; - -- : RNP - ReflPron = {s = reflPron} ; + -- : N2 -> VPSlash + N2VPSlash n2 = UseComp (CompCN (UseN2 n2)) ** {c2 = n2.c2} ; - ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! Nom ++ cn.s ! num.n ! Nom} ; - PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ; + -- : VPSlash -> NP -> NP ; publishing of the document + -- NominalizeVPSlashNP vpslash np = {} ; - ConjRNP conj rpns = conjunctDistrTable Agr conj rpns ; - Base_rr_RNP x y = twoTable Agr x y ; - Base_nr_RNP x y = twoTable Agr {s = \\a => x.s ! NPAcc} y ; - Base_rn_RNP x y = twoTable Agr x {s = \\a => y.s ! NPAcc} ; - Cons_rr_RNP x xs = consrTable Agr comma x xs ; - Cons_nr_RNP x xs = consrTable Agr comma {s = \\a => x.s ! NPAcc} xs ; +--------------------------------- +-- P - ----- TODO: RNPList construction + lin - ComplGenVV v a p vp = insertObj (\\agr => a.s ++ p.s ++ - infVP v.typ vp a.a p.p agr) - (predVV v) ; --} - -- : S -> Comp ; -- (the fact is) that she sleeps - CompS s = {s = \\_ => "et" ++ s.s} ; + -- : VPSlash -> NP -> VP ; -- be begged by her to go + PassAgentVPSlash vps np = let vp : VP = PassVPSlash vps in vp ** { + adv = vp.adv ++ np.s ! NPCase Gen ++ "poolt" ; + } ; - -- : QS -> Comp ; -- (the question is) who sleeps - CompQS qs = {s = \\_ => qs.s } ; - -- : Ant -> Pol -> VP -> Comp ; -- (she is) to go - CompVP ant pol vp = {s = \\a => infVPAnt ant.a (NPCase Nom) pol.p a vp InfDa } ; + -- : VPSlash -> VP ; -- be forced to sleep + PassVPSlash vps = vps ** { + s = \\vf => case vf of { + VIFin t => vps.s ! VIPass t ; + x => vps.s ! x } ; + sc = compl2subjcase vps.c2 + } ; --- English-specific - -- : Pol - UncontractedNeg = { s = [] ; p = Neg } ; + -- : VPSlash -> AP ; -- täna leitud + PastPartAP vp = { + s = \\_,_ => vp2adv vp True (VIPass Past) ; + infl = Invariable + } ; - -- : VP -> Utt ; -- There's no "short form", so just using InfMa instead of InfDa - UttVPShort vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfMa} ; - --TODO: maybe InfMa should be default in PhraseEst and InfDa here? + -- : VP -> AP ; -- (the man) looking at Mary / filme vaatav (mees) + PresPartAP vp = { + s = \\_,_ => vp2adv vp True VIPresPart ; + infl = Invariable + } ; + + -- : VPSlash -> NP -> AP -- hobisukeldujate poolt leitud (süvaveepomm) + PastPartAgentAP vp np = { + s = \\_,_ => np.s ! NPCase Gen ++ "poolt" ++ vp2adv vp True (VIPass Past) ; + infl = Invariable + } ; + + PositAdVAdj = PositAdvAdj ; + + -- : AP -> VP -> Cl ; -- it is good to walk / on hea kõndida + PredAPVP ap vp = + let heaOllaVP : VP = insertObj (\\_,_,_ => ap.s ! True ! NCase Sg Nom) vp ; -- puts AP into the s2 field + heaOllaComp : Comp = CompVP ASimul PPos heaOllaVP ; -- chooses InfDa, fixes word order + heaOlla : VP = UseComp heaOllaComp -- looks silly, but I want to reuse the abstract syntax funs :-P + in existClause noSubj (agrP3 Sg) heaOlla ; + + -- : IAdv -> VP -> QCl ; -- how to walk? + PredIAdvVP iadv vp = {s = \\t,a,p => iadv.s ++ vp2adv vp True (VIInf InfMa)} ; + + PrepCN prep cn = PrepNP prep (MassNP cn) ; + + ProDrop pron = pron ** {s = \\_ => []} ; + + ProgrVPSlash vps = ProgrVP vps ** vps ; + + PurposeVP = InOrderToVP ; --- is there a difference? + + oper + vp2adv : R.VP -> Bool -> VIForm -> Str = \vp,sentIsPos,vif -> + vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut + ++ vp.adv -- paremini + ++ vp.p -- ära + ++ (vp.s ! vif ! Simul ! Pos ! agrP3 Sg).fin -- tunda/tundes/tundmata/... + ++ vp.ext ; + +--------------------------------- +-- S - W + + lin + + -- SlashBareV2S v s = insertExtrapos s.s (predV v) ** v ; + + UseDAP, + UseDAPFem, + UseDAPMasc = DetNP ; + + UttAccIP ip = {s = ip.s ! NPAcc} ; + UttAccNP np = {s = np.s ! NPAcc} ; + UttAdV adv = adv ; + UttDatIP ip = {s = ip.s ! NPCase Part} ; -- is partitive a reasonable translation? + UttDatNP np = {s = np.s ! NPCase Part} ; + + -- : VP -> Utt ; -- There's no "short form", so just using InfMa instead of InfDa + UttVPShort vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfMa} ; + --TODO: maybe InfMa should be default in PhraseEst and InfDa here? -} \ No newline at end of file + WithoutVP vp = -- ilma raamatut nägemata + { s = "ilma" ++ vp2adv vp False (VIInf InfMata) } ; + + +} From e06c3433b91506118173844675f678e3cc810cbd Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 13 Apr 2022 10:42:34 +0800 Subject: [PATCH 72/92] (Est) Automatic whitespace removal in its own commit,rather than have whitespace changes in content commits --- src/estonian/AdjectiveEst.gf | 10 +- src/estonian/AllEst.gf | 2 +- src/estonian/AllEstAbs.gf | 2 +- src/estonian/CatEst.gf | 13 +- src/estonian/ConstructionEst.gf | 26 +-- src/estonian/DocumentationEst.gf | 2 +- src/estonian/DocumentationEstEng.gf | 2 +- src/estonian/DocumentationEstFunctor.gf | 84 ++++----- src/estonian/ExtraEst.gf | 120 ++++++------ src/estonian/ExtraEstAbs.gf | 2 +- src/estonian/GrammarEst.gf | 6 +- src/estonian/IdiomEst.gf | 20 +- src/estonian/LexiconEst.gf | 4 +- src/estonian/MakeStructuralEst.gf | 6 +- src/estonian/MorphoEst.gf | 118 ++++++------ src/estonian/NounEst.gf | 60 +++--- src/estonian/ParadigmsEst.gf | 220 +++++++++++----------- src/estonian/QuestionEst.gf | 42 ++--- src/estonian/RelativeEst.gf | 12 +- src/estonian/ResEst.gf | 236 ++++++++++++------------ src/estonian/SentenceEst.gf | 16 +- src/estonian/SymbolEst.gf | 2 +- src/estonian/TerminologyEst.gf | 10 +- src/estonian/VerbEst.gf | 62 +++---- 24 files changed, 539 insertions(+), 538 deletions(-) diff --git a/src/estonian/AdjectiveEst.gf b/src/estonian/AdjectiveEst.gf index 85f38ae3..5cf65d4e 100644 --- a/src/estonian/AdjectiveEst.gf +++ b/src/estonian/AdjectiveEst.gf @@ -16,10 +16,10 @@ concrete AdjectiveEst of Adjective = CatEst ** open ResEst, Prelude in { } ; infl = Regular ; --a.infl } ; - + CAdvAP ad ap np = { s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ np.s ! NPCase Nom ; - infl = ap.infl + infl = ap.infl } ; UseComparA a = { s = \\_,nf => a.s ! Compar ! AN nf ; @@ -34,14 +34,14 @@ concrete AdjectiveEst of Adjective = CatEst ** open ResEst, Prelude in { ComplA2 adj np = { - s = \\isMod,af => + s = \\isMod,af => preOrPost isMod (appCompl True Pos adj.c2 np) (adj.s ! Posit ! AN af) ; infl = adj.infl } ; ReflA2 adj = { - s = \\isMod,af => - preOrPost isMod + s = \\isMod,af => + preOrPost isMod (appCompl True Pos adj.c2 (reflPron (agrP3 Sg))) (adj.s ! Posit ! AN af) ; infl = adj.infl } ; diff --git a/src/estonian/AllEst.gf b/src/estonian/AllEst.gf index 90c71810..5be738ac 100644 --- a/src/estonian/AllEst.gf +++ b/src/estonian/AllEst.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../prelude:../api -concrete AllEst of AllEstAbs = +concrete AllEst of AllEstAbs = LangEst, -- - [SlashV2VNP,SlashVV, TFut], ---- to speed up linking; to remove spurious parses ExtendEst -- - [ProDrop, ProDropPoss, S_OSV, S_VSO, S_ASV] -- to exclude spurious parses ** diff --git a/src/estonian/AllEstAbs.gf b/src/estonian/AllEstAbs.gf index e6627915..b49593b2 100644 --- a/src/estonian/AllEstAbs.gf +++ b/src/estonian/AllEstAbs.gf @@ -1,4 +1,4 @@ -abstract AllEstAbs = +abstract AllEstAbs = Lang, ExtraEstAbs ** {} ; diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index 57b891d0..6207874f 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -21,7 +21,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { QCl = {s : ResEst.Tense => Anteriority => Polarity => Str} ; IP = {s : NPForm => Str ; n : Number} ; - IComp = {s : Agr => Str} ; + IComp = {s : Agr => Str} ; IDet = {s : Case => Str ; n : Number ; isNum : Bool} ; IQuant = {s : Number => Case => Str} ; @@ -33,17 +33,17 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { -- Verb VP = ResEst.VP ; - VPSlash = ResEst.VP ** {c2 : Compl} ; - Comp = {s : Agr => Str} ; + VPSlash = ResEst.VP ** {c2 : Compl} ; + Comp = {s : Agr => Str} ; -- Adjective -- The $Bool$ in s tells whether usage is modifying (as opposed to -- predicative), e.g. "x on suurem kui y" vs. "y:st suurem arv". --- The $Infl$ in infl tells whether the adjective inflects as a +-- The $Infl$ in infl tells whether the adjective inflects as a -- modifier: e.g. "väsinud mehele" vs. "mees muutus väsinuks". - AP = {s : Bool => NForm => Str ; infl : Infl} ; + AP = {s : Bool => NForm => Str ; infl : Infl} ; -- Noun @@ -55,8 +55,9 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { sp : Case => Str ; -- se (substantival form) n : Number ; -- Pl (agreement feature for verb) isNum : Bool ; -- True (a numeral is present) - isDef : Bool -- True (verb agrees in Pl, Nom is not Part) --I: actually, can we get rid of this? + isDef : Bool -- True (verb agrees in Pl, Nom is not Part) --I: actually, can we get rid of this? } ; + ---- QuantSg, QuantPl = {s : Case => Str ; isDef : Bool} ; Ord = {s : NForm => Str} ; Predet = {s : Number => NPForm => Str} ; diff --git a/src/estonian/ConstructionEst.gf b/src/estonian/ConstructionEst.gf index ff11e900..74840743 100644 --- a/src/estonian/ConstructionEst.gf +++ b/src/estonian/ConstructionEst.gf @@ -1,6 +1,6 @@ --# -path=alltenses:.:../abstract:../api:../common -concrete ConstructionEst of Construction = CatEst ** +concrete ConstructionEst of Construction = CatEst ** open SyntaxEst, SymbolicEst, ParadigmsEst, (L = LexiconEst), (E = ExtraEst), (R = ResEst), Prelude in { flags coding=utf8 ; @@ -12,7 +12,7 @@ lin ill_VP = mkVP (mkA "haige") ; ready_VP = mkVP (ParadigmsEst.mkA "valmis") ; - has_age_VP card = + has_age_VP card = let n_years_AdA : AdA = lin AdA (mkUtt (lin NP (mkNP L.year_N))) in mkVP (mkAP n_years_AdA L.old_A) ; @@ -25,7 +25,7 @@ lin -- some more things weather_adjCl ap = mkCl (mkVP (lin AP ap)) ; - + is_right_VP = mkVP have_V2 (lin NP (mkNP (ParadigmsEst.mkN "õigus"))) ; is_wrong_VP = mkVP (ParadigmsEst.mkV "eksima") ; @@ -37,7 +37,7 @@ lin where_go_QCl np = mkQCl (lin IAdv (ss "kuhu")) (mkCl np (mkVP L.go_V)) ; where_come_from_QCl np = mkQCl (lin IAdv (ss "kust")) (mkCl np (mkVP L.come_V)) ; - + go_here_VP = mkVP (mkVP L.go_V) (mkAdv "siia") ; come_here_VP = mkVP (mkVP L.come_V) (mkAdv "siia") ; come_from_here_VP = mkVP (mkVP L.come_V) (mkAdv "sealt") ; @@ -61,16 +61,16 @@ lin monthAdv m = SyntaxEst.mkAdv in_Prep (mkNP m) ; yearAdv y = SyntaxEst.mkAdv (prePrep nominative "aastal") y ; ----- dayMonthAdv d m = ParadigmsEst.mkAdv (d.s ! R.NPCase R.Nom ++ BIND ++ "." ++ m.s ! R.NCase R.Sg R.Part) ; +---- dayMonthAdv d m = ParadigmsEst.mkAdv (d.s ! R.NPCase R.Nom ++ BIND ++ "." ++ m.s ! R.NCase R.Sg R.Part) ; ---- monthYearAdv m y = SyntaxEst.mkAdv in_Prep (mkNP (mkNP m) (SyntaxEst.mkAdv (casePrep nominative) y)) ; ----- dayMonthYearAdv d m y = ----- lin Adv {s = d.s ! R.NPCase R.Nom ++ BIND ++ "." ++ m.s ! R.NCase R.Sg R.Part ++ y.s ! R.NPCase R.Nom} ; +---- dayMonthYearAdv d m y = +---- lin Adv {s = d.s ! R.NPCase R.Nom ++ BIND ++ "." ++ m.s ! R.NCase R.Sg R.Part ++ y.s ! R.NPCase R.Nom} ; intYear = symb ; intMonthday = symb ; oper - pointWeekday : Weekday -> Str = \w -> (SyntaxEst.mkAdv (casePrep essive) (mkNP w.noun)).s ; + pointWeekday : Weekday -> Str = \w -> (SyntaxEst.mkAdv (casePrep essive) (mkNP w.noun)).s ; lincat Language = N ; @@ -86,11 +86,11 @@ lin oper mkLanguage : Str -> N = \s -> mkN (s ++ "keel") ; -oper mkWeekday : Str -> Weekday = \d -> +oper mkWeekday : Str -> Weekday = \d -> lin Weekday { - noun = mkN d ; + noun = mkN d ; habitual = ParadigmsEst.mkAdv (d + "iti") ; --kolmapäeviti - } ; + } ; lin monday_Weekday = mkWeekday "esmaspäev" ; @@ -101,9 +101,9 @@ lin friday_Weekday = mkWeekday "reede" ; lin saturday_Weekday = mkWeekday "laupäev" ; lin sunday_Weekday = mkWeekday "pühapäev" ; -lin january_Month = mkN "jaanuar" ; +lin january_Month = mkN "jaanuar" ; lin february_Month = mkN "veebruar" ; -lin march_Month = mkN "märts" ; +lin march_Month = mkN "märts" ; lin april_Month = mkN "aprill" ; lin may_Month = mkN "mai" ; lin june_Month = mkN "juuni" ; diff --git a/src/estonian/DocumentationEst.gf b/src/estonian/DocumentationEst.gf index 6e6ae909..c796ee94 100644 --- a/src/estonian/DocumentationEst.gf +++ b/src/estonian/DocumentationEst.gf @@ -2,5 +2,5 @@ -- documentation of Estonian in Estonian: the default introduced in LangEst -concrete DocumentationEst of Documentation = CatEst ** +concrete DocumentationEst of Documentation = CatEst ** DocumentationEstFunctor with (Terminology = TerminologyEst) ; diff --git a/src/estonian/DocumentationEstEng.gf b/src/estonian/DocumentationEstEng.gf index e487fa1e..07efbd0e 100644 --- a/src/estonian/DocumentationEstEng.gf +++ b/src/estonian/DocumentationEstEng.gf @@ -2,5 +2,5 @@ -- documentation of Estonian in English -concrete DocumentationEstEng of Documentation = CatEst ** +concrete DocumentationEstEng of Documentation = CatEst ** DocumentationEstFunctor with (Terminology = TerminologyEng) ; diff --git a/src/estonian/DocumentationEstFunctor.gf b/src/estonian/DocumentationEstFunctor.gf index 4011c2c1..a8e68343 100644 --- a/src/estonian/DocumentationEstFunctor.gf +++ b/src/estonian/DocumentationEstFunctor.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common -incomplete concrete DocumentationEstFunctor of Documentation = CatEst ** open +incomplete concrete DocumentationEstFunctor of Documentation = CatEst ** open Terminology, -- the interface ResEst, ParadigmsEst, @@ -30,17 +30,17 @@ lin s2 = inflNoun (\nf -> noun.s ! nf) } ; - InflectionA, InflectionA2 = \adj -> + InflectionA, InflectionA2 = \adj -> let posit : (AForm => Str) = adj.s ! Posit ; compar : (AForm => Str) = adj.s ! Compar ; superl : (AForm => Str) = adj.s ! Superl ; - in + in { t = "a" ; s1 = heading1 (heading adjective_Category) ; - s2 = inflNoun (\nf -> posit ! AN nf) ++ - heading2 (heading comparative_Parameter) ++ - inflNoun (\nf -> compar ! AN nf) ++ - heading2 (heading superlative_Parameter) ++ + s2 = inflNoun (\nf -> posit ! AN nf) ++ + heading2 (heading comparative_Parameter) ++ + inflNoun (\nf -> compar ! AN nf) ++ + heading2 (heading superlative_Parameter) ++ inflNoun (\nf -> superl ! AN nf) } ; @@ -58,91 +58,91 @@ lin InflectionV v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v)) ; s2 = inflVerb v } ; InflectionV2 v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.something_NP)) ; s2 = inflVerb v } ; InflectionV3 v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.something_NP S.something_NP)) ; s2 = inflVerb v } ; InflectionV2V v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (S.mkVP (L.sleep_V)))) ; s2 = inflVerb v } ; InflectionV2S v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin S (ss "...")))) ; s2 = inflVerb v } ; InflectionV2Q v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin QS (ss "...")))) ; s2 = inflVerb v } ; InflectionV2A v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP L.beautiful_A)) ; s2 = inflVerb v } ; InflectionVV v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v (S.mkVP (L.sleep_V)))) ; s2 = inflVerb v } ; InflectionVS v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v (lin S (ss "...")))) ; s2 = inflVerb v } ; InflectionVQ v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v (lin QS (ss "...")))) ; s2 = inflVerb v } ; InflectionVA v = { t = "v" ; - s1 = heading1 (heading verb_Category) ++ + s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v L.beautiful_A)) ; s2 = inflVerb v } ; -oper +oper verbExample : CatEst.Cl -> Str = \cl -> (S.mkUtt cl).s ; {- -} --# notpresent inflVerb : CatEst.V -> Str = \verb -> - let + let --verb = sverb2verbSep verb0 ; vfin : ResEst.VForm -> Str = \f -> verb.s ! f ; - + nounNounHeading : Parameter -> Parameter -> Str = \n1,n2 -> (S.mkUtt (G.PossNP (S.mkCN n1) (S.mkNP n2))).s ; in @@ -152,7 +152,7 @@ oper th (heading singular_Parameter) ++ th (heading plural_Parameter) ++ th (heading passive_Parameter) --# notpresent - ) ++ + ) ++ tr (th "1.p" ++ td (vfin (Presn Sg P1)) ++ td (vfin (Presn Pl P1)) ++ intagAttr "td" "rowspan=3" (vfin (PassPresn True)) --# notpresent ) ++ @@ -167,13 +167,13 @@ oper th (heading singular_Parameter) ++ th (heading plural_Parameter) ++ th (heading passive_Parameter) --# notpresent - ) ++ + ) ++ tr (th "1.p" ++ td (vfin (Impf Sg P1)) ++ td (vfin (Impf Pl P1)) ++ intagAttr "td" "rowspan=3" (vfin (PassImpf True))) ++ tr (th "2.p" ++ td (vfin (Impf Sg P2)) ++ td (vfin (Impf Pl P2))) ++ tr (th "3.p" ++ td (vfin (Impf Sg P3)) ++ td (vfin (Impf Pl P3))) ++ tr (th (heading negative_Parameter) ++ - td (vfin (PastPart Act)) ++ + td (vfin (PastPart Act)) ++ td (vfin (PastPart Pass)) ++ td (vfin (PassImpf False))) ) ++ @@ -183,12 +183,12 @@ oper th (heading singular_Parameter) ++ th (heading plural_Parameter) ++ th (heading passive_Parameter) --# notpresent - ) ++ + ) ++ tr (th "1.p" ++ td (vfin (Condit Sg P1)) ++ td (vfin (Condit Pl P1)) ++ intagAttr "td" "rowspan=3" "TODO pass condit (nt loetaks)" --# notpresent ) ++ tr (th "2.p" ++ td (vfin (Condit Sg P2)) ++ td (vfin (Condit Pl P2))) ++ - tr (th "3.p" ++ td (vfin (Condit Sg P3)) ++ td (vfin (Condit Pl P3))) + tr (th "3.p" ++ td (vfin (Condit Sg P3)) ++ td (vfin (Condit Pl P3))) ) ++ heading3 (nounNounHeading present_Parameter quotative_Parameter) ++ frameTable ( @@ -196,8 +196,8 @@ oper th (heading singular_Parameter) ++ th (heading plural_Parameter) ++ th (heading passive_Parameter) --# notpresent - ) ++ - tr (th "isik." ++ td (vfin (Quotative Act)) + ) ++ + tr (th "isik." ++ td (vfin (Quotative Act)) ++ intagAttr "td" "rowspan=3" (vfin (Quotative Act)) --# notpresent ) ++ tr (th "umbis." ++ td (vfin (Quotative Pass)) ++ td (vfin (Quotative Pass)) @@ -208,11 +208,11 @@ oper th (heading singular_Parameter) ++ th (heading plural_Parameter) ++ th (heading passive_Parameter) --# notpresent - ) ++ + ) ++ tr (th "1.p" ++ td "" ++ td (vfin ImperP1Pl) ++ intagAttr "td" "rowspan=3" (vfin ImperPass)) ++ tr (th "2.p" ++ td (vfin (Imper Sg)) ++ td (vfin (Imper Pl))) ++ - tr (th "3.p" ++ td (vfin (ImperP3)) ++ td (vfin ImperP3)) + tr (th "3.p" ++ td (vfin (ImperP3)) ++ td (vfin ImperP3)) ) ++ heading2 (nounPluralHeading nominal_form_ParameterType).s ++ heading3 (heading infinitive_Parameter) ++ @@ -221,32 +221,32 @@ oper th (heading nominative_Parameter) ++ td (vfin (Inf InfDa))) ++ tr (th (heading inessive_Parameter) ++ td (vfin (Inf InfDes))) ++ - tr (intagAttr "th" "rowspan=5" "ma" ++ + tr (intagAttr "th" "rowspan=5" "ma" ++ th (heading illative_Parameter) ++ td (vfin (Inf InfMa))) ++ tr (th (heading inessive_Parameter) ++ td (vfin (Inf InfMas))) ++ tr (th (heading elative_Parameter) ++ td (vfin (Inf InfMast))) ++ - tr (th (heading abessive_Parameter) ++ td (vfin (Inf InfMata))) ++ + tr (th (heading abessive_Parameter) ++ td (vfin (Inf InfMata))) ++ tr (th (heading translative_Parameter) ++ td (vfin (Inf InfMaks))) - ) ++ + ) ++ heading3 (heading participle_Parameter) ++ frameTable ( - tr (intagAttr "th" "rowspan=2" (heading present_Parameter) ++ - th (heading active_Parameter) ++ + tr (intagAttr "th" "rowspan=2" (heading present_Parameter) ++ + th (heading active_Parameter) ++ td (vfin (PresPart Act))) ++ - tr (th (heading passive_Parameter) ++ + tr (th (heading passive_Parameter) ++ td (vfin (PresPart Pass))) ++ - tr (intagAttr "th" "rowspan=2" (heading perfect_Parameter) ++ - th (heading active_Parameter) ++ + tr (intagAttr "th" "rowspan=2" (heading perfect_Parameter) ++ + th (heading active_Parameter) ++ td (vfin (PastPart Act ))) ++ - tr (th (heading passive_Parameter) ++ + tr (th (heading passive_Parameter) ++ td (vfin (PastPart Pass ))) ) ; --} - inflNoun : (NForm -> Str) -> Str = \nouns -> - frameTable ( + inflNoun : (NForm -> Str) -> Str = \nouns -> + frameTable ( tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++ tr (th (heading nominative_Parameter) ++ td (nouns (NCase Sg Nom)) ++ td (nouns (NCase Pl Nom))) ++ tr (th (heading genitive_Parameter) ++ td (nouns (NCase Sg Gen)) ++ td (nouns (NCase Pl Gen))) ++ @@ -274,6 +274,6 @@ lin MkTag i = ss (i.t) ; {- --# notpresent --} +-} } diff --git a/src/estonian/ExtraEst.gf b/src/estonian/ExtraEst.gf index b9be4010..16ba9ea7 100644 --- a/src/estonian/ExtraEst.gf +++ b/src/estonian/ExtraEst.gf @@ -1,4 +1,4 @@ -concrete ExtraEst of ExtraEstAbs = CatEst ** +concrete ExtraEst of ExtraEstAbs = CatEst ** open ResEst, MorphoEst, Coordination, Prelude, NounEst, StructuralEst, (R = ParamX) in { flags coding=utf8; lin @@ -6,7 +6,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** s,sp = \\_,_ => np.s ! NPCase Gen ; isNum = False ; isDef = True ; --- "Jussin kolme autoa ovat" ; thus "...on" is missing - isNeg = False + isNeg = False } ; GenCN = caseCN Gen ; -- soome mees @@ -18,11 +18,11 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ; GenRP num cn = { - s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ; - a = RNoAg + s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ; + a = RNoAg --- a = RAg (agrP3 num.n) } ; - oper + oper caseCN : Case -> NP -> CN -> CN = \c,np,cn -> lin CN { s = \\nf => np.s ! NPCase c ++ cn.s ! nf } ; @@ -37,17 +37,17 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** MkVPI vp = {s = \\i => infVP (NPCase Nom) Pos (agrP3 Sg) vp i} ; ConjVPI = conjunctDistrTable InfForm ; - ComplVPIVV vv vpi = + ComplVPIVV vv vpi = insertObj (\\_,_,_ => vpi.s ! vv.vi) (predV vv) ; lincat VPS = { - s : Agr => Str ; + s : Agr => Str ; sc : NPForm ; --- can be different for diff parts } ; [VPS] = { - s1,s2 : Agr => Str ; + s1,s2 : Agr => Str ; sc : NPForm ; --- take the first: minä osaan kutoa ja täytyy virkata } ; @@ -79,45 +79,45 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** PassAgentVPSlash vp np = vp ; {- - s = {s = vp.s.s ; h = vp.s.h ; p = vp.s.p ; sc = npform2subjcase vp.c2.c} ; + s = {s = vp.s.s ; h = vp.s.h ; p = vp.s.p ; sc = npform2subjcase vp.c2.c} ; s2 = \\b,p,a => np.s ! NPCase Nom ++ vp.s2 ! b ! p ! a ; adv = vp.adv ; ext = vp.ext ; vptyp = vp.vptyp ; } ; -} - AdvExistNP adv np = - mkClause (\_ -> adv.s) np.a (insertObj + AdvExistNP adv np = + mkClause (\_ -> adv.s) np.a (insertObj (\\_,b,_ => np.s ! NPCase Nom) (predV (verbOlema ** {sc = NPCase Nom}))) ; RelExistNP prep rp np = { - s = \\t,ant,bo,ag => - let + s = \\t,ant,bo,ag => + let n = complNumAgr ag ; - cl = mkClause + cl = mkClause (\_ -> appCompl True Pos prep (rp2np n rp)) - np.a - (insertObj - (\\_,b,_ => np.s ! NPCase Nom) + np.a + (insertObj + (\\_,b,_ => np.s ! NPCase Nom) (predV (verbOlema ** {sc = NPCase Nom}))) ; - in + in cl.s ! t ! ant ! bo ! SDecl ; c = NPCase Nom } ; AdvPredNP adv v np = - mkClause (\_ -> adv.s) np.a (insertObj + mkClause (\_ -> adv.s) np.a (insertObj (\\_,b,_ => np.s ! NPCase Nom) (predV v)) ; - ICompExistNP adv np = - let cl = mkClause (\_ -> adv.s ! np.a) np.a (insertObj + ICompExistNP adv np = + let cl = mkClause (\_ -> adv.s ! np.a) np.a (insertObj (\\_,b,_ => np.s ! NPCase Nom) (predV (verbOlema ** {sc = NPCase Nom}))) ; in { s = \\t,a,p => cl.s ! t ! a ! p ! SDecl } ; IAdvPredNP iadv v np = - let cl = mkClause (\_ -> iadv.s) np.a (insertObj + let cl = mkClause (\_ -> iadv.s) np.a (insertObj (\\_,b,_ => np.s ! v.sc) (predV v)) ; in { s = \\t,a,p => cl.s ! t ! a ! p ! SDecl @@ -132,14 +132,14 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** n = Sg } ; - PartCN cn = - let + PartCN cn = + let acn = DetCN (DetQuant IndefArt NumSg) cn in { s = table { NPCase Nom | NPAcc => acn.s ! NPCase ResEst.Part ; c => acn.s ! c - } ; + } ; a = acn.a ; isPron = False ; isNeg = False } ; @@ -147,34 +147,34 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** --The reflexive possessive "oma" --for "ta näeb oma koera" instead of *"tema koera" OmaPoss = {s,sp = \\_,_ => "oma" ; isDef,isNeg,isNum = False} ; - + ma_Pron = shortPronoun "ma" "mu" "mind" "minu" Sg P1 ; sa_Pron = shortPronoun "sa" "su" "sind" "sinu" Sg P2; ta_Pron = shortPronoun "ta" "ta" "teda" "tema" Sg P3 ; - me_Pron = + me_Pron = {s = table { NPCase Nom => "me" ; - n => (we_Pron.s) ! n + n => (we_Pron.s) ! n } ; - a = Ag Pl P1 } ; + a = Ag Pl P1 } ; - te_Pron = + te_Pron = {s = table { NPCase Nom => "te" ; - n => (youPl_Pron.s) ! n + n => (youPl_Pron.s) ! n } ; - a = Ag Pl P2 } ; + a = Ag Pl P2 } ; nad_Pron = {s = table { NPCase Nom => "nad" ; - n => (they_Pron.s) ! n + n => (they_Pron.s) ! n } ; - a = Ag Pl P3 } ; + a = Ag Pl P3 } ; ---- copied from VerbEst.CompAP, should be shared ICompAP ap = { - s = \\agr => + s = \\agr => let n = complNumAgr agr ; c = case n of { @@ -187,68 +187,68 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** IAdvAdv adv = {s = "kui" ++ adv.s} ; ProDrop p = { - s = table {NPCase (Nom | Gen) => [] ; c => p.s ! c} ; + s = table {NPCase (Nom | Gen) => [] ; c => p.s ! c} ; ---- drop Gen only works in adjectival position a = p.a } ; - -- : Pron -> Quant ; + -- : Pron -> Quant ; ProDropPoss p = { s = \\_,_ => "oma" ; sp = \\_,_ => p.s ! NPCase Gen ; isNum = False ; - isDef = True ; + isDef = True ; isNeg = False } ; - lincat + lincat ClPlus, ClPlusObj, ClPlusAdv = ClausePlus ; Part = {s : Str} ; - lin - S_SVO part t p clp = - let + lin + S_SVO part t p clp = + let cl = clp.s ! t.t ! t.a ! p.p ; pa = part.s ---- in - {s = t.s ++ p.s ++ cl.subj ++ pa ++ cl.fin ++ cl.inf ++ cl.compl ++ cl.adv ++ cl.ext} ; + {s = t.s ++ p.s ++ cl.subj ++ pa ++ cl.fin ++ cl.inf ++ cl.compl ++ cl.adv ++ cl.ext} ; - S_OSV part t p clp = - let + S_OSV part t p clp = + let cl = clp.s ! t.t ! t.a ! p.p ; pa = part.s ---- in - {s = t.s ++ p.s ++ cl.compl ++ pa ++ cl.subj ++ cl.fin ++ cl.inf ++ cl.adv ++ cl.ext} ; - S_VSO part t p clp = - let + {s = t.s ++ p.s ++ cl.compl ++ pa ++ cl.subj ++ cl.fin ++ cl.inf ++ cl.adv ++ cl.ext} ; + S_VSO part t p clp = + let cl = clp.s ! t.t ! t.a ! p.p ; pa = part.s in - {s = t.s ++ p.s ++ cl.fin ++ pa ++ cl.subj ++ cl.inf ++ cl.compl ++ cl.adv ++ cl.ext} ; - S_ASV part t p clp = - let + {s = t.s ++ p.s ++ cl.fin ++ pa ++ cl.subj ++ cl.inf ++ cl.compl ++ cl.adv ++ cl.ext} ; + S_ASV part t p clp = + let cl = clp.s ! t.t ! t.a ! p.p ; pa = part.s in - {s = t.s ++ p.s ++ cl.adv ++ pa ++ cl.subj ++ cl.fin ++ cl.inf ++ cl.compl ++ cl.ext} ; + {s = t.s ++ p.s ++ cl.adv ++ pa ++ cl.subj ++ cl.fin ++ cl.inf ++ cl.compl ++ cl.ext} ; - S_OVS part t p clp = - let + S_OVS part t p clp = + let cl = clp.s ! t.t ! t.a ! p.p ; pa = part.s ---- in - {s = t.s ++ p.s ++ cl.compl ++ pa ++ cl.fin ++ cl.inf ++ cl.subj ++ cl.adv ++ cl.ext} ; + {s = t.s ++ p.s ++ cl.compl ++ pa ++ cl.fin ++ cl.inf ++ cl.subj ++ cl.adv ++ cl.ext} ; PredClPlus np vp = mkClausePlus (subjForm np vp.sc) np.a vp ; PredClPlusFocSubj np vp = insertKinClausePlus 0 (mkClausePlus (subjForm np vp.sc) np.a vp) ; PredClPlusFocVerb np vp = insertKinClausePlus 1 (mkClausePlus (subjForm np vp.sc) np.a vp) ; - PredClPlusObj np vps obj = + PredClPlusObj np vps obj = insertObjClausePlus 0 False (\\b => appCompl True b vps.c2 obj) (mkClausePlus (subjForm np vps.sc) np.a vps) ; - PredClPlusFocObj np vps obj = + PredClPlusFocObj np vps obj = insertObjClausePlus 0 True (\\b => appCompl True b vps.c2 obj) (mkClausePlus (subjForm np vps.sc) np.a vps) ; - PredClPlusAdv np vp adv = + PredClPlusAdv np vp adv = insertObjClausePlus 1 False (\\_ => adv.s) (mkClausePlus (subjForm np vp.sc) np.a vp) ; - PredClPlusFocAdv np vp adv = + PredClPlusFocAdv np vp adv = insertObjClausePlus 1 True (\\_ => adv.s) (mkClausePlus (subjForm np vp.sc) np.a vp) ; ClPlusWithObj c = c ; @@ -256,4 +256,4 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** gi_Part = ss "gi" | ss "ki" ; -} +} diff --git a/src/estonian/ExtraEstAbs.gf b/src/estonian/ExtraEstAbs.gf index 0e09f3d4..326a960f 100644 --- a/src/estonian/ExtraEstAbs.gf +++ b/src/estonian/ExtraEstAbs.gf @@ -33,7 +33,7 @@ abstract ExtraEstAbs = Extra [ me_Pron : Pron ; te_Pron : Pron ; nad_Pron : Pron ; - + OmaPoss : Quant ; -- Reflexive possessive "oma" ProDropPoss : Pron -> Quant ; -- vaimoni --TODO Is this relevant in Estonian? Is the agreement of pronoun ever needed, or is it the same as oma? diff --git a/src/estonian/GrammarEst.gf b/src/estonian/GrammarEst.gf index 93d2120c..1daf4bd4 100644 --- a/src/estonian/GrammarEst.gf +++ b/src/estonian/GrammarEst.gf @@ -1,6 +1,6 @@ -concrete GrammarEst of Grammar = - NounEst, - VerbEst, +concrete GrammarEst of Grammar = + NounEst, + VerbEst, AdjectiveEst, AdverbEst, NumeralEst, diff --git a/src/estonian/IdiomEst.gf b/src/estonian/IdiomEst.gf index b7e50c81..c4e3657a 100644 --- a/src/estonian/IdiomEst.gf +++ b/src/estonian/IdiomEst.gf @@ -1,11 +1,11 @@ -concrete IdiomEst of Idiom = CatEst ** +concrete IdiomEst of Idiom = CatEst ** open MorphoEst, ParadigmsEst, Prelude in { flags optimize=all_subs ; coding=utf8; lin - ExistNP np = - let + ExistNP np = + let cas : Polarity -> NPForm = \p -> case p of { Pos => NPCase Nom ; -- on olemas lammas Neg => NPCase Part -- ei ole olemas lammast @@ -14,7 +14,7 @@ concrete IdiomEst of Idiom = CatEst ** in existClause noSubj (agrP3 Sg) vp ; - ExistIP ip = + ExistIP ip = let cas : NPForm = NPCase Nom ; ---- also partitive in Extra vp = insertObj (\\_,b,_ => "olemas") (predV olla) ; @@ -45,11 +45,11 @@ concrete IdiomEst of Idiom = CatEst ** adv = vp.adv ; p = vp.p ; ext = vp.ext ; - sc = vp.sc ; + sc = vp.sc ; } ; - ProgrVP vp = - let + ProgrVP vp = + let inf = (vp.s ! VIInf InfMas ! Simul ! Pos ! agrP3 Sg).fin ; on = predV olla in { @@ -58,16 +58,16 @@ concrete IdiomEst of Idiom = CatEst ** adv = vp.adv ; p = vp.p ; ext = vp.ext ; - sc = vp.sc ; + sc = vp.sc ; } ; -- This gives "otetaan oluet" instead of "ottakaamme oluet". -- The imperative is not available in a $VP$. - ImpPl1 vp = + ImpPl1 vp = let vps = vp.s ! VIPass Pres ! Simul ! Pos ! Ag Pl P1 in - {s = vps.fin ++ vps.inf ++ + {s = vps.fin ++ vps.inf ++ vp.s2 ! True ! Pos ! Ag Pl P1 ++ vp.p ++ vp.ext } ; diff --git a/src/estonian/LexiconEst.gf b/src/estonian/LexiconEst.gf index fb763457..ca2e1cb9 100644 --- a/src/estonian/LexiconEst.gf +++ b/src/estonian/LexiconEst.gf @@ -1,6 +1,6 @@ concrete LexiconEst of Lexicon = CatEst ** open MorphoEst, ParadigmsEst, Prelude in { -flags +flags optimize=values ; coding=utf8; @@ -216,7 +216,7 @@ lin yellow_A = mkA (mkN "kollane" "kollase" "kollast" "kollasesse" "kollaste" "kollaseid") ; young_A = mkA (mkN "noor" "noore" "noort") ; - do_V2 = mkV2 (mkV "tegema" "teha") ; + do_V2 = mkV2 (mkV "tegema" "teha") ; now_Adv = mkAdv "nüüd" ; already_Adv = mkAdv "juba" ; diff --git a/src/estonian/MakeStructuralEst.gf b/src/estonian/MakeStructuralEst.gf index 97614ef7..0b17be12 100644 --- a/src/estonian/MakeStructuralEst.gf +++ b/src/estonian/MakeStructuralEst.gf @@ -1,9 +1,9 @@ resource MakeStructuralEst = open CatEst, ParadigmsEst, MorphoEst, Prelude in { -oper - mkConj : Str -> Str -> ParadigmsEst.Number -> Conj = \x,y,n -> +oper + mkConj : Str -> Str -> ParadigmsEst.Number -> Conj = \x,y,n -> {s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ; - mkSubj : Str -> Subj = \x -> + mkSubj : Str -> Subj = \x -> {s = x ; lock_Subj = <>} ; mkIQuant : Str -> IQuant = \s -> {s = \\n,c => s ; lock_IQuant = <>} ; ---- diff --git a/src/estonian/MorphoEst.gf b/src/estonian/MorphoEst.gf index dfd3af92..e7cc6e53 100644 --- a/src/estonian/MorphoEst.gf +++ b/src/estonian/MorphoEst.gf @@ -11,7 +11,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { flags optimize=all ; coding=utf8; oper - + ---------------------- -- morph. paradigms -- ---------------------- @@ -19,7 +19,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { --Noun paradigms in HjkEst --Comparative adjectives - --(could just use hjk_type_IVb_audit "suurem" "a") + --(could just use hjk_type_IVb_audit "suurem" "a") -- Comparative adjectives inflect in the same way -- TODO: confirm this dSuurempi : Str -> NForms = \suurem -> @@ -47,17 +47,17 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { saama (saa + "da") (saa + "b") - (saa + "dakse") + (saa + "dakse") (saa + "ge") -- Imper Pl sai - (saa + "nud") + (saa + "nud") (saa + "dud") ; -- TS 49 -- no d/t in da, takse ; imperfect 3sg ends in s cKaima : (_ : Str) -> VForms = \kaima -> let - kai = Predef.tk 2 kaima ; + kai = Predef.tk 2 kaima ; in vForms8 kaima (kai + "a") @@ -65,10 +65,10 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (kai + "akse") (kai + "ge") (kai + "s") - (kai + "nud") + (kai + "nud") (kai + "dud") ; - -- TS 49 + -- TS 49 -- vowel changes in da, takse, no d/t ; imperfect 3sg ends in i cJooma : (_ : Str) -> VForms = \jooma -> let @@ -78,7 +78,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { u = case o of { "o" => "u" ; "ö" => "ü" ; - _ => o + _ => o } ; q = case o of { ("o"|"ö") => "õ" ; @@ -91,9 +91,9 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { juua (joo + "b") (juua + "kse") - (joo + "ge") + (joo + "ge") j6i - (joo + "nud") + (joo + "nud") (joo + "dud") ; -- TS 50-52 (elama, muutuma, kirjutama), 53 (tegelema) alt forms @@ -105,10 +105,10 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { elama (ela + "da") (ela + "b") - (ela + "takse") + (ela + "takse") (ela + "ge") -- Imperative P1 Pl - (ela + "s") -- Imperfect P3 Sg - (ela + "nud") + (ela + "s") -- Imperfect P3 Sg + (ela + "nud") (ela + "tud") ; -- TS 53 (tegelema) @@ -121,12 +121,12 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { tegelema (tegel + "da") (tegele + "b") - (tegel + "dakse") + (tegel + "dakse") (tegel + "ge") -- Imperative P1 Pl - (tegele + "s") -- Imperfect P3 Sg - (tegel + "nud") - (tegel + "dud") ; - + (tegele + "s") -- Imperfect P3 Sg + (tegel + "nud") + (tegel + "dud") ; + -- TS 54 (tulema) -- consonant assimilation (l,r,n) in da, takse -- d in tud, g in ge @@ -146,7 +146,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (tul + "i") (tul + "nud") (tul + "dud") ; - + -- TS 55-56 (õppima, sündima) -- t in takse, tud ; consonant gradation on stem cLeppima : (_ : Str) -> VForms = \leppima -> @@ -154,7 +154,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { leppi = Predef.tk 2 leppima ; i = last leppi ; lepp = init leppi ; - lepi = (weaker lepp) + i + lepi = (weaker lepp) + i in vForms8 leppima (leppi + "da") @@ -164,7 +164,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (leppi + "s") -- Imperfect P3 Sg (leppi + "nud") (lepi + "tud") ; - + -- TS 57 (lugema) -- Like 55-56 but irregular gradation patterns, that shouldn't be in HjkEst.weaker --including also marssima,valssima @@ -184,7 +184,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { _ + ("uge"|"ude") => l + "oe" ; _ + #c + "ssi" => (init lug) + e; - _ => (weaker lug) + e + _ => (weaker lug) + e } ; in vForms8 lugema @@ -195,8 +195,8 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (luge + "s") -- Imperfect P3 Sg (luge + "nud") (loe + "tud") ; - - + + -- TS 58 muutma, saatma, -- like laskma (TS 62, 64), but no reduplication of stem consonant (muutma~muuta, not *muutta) -- like andma (TS 63) but different takse (muudetakse vs. antakse) @@ -213,8 +213,8 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (muut + "is") (muut + "nud") (muud + "etud") ; -- always e? - - -- TS 59-60 (petma~petetakse, jätma~jäetakse) + + -- TS 59-60 (petma~petetakse, jätma~jäetakse) -- takse given as second argument cPetma : (_,_ : Str) -> VForms = \petma,jaetakse -> let @@ -251,8 +251,8 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (jatt + "is") (jat + "nud") (ko + "etud") ; --} - +-} + -- TS 61 (laulma) --vowel (a/e) given with the second argument --veenma,naerma @@ -268,7 +268,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (kuul + "is") (kuul + "nud") (kuul + "dud") ; - + -- TS 62 (tõusma), 64 (mõksma) -- vowel (a/e) given with the second argument -- doesn't give alt. forms joosta, joostes @@ -283,9 +283,9 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (las + "takse") (las + "ke") (lask + "is") - (lask + "nud") + (lask + "nud") (las + "tud") ; - + -- TS 62 alt forms cJooksma : (_ : Str) -> VForms = \jooksma -> let @@ -298,10 +298,10 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (joos + "takse") (joos + "ke") (jooks + "is") - (jooks + "nud") + (jooks + "nud") (joos + "tud") ; - -- TS 63 (andma, murdma, hoidma) + -- TS 63 (andma, murdma, hoidma) -- vowel given in second arg (andma~annab; tundma~tunneb) cAndma : (_,_ : Str) -> VForms = \andma,annab -> let @@ -310,18 +310,18 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { ann = weaker and ; --murr, hoi te = case (last ann) of { --to prevent teadma~teaab "a" => init ann ; - _ => ann + _ => ann } ; in vForms8 andma (and + "a") - annab + annab (an + "takse") (and + "ke") (and + "is") (and + "nud") (an + "tud") ; - + -- TS 65 (pesema) -- a consonant stem verb in disguise cPesema : (_ : Str) -> VForms = \pesema -> @@ -356,9 +356,9 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (nag + "i") (nai + "nud") (nah + "tud") ; - - - -- TS 67-68 (hüppama, tõmbama) + + + -- TS 67-68 (hüppama, tõmbama) -- strong stem in ma, b, s -- weak stem in da, takse, ge, nud, tud -- t in da, takse; k in ge @@ -387,7 +387,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { omb = Predef.tk 2 omble ; omm = case omb of { "mõt" => "mõe" ; --some "double weak" patterns; however weaker (weaker omb) makes the coverage worse - _ => weaker omb + _ => weaker omb } ; ommel = omm + e + l ; in vForms8 @@ -445,22 +445,22 @@ These used to be here: aForms2A : AForms -> Adjective = \afs -> { s = table { Posit => table { - AN n => (nForms2N afs.posit).s ! n ; + AN n => (nForms2N afs.posit).s ! n ; AAdv => afs.adv_posit } ; Compar => table { - AN n => (nForms2N afs.compar).s ! n ; + AN n => (nForms2N afs.compar).s ! n ; AAdv => afs.adv_compar } ; Superl => table { - AN n => (nForms2N afs.superl).s ! n ; + AN n => (nForms2N afs.superl).s ! n ; AAdv => afs.adv_superl } } ; lock_A = <> } ; - nforms2aforms : NForms -> AForms = \nforms -> + nforms2aforms : NForms -> AForms = \nforms -> let suure = init (nforms ! 1) ; suur = Predef.tk 4 (nforms ! 8) ; @@ -477,7 +477,7 @@ These used to be here: These used to be here: VForms : Type = Predef.Ints 7 => Str ; - vForms8 : (x1,_,_,_,_,_,_,x8 : Str) -> VForms ; + vForms8 : (x1,_,_,_,_,_,_,x8 : Str) -> VForms ; regVForms : (x1,_,_,x4 : Str) -> VForms ; vforms2V : VForms -> Verb ; -} @@ -487,7 +487,7 @@ These used to be here: -- for Structural ----------------------- -caseTable : Number -> Noun -> Case => Str = \n,cn -> +caseTable : Number -> Noun -> Case => Str = \n,cn -> \\c => cn.s ! NCase n c ; mkDet : Number -> Noun -> { @@ -510,11 +510,11 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> -- TODO: remove NPAcc? -- I: keep NPAcc; see appCompl in ResEst, it takes care of finding a right case for various types of complements; incl. when pronouns get different treatment than nouns (PassVP). mkPronoun : (_,_,_ : Str) -> Number -> Person -> - {s : NPForm => Str ; a : Agr} = + {s : NPForm => Str ; a : Agr} = \mina, minu, mind, n, p -> let { minu_short = ie_to_i minu - } in + } in {s = table { NPCase Nom => mina ; NPCase Gen => minu ; @@ -533,7 +533,7 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> NPAcc => mind } ; a = Ag n p - } ; + } ; -- meiesse/teiesse -> meisse/teisse ie_to_i : Str -> Str ; @@ -543,14 +543,14 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> _ => x } ; - shortPronoun : (_,_,_,_ : Str) -> Number -> Person -> - {s : NPForm => Str ; a : Agr} = + shortPronoun : (_,_,_,_ : Str) -> Number -> Person -> + {s : NPForm => Str ; a : Agr} = \ma, mu, mind, minu, n, p -> let shortMa = mkPronoun ma mu mind n p ; mulle : Str = case mu of { - "mu" => "mulle" ; + "mu" => "mulle" ; "su" => "sulle" ; - _ => shortMa.s ! NPCase Allat + _ => shortMa.s ! NPCase Allat } ; in shortMa ** { s = table { @@ -561,18 +561,18 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> NPCase Comit => minu + "ga" ; NPCase Termin => minu + "ni" ; x => shortMa.s ! x } } ; - + oper - relPron : NForm => Str = - let mis = nForms2N (nForms6 "mis" "mille" "mida" "millesse" "mille" "mida") - in fixPlNom "mis" mis.s ; + relPron : NForm => Str = + let mis = nForms2N (nForms6 "mis" "mille" "mida" "millesse" "mille" "mida") + in fixPlNom "mis" mis.s ; kesPron : NForm => Str = - let kes = nForms2N (nForms6 "kes" "kelle" "keda" "kellesse" "kelle" "keda") + let kes = nForms2N (nForms6 "kes" "kelle" "keda" "kellesse" "kelle" "keda") in fixPlNom "kes" kes.s ; ProperName = {s : Case => Str} ; @@ -613,7 +613,7 @@ oper Allat => "nendele" ; Abess => "nendeta" ; Comit => "nendega" ; - Termin => "nendeni" + Termin => "nendeni" } ; } ; diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index 2d873ab6..3b65059c 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -7,15 +7,15 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in -- The $Number$ is subtle: "nuo autot", "nuo kolme autoa" are both plural -- for verb agreement, but the noun form is singular in the latter. - DetCN det cn = + DetCN det cn = let n : Number = case det.isNum of { True => Sg ; _ => det.n } ; ncase : NPForm -> Case * NForm = \c -> - let k = npform2case n c - in + let k = npform2case n c + in case of { <_, NPAcc, True,_> => ; -- kolm kassi (as object) <_, NPCase Nom, True,_> => ; -- kolm kassi (as subject) @@ -25,12 +25,12 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in <_, NPCase Abess, _, _> => ; -- kolme kassita <_, NPCase Ess, _, _> => ; -- kolme kassina <_, NPCase Termin,_, _> => ; -- kolme kassini - + <_, _, True,_> => ; -- kolmeks kassiks (all other cases) _ => -- kass, kassi, ... (det is not a number) } in { - s = \\c => let + s = \\c => let k = ncase c ; in det.s ! k.p1 ++ cn.s ! k.p2 ; @@ -42,7 +42,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in isPron = False } ; - DetNP det = + DetNP det = let n : Number = case det.isNum of { True => Sg ; @@ -50,7 +50,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in } ; in { s = \\c => let k = npform2case n c in - det.sp ! k ; + det.sp ! k ; a = agrP3 (case det.isDef of { False => Sg ; -- autoja menee; kolme autoa menee _ => det.n @@ -59,7 +59,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in } ; UsePN pn = { - s = \\c => pn.s ! npform2case Sg c ; + s = \\c => pn.s ! npform2case Sg c ; a = agrP3 Sg ; isPron = False } ; @@ -72,10 +72,10 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in } ; PPartNP np v2 = - let + let num : Number = complNumAgr np.a ; part : Str = v2.s ! (PastPart Pass) ; - adj : NForms = hjk_type_IVb_maakas part ; + adj : NForms = hjk_type_IVb_maakas part ; partGen : Str = adj ! 1 ; partEss : Str = partGen + "na" in { @@ -91,8 +91,8 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in } ; DetQuantOrd quant num ord = { - s = \\c => quant.s ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ; - sp = \\c => quant.sp ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ; + s = \\c => quant.s ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ; + sp = \\c => quant.sp ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ; n = num.n ; isNum = num.isNum ; isDef = quant.isDef @@ -135,19 +135,19 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in NumCard n = n ** {isNum = case n.n of {Sg => False ; _ => True}} ; -- üks raamat/kaks raamatut NumDigits numeral = { - s = \\n,c => numeral.s ! NCard (NCase n c) ; - n = numeral.n + s = \\n,c => numeral.s ! NCard (NCase n c) ; + n = numeral.n } ; OrdDigits numeral = {s = \\nc => numeral.s ! NOrd nc} ; NumNumeral numeral = { - s = \\n,c => numeral.s ! NCard (NCase n c) ; + s = \\n,c => numeral.s ! NCard (NCase n c) ; n = numeral.n } ; OrdNumeral numeral = {s = \\nc => numeral.s ! NOrd nc} ; AdNum adn num = { - s = \\n,c => adn.s ++ num.s ! n ! c ; + s = \\n,c => adn.s ++ num.s ! n ! c ; n = num.n } ; @@ -156,17 +156,17 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in OrdSuperl a = {s = \\nc => "kõige" ++ a.s ! Compar ! AN nc} ; DefArt = { - s = \\_,_ => [] ; - sp = table {Sg => pronSe.s ; Pl => pronNe.s} ; + s = \\_,_ => [] ; + sp = table {Sg => pronSe.s ; Pl => pronNe.s} ; isNum = False ; isDef = True -- autot ovat } ; IndefArt = { s = \\_,_ => [] ; --use isDef in DetCN - sp = \\n,c => - (nForms2N (nForms6 "üks" "ühe" "üht" "ühesse" "ühtede" - "ühtesid")).s ! NCase n c ; + sp = \\n,c => + (nForms2N (nForms6 "üks" "ühe" "üht" "ühesse" "ühtede" + "ühtesid")).s ! NCase n c ; isNum,isDef = False -- autoja on } ; @@ -176,7 +176,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in ncase : Case -> NForm = \c -> NCase n c ; in { s = \\c => let k = npform2case n c in - cn.s ! ncase k ; + cn.s ! ncase k ; a = agrP3 Sg ; isPron = False } ; @@ -209,21 +209,21 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in AdjCN ap cn = { - s = \\nf => + s = \\nf => case ap.infl of { - (Invariable|Participle) => ap.s ! True ! (NCase Sg Nom) ++ cn.s ! nf ; --valmis kassile; väsinud kassile - Regular => case nf of { - NCase num (Ess|Abess|Comit|Termin) => ap.s ! True ! (NCase num Gen) ++ cn.s ! nf ; --suure kassiga, not *suurega kassiga + Invariable|Participle => ap.s ! True ! NCase Sg Nom ++ cn.s ! nf ; --valmis kassile; väsinud kassile + Regular => case nf of { + NCase num (Ess|Abess|Comit|Termin) => ap.s ! True ! NCase num Gen ++ cn.s ! nf ; --suure kassiga, not *suurega kassiga _ => ap.s ! True ! nf ++ cn.s ! nf - } - } + } + } } ; RelCN cn rs = {s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)} ; RelNP np rs = { - s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; - a = np.a ; + s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; + a = np.a ; isPron = np.isPron ---- correct ? } ; diff --git a/src/estonian/ParadigmsEst.gf b/src/estonian/ParadigmsEst.gf index 033dc3ac..5f74e472 100644 --- a/src/estonian/ParadigmsEst.gf +++ b/src/estonian/ParadigmsEst.gf @@ -2,12 +2,12 @@ -- -- Based on the Finnish Lexical Paradigms by Aarne Ranta 2003--2008 -- --- This is an API to the user of the resource grammar +-- This is an API to the user of the resource grammar -- for adding lexical items. It gives functions for forming -- expressions of open categories: nouns, adjectives, verbs. --- +-- -- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API and $Structural.gf$. +-- accessed through the resource syntax API and $Structural.gf$. -- -- The main difference with $MorphoEst.gf$ is that the types -- referred to are compiled resource grammar types. We have moreover @@ -23,9 +23,9 @@ -- @author Kaarel Kaljurand -- @version 2013-10-21 -resource ParadigmsEst = open - (Predef=Predef), - Prelude, +resource ParadigmsEst = open + (Predef=Predef), + Prelude, MorphoEst, HjkEst, CatEst @@ -33,9 +33,9 @@ resource ParadigmsEst = open flags optimize=noexpand ; coding=utf8; ---2 Parameters +--2 Parameters -- --- To abstract over gender, number, and (some) case names, +-- To abstract over gender, number, and (some) case names, -- we define the following identifiers. The application programmer -- should always use these constants instead of the constructors -- defined in $ResEst$. @@ -83,15 +83,15 @@ oper --2 Conjunctions, adverbs - mkAdv : Str -> Adv ; - mkAdV : Str -> AdV ; - mkAdN : Str -> AdN ; - mkAdA : Str -> AdA ; + mkAdv : Str -> Adv ; + mkAdV : Str -> AdV ; + mkAdN : Str -> AdN ; + mkAdA : Str -> AdA ; mkConj : overload { mkConj : Str -> Conj ; -- just one word, default number Sg: e.g. "ja" mkConj : Str -> Number -> Conj ; --just one word + number: e.g. "ja" Pl - mkConj : Str -> Str -> Conj ; --two words, default number: e.g. "nii" "kui" + mkConj : Str -> Str -> Conj ; --two words, default number: e.g. "nii" "kui" mkConj : Str -> Str -> Number -> Conj ; --two words + number: e.g. "nii" "kui" Pl } ; @@ -139,7 +139,7 @@ oper -- Non-comparison one-place adjectives are just like nouns. -- The regular adjectives are based on $regN$ in the positive. --- Comparison adjectives have three forms. +-- Comparison adjectives have three forms. -- The comparative and the superlative -- are always inflected in the same way, so the nominative of them is actually -- enough (TODO: confirm). @@ -156,7 +156,7 @@ oper mkA2 : A -> Prep -> A2 -- e.g. "vihane" (postGenPrep "peale") = \a,p -> a ** {c2 = p ; lock_A2 = <>}; - invA : Str -> A ; -- invariable adjectives, such as genitive attributes ; no agreement to head, no comparison forms. + invA : Str -> A ; -- invariable adjectives, such as genitive attributes ; no agreement to head, no comparison forms. --2 Verbs -- @@ -237,8 +237,8 @@ oper mkV2V : V -> Prep -> V2V ; -- e.g. "käskima" adessive mkV2V : Str -> V2V ; -- e.g. "käskima" adessive } ; - mkV2Vf : V -> Prep -> InfForm -> V2V ; -- e.g. "keelama" partitive infMast - + mkV2Vf : V -> Prep -> InfForm -> V2V ; -- e.g. "keelama" partitive infMast + mkVA : overload { mkVA : V -> Prep -> VA ; -- e.g. "muutuma" translative mkVA : Str -> VA ; -- string, default case translative @@ -248,21 +248,21 @@ oper mkV2A : V -> Prep -> Prep -> V2A ; -- e.g. "värvima" genitive translative mkV2A : Str -> V2A ; -- string, default cases genitive and translative } ; - + mkVQ : overload { - mkVQ : V -> VQ ; - mkVQ : Str -> VQ ; + mkVQ : V -> VQ ; + mkVQ : Str -> VQ ; } ; - mkV2Q : V -> Prep -> V2Q ; -- e.g. "küsima" ablative + mkV2Q : V -> Prep -> V2Q ; -- e.g. "küsima" ablative mkAS : A -> AS ; --% mkA2S : A -> Prep -> A2S ; --% mkAV : A -> AV ; --% mkA2V : A -> Prep -> A2V ; --% --- Notice: categories $AS, A2S, AV, A2V$ are just $A$, +-- Notice: categories $AS, A2S, AV, A2V$ are just $A$, -- and the second argument is given --- as an adverb. Likewise +-- as an adverb. Likewise -- $V0$ is just $V$. V0 : Type ; --% @@ -290,13 +290,13 @@ oper translative = Transl ; terminative = Termin ; essive = Ess ; - abessive = Abess ; + abessive = Abess ; comitative = Comit ; - + infDa = InfDa ; infMa = InfMa ; infMast = InfMast ; infDes = InfDes ; infMas = InfMas ; infMaks = InfMaks ; infMata = InfMata ; - prePrep : Case -> Str -> Prep = + prePrep : Case -> Str -> Prep = \c,p -> {c = NPCase c ; s = p ; isPre = True ; lock_Prep = <>} ; postPrep : Case -> Str -> Prep = \c,p -> {c = NPCase c ; s = p ; isPre = False ; lock_Prep = <>} ; @@ -313,7 +313,7 @@ oper mkAdA : Str -> AdA = \str -> {s = str ; lock_AdA = <>} ; - + mkConj = overload { mkConj : Str -> Conj = \ja -> lin Conj ((sd2 "" ja) ** {n = Sg}) ; mkConj : Str -> Number -> Conj = \ja,num -> lin Conj ((sd2 "" ja) ** {n = num}) ; @@ -335,12 +335,12 @@ oper } ; -- Adjective forms (incl. comp and sup) are derived from noun forms - mk1A : Str -> A = \suur -> - let aforms = aForms2A (nforms2aforms (hjk_type suur)) + mk1A : Str -> A = \suur -> + let aforms = aForms2A (nforms2aforms (hjk_type suur)) in aforms ** {infl = Regular } ; - - mkNA : N -> A = \suur -> - let aforms = aForms2A (nforms2aforms (n2nforms suur)) ; + + mkNA : N -> A = \suur -> + let aforms = aForms2A (nforms2aforms (n2nforms suur)) ; in aforms ** {infl = Regular } ; @@ -348,28 +348,28 @@ oper -- mk2N, mk3N, mk4N make sure that the user specified forms end up in the paradigm, -- even though the rest is wrong - mk2N : (link,lingi : Str) -> N = \link,lingi -> - let nfs : NForms = (nForms2 link lingi) ; + mk2N : (link,lingi : Str) -> N = \link,lingi -> + let nfs : NForms = (nForms2 link lingi) ; nfs_fixed : NForms = table { 0 => link ; 1 => lingi ; 2 => nfs ! 2 ; 3 => nfs ! 3 ; 4 => nfs ! 4 ; - 5 => nfs ! 5 + 5 => nfs ! 5 } ; in nForms2N nfs_fixed ** {lock_N = <> } ; - mk3N : (tukk,tuku,tukku : Str) -> N = \tukk,tuku,tukku -> - let nfs : NForms = (nForms3 tukk tuku tukku) ; + mk3N : (tukk,tuku,tukku : Str) -> N = \tukk,tuku,tukku -> + let nfs : NForms = (nForms3 tukk tuku tukku) ; nfs_fixed : NForms = table { 0 => tukk ; 1 => tuku ; 2 => tukku ; 3 => nfs ! 3 ; 4 => nfs ! 4 ; - 5 => nfs ! 5 + 5 => nfs ! 5 } ; in nForms2N nfs_fixed ** {lock_N = <> } ; @@ -381,7 +381,7 @@ oper 1 => paadi ; 2 => paati ; 3 => nfs ! 3 ; - 4 => nfs ! 4 ; + 4 => nfs ! 4 ; 5 => paate } ; in nForms2N nfs_fixed ** {lock_N = <> } ; @@ -510,7 +510,7 @@ oper -- voolik/vooliku/voolikut <_ + #c, _ + #v, _ + #v + "t"> => hjk_type_IVb_audit tukk u ; - _ => nForms2 tukk tuku + _ => nForms2 tukk tuku } ; nForms4 : (_,_,_,_ : Str) -> NForms = \paat,paadi,paati,paate -> @@ -518,33 +518,33 @@ oper -- distinguish between joonis and segadus <_ +("ne"|"s"), _+"se", _+"st", _+"seid"> => hjk_type_Va_otsene paat ; <_ +("ne"|"s"), _+"se", _+"st", _+"si"> => hjk_type_Vb_oluline paat ; - + <_ +"ne", _+"se", _+"set", _+"seid"> => nForms3 paat paadi paati ; -- -ne adjectives ('algne') are not like 'tõuge' --distinguish between kõne and aine - <_ +"e", _+"e", _+"et", _+"sid"> => hjk_type_III_ratsu paat ; + <_ +"e", _+"e", _+"et", _+"sid"> => hjk_type_III_ratsu paat ; <_ +"e", _+"e", _+"et", _+"eid"> => hjk_type_VII_touge2 paat paadi ; - _ => nForms3 paat paadi paati + _ => nForms3 paat paadi paati } ; {- --Version that uses pl gen instead of pl part - nForms4 : (_,_,_,_ : Str) -> NForms = \paat,paadi,paati,paatide -> + nForms4 : (_,_,_,_ : Str) -> NForms = \paat,paadi,paati,paatide -> case of { -- pl gen can't distinguish between joonis and segadus -- <_ +("ne"|"s"), _+"se", _+"st", _+"seid"> => hjk_type_Va_otsene paat ; -- <_ +("ne"|"s"), _+"se", _+"st", _+"si"> => hjk_type_Vb_oluline paat ; - + --pl gen can distinguish between kõne and aine --plus side that any noun that is formed with 4-arg, - --the user given forms are inserted to the paradigm, + --the user given forms are inserted to the paradigm, --and more forms are created from pl gen, none from pl part - <_ +"e", _+"e", _+"et", _+"de"> => hjk_type_III_ratsu paat ; + <_ +"e", _+"e", _+"et", _+"de"> => hjk_type_III_ratsu paat ; <_ +"e", _+"e", _+"et", _+"te"> => hjk_type_VII_touge2 paat paadi ; - _ => nForms3 paat paadi paati - } ; + _ => nForms3 paat paadi paati + } ; -} mkN2 = overload { @@ -553,12 +553,12 @@ oper } ; mmkN2 : N -> Prep -> N2 = \n,c -> n ** {c2 = c ; isPre = mkIsPre c ; lock_N2 = <>} ; - mkN3 = \n,c,e -> n ** {c2 = c ; c3 = e ; + mkN3 = \n,c,e -> n ** {c2 = c ; c3 = e ; isPre = mkIsPre c ; -- matka Londonist Pariisi isPre2 = mkIsPre e ; -- Suomen voitto Ruotsista lock_N3 = <> } ; - + mkIsPre : Prep -> Bool = \p -> case p.c of { NPCase Gen => notB p.isPre ; -- Jussin veli (prep is , isPre becomes False) _ => True -- syyte Jussia vastaan, puhe Jussin puolesta @@ -588,7 +588,7 @@ oper mkA_1 : Str -> A = \x -> noun2adjDeg (mk1N x) ** {infl = Regular ; lock_A = <>} ; -- auxiliaries - mkAdjective : (_,_,_ : Adj) -> A = \hea,parem,parim -> + mkAdjective : (_,_,_ : Adj) -> A = \hea,parem,parim -> {s = table { Posit => hea.s ; Compar => parem.s ; @@ -601,8 +601,8 @@ oper -- Adjectives whose comparison forms are explicitly given. -- The inflection of these forms with the audit-rule always works. regAdjective : Noun -> Str -> Str -> A = \posit,compar,superl -> - mkAdjective - (noun2adj posit) + mkAdjective + (noun2adj posit) (noun2adjComp False (nForms2N (hjk_type_IVb_audit compar "a"))) (noun2adjComp False (nForms2N (hjk_type_IVb_audit superl "a"))) ; @@ -637,31 +637,31 @@ oper mkV : (aru : Str) -> (saama : V) -> V = mkPV ; -- particle verbs } ; - mk1V : Str -> V = \s -> - let vfs = vforms2V (vForms1 s) in + mk1V : Str -> V = \s -> + let vfs = vforms2V (vForms1 s) in vfs ** {sc = NPCase Nom ; lock_V = <>} ; - mk2V : (_,_ : Str) -> V = \x,y -> - let - vfs = vforms2V (vForms2 x y) + mk2V : (_,_ : Str) -> V = \x,y -> + let + vfs = vforms2V (vForms2 x y) in vfs ** {sc = NPCase Nom ; lock_V = <>} ; - mk3V : (_,_,_ : Str) -> V = \x,y,z -> - let - vfs = vforms2V (vForms3 x y z) + mk3V : (_,_,_ : Str) -> V = \x,y,z -> + let + vfs = vforms2V (vForms3 x y z) in vfs ** {sc = NPCase Nom ; lock_V = <>} ; - mk4V : (x1,_,_,x4 : Str) -> V = \a,b,c,d -> - let + mk4V : (x1,_,_,x4 : Str) -> V = \a,b,c,d -> + let vfs = vforms2V (vForms4 a b c d) in vfs ** {sc = NPCase Nom ; lock_V = <>} ; - mk8V : (x1,_,_,_,_,_,_,x8 : Str) -> V = \a,b,c,d,e,f,g,h -> + mk8V : (x1,_,_,_,_,_,_,x8 : Str) -> V = \a,b,c,d,e,f,g,h -> let vfs = vforms2V (vForms8 a b c d e f g h) in vfs ** {sc = NPCase Nom ; lock_V = <>} ; mkPV : (aru : Str) -> (saama : V) -> V = \aru,saama -> {s = saama.s ; p = aru ; sc = saama.sc ; lock_V = <> } ; - - - -- This used to be the last case: _ => Predef.error (["expected infinitive, found"] ++ ottaa) - -- regexp example: ("" | ?) + ("a" | "e" | "i") + _ + "aa" => + + + -- This used to be the last case: _ => Predef.error (["expected infinitive, found"] ++ ottaa) + -- regexp example: ("" | ?) + ("a" | "e" | "i") + _ + "aa" => vForms1 : Str -> VForms = \lugema -> let luge = Predef.tk 2 lugema ; @@ -672,7 +672,7 @@ oper -- Small class of CVVma ? + ("ä"|"õ"|"i") + "ima" => cKaima lugema ; --käima,viima,võima - ? + ("aa"|"ee"|"ää") + "ma" => + ? + ("aa"|"ee"|"ää") + "ma" => cSaama lugema ; -- saama,jääma,keema ? + ("oo"|"öö"|"üü") + "ma" => cJooma lugema ; --jooma,looma,lööma,müüma,pooma,sööma,tooma @@ -680,30 +680,30 @@ oper -- TS 53 _ + #c + #v + "elema" => cTegelema lugema ; --not aelema - + -- TS 54 -- Small class, just list all members ("tule"|"sure"|"pane") + "ma" => cTulema lugema ; - + -- TS 55-57 -- Consonant gradation -- Regular (55-56)'leppima' and irregular (57) 'lugema' -- For reliable results regarding consonant gradation, use mk3V _ + "ndima" => cLeppima lugema ; - _ + #lmnr + ("k"|"p"|"t"|"b") + ("ima"|"uma") => + _ + #lmnr + ("k"|"p"|"t"|"b") + ("ima"|"uma") => cLeppima lugema ; - _ + ("sk"|"ps"|"ks"|"ts"|"pl") + ("ima") => --|"uma") => + _ + ("sk"|"ps"|"ks"|"ts"|"pl") + ("ima") => --|"uma") => cLeppima lugema ; - _ + ("hk"|"hm"|"hn"|"hr"|"ht") + ("ima") => --most *hCuma are TS 51 (muutuma) + _ + ("hk"|"hm"|"hn"|"hr"|"ht") + ("ima") => --most *hCuma are TS 51 (muutuma) cLeppima lugema ; _ + #c + "ssima" => --weaker *ss = *ss; should be weaker Css = Cs cLugema lugema ; - _ + ("pp"|"kk"|"tt"|"ss"|"ff"|"nn"|"mm"|"ll"|"rr") + ("ima"|"uma") => + _ + ("pp"|"kk"|"tt"|"ss"|"ff"|"nn"|"mm"|"ll"|"rr") + ("ima"|"uma") => cLeppima lugema ; - - -- TS 59 (petma, tapma) + + -- TS 59 (petma, tapma) -- Use mk4V for TS 60 (jätma, võtma) ? + #v + ("tma"|"pma") => cPetma lugema (luge + "etakse") ; @@ -714,31 +714,31 @@ oper -- TS 61 (laulma,kuulma,naerma,möönma) -- Default vowel e for lma, a for (r|n)ma. -- Other vowel with mk3V. - _ + "lma" => - cKuulma lugema (loe + "eb") ; + _ + "lma" => + cKuulma lugema (loe + "eb") ; _ + ("r"|"n") + "ma" => cKuulma lugema (loe + "ab") ; - + -- TS 63 (andma,hoidma) -- Other vowel than a (tundma~tunneb) with mk3V _ + "dma" => cAndma lugema (loe + "ab") ; - + -- TS 62, 64 (tõusma,mõskma), default vowel e -- 62 alt form (jooksma,joosta) with mk2V -- Other vowel than e with mk3V - _ + #c + "ma" => + _ + #c + "ma" => cLaskma lugema (loe + "eb") ; - + -- TS 65 (pesema) #c + #v + "sema" => cPesema lugema ; - + -- TS 66 (nägema) -- Small class, just list all members ("nägema"|"tegema") => cNagema lugema ; - + -- TS 67-68 with mk2V -- no 100% way to distinguish from 50-52 that end in ama @@ -754,7 +754,7 @@ oper -- Default case _ => cElama lugema - } ; + } ; vForms2 : (_,_ : Str) -> VForms = \petma,petta -> -- Arguments: ma infinitive, da infinitive @@ -781,22 +781,22 @@ oper -- * Non-detectable gradation (sattuma~satub ; pettuma~pettub) -- * Non-default vowel in b for TS 58-64 (laulma~laulab) case of { - + --to be sure about vowel in b <_ + "dma", _ + "da", _> => cAndma taguma taob ; <_, _ + #vv + #lmnr + "da", _> => cKuulma taguma taob ; - <_, _ + #c + "ta", _> => cLaskma taguma taob ; + <_, _ + #c + "ta", _> => cLaskma taguma taob ; --irregular gradation <_, _, (""|#c) + #c + #v + #v + "b"> => cLugema taguma ; --57 --to be sure about consonant gradation <_ + #c + "lema", _, _> => vForms2 taguma taguda ; --catch "-Clema" first - <_ + #v + "ma", _+"da", _> => cSattumaPettuma taguma taob ; + <_ + #v + "ma", _+"da", _> => cSattumaPettuma taguma taob ; - <_,_,_> => vForms2 taguma taguda + <_,_,_> => vForms2 taguma taguda } ; - + vForms4 : (x1,_,_,x4 : Str) -> VForms = \jatma,jatta,jatab,jaetakse -> -- 4 forms needed to get full paradigm for regular verbs -- (source: http://www.eki.ee/books/ekk09/index.php?p=3&p1=5&id=227) @@ -804,7 +804,7 @@ oper -- Filter out known irregularities and give rest to regVForms. -- Not trying to match TS 49 ; can't separate käima (49) from täima (50), or detect compounds like taaslooma. case of { - <_, _+("kka"|"ppa"|"tta"), + <_, _+("kka"|"ppa"|"tta"), _, _+"takse"> => cPetma jatma jaetakse ; <_ + "dma", _, _, _+"takse"> => cAndma jatma jatab ; @@ -813,15 +813,15 @@ oper <_, _ + "ha", _, _> => cNagema jatma ; <_ + #v + "sema", _ + "sta", _, _> => cPesema jatma ; <_,_,_,_> => regVForms jatma jatta jatab jaetakse - } ; - + } ; + caseV c v = {s = v.s ; p = v.p; sc = NPCase c ; lock_V = <>} ; vOlema = verbOlema ** {sc = NPCase Nom ; lock_V = <>} ; vMinema = verbMinema ** {sc = NPCase Nom ; lock_V = <>} ; mk2V2 : V -> Prep -> V2 = \v,c -> v ** {c2 = c ; lock_V2 = <>} ; - caseV2 : V -> Case -> V2 = \v,c -> mk2V2 v (casePrep c) ; + caseV2 : V -> Case -> V2 = \v,c -> mk2V2 v (casePrep c) ; dirV2 v = mk2V2 v accPrep ; @@ -837,13 +837,13 @@ oper dirV2 : V -> V2 ; mkV3 = overload { - mkV3 : V -> Prep -> Prep -> V3 = \v,p,q -> v ** {c2 = p ; c3 = q ; lock_V3 = <>} ; - mkV2 : V -> V3 = \v -> v ** {c2 = accPrep ; - c3 = (casePrep allative) ; - lock_V3 = <>} ; - mkV2 : Str -> V3 = \str -> (mkV str) ** {c2 = accPrep ; - c3 = (casePrep allative) ; - lock_V3 = <>} ; + mkV3 : V -> Prep -> Prep -> V3 = \v,p,q -> v ** {c2 = p ; c3 = q ; lock_V3 = <>} ; + mkV2 : V -> V3 = \v -> v ** {c2 = accPrep ; + c3 = (casePrep allative) ; + lock_V3 = <>} ; + mkV2 : Str -> V3 = \str -> (mkV str) ** {c2 = accPrep ; + c3 = (casePrep allative) ; + lock_V3 = <>} ; } ; dirV3 v p = mkV3 v accPrep (casePrep p) ; dirdirV3 v = dirV3 v allative ; @@ -855,7 +855,7 @@ oper mkVV = overload { mkVV : V -> VV = \v -> mkVVf v infDa ; mkVV : Str -> VV = \str -> mkVVf (mkV str) infDa ; - } ; + } ; mkVVf v f = v ** {vi = f ; lock_VV = <>} ; mkVQ = overload { mkVQ : V -> VQ = \v -> v ** {lock_VQ = <>} ; @@ -876,7 +876,7 @@ oper mkV2V : V -> Prep -> V2V = \v,p -> mkV2Vf v p infMa ; mkV2V : V -> V2V = \v -> mkV2Vf v (casePrep genitive) infMa ; mkV2V : Str -> V2V = \str -> mkV2Vf (mkV str) (casePrep genitive) infMa ; - } ; + } ; mkV2Vf v p f = mk2V2 v p ** {vi = f ; lock_V2V = <>} ; mkVA = overload { @@ -885,13 +885,13 @@ oper mkVA : Str -> VA = \str -> (mkV str) ** {c2 = casePrep translative ; lock_VA = <>} ; } ; - mkV2A = overload { + mkV2A = overload { mkV2A : V -> Prep -> Prep -> V2A = \v,p,q -> v ** {c2 = p ; c3 = q ; lock_V2A = <>} ; - mkV2A : V -> V2A = \v -> v ** {c2 = casePrep genitive ; - c3 = casePrep translative ; + mkV2A : V -> V2A = \v -> v ** {c2 = casePrep genitive ; + c3 = casePrep translative ; lock_V2A = <>} ; - mkV2A : Str -> V2A = \str -> (mkV str) ** {c2 = casePrep genitive ; - c3 = casePrep translative ; + mkV2A : Str -> V2A = \str -> (mkV str) ** {c2 = casePrep genitive ; + c3 = casePrep translative ; lock_V2A = <>} ; } ; diff --git a/src/estonian/QuestionEst.gf b/src/estonian/QuestionEst.gf index 2d0ecdbf..58a69f6b 100644 --- a/src/estonian/QuestionEst.gf +++ b/src/estonian/QuestionEst.gf @@ -8,16 +8,16 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in { s = \\t,a,p => cl.s ! t ! a ! p ! SQuest } ; - QuestVP ip vp = - let + QuestVP ip vp = + let cl = mkClause (subjForm (ip ** {isPron = False ; a = agrP3 ip.n}) vp.sc) (agrP3 ip.n) vp in { s = \\t,a,p => cl.s ! t ! a ! p ! SDecl } ; QuestSlash ip slash = { - s = \\t,a,p => - let + s = \\t,a,p => + let cls = slash.s ! t ! a ! p ; who = appCompl True p slash.c2 (ip ** {a = agrP3 ip.n ; isPron = False}) in @@ -29,15 +29,15 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in { } ; QuestIComp icomp np = { - s = \\t,a,p => - let + s = \\t,a,p => + let vp = predV (verbOlema ** {sc = NPCase Nom}) ; cl = mkClause (subjForm np vp.sc) np.a vp ; in icomp.s ! np.a ++ cl.s ! t ! a ! p ! SDecl } ; - PrepIP p ip = {s = + PrepIP p ip = {s = appCompl True Pos p (ip ** {a = agrP3 ip.n ; isPron = False})} ; AdvIP ip adv = { @@ -46,15 +46,15 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in { } ; -- The computation of $ncase$ is a special case of that in $NounEst.DetCN$, --- since we don't have possessive suffixes or definiteness. +-- since we don't have possessive suffixes or definiteness. --- It could still be nice to have a common oper... IdetCN idet cn = let n = idet.n in { - s = \\c => - let + s = \\c => + let k : Case = npform2case n c ; icase : Case = Nom ; --case k of { --mis kassiga - -- (Ess|Abess|Comit|Termin) => Gen ; + -- (Ess|Abess|Comit|Termin) => Gen ; -- _ => k -- } ; ncase : NForm = case of { @@ -63,33 +63,33 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in { _ => NCase n k -- mitkä kytkimet } in - idet.s ! icase ++ cn.s ! ncase ; + idet.s ! icase ++ cn.s ! ncase ; n = n } ; IdetIP idet = let n = idet.n in { - s = \\c => - let + s = \\c => + let k = npform2case n c ; in - idet.s ! k ; + idet.s ! k ; n = n } ; - IdetQuant idet num = - let + IdetQuant idet num = + let n = num.n ; - isn = num.isNum + isn = num.isNum in { - s = \\k => - let + s = \\k => + let ncase = case of { => NCase Sg Part ; -- mitkä kolme kytkintä <_, True> => NCase Sg k ; -- miksi kolmeksi kytkimeksi _ => NCase n k -- mitkä kytkimet } in - idet.s ! n ! k ++ num.s ! Sg ! k ; + idet.s ! n ! k ++ num.s ! Sg ! k ; n = n ; isNum = isn } ; diff --git a/src/estonian/RelativeEst.gf b/src/estonian/RelativeEst.gf index 705d77a8..4f90bb25 100644 --- a/src/estonian/RelativeEst.gf +++ b/src/estonian/RelativeEst.gf @@ -11,14 +11,14 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in } ; RelVP rp vp = { - s = \\t,ant,b,ag => - let + s = \\t,ant,b,ag => + let agr = case rp.a of { RNoAg => ag ; RAg a => a } ; - cl = mkClause - (subjForm {s = rp.s ! (complNumAgr agr) ; + cl = mkClause + (subjForm {s = rp.s ! (complNumAgr agr) ; a = agr ; isPron = False} vp.sc) agr vp in cl.s ! t ! ant ! b ! SDecl ; @@ -26,8 +26,8 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in } ; RelSlash rp slash = { - s = \\t,a,p,ag => - let + s = \\t,a,p,ag => + let cls = slash.s ! t ! a ! p ; who = appCompl True p slash.c2 (rp2np (complNumAgr ag) rp) in diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index 0b72ab54..1e123dd4 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -15,11 +15,11 @@ resource ResEst = ParamX ** open Prelude in { -- This is the $Case$ as needed for both nouns and $NP$s. param - Case = Nom | Gen | Part - | Illat | Iness | Elat | Allat | Adess | Ablat + Case = Nom | Gen | Part + | Illat | Iness | Elat | Allat | Adess | Ablat | Transl | Ess | Termin | Abess | Comit; - NForm = NCase Number Case ; + NForm = NCase Number Case ; -- Agreement of $NP$ has number*person and the polite second ("te olette valmis"). @@ -56,13 +56,13 @@ oper --2 Noun phrases -- --- Two forms of *virtual accusative* are needed for nouns in singular, --- the nominative and the genitive one ("loen raamatu"/"loe raamat"). --- For nouns in plural, only a nominative accusative exists in positive clauses. +-- Two forms of *virtual accusative* are needed for nouns in singular, +-- the nominative and the genitive one ("loen raamatu"/"loe raamat"). +-- For nouns in plural, only a nominative accusative exists in positive clauses. -- Pronouns use the partitive as their accusative form ("mind", "sind"), in both -- positive and negative, indicative and imperative clauses. -param +param NPForm = NPCase Case | NPAcc ; oper @@ -80,14 +80,14 @@ oper -- A special form is needed for the negated plural imperative. param - VForm = + VForm = Inf InfForm | Presn Number Person | Impf Number Person | Condit Number Person | ConditPass --loetagu | Imper Number - | ImperP3 + | ImperP3 | ImperP1Pl | ImperPass | PassPresn Bool @@ -98,11 +98,11 @@ param ; Voice = Act | Pass ; - + InfForm = InfDa -- lugeda - | InfDes -- lugedes - | InfMa -- lugema + | InfDes -- lugedes + | InfMa -- lugema | InfMas -- lugemas | InfMast -- lugemast | InfMata -- lugemata @@ -112,7 +112,7 @@ param SType = SDecl | SQuest | SInv ; --2 For $Relative$ - + RAgr = RNoAg | RAg Agr ; --2 For $Numeral$ @@ -122,14 +122,14 @@ param --2 Transformations between parameter types oper - agrP3 : Number -> Agr = \n -> + agrP3 : Number -> Agr = \n -> Ag n P3 ; conjAgr : Agr -> Agr -> Agr = \a,b -> case of { => Ag (conjNumber n m) (conjPerson p q) ; => Ag Pl (conjPerson p P2) ; => Ag Pl (conjPerson p P2) ; - _ => b + _ => b } ; --- @@ -178,33 +178,33 @@ param param VIForm = - VIFin Tense + VIFin Tense | VIInf InfForm | VIPass Tense - | VIPresPart - | VIImper - ; + | VIPresPart + | VIImper + ; oper VP : Type = { - s : VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ; + s : VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ; s2 : Bool => Polarity => Agr => Str ; -- raamat/raamatu/raamatut adv : Str ; p : Str ; --uninflecting component in multi-word verbs ext : Str ; sc : NPForm ; } ; - + predV : (Verb ** {sc : NPForm}) -> VP = \verb -> { - s = \\vi,ant,b,agr0 => + s = \\vi,ant,b,agr0 => let agr = verbAgr agr0 ; verbs = verb.s ; part : Str = case vi of { - VIPass _ => verbs ! (PastPart Pass) ; + VIPass _ => verbs ! (PastPart Pass) ; _ => verbs ! (PastPart Act) - } ; - + } ; + einegole : Str * Str * Str = case of { => <"ei", verbs ! Imper Sg, "ole"> ; => <"ei", verbs ! Imper Sg, "ole"> ; @@ -217,23 +217,23 @@ oper => <"ei", verbs ! ConditPass, "oleks"> ; --# notpresent => <"ei", verbs ! PassImpf False, "olnud"> ; --# notpresent => <"ei", verbs ! PresPart Act, "olev"> ; --# notpresent - => <"ei", verbs ! Inf i, verbOlema.s ! Inf i> + => <"ei", verbs ! Inf i, verbOlema.s ! Inf i> } ; - + ei : Str = einegole.p1 ; neg : Str = einegole.p2 ; ole : Str = einegole.p3 ; - + olema : VForm => Str = verbOlema.s ; - + vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ; - + mkvf : VForm -> {fin, inf : Str} = \p -> case of { => vf (verbs ! p) [] ; - => vf (olema ! p) part ; + => vf (olema ! p) part ; => vf (ei ++ neg) [] ; - => vf (ei ++ ole) part + => vf (ei ++ ole) part } ; passPol = case b of {Pos => True ; Neg => False} ; @@ -256,19 +256,19 @@ oper adv = [] ; ext = [] ; --relative clause p = verb.p ; --particle verbs - sc = verb.sc + sc = verb.sc } ; - insertObj : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp -> + insertObj : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp -> vp ** { s2 = \\fin,b,a => vp.s2 ! fin ! b ! a ++ obj ! fin ! b ! a } ; - insertObjPre : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp -> + insertObjPre : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp -> vp ** { s2 = \\fin,b,a => obj ! fin ! b ! a ++ vp.s2 ! fin ! b ! a } ; - insertAdv : Str -> VP -> VP = \adv,vp -> + insertAdv : Str -> VP -> VP = \adv,vp -> vp ** { adv = vp.adv ++ adv } ; - insertExtrapos : Str -> VP -> VP = \obj,vp -> + insertExtrapos : Str -> VP -> VP = \obj,vp -> vp ** { ext = vp.ext ++ obj } ; -- For $Sentence$. @@ -286,12 +286,12 @@ oper -- declarative sentence with the yes/no-queryword "kas". -- SQuest: "kas" + SDecl -- It would be also correct to use the Finnish structure, just without the ko-particle. - -- Inari: added a third SType, SInv. + -- Inari: added a third SType, SInv. -- Not sure if SInv is needed, but keeping it for possible future use. -- There's need for an inverted word order with auxiliary verbs; infVP handles that. ComplVV calls infVP, which inverts the word order for the complement VP, and puts it into the resulting VP's `compl' field. -- SInv made by mkClause would be for cases where you just need to construct an inverted word order, and then call it from some other place; application grammar (TODO: api oper for SType) or ExtraEst. - mkClause : (Polarity -> Str) -> Agr -> VP -> Clause = \sub,agr,vp -> - { s = \\t,a,b => + mkClause : (Polarity -> Str) -> Agr -> VP -> Clause = \sub,agr,vp -> + { s = \\t,a,b => let c = (mkClausePlus sub agr vp).s ! t ! a ! b ; -- saan sinust aru 0 @@ -300,51 +300,51 @@ oper -- [sind näha] 0 tahtnud -- täna olen ma sinust aru saanud invCl = c.adv ++ c.fin ++ c.subj ++ c.compl ++ c.p ++ c.inf ++ c.ext - in + in table { SDecl => declCl ; SQuest => "kas" ++ declCl ; - SInv => invCl + SInv => invCl } } ; - existClause : (Polarity -> Str) -> Agr -> VP -> Clause = \sub,agr,vp -> - { s = \\t,a,b => + existClause : (Polarity -> Str) -> Agr -> VP -> Clause = \sub,agr,vp -> + { s = \\t,a,b => let c = (mkClausePlus sub agr vp).s ! t ! a ! b ; -- (mis) on olnud olemas (lammas) declCl = c.subj ++ c.fin ++ c.inf ++ c.compl ; - in + in table { SQuest => "kas" ++ declCl ; - _ => declCl + _ => declCl } } ; mkClausePlus : (Polarity -> Str) -> Agr -> VP -> ClausePlus = \sub,agr,vp -> { - s = \\t,a,b => - let + s = \\t,a,b => + let agrfin = case vp.sc of { NPCase Nom => ; _ => -- minule meeldib, minul on } ; verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ; - in {subj = sub b ; - fin = verb.fin ; - inf = verb.inf ; + in {subj = sub b ; + fin = verb.fin ; + inf = verb.inf ; compl = vp.s2 ! agrfin.p2 ! b ! agr ; p = vp.p ; - adv = vp.adv ; - ext = vp.ext ; + adv = vp.adv ; + ext = vp.ext ; } } ; - insertKinClausePlus : Predef.Ints 1 -> ClausePlus -> ClausePlus = \p,cl -> { + insertKinClausePlus : Predef.Ints 1 -> ClausePlus -> ClausePlus = \p,cl -> { s = \\t,a,b => - let - c = cl.s ! t ! a ! b + let + c = cl.s ! t ! a ! b in case p of { 0 => {subj = c.subj ++ gi ; fin = c.fin ; inf = c.inf ; -- Jussikin nukkuu @@ -354,37 +354,37 @@ oper } } ; - insertObjClausePlus : Predef.Ints 1 -> Bool -> (Polarity => Str) -> ClausePlus -> ClausePlus = - \p,ifKin,obj,cl -> { + insertObjClausePlus : Predef.Ints 1 -> Bool -> (Polarity => Str) -> ClausePlus -> ClausePlus = + \p,ifKin,obj,cl -> { s = \\t,a,b => - let + let c = cl.s ! t ! a ! b ; co = obj ! b ++ if_then_Str ifKin (kin b) [] ; in case p of { - 0 => {subj = c.subj ; fin = c.fin ; inf = c.inf ; + 0 => {subj = c.subj ; fin = c.fin ; inf = c.inf ; compl = co ; p = c.p ; adv = c.compl ++ c.adv ; ext = c.ext ; h = c.h} ; -- Jussi juo maitoakin - 1 => {subj = c.subj ; fin = c.fin ; inf = c.inf ; + 1 => {subj = c.subj ; fin = c.fin ; inf = c.inf ; compl = c.compl ; p = c.p ; adv = co ; ext = c.adv ++ c.ext ; h = c.h} -- Jussi nukkuu nytkin } } ; - kin : Polarity -> Str = + kin : Polarity -> Str = \p -> case p of {Pos => "gi" ; Neg => "gi"} ; - - --allomorph "ki", depends only on phonetic rules "üks+ki", "ühe+gi" + + --allomorph "ki", depends only on phonetic rules "üks+ki", "ühe+gi" --waiting for post construction in GF :P gi : Str = "gi" ; -- This is used for subjects of passives: therefore isFin in False. - subjForm : NP -> NPForm -> Polarity -> Str = \np,sc,b -> + subjForm : NP -> NPForm -> Polarity -> Str = \np,sc,b -> appCompl False b {s = [] ; c = sc ; isPre = True} np ; infVP : NPForm -> Polarity -> Agr -> VP -> InfForm -> Str = infVPAnt Simul ; infVPAnt : Anteriority -> NPForm -> Polarity -> Agr -> VP -> InfForm -> Str = \ant,sc,pol,agr,vp,vi -> - let + let fin = case sc of { -- subject case NPCase Nom => True ; -- mina tahan joosta _ => False -- minul peab auto olema @@ -399,12 +399,12 @@ oper --TODO adv placement? --TODO inf ++ fin or fin ++ inf? does it ever become a case here? --- The definitions below were moved here from $MorphoEst$ so that +-- The definitions below were moved here from $MorphoEst$ so that -- auxiliary of predication can be defined. - verbOlema : Verb = + verbOlema : Verb = let olema = mkVerb - "olema" "olla" "olen" "ollakse" + "olema" "olla" "olen" "ollakse" "olge" "oli" "olnud" "oldud" in {s = table { Presn _ P3 => "on" ; @@ -413,9 +413,9 @@ oper p = [] } ; - verbMinema : Verb = - let minema = mkVerb - "minema" "minna" "läheb" "minnakse" + verbMinema : Verb = + let minema = mkVerb + "minema" "minna" "läheb" "minnakse" "minge" "läks" "läinud" "mindud" in {s = table { Impf Sg P1 => "läksin" ; @@ -428,20 +428,20 @@ oper } ; p = [] } ; - + --3 Verbs --Auxiliary for internal use - mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> Verb = - \tulema,tulla,tuleb,tullakse,tulge,tuli,tulnud,tuldud -> - vforms2V (vForms8 + mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> Verb = + \tulema,tulla,tuleb,tullakse,tulge,tuli,tulnud,tuldud -> + vforms2V (vForms8 tulema tulla tuleb tullakse tulge tuli tulnud tuldud ) ; --below moved here from MorphoEst VForms : Type = Predef.Ints 7 => Str ; - + vForms8 : (x1,_,_,_,_,_,_,x8 : Str) -> VForms = \tulema,tulla,tuleb,tullakse,tulge,tuli,tulnud,tuldud -> table { @@ -455,34 +455,34 @@ oper 7 => tuldud } ; - vforms2V : VForms -> Verb = \vh -> + vforms2V : VForms -> Verb = \vh -> let - tulema = vh ! 0 ; - tulla = vh ! 1 ; - tuleb = vh ! 2 ; - tullakse = vh ! 3 ; --juuakse; loetakse - tulge = vh ! 4 ; --necessary for tulla, surra (otherwise *tulege, *surege) + tulema = vh ! 0 ; + tulla = vh ! 1 ; + tuleb = vh ! 2 ; + tullakse = vh ! 3 ; --juuakse; loetakse + tulge = vh ! 4 ; --necessary for tulla, surra (otherwise *tulege, *surege) tuli = vh ! 5 ; --necessary for jooma-juua-jõi tulnud = vh ! 6 ; tuldud = vh ! 7 ; --necessary for t/d in tuldi; loeti - + tull_ = init tulla ; --juu(a); saad(a); tull(a); tulles = tull_ + "es" ; --juues; saades; tulles; - + tule_ = init tuleb ; - + lask_ = Predef.tk 2 tulema ; laulev = case (last lask_) of { --sooma~soov ; laulma~laulev ("a"|"e"|"i"|"o"|"u"|"õ"|"ä"|"ö"|"ü") => lask_ + "v" ; _ => lask_ + "ev" } ; --consonant stem in -ma, add e - + --imperfect stem kaisi_ = case (Predef.dp 3 tuli) of { "sis" => lask_ + "i" ; --tõusin, tõusis _ + "i" => tuli ; --jõin, jõi _ => lask_ + "si" --käisin, käis; muutsin, muutis - }; - + }; + tuld_ = Predef.tk 2 tuldud ; --d/t choice for tuldi etc. tulgu = (init tulge) + "u" ; in @@ -510,13 +510,13 @@ oper ConditPass => tuld_ + "aks" ; --# notpresent Imper Sg => tule_ ; -- tule / ära tule Imper Pl => tulge ; -- tulge / ärge tulge - ImperP3 => tulgu ; -- tulgu (ta/nad) + ImperP3 => tulgu ; -- tulgu (ta/nad) ImperP1Pl => tulge + "m" ; -- tulgem ImperPass => tuld_ + "agu" ; --tuldagu PassPresn True => tullakse ; PassPresn False => tuld_ + "a" ; --da or ta PassImpf True => tuld_ + "i" ; --di or ti - PassImpf False => tuldud ; + PassImpf False => tuldud ; Quotative Act => lask_ + "vat" ; Quotative Pass => tuld_ + "avat" ; --d or t PresPart Act => laulev ; @@ -527,10 +527,10 @@ oper Inf InfMas => tulema + "s" ; Inf InfMast => tulema + "st" ; Inf InfMata => tulema + "ta" ; - Inf InfMaks => tulema + "ks" + Inf InfMaks => tulema + "ks" } ; sc = NPCase Nom ; - p = [] + p = [] } ; -- For regular verbs, paradigm from 4 base forms @@ -547,12 +547,12 @@ oper "t" => "k" ; _ => "g" } ; - toit_ = case (last vestle_) of { + toit_ = case (last vestle_) of { ("t"|"d") => vesteld_ ; --toit(ma) -> toitke; _ => vestel_ --vestle(ma) -> vestelge } ; - laski_ = case (last vestle_) of { - ("a"|"e"|"i"|"o"|"u"|"õ"|"ä"|"ö"|"ü") + laski_ = case (last vestle_) of { + ("a"|"e"|"i"|"o"|"u"|"õ"|"ä"|"ö"|"ü") => vestle_ ; --vestle(ma) -> vestles _ => vestle_ + "i" --lask(ma) -> laskis } ; @@ -566,7 +566,7 @@ oper (laski_ + "s") --ma: kindla kõneviisi lihtmineviku pöörded; (toit_ + "nud") --da: isikulise tegumoe mineviku kesksõna (jaet_ + "ud"); --takse: ülejäänud umbisikulise tgm vormid - + regVerb : (_,_,_,_ : Str) -> Verb = \kinkima,kinkida,kingib,kingitakse -> vforms2V (regVForms kinkima kinkida kingib kingitakse) ; @@ -580,8 +580,8 @@ oper -- parem -> paremini -- parim -> kõige paremini | parimalt? noun2adjComp : Bool -> Noun -> Adj = \isPos,tuore -> - let - tuoreesti = Predef.tk 1 (tuore.s ! NCase Sg Gen) + "sti" ; + let + tuoreesti = Predef.tk 1 (tuore.s ! NCase Sg Gen) + "sti" ; tuoreemmin = Predef.tk 2 (tuore.s ! NCase Sg Gen) + "in" in {s = table { AN f => tuore.s ! f ; @@ -602,21 +602,21 @@ oper compAP = icompAP [] ; icompAP : Str -> {s : Bool => NForm => Str} -> {s : Agr => Str} = \kui,ap -> - { s = \\agr => - let n = complNumAgr agr ; + { s = \\agr => + let n = complNumAgr agr ; in kui ++ ap.s ! False ! NCase n Nom } ; - - compCN : Noun -> {s : Agr => Str} = \cn -> - { s = \\agr => - let n = complNumAgr agr ; + + compCN : Noun -> {s : Agr => Str} = \cn -> + { s = \\agr => + let n = complNumAgr agr ; in cn.s ! NCase n Nom } ; --- Reflexive pronoun. +-- Reflexive pronoun. --- Possessive could be shared with the more general $NounFin.DetCN$. - reflPron : Agr -> NP = \agr -> - let + reflPron : Agr -> NP = \agr -> + let ise = nForms2N (nForms6 "ise" "enda" "ennast" "endasse" "endi" "endid") ; n = case agr of { AgPol => Sg ; @@ -638,7 +638,7 @@ oper NForms : Type = Predef.Ints 5 => Str ; - nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms = + nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms = \jogi,joe,joge,joesse, -- sg nom, gen, part, ill jogede,jogesid -> table { -- pl gen, part, 0 => jogi ; @@ -646,7 +646,7 @@ oper 2 => joge ; 3 => joesse ; 4 => jogede ; - 5 => jogesid + 5 => jogesid } ; n2nforms : Noun -> NForms = \ukko -> table { @@ -655,12 +655,12 @@ oper 2 => ukko.s ! NCase Sg Part ; 3 => ukko.s ! NCase Sg Illat ; 4 => ukko.s ! NCase Pl Gen ; - 5 => ukko.s ! NCase Pl Part + 5 => ukko.s ! NCase Pl Part } ; -- Converts 6 given strings (Nom, Gen, Part, Illat, Gen, Part) into Noun -- http://www.eki.ee/books/ekk09/index.php?p=3&p1=5&id=226 - nForms2N : NForms -> Noun = \f -> + nForms2N : NForms -> Noun = \f -> let jogi = f ! 0 ; joe = f ! 1 ; @@ -668,7 +668,7 @@ oper joesse = f ! 3 ; jogede = f ! 4 ; jogesid = f ! 5 ; - in + in {s = table { NCase Sg Nom => jogi ; NCase Sg Gen => joe ; @@ -698,7 +698,7 @@ oper NCase Pl Allat => jogede + "le" ; NCase Pl Abess => jogede + "ta" ; NCase Pl Comit => jogede + "ga" ; - NCase Pl Termin => jogede + "ni" + NCase Pl Termin => jogede + "ni" } --; -- lock_N = <> @@ -721,9 +721,9 @@ oper isDef : Bool } ; - heavyQuant : PQuant -> PQuant ** {sp : Number => Case => Str} = \d -> - d ** {sp = d.s} ; - PQuant : Type = - {s : Number => Case => Str ; isDef : Bool} ; + heavyQuant : PQuant -> PQuant ** {sp : Number => Case => Str} = \d -> + d ** {sp = d.s} ; + PQuant : Type = + {s : Number => Case => Str ; isDef : Bool} ; } diff --git a/src/estonian/SentenceEst.gf b/src/estonian/SentenceEst.gf index 4d5f6f3c..f14b1e96 100644 --- a/src/estonian/SentenceEst.gf +++ b/src/estonian/SentenceEst.gf @@ -9,17 +9,17 @@ concrete SentenceEst of Sentence = CatEst ** open Prelude, ResEst in { PredSCVP sc vp = mkClause (\_ -> sc.s) (agrP3 Sg) vp ; ImpVP vp = { - s = \\pol,agr => - let + s = \\pol,agr => + let verb = vp.s ! VIImper ! Simul ! pol ! agr ; compl = vp.s2 ! False ! pol ! agr ++ vp.ext --- False = like inf (osta auto) in --(ära) loe raamat(ut) läbi - verb.fin ++ verb.inf ++ compl ++ vp.p ; + verb.fin ++ verb.inf ++ compl ++ vp.p ; } ; -- The object case is formed at the use site of $c2$, in $Relative$ and $Question$. - SlashVP np vp = { + SlashVP np vp = { s = \\t,a,p => (mkClause (subjForm np vp.sc) np.a vp).s ! t ! a ! p ! SDecl ; c2 = vp.c2 } ; @@ -30,13 +30,13 @@ concrete SentenceEst of Sentence = CatEst ** open Prelude, ResEst in { } ; SlashPrep cl prep = { - s = \\t,a,p => cl.s ! t ! a ! p ! SDecl ; + s = \\t,a,p => cl.s ! t ! a ! p ! SDecl ; c2 = prep } ; - SlashVS np vs slash = { - s = \\t,a,p => - (mkClause (subjForm np vs.sc) np.a + SlashVS np vs slash = { + s = \\t,a,p => + (mkClause (subjForm np vs.sc) np.a (insertExtrapos (etta_Conj ++ slash.s) (predV vs)) ).s ! t ! a ! p ! SDecl ; diff --git a/src/estonian/SymbolEst.gf b/src/estonian/SymbolEst.gf index 3517d511..0d1000a6 100644 --- a/src/estonian/SymbolEst.gf +++ b/src/estonian/SymbolEst.gf @@ -29,7 +29,7 @@ lin SymbNum n = {s = \\_,_ => n.s ; isNum = True ; n = Pl} ; SymbOrd n = {s = \\_ => glue n.s "."} ; -lincat +lincat Symb, [Symb] = SS ; diff --git a/src/estonian/TerminologyEst.gf b/src/estonian/TerminologyEst.gf index 75344a2c..4eb04c7f 100644 --- a/src/estonian/TerminologyEst.gf +++ b/src/estonian/TerminologyEst.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common -concrete TerminologyEst of Terminology = CatEst ** open +concrete TerminologyEst of Terminology = CatEst ** open ResEst, ParadigmsEst, (G = GrammarEst), @@ -17,9 +17,9 @@ lincat ParameterType = G.N ; Parameter = G.N ; Modifier = G.A ; - + Heading = {s : Str} ; - + lin noun_Category = mkN "käändsõna" ; @@ -59,7 +59,7 @@ lin active_Parameter = mkN "isikuline tegumood" ; passive_Parameter = mkN "umbsikuline tegumood" ; - + imperative_Parameter = mkN "käskiv kõneviis" "käskiva kõneviisi"; indicative_Parameter = mkN "kindel kõneviis" "kindla kõneviisi"; conjunctive_Parameter = mkN "konjunktiiv" ; @@ -67,7 +67,7 @@ lin present_Parameter = mkN "olevik" ; past_Parameter = mkN "lihtminevik" ; - future_Parameter = mkN "futuur" ; ---- ??? + future_Parameter = mkN "futuur" ; ---- ??? conditional_Parameter = mkN "tingiv kõneviis" "tingiva kõneviisi"; perfect_Parameter = mkN "täisminevik" ; quotative_Parameter = mkN "kaudne kõneviis" "kaudse kõneviisi"; diff --git a/src/estonian/VerbEst.gf b/src/estonian/VerbEst.gf index 7f54194a..3c8344a3 100644 --- a/src/estonian/VerbEst.gf +++ b/src/estonian/VerbEst.gf @@ -9,17 +9,17 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { SlashV2a v = predV v ** {c2 = v.c2} ; - Slash2V3 v np = - insertObj + Slash2V3 v np = + insertObj (\\fin,b,_ => appCompl fin b v.c2 np) (predV v) ** {c2 = v.c3} ; - Slash3V3 v np = - insertObj + Slash3V3 v np = + insertObj (\\fin,b,_ => appCompl fin b v.c3 np) (predV v) ** {c2 = v.c2} ; - ComplVV v vp = - insertObj - (\\_,b,a => infVP v.sc b a vp v.vi) - (predV {s = v.s ; + ComplVV v vp = + insertObj + (\\_,b,a => infVP v.sc b a vp v.vi) + (predV {s = v.s ; p = v.p ; sc = case vp.sc of { NPCase Nom => v.sc ; -- minul tuleb kirjutada (VV 'tulema' determines the subject case) @@ -30,47 +30,47 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { ComplVS v s = insertExtrapos (etta_Conj ++ s.s) (predV v) ; ComplVQ v q = insertExtrapos ( q.s) (predV v) ; - ComplVA v ap = - insertObj - (\\_,b,agr => + ComplVA v ap = + insertObj + (\\_,b,agr => let n = (complNumAgr agr) in ap.s ! False ! (NCase n (npform2case n v.c2.c))) --- v.cs.s ignored (predV v) ; - SlashV2S v s = + SlashV2S v s = insertExtrapos (etta_Conj ++ s.s) (predV v) ** {c2 = v.c2} ; - SlashV2Q v q = + SlashV2Q v q = insertExtrapos (q.s) (predV v) ** {c2 = v.c2} ; - SlashV2V v vp = + SlashV2V v vp = insertObj (\\_,b,a => infVP v.sc b a vp v.vi) (predV v) ** {c2 = v.c2} ; ---- different infinitives - SlashV2A v ap = - insertObj - (\\fin,b,_ => + SlashV2A v ap = + insertObj + (\\fin,b,_ => ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c))) ----agr to obj (predV v) ** {c2 = v.c2} ; ComplSlash vp np = insertObjPre (\\fin,b,_ => appCompl fin b vp.c2 np) vp ; - UseComp comp = + UseComp comp = insertObj (\\_,_ => comp.s) (predV (verbOlema ** {sc = NPCase Nom})) ; - SlashVV v vp = - insertObj - (\\_,b,a => infVP v.sc b a vp v.vi) - (predV {s = v.s ; + SlashVV v vp = + insertObj + (\\_,b,a => infVP v.sc b a vp v.vi) + (predV {s = v.s ; p = v.p ; sc = case vp.sc of { NPCase Nom => v.sc ; -- minun täytyy pestä auto c => c -- minulla täytyy olla auto - } + } } ) ** {c2 = vp.c2} ; ---- correct ?? - SlashV2VNP v np vp = - insertObjPre + SlashV2VNP v np vp = + insertObjPre (\\fin,b,a => appCompl True b v.c2 np ++ ---- fin -> stack overflow - infVP v.sc b a vp v.vi) + infVP v.sc b a vp v.vi) (predV v) ** {c2 = vp.c2} ; AdvVP vp adv = insertAdv adv.s vp ; @@ -91,7 +91,7 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { ----b UseVS, UseVQ = \v -> v ** {c2 = {s = [] ; c = NPAcc ; isPre = True}} ; - CompAP = compAP ; + CompAP = compAP ; CompCN = compCN ; CompNP np = {s = \\_ => np.s ! NPCase Nom} ; CompAdv a = {s = \\_ => a.s} ; @@ -102,17 +102,17 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { --2 The object case -- -- The rules involved are ComplV2 and ComplVV above. --- The work is done jointly in ResEst.infVP and appCompl. +-- The work is done jointly in ResEst.infVP and appCompl. -- Cases to test: l -table (to see negated forms) --``` -- minun täytyy ostaa auto --- PredVP (UsePron i_Pron) (ComplVV must_VV +-- PredVP (UsePron i_Pron) (ComplVV must_VV -- (ComplV2 buy_V2 (DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN car_N)))) -- minä tahdon ostaa auton --- PredVP (UsePron i_Pron) (ComplVV want_VV +-- PredVP (UsePron i_Pron) (ComplVV want_VV -- (ComplV2 buy_V2 (DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN car_N)))) -- minulla täytyy olla auto --- PredVP (UsePron i_Pron) (ComplVV must_VV +-- PredVP (UsePron i_Pron) (ComplVV must_VV -- (ComplV2 have_V2 (DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN car_N)))) --``` -- Unfortunately, there is no nice way to say "I want to have a car". From 21259015e0982c18c5a4f44ff2ada7a1c95c0f4d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 13 Apr 2022 11:37:25 +0800 Subject: [PATCH 73/92] (Est) Reduce inflection table in VP Include VForms in VP, only construct VPForms when making Cl --- src/estonian/CatEst.gf | 19 ++++--- src/estonian/ExtendEst.gf | 2 +- src/estonian/ExtraEst.gf | 2 +- src/estonian/IdiomEst.gf | 15 ++---- src/estonian/ResEst.gf | 105 ++++++++++++++++++++++-------------- src/estonian/SentenceEst.gf | 2 +- src/estonian/VerbEst.gf | 8 +-- 7 files changed, 83 insertions(+), 70 deletions(-) diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index 6207874f..29c85753 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -80,21 +80,24 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { -- Open lexical classes, e.g. Lexicon V, VS, VQ = Verb1 ; -- = {s : VForm => Str ; sc : Case} ; - V2, VA, V2Q, V2S = Verb1 ** {c2 : Compl} ; - V2A = Verb1 ** {c2, c3 : Compl} ; - VV = Verb1 ** {vi : InfForm} ; ---- infinitive form - V2V = Verb1 ** {c2 : Compl ; vi : InfForm} ; ---- infinitive form - V3 = Verb1 ** {c2, c3 : Compl} ; + V2, VA, V2Q, V2S = Verb2 ; + V2A, V3 = Verb3 ; + VV = Verb1 ** {vi : InfForm} ; + V2V = Verb2 ** {vi : InfForm} ; -- infinitive form A = Adjective ** {infl : Infl} ; A2 = A ** {c2 : Compl} ; N = Noun ; - N2 = Noun ** {c2 : Compl ; isPre : Bool ; lock_N2 : {}} ; - N3 = Noun ** {c2,c3 : Compl ; isPre,isPre2 : Bool ; lock_N3 : {}} ; + N2 = Noun ** {c2 : Compl ; isPre : Bool} ; + N3 = Noun ** {c2,c3 : Compl ; isPre,isPre2 : Bool} ; PN = {s : Case => Str} ; -oper Verb1 = Verb ** { sc : NPForm} ; --what is this for? --subject case, i.e. "ma näen kassi"/"mul on kass" + linref + VP = \vp -> linV vp.v ; + V,VS,VQ = linV ; + V2,VA,V2S,V2Q = linV2 ; + } diff --git a/src/estonian/ExtendEst.gf b/src/estonian/ExtendEst.gf index 1103c5b7..0e3c230e 100644 --- a/src/estonian/ExtendEst.gf +++ b/src/estonian/ExtendEst.gf @@ -395,7 +395,7 @@ concrete ExtendEst of Extend = vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut ++ vp.adv -- paremini ++ vp.p -- ära - ++ (vp.s ! vif ! Simul ! Pos ! agrP3 Sg).fin -- tunda/tundes/tundmata/... + ++ (mkVPForms vp.v ! vif ! Simul ! Pos ! agrP3 Sg).fin -- tunda/tundes/tundmata/... ++ vp.ext ; --------------------------------- diff --git a/src/estonian/ExtraEst.gf b/src/estonian/ExtraEst.gf index 16ba9ea7..63d32741 100644 --- a/src/estonian/ExtraEst.gf +++ b/src/estonian/ExtraEst.gf @@ -60,7 +60,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** } ; MkVPS t p vp = { -- Temp -> Pol -> VP -> VPS ; - s = \\a => let vps = vp.s ! VIFin t.t ! t.a ! p.p ! a + s = \\a => let vps = mkVPForms vp.v ! VIFin t.t ! t.a ! p.p ! a in t.s ++ p.s ++ vps.fin ++ vps.inf ++ diff --git a/src/estonian/IdiomEst.gf b/src/estonian/IdiomEst.gf index c4e3657a..a57c8964 100644 --- a/src/estonian/IdiomEst.gf +++ b/src/estonian/IdiomEst.gf @@ -39,21 +39,14 @@ concrete IdiomEst of Idiom = CatEst ** ImpersCl vp = mkClause noSubj (agrP3 Sg) vp ; - GenericCl vp = mkClause noSubj (agrP3 Sg) { - s = \\_ => vp.s ! VIPass Pres ; - s2 = vp.s2 ; - adv = vp.adv ; - p = vp.p ; - ext = vp.ext ; - sc = vp.sc ; - } ; + GenericCl vp = mkClause noSubj (agrP3 Sg) (passiveVP vp) ; ProgrVP vp = let - inf = (vp.s ! VIInf InfMas ! Simul ! Pos ! agrP3 Sg).fin ; + inf = (mkVPForms vp.v ! VIInf InfMas ! Simul ! Pos ! agrP3 Sg).fin ; on = predV olla in { - s = on.s ; + v = verbOlema ; s2 = \\b,p,a => vp.s2 ! b ! p ! a ++ inf ; adv = vp.adv ; p = vp.p ; @@ -65,7 +58,7 @@ concrete IdiomEst of Idiom = CatEst ** -- The imperative is not available in a $VP$. ImpPl1 vp = - let vps = vp.s ! VIPass Pres ! Simul ! Pos ! Ag Pl P1 + let vps = mkVPForms vp.v ! VIPass Pres ! Simul ! Pos ! Ag Pl P1 in {s = vps.fin ++ vps.inf ++ vp.s2 ! True ! Pos ! Ag Pl P1 ++ vp.p ++ vp.ext diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index 1e123dd4..cbcece30 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -176,6 +176,13 @@ param p : Str -- particle verbs } ; + Verb1 : Type = Verb ** {sc : NPForm} ; --subject case, i.e. "ma näen kassi"/"mul on kass" + Verb2 : Type = Verb1 ** {c2 : Compl} ; + Verb3 : Type = Verb2 ** {c3 : Compl} ; + + linV : Verb -> Str = \v -> v.s ! Inf InfMa ++ v.p ; + linV2 : Verb -> Str = \v -> v.s ! Inf InfMa ++ v.p ; + param VIForm = VIFin Tense @@ -187,7 +194,7 @@ param oper VP : Type = { - s : VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ; + v : Verb ; s2 : Bool => Polarity => Agr => Str ; -- raamat/raamatu/raamatut adv : Str ; p : Str ; --uninflecting component in multi-word verbs @@ -195,48 +202,63 @@ oper sc : NPForm ; } ; - predV : (Verb ** {sc : NPForm}) -> VP = \verb -> { - s = \\vi,ant,b,agr0 => - let - agr = verbAgr agr0 ; - verbs = verb.s ; - part : Str = case vi of { - VIPass _ => verbs ! (PastPart Pass) ; - _ => verbs ! (PastPart Act) - } ; + passiveVerb : Verb -> Verb = \verb -> verb ** { + s = table { + Presn _ _ => verb.s ! PassPresn True ; + Impf _ _ => verb.s ! PassImpf True ; --# notpresent + Condit _ _ => verb.s ! ConditPass ; --# notpresent + ImperP3|ImperP1Pl|Imper _ => verb.s ! ImperPass ; + PresPart _ => verb.s ! PresPart Pass ; + PastPart _ => verb.s ! PastPart Pass ; + x => verb.s ! x } + } ; - einegole : Str * Str * Str = case of { - => <"ei", verbs ! Imper Sg, "ole"> ; - => <"ei", verbs ! Imper Sg, "ole"> ; - => <"ei", verbs ! Condit Sg P3, "oleks"> ; - => <"ei", part, "olnud"> ; - => <"ära", verbs ! Imper Sg, "ole"> ; - => <"ärge", verbs ! Imper Pl, "olge"> ; - => <"ei", verbs ! PassPresn False, "ole"> ; - => <"ei", verbs ! PassPresn False, "ole"> ; --# notpresent - => <"ei", verbs ! ConditPass, "oleks"> ; --# notpresent - => <"ei", verbs ! PassImpf False, "olnud"> ; --# notpresent - => <"ei", verbs ! PresPart Act, "olev"> ; --# notpresent - => <"ei", verbs ! Inf i, verbOlema.s ! Inf i> + -- NB. only chooses passive verb forms, to get subject case need compl2subjcase, used in PassV2 + passiveVP : VP -> VP = \vp -> vp ** {v = passiveVerb vp.v} ; - } ; + VPForms : Type = VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ; - ei : Str = einegole.p1 ; - neg : Str = einegole.p2 ; - ole : Str = einegole.p3 ; + mkVPForms : Verb -> VPForms = \verb -> \\vi,ant,b,agr0 => + let + agr = verbAgr agr0 ; + verbs = verb.s ; + part : Str = case vi of { + VIPass _ => verbs ! PastPart Pass ; + _ => verbs ! PastPart Act + } ; - olema : VForm => Str = verbOlema.s ; + einegole : Str * Str * Str = case of { + => <"ei", verbs ! Imper Sg, "ole"> ; + => <"ei", verbs ! Imper Sg, "ole"> ; + => <"ei", verbs ! Condit Sg P3, "oleks"> ; + => <"ei", part, "olnud"> ; + => <"ära", verbs ! Imper Sg, "ole"> ; + => <"ärge", verbs ! Imper Pl, "olge"> ; + => <"ei", verbs ! PassPresn False, "ole"> ; + => <"ei", verbs ! PassPresn False, "ole"> ; --# notpresent + => <"ei", verbs ! ConditPass, "oleks"> ; --# notpresent + => <"ei", verbs ! PassImpf False, "olnud"> ; --# notpresent + => <"ei", verbs ! PresPart Act, "olev"> ; --# notpresent + => <"ei", verbs ! Inf i, verbOlema.s ! Inf i> - vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ; + } ; - mkvf : VForm -> {fin, inf : Str} = \p -> case of { - => vf (verbs ! p) [] ; - => vf (olema ! p) part ; - => vf (ei ++ neg) [] ; - => vf (ei ++ ole) part - } ; + ei : Str = einegole.p1 ; + neg : Str = einegole.p2 ; + ole : Str = einegole.p3 ; - passPol = case b of {Pos => True ; Neg => False} ; + olema : VForm => Str = verbOlema.s ; + + vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ; + + mkvf : VForm -> {fin, inf : Str} = \p -> case of { + => vf (verbs ! p) [] ; + => vf (olema ! p) part ; + => vf (ei ++ neg) [] ; + => vf (ei ++ ole) part + } ; + + passPol = case b of {Pos => True ; Neg => False} ; in case vi of { VIFin Past => mkvf (Impf agr.n agr.p) ; --# notpresent @@ -252,6 +274,8 @@ oper VIInf i => mkvf (Inf i) } ; + predV : Verb1 -> VP = \verb -> { + v = verb ; -- ignoring the subject s2 = \\_,_,_ => [] ; adv = [] ; ext = [] ; --relative clause @@ -329,7 +353,7 @@ oper NPCase Nom => ; _ => -- minule meeldib, minul on } ; - verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ; + verb = mkVPForms vp.v ! VIFin t ! a ! b ! agrfin.p1 ; in {subj = sub b ; fin = verb.fin ; inf = verb.inf ; @@ -389,7 +413,7 @@ oper NPCase Nom => True ; -- mina tahan joosta _ => False -- minul peab auto olema } ; - verb = vp.s ! VIInf vi ! ant ! Pos ! agr ; -- no "ei" + verb = mkVPForms vp.v ! VIInf vi ! ant ! Pos ! agr ; -- no "ei" compl = vp.s2 ! fin ! pol ! agr ; -- but compl. case propagated adv = vp.adv in @@ -590,8 +614,7 @@ oper } ; } ; - Noun = {s : NForm => Str} ; - + Noun : Type = {s : NForm => Str} ; -- To form an adjective, it is usually enough to give a noun declension: the -- adverbial form is regular. @@ -660,7 +683,7 @@ oper -- Converts 6 given strings (Nom, Gen, Part, Illat, Gen, Part) into Noun -- http://www.eki.ee/books/ekk09/index.php?p=3&p1=5&id=226 - nForms2N : NForms -> Noun = \f -> + nForms2N : NForms -> Noun = \f -> let jogi = f ! 0 ; joe = f ! 1 ; diff --git a/src/estonian/SentenceEst.gf b/src/estonian/SentenceEst.gf index f14b1e96..7209fc20 100644 --- a/src/estonian/SentenceEst.gf +++ b/src/estonian/SentenceEst.gf @@ -11,7 +11,7 @@ concrete SentenceEst of Sentence = CatEst ** open Prelude, ResEst in { ImpVP vp = { s = \\pol,agr => let - verb = vp.s ! VIImper ! Simul ! pol ! agr ; + verb = mkVPForms vp.v ! VIImper ! Simul ! pol ! agr ; compl = vp.s2 ! False ! pol ! agr ++ vp.ext --- False = like inf (osta auto) in --(ära) loe raamat(ut) läbi verb.fin ++ verb.inf ++ compl ++ vp.p ; diff --git a/src/estonian/VerbEst.gf b/src/estonian/VerbEst.gf index 3c8344a3..3f5f0c3d 100644 --- a/src/estonian/VerbEst.gf +++ b/src/estonian/VerbEst.gf @@ -79,13 +79,7 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { ReflVP v = insertObjPre (\\fin,b,agr => appCompl fin b v.c2 (reflPron agr)) v ; - PassV2 v = - let vp = predV v in vp ** { - s = \\vf => case vf of { - VIFin t => vp.s ! VIPass t ; - -- VIImper => v.s ! ImperPass ; -- TODO: include these forms from V into VP - -- VIPresPart => v.s ! PresPart Pass ; - x => vp.s ! x } ; + PassV2 v = let vp : VP = passiveVP (predV v) in vp ** { sc = compl2subjcase v.c2 -- koer valitakse ; koerale räägitakse } ; From b2cc67aef50edfa1bcb9f2eeede8ce9e665f4ace Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 13 Apr 2022 17:27:14 +0800 Subject: [PATCH 74/92] (Est) Fix negative passive TODO: more stable solution? conneg in Imper Sg is a bit of a hack --- src/estonian/ResEst.gf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index cbcece30..c6ce9643 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -204,12 +204,13 @@ oper passiveVerb : Verb -> Verb = \verb -> verb ** { s = table { - Presn _ _ => verb.s ! PassPresn True ; + Presn _ _ => verb.s ! PassPresn True ; Impf _ _ => verb.s ! PassImpf True ; --# notpresent Condit _ _ => verb.s ! ConditPass ; --# notpresent - ImperP3|ImperP1Pl|Imper _ => verb.s ! ImperPass ; - PresPart _ => verb.s ! PresPart Pass ; - PastPart _ => verb.s ! PastPart Pass ; + ImperP3 => verb.s ! ImperPass ; + Imper Sg => verb.s ! PassPresn False ; -- weird hack, because the Imper Sg field is used for negative form; if VP undergoes PassV*, then its negation should also be in passive. + PresPart _ => verb.s ! PresPart Pass ; + PastPart _ => verb.s ! PastPart Pass ; x => verb.s ! x } } ; From 0bae53b0b922c5d14ef932dcba7fd0d5484ed724 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 13 Apr 2022 17:38:17 +0800 Subject: [PATCH 75/92] (Est) 7 InfForms -> 2 stems + gluing suffixes --- src/estonian/CatEst.gf | 4 +- src/estonian/DocumentationEstFunctor.gf | 19 ++++--- src/estonian/ExtendEst.gf | 57 ++++++++++----------- src/estonian/ExtraEst.gf | 20 +++++--- src/estonian/IdiomEst.gf | 16 ++---- src/estonian/ParadigmsEst.gf | 10 +++- src/estonian/PhraseEst.gf | 2 +- src/estonian/ResEst.gf | 67 ++++++++++++++----------- 8 files changed, 104 insertions(+), 91 deletions(-) diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index 29c85753..0b8b5cc6 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -82,8 +82,8 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { V, VS, VQ = Verb1 ; -- = {s : VForm => Str ; sc : Case} ; V2, VA, V2Q, V2S = Verb2 ; V2A, V3 = Verb3 ; - VV = Verb1 ** {vi : InfForm} ; - V2V = Verb2 ** {vi : InfForm} ; -- infinitive form + VV = Verb1 ** {vi : InfForms} ; + V2V = Verb2 ** {vi : InfForms} ; A = Adjective ** {infl : Infl} ; A2 = A ** {c2 : Compl} ; diff --git a/src/estonian/DocumentationEstFunctor.gf b/src/estonian/DocumentationEstFunctor.gf index a8e68343..a40affde 100644 --- a/src/estonian/DocumentationEstFunctor.gf +++ b/src/estonian/DocumentationEstFunctor.gf @@ -142,6 +142,8 @@ oper --verb = sverb2verbSep verb0 ; vfin : ResEst.VForm -> Str = \f -> verb.s ! f ; + vinf : ResEst.InfForms -> Str = \if -> + applyInfFormsV if verb.s ; nounNounHeading : Parameter -> Parameter -> Str = \n1,n2 -> (S.mkUtt (G.PossNP (S.mkCN n1) (S.mkNP n2))).s ; @@ -218,15 +220,16 @@ oper heading3 (heading infinitive_Parameter) ++ frameTable ( tr (intagAttr "th" "rowspan=2" "da" ++ - th (heading nominative_Parameter) ++ td (vfin (Inf InfDa))) ++ - tr (th (heading inessive_Parameter) ++ td (vfin (Inf InfDes))) ++ + th (heading nominative_Parameter) ++ td (vinf InfDa)) ++ + tr (th (heading inessive_Parameter) ++ td (vinf InfDes)) ++ - tr (intagAttr "th" "rowspan=5" "ma" ++ - th (heading illative_Parameter) ++ td (vfin (Inf InfMa))) ++ - tr (th (heading inessive_Parameter) ++ td (vfin (Inf InfMas))) ++ - tr (th (heading elative_Parameter) ++ td (vfin (Inf InfMast))) ++ - tr (th (heading abessive_Parameter) ++ td (vfin (Inf InfMata))) ++ - tr (th (heading translative_Parameter) ++ td (vfin (Inf InfMaks))) + tr (intagAttr "th" "rowspan=6" "ma" ++ + th (heading illative_Parameter) ++ td (vinf InfMa)) ++ + tr (th (heading inessive_Parameter) ++ td (vinf InfMas)) ++ + tr (th (heading elative_Parameter) ++ td (vinf InfMast)) ++ + tr (th (heading abessive_Parameter) ++ td (vinf InfMata)) ++ + tr (th (heading abessive_Parameter) ++ td (vinf InfMaks)) ++ + tr (th (heading translative_Parameter) ++ td (vinf InfMine)) ) ++ heading3 (heading participle_Parameter) ++ diff --git a/src/estonian/ExtendEst.gf b/src/estonian/ExtendEst.gf index 0e3c230e..c953be65 100644 --- a/src/estonian/ExtendEst.gf +++ b/src/estonian/ExtendEst.gf @@ -40,7 +40,7 @@ concrete ExtendEst of Extend = Prelude, MorphoEst, LexiconEst, - ParadigmsEst in { + ParadigmsEst in { --------------------------------- -- VPS, VPI, VPS2 + list versions @@ -176,7 +176,7 @@ concrete ExtendEst of Extend = A2VPSlash a2 = UseComp (CompAP (UseA2 a2)) ** {c2 = a2.c2} ; -- : VP -> Adv ; - ByVP vp = {s = vp2adv vp True (VIInf InfDes)} ; + ByVP = GerundAdv ; --------------------------------- -- C @@ -220,15 +220,8 @@ concrete ExtendEst of Extend = lin - {- TODO: need to change VP to get EmbedPresPart and various Gerunds to work: - 1) Add "mine" form into VP (or switch to a BIND solution and just add a stem) - 2) Change s2 in VP so that we can manipulate the complement to be in genitive! - - -- : VP -> SC ; -- looking at Mary (is fun) / filmide vaatamine (on tore) - EmbedPresPart vp = - let vpGen = vp ; --** { s2 = \\_,_,_ => vp.s2 ! True ! Pos ! } - {s = vp2adv vp True VI } ; - -} + -- : VP -> SC ; -- looking at Mary (is fun) / filmide vaatamine (on tore) / ___ga abielus olemine, + EmbedPresPart vp = {s = infVP (NPCase Gen) Pos (agrP3 Sg) vp InfMine } ; EmbedSSlash s = {s = s.s ++ s.c2.s} ; @@ -302,14 +295,13 @@ concrete ExtendEst of Extend = GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ; -- : VP -> Adv - GerundAdv vp = {s = vp2adv vp True (VIInf InfDes)} ; - + GerundAdv vp = {s = infVPdefault vp InfDes} ; -- : VP -> CN -- publishing of the document (can get a determiner) --- GerundCN vp = {} ; + GerundCN vp = {s = \\nf => infVPdefault vp InfMine} ; -- : VP -> NP -- publishing the document (by nature definite) --- GerundNP vp = {} ; + GerundNP vp = MassNP (GerundCN vp) ; --------------------------------- -- I - N @@ -322,9 +314,8 @@ concrete ExtendEst of Extend = -- : Adv -> IAdv ; -- "how often" IAdvAdv adv = { s = "kui" ++ adv.s } ; - -- : VP -> Adv - InOrderToVP vp = -- et raamatut paremini näha - { s = "et" ++ vp2adv vp True (VIInf InfDa) } ; + -- : VP -> Adv -- et raamatut paremini näha + InOrderToVP vp = {s = "et" ++ infVPdefault vp InfDa} ; -- : N2 -> VPSlash N2VPSlash n2 = UseComp (CompCN (UseN2 n2)) ** {c2 = n2.c2} ; @@ -380,7 +371,7 @@ concrete ExtendEst of Extend = in existClause noSubj (agrP3 Sg) heaOlla ; -- : IAdv -> VP -> QCl ; -- how to walk? - PredIAdvVP iadv vp = {s = \\t,a,p => iadv.s ++ vp2adv vp True (VIInf InfMa)} ; + PredIAdvVP iadv vp = {s = \\t,a,p => iadv.s ++ infVPdefault vp InfMa} ; PrepCN prep cn = PrepNP prep (MassNP cn) ; @@ -391,12 +382,19 @@ concrete ExtendEst of Extend = PurposeVP = InOrderToVP ; --- is there a difference? oper + -- calling infVP with the "default arguments": NPCase Nom, Pos, agrP3 Sg + infVPdefault : VP -> InfForms -> Str = infVP (NPCase Nom) Pos (agrP3 Sg) ; + vp2adv : R.VP -> Bool -> VIForm -> Str = \vp,sentIsPos,vif -> - vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut - ++ vp.adv -- paremini - ++ vp.p -- ära - ++ (mkVPForms vp.v ! vif ! Simul ! Pos ! agrP3 Sg).fin -- tunda/tundes/tundmata/... - ++ vp.ext ; + let vpforms : {fin,inf : Str} = case vif of { + VIInf if => applyInfFormsVP {stem=if ; suf="a"} vp ; --- this oper shouldn't be used if you want to use an InfForm but just trying to be robust here + _ => mkVPForms vp.v ! vif ! Simul ! Pos ! agrP3 Sg} ; + in vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut + ++ vp.adv -- paremini + ++ vp.p -- ära + ++ vpforms.fin -- tunda/tundes/tundmata/... + ++ vpforms.inf -- TODO is this necessary??? + ++ vp.ext ; --------------------------------- -- S - W @@ -415,14 +413,11 @@ concrete ExtendEst of Extend = UttDatIP ip = {s = ip.s ! NPCase Part} ; -- is partitive a reasonable translation? UttDatNP np = {s = np.s ! NPCase Part} ; - -- : VP -> Utt ; -- There's no "short form", so just using InfMa instead of InfDa - UttVPShort vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfMa} ; - --TODO: maybe InfMa should be default in PhraseEst and InfDa here? + -- : VP -> Utt ; -- There's no "short form", so just using InfDa instead of InfMa + UttVPShort vp = {s = infVPdefault vp InfDa} ; - - - WithoutVP vp = -- ilma raamatut nägemata - { s = "ilma" ++ vp2adv vp False (VIInf InfMata) } ; + -- : VP -> Adv ; -- ilma raamatut nägemata + WithoutVP vp = {s = "ilma" ++ infVPdefault vp InfMata} ; } diff --git a/src/estonian/ExtraEst.gf b/src/estonian/ExtraEst.gf index 63d32741..3de8e8b5 100644 --- a/src/estonian/ExtraEst.gf +++ b/src/estonian/ExtraEst.gf @@ -27,18 +27,24 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** lin CN { s = \\nf => np.s ! NPCase c ++ cn.s ! nf } ; lincat - VPI = {s : InfForm => Str} ; - [VPI] = {s1,s2 : InfForm => Str} ; + VPI = {s : InfStem => Str} ; + [VPI] = {s1,s2 : InfStem => Str} ; -- VPI = {s : Str} ; -- [VPI] = {s1,s2 : Str} ; lin - BaseVPI = twoTable InfForm ; - ConsVPI = consrTable InfForm comma ; + BaseVPI = twoTable InfStem ; + ConsVPI = consrTable InfStem comma ; - MkVPI vp = {s = \\i => infVP (NPCase Nom) Pos (agrP3 Sg) vp i} ; - ConjVPI = conjunctDistrTable InfForm ; + MkVPI vp = {s = \\i => infVPIF (NPCase Nom) Pos (agrP3 Sg) vp i} ; + ConjVPI = conjunctDistrTable InfStem ; ComplVPIVV vv vpi = - insertObj (\\_,_,_ => vpi.s ! vv.vi) (predV vv) ; + insertObj (\\_,_,_ => vpi.s ! vv.vi.stem) (predV vv) ; + + oper + -- Version that uses InfStem + infVPIF : NPForm -> Polarity -> Agr -> VP -> InfStem -> Str = \sc,pol,agr,vp,if -> + infVPAnt Simul sc pol agr vp {stem=if ; suf="a"} ; + lincat VPS = { diff --git a/src/estonian/IdiomEst.gf b/src/estonian/IdiomEst.gf index a57c8964..59c1b9ef 100644 --- a/src/estonian/IdiomEst.gf +++ b/src/estonian/IdiomEst.gf @@ -41,18 +41,10 @@ concrete IdiomEst of Idiom = CatEst ** GenericCl vp = mkClause noSubj (agrP3 Sg) (passiveVP vp) ; - ProgrVP vp = - let - inf = (mkVPForms vp.v ! VIInf InfMas ! Simul ! Pos ! agrP3 Sg).fin ; - on = predV olla - in { - v = verbOlema ; - s2 = \\b,p,a => vp.s2 ! b ! p ! a ++ inf ; - adv = vp.adv ; - p = vp.p ; - ext = vp.ext ; - sc = vp.sc ; - } ; + ProgrVP vp = vp ** { + v = verbOlema ; + s2 = \\b,p,a => vp.s2 ! b ! p ! a ++ (applyInfFormsVP InfMas vp).fin ; + } ; -- This gives "otetaan oluet" instead of "ottakaamme oluet". -- The imperative is not available in a $VP$. diff --git a/src/estonian/ParadigmsEst.gf b/src/estonian/ParadigmsEst.gf index 5f74e472..432f622f 100644 --- a/src/estonian/ParadigmsEst.gf +++ b/src/estonian/ParadigmsEst.gf @@ -27,6 +27,7 @@ resource ParadigmsEst = open (Predef=Predef), Prelude, MorphoEst, + (ResEst=ResEst), HjkEst, CatEst in { @@ -62,6 +63,8 @@ oper abessive : Case ; -- e.g. "karbita" comitative : Case ; -- e.g. "karbiga" + InfForm : Type ; + infDa : InfForm ; -- e.g. "lugeda" infDes : InfForm ; -- e.g. "lugedes" infMa : InfForm ; -- e.g. "lugema" @@ -69,6 +72,7 @@ oper infMaks : InfForm ; -- e.g. "lugemaks" infMast : InfForm ; -- e.g. "lugemast" infMata : InfForm ; -- e.g. "lugemata" + infMine : InfForm ; -- e.g. "lugemine" -- The following type is used for defining *rection*, i.e. complements -- of many-place verbs and adjective. A complement can be defined by @@ -293,8 +297,10 @@ oper abessive = Abess ; comitative = Comit ; + -- combination of stem + suffix, e.g. infDes = {stem = InfD ; suf = "es"} ; + InfForm = ResEst.InfForms ; infDa = InfDa ; infMa = InfMa ; infMast = InfMast ; - infDes = InfDes ; infMas = InfMas ; infMaks = InfMaks ; infMata = InfMata ; + infDes = InfDes ; infMas = InfMas ; infMaks = InfMaks ; infMata = InfMata ; infMine = InfMine ; prePrep : Case -> Str -> Prep = \c,p -> {c = NPCase c ; s = p ; isPre = True ; lock_Prep = <>} ; @@ -856,7 +862,7 @@ oper mkVV : V -> VV = \v -> mkVVf v infDa ; mkVV : Str -> VV = \str -> mkVVf (mkV str) infDa ; } ; - mkVVf v f = v ** {vi = f ; lock_VV = <>} ; + mkVVf v f = lin VV (v ** {vi = f}) ; mkVQ = overload { mkVQ : V -> VQ = \v -> v ** {lock_VQ = <>} ; mkVQ : Str -> VQ = \str -> (mkV str) ** {lock_VQ = <>} ; diff --git a/src/estonian/PhraseEst.gf b/src/estonian/PhraseEst.gf index 90452839..0557107b 100644 --- a/src/estonian/PhraseEst.gf +++ b/src/estonian/PhraseEst.gf @@ -12,7 +12,7 @@ concrete PhraseEst of Phrase = CatEst ** open ResEst, (P = Prelude) in { UttIP ip = {s = ip.s ! NPCase Nom} ; UttIAdv iadv = iadv ; UttNP np = {s = np.s ! NPCase Nom} ; - UttVP vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfDa} ; + UttVP vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfMa} ; UttAdv adv = adv ; UttCN np = {s = np.s ! NCase Sg Nom} ; UttAP np = {s = np.s ! P.False ! NCase Sg Nom} ; diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index c6ce9643..f34eb997 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -81,7 +81,7 @@ oper param VForm = - Inf InfForm + Inf InfStem | Presn Number Person | Impf Number Person | Condit Number Person @@ -99,16 +99,32 @@ param Voice = Act | Pass ; - InfForm = - InfDa -- lugeda - | InfDes -- lugedes - | InfMa -- lugema - | InfMas -- lugemas - | InfMast -- lugemast - | InfMata -- lugemata - | InfMaks -- lugemaks + InfStem = + InfD -- luge+da/des, but can be irregular: tulla, tulles + | InfM -- lugema/mas/mast/maks/mata/mine ; +oper + InfForms : Type = {stem : InfStem ; suf : Str} ; + InfDa, InfDes, InfMa, InfMas, InfMast, InfMata, InfMaks, InfMine : InfForms ; + InfDa = {stem = InfD ; suf = "a"} ; -- lugeda + InfDes = {stem = InfD ; suf = "es"} ; -- lugedes + InfMa = {stem = InfM ; suf = "a"} ; -- lugema + InfMas = {stem = InfM ; suf = "as"} ; -- lugemas + InfMast = {stem = InfM ; suf = "ast"} ; -- lugemast + InfMata = {stem = InfM ; suf = "ata"} ; -- lugemata + InfMaks = {stem = InfM ; suf = "aks"} ; -- lugemaks + InfMine = {stem = InfM ; suf = "ine"} ; -- lugemine + + applyInfFormsVP : InfForms -> VP -> {fin,inf : Str} = \if,vp -> + let vpforms : VPForms = mkVPForms vp.v ; + stemOnly : {fin,inf : Str} = vpforms ! VIInf if.stem ! Simul ! Pos ! agrP3 Sg ; + in stemOnly ** {fin = glue stemOnly.fin if.suf} ; -- Despite the name, the infinite form is in the "fin" field, "inf" contains participle + + applyInfFormsV : InfForms -> (VForm => Str) -> Str = \if,vf -> + glue (vf ! Inf if.stem) if.suf ; + +param SType = SDecl | SQuest | SInv ; --2 For $Relative$ @@ -180,13 +196,12 @@ param Verb2 : Type = Verb1 ** {c2 : Compl} ; Verb3 : Type = Verb2 ** {c3 : Compl} ; - linV : Verb -> Str = \v -> v.s ! Inf InfMa ++ v.p ; - linV2 : Verb -> Str = \v -> v.s ! Inf InfMa ++ v.p ; + linV2, linV : Verb -> Str = \v -> applyInfFormsV InfMa v.s ++ v.p ; param VIForm = VIFin Tense - | VIInf InfForm + | VIInf InfStem | VIPass Tense | VIPresPart | VIImper @@ -276,7 +291,7 @@ oper } ; predV : Verb1 -> VP = \verb -> { - v = verb ; -- ignoring the subject + v = verb ; -- ignoring the subject case of Verb, it is stored in VP.sc later s2 = \\_,_,_ => [] ; adv = [] ; ext = [] ; --relative clause @@ -405,17 +420,18 @@ oper subjForm : NP -> NPForm -> Polarity -> Str = \np,sc,b -> appCompl False b {s = [] ; c = sc ; isPre = True} np ; - infVP : NPForm -> Polarity -> Agr -> VP -> InfForm -> Str = infVPAnt Simul ; + infVP : NPForm -> Polarity -> Agr -> VP -> InfForms -> Str = infVPAnt Simul ; - infVPAnt : Anteriority -> NPForm -> Polarity -> Agr -> VP -> InfForm -> Str = + infVPAnt : Anteriority -> NPForm -> Polarity -> Agr -> VP -> InfForms -> Str = \ant,sc,pol,agr,vp,vi -> let - fin = case sc of { -- subject case - NPCase Nom => True ; -- mina tahan joosta - _ => False -- minul peab auto olema + complCase = case sc of { -- choosing case for the complement. sometimes this function is called so that sc is the VP's subject case, but other times it's some other form. + NPCase Nom => True ; + _ => False } ; - verb = mkVPForms vp.v ! VIInf vi ! ant ! Pos ! agr ; -- no "ei" - compl = vp.s2 ! fin ! pol ! agr ; -- but compl. case propagated + verbStem = mkVPForms vp.v ! VIInf vi.stem ! ant ! Pos ! agr ; -- no "ei" + verb = verbStem ** {fin = glue verbStem.fin vi.suf} ; + compl = vp.s2 ! complCase ! pol ! agr ; -- but compl. case propagated adv = vp.adv in -- inverted word order; e.g. @@ -512,8 +528,8 @@ oper tulgu = (init tulge) + "u" ; in {s = table { - Inf InfDa => tulla ; - Inf InfDes => tulles ; + Inf InfD => tull_ ; + Inf InfM => init tulema ; Presn Sg P1 => tule_ + "n" ; Presn Sg P2 => tule_ + "d" ; Presn Sg P3 => tuleb ; @@ -547,12 +563,7 @@ oper PresPart Act => laulev ; PresPart Pass => tuld_ + "av" ; --d or t PastPart Act => tulnud ; - PastPart Pass => tuldud ; - Inf InfMa => tulema ; - Inf InfMas => tulema + "s" ; - Inf InfMast => tulema + "st" ; - Inf InfMata => tulema + "ta" ; - Inf InfMaks => tulema + "ks" + PastPart Pass => tuldud } ; sc = NPCase Nom ; p = [] From 4e204d66a8e328ec5fc13f4dc8595b8f98541bf7 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 14 Apr 2022 19:07:03 +0800 Subject: [PATCH 76/92] (Est) Use genitive stem+suffix for 4 other cases --- src/estonian/AdverbEst.gf | 2 +- src/estonian/DocumentationEstFunctor.gf | 48 +++++++++------- src/estonian/ExtraEst.gf | 17 +++--- src/estonian/MorphoEst.gf | 16 +----- src/estonian/NounEst.gf | 12 +--- src/estonian/ParadigmsEst.gf | 73 +++++++++++++++---------- src/estonian/RelativeEst.gf | 2 +- src/estonian/ResEst.gf | 69 +++++++++++++---------- src/estonian/VerbEst.gf | 4 +- 9 files changed, 128 insertions(+), 115 deletions(-) diff --git a/src/estonian/AdverbEst.gf b/src/estonian/AdverbEst.gf index ad84dcb9..566f3475 100644 --- a/src/estonian/AdverbEst.gf +++ b/src/estonian/AdverbEst.gf @@ -11,7 +11,7 @@ concrete AdverbEst of Adverb = CatEst ** open ResEst, Prelude in { s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ s.s } ; - PrepNP prep np = {s = preOrPost prep.isPre prep.s (np.s ! prep.c)} ; + PrepNP prep np = {s = appCompl True Pos prep np} ; AdAdv = cc2 ; diff --git a/src/estonian/DocumentationEstFunctor.gf b/src/estonian/DocumentationEstFunctor.gf index a40affde..91faf858 100644 --- a/src/estonian/DocumentationEstFunctor.gf +++ b/src/estonian/DocumentationEstFunctor.gf @@ -23,11 +23,17 @@ lincat oper heading : N -> Str = \n -> (nounHeading n).s ; + caseplus2nf : N -> ResEst.Number -> CasePlus -> Str = \noun,num,cas -> + noun.s ! NCase num cas.c ++ cas.suf ; + + caseplus2af : (AForm => Str) -> ResEst.Number -> CasePlus -> Str = \adj,num,cas -> + adj ! AN (NCase num cas.c) ++ cas.suf ; + lin InflectionN, InflectionN2, InflectionN3 = \noun -> { t = "s" ; s1 = heading1 (heading noun_Category) ; - s2 = inflNoun (\nf -> noun.s ! nf) + s2 = inflNoun (caseplus2nf noun) } ; InflectionA, InflectionA2 = \adj -> @@ -37,11 +43,11 @@ lin in { t = "a" ; s1 = heading1 (heading adjective_Category) ; - s2 = inflNoun (\nf -> posit ! AN nf) ++ + s2 = inflNoun (caseplus2af posit) ++ heading2 (heading comparative_Parameter) ++ - inflNoun (\nf -> compar ! AN nf) ++ + inflNoun (caseplus2af compar) ++ heading2 (heading superlative_Parameter) ++ - inflNoun (\nf -> superl ! AN nf) + inflNoun (caseplus2af superl) } ; InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> { @@ -248,24 +254,24 @@ oper td (vfin (PastPart Pass ))) ) ; --} - inflNoun : (NForm -> Str) -> Str = \nouns -> + inflNoun : (Number -> CasePlus -> Str) -> Str = \nouns -> frameTable ( - tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++ - tr (th (heading nominative_Parameter) ++ td (nouns (NCase Sg Nom)) ++ td (nouns (NCase Pl Nom))) ++ - tr (th (heading genitive_Parameter) ++ td (nouns (NCase Sg Gen)) ++ td (nouns (NCase Pl Gen))) ++ - tr (th (heading partitive_Parameter) ++ td (nouns (NCase Sg Part)) ++ td (nouns (NCase Pl Part))) ++ - tr (th (heading translative_Parameter) ++ td (nouns (NCase Sg Transl)) ++ td (nouns (NCase Pl Transl))) ++ - tr (th (heading essive_Parameter) ++ td (nouns (NCase Sg Ess)) ++ td (nouns (NCase Pl Ess))) ++ - tr (th (heading inessive_Parameter) ++ td (nouns (NCase Sg Iness)) ++ td (nouns (NCase Pl Iness))) ++ - tr (th (heading elative_Parameter) ++ td (nouns (NCase Sg Elat)) ++ td (nouns (NCase Pl Elat))) ++ - tr (th (heading illative_Parameter) ++ td (nouns (NCase Sg Illat)) ++ td (nouns (NCase Pl Illat))) ++ - tr (th (heading adessive_Parameter) ++ td (nouns (NCase Sg Adess)) ++ td (nouns (NCase Pl Adess))) ++ - tr (th (heading ablative_Parameter) ++ td (nouns (NCase Sg Ablat)) ++ td (nouns (NCase Pl Ablat))) ++ - tr (th (heading allative_Parameter) ++ td (nouns (NCase Sg Allat)) ++ td (nouns (NCase Pl Allat))) ++ - tr (th (heading abessive_Parameter) ++ td (nouns (NCase Sg Abess)) ++ td (nouns (NCase Pl Abess))) ++ - tr (th (heading comitative_Parameter) ++ td (nouns (NCase Sg Comit)) ++ td (nouns (NCase Pl Comit))) ++ - tr (th (heading instructive_Parameter) ++ td (nouns (NCase Sg Termin)) ++ td (nouns (NCase Pl Termin)) - )) ; + tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ + tr (th (heading nominative_Parameter) ++ td (nouns Sg Nominative) ++ td (nouns Pl Nominative)) ++ + tr (th (heading genitive_Parameter) ++ td (nouns Sg Genitive) ++ td (nouns Pl Genitive)) ++ + tr (th (heading partitive_Parameter) ++ td (nouns Sg Partitive) ++ td (nouns Pl Partitive)) ++ + tr (th (heading translative_Parameter) ++ td (nouns Sg Translative) ++ td (nouns Pl Translative)) ++ + tr (th (heading essive_Parameter) ++ td (nouns Sg Essive) ++ td (nouns Pl Essive)) ++ + tr (th (heading inessive_Parameter) ++ td (nouns Sg Inessive) ++ td (nouns Pl Inessive)) ++ + tr (th (heading elative_Parameter) ++ td (nouns Sg Elative) ++ td (nouns Pl Elative)) ++ + tr (th (heading illative_Parameter) ++ td (nouns Sg Illative) ++ td (nouns Pl Illative)) ++ + tr (th (heading adessive_Parameter) ++ td (nouns Sg Adessive) ++ td (nouns Pl Adessive)) ++ + tr (th (heading ablative_Parameter) ++ td (nouns Sg Ablative) ++ td (nouns Pl Ablative)) ++ + tr (th (heading allative_Parameter) ++ td (nouns Sg Allative) ++ td (nouns Pl Allative)) ++ + tr (th (heading abessive_Parameter) ++ td (nouns Sg Abessive) ++ td (nouns Pl Abessive)) ++ + tr (th (heading comitative_Parameter) ++ td (nouns Sg Comitative) ++ td (nouns Pl Comitative)) ++ + tr (th (heading instructive_Parameter) ++ td (nouns Sg Terminative) ++ td (nouns Pl Terminative)) + ) ; lin NoDefinition t = {s=t.s}; diff --git a/src/estonian/ExtraEst.gf b/src/estonian/ExtraEst.gf index 3de8e8b5..644d8e9e 100644 --- a/src/estonian/ExtraEst.gf +++ b/src/estonian/ExtraEst.gf @@ -1,5 +1,5 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** - open ResEst, MorphoEst, Coordination, Prelude, NounEst, StructuralEst, (R = ParamX) in { + open ResEst, MorphoEst, Coordination, Prelude, NounEst, StructuralEst, (R = ParamX), (P = ParadigmsEst) in { flags coding=utf8; lin GenNP np = { @@ -9,11 +9,11 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** isNeg = False } ; - GenCN = caseCN Gen ; -- soome mees - ComitCN = caseCN Comit ; -- puudega mets - ElatCN = caseCN Elat ; -- puust laud - AbessCN = caseCN Abess ; -- autota pere - TerminCN = caseCN Termin ; -- maani kleit + GenCN = caseCN Genitive ; -- soome mees + ComitCN = caseCN Comitative ; -- puudega mets + ElatCN = caseCN Elative ; -- puust laud + AbessCN = caseCN Abessive ; -- autota pere + TerminCN = caseCN Terminative ; -- maani kleit GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ; @@ -23,8 +23,9 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** --- a = RAg (agrP3 num.n) } ; oper - caseCN : Case -> NP -> CN -> CN = \c,np,cn -> - lin CN { s = \\nf => np.s ! NPCase c ++ cn.s ! nf } ; + caseCN : CasePlus -> NP -> CN -> CN = \c,np,cn -> cn ** { + s = \\nf => appCompl True Pos (P.casePrep c) np ++ cn.s ! nf + } ; lincat VPI = {s : InfStem => Str} ; diff --git a/src/estonian/MorphoEst.gf b/src/estonian/MorphoEst.gf index e7cc6e53..18de3683 100644 --- a/src/estonian/MorphoEst.gf +++ b/src/estonian/MorphoEst.gf @@ -520,16 +520,12 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> NPCase Gen => minu ; NPCase Part => mind ; NPCase Transl => minu + "ks" ; - NPCase Ess => minu + "na" ; NPCase Iness => minu_short + "s" ; NPCase Elat => minu_short + "st" ; NPCase Illat => minu_short + "sse" ; NPCase Adess => minu_short + "l" ; NPCase Ablat => minu_short + "lt" ; NPCase Allat => minu_short + "le" ; - NPCase Abess => minu + "ta" ; - NPCase Comit => minu + "ga" ; - NPCase Termin => minu + "ni" ; NPAcc => mind } ; a = Ag n p @@ -584,16 +580,12 @@ oper Gen => "selle" ; Part => "seda" ; Transl => "selleks" ; - Ess => "sellena" ; Iness => "selles" ; Elat => "sellest" ; Illat => "sellesse" ; Adess => "sellel" ; Ablat => "sellelt" ; - Allat => "sellele" ; - Abess => "selleta" ; - Comit => "sellega" ; - Termin => "selleni" + Allat => "sellele" } ; } ; @@ -604,16 +596,12 @@ oper Gen => "nende" ; Part => "neid" ; Transl => "nendeks" ; - Ess => "nendena" ; Iness => "nendes" ; Elat => "nendest" ; Illat => "nendesse" ; Adess => "nendel" ; Ablat => "nendelt" ; - Allat => "nendele" ; - Abess => "nendeta" ; - Comit => "nendega" ; - Termin => "nendeni" + Allat => "nendele" } ; } ; diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index 3b65059c..b641c689 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -19,13 +19,6 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in case of { <_, NPAcc, True,_> => ; -- kolm kassi (as object) <_, NPCase Nom, True,_> => ; -- kolm kassi (as subject) - - --Only the last word gets case ending. - <_, NPCase Comit, _, _> => ; -- kolme kassiga - <_, NPCase Abess, _, _> => ; -- kolme kassita - <_, NPCase Ess, _, _> => ; -- kolme kassina - <_, NPCase Termin,_, _> => ; -- kolme kassini - <_, _, True,_> => ; -- kolmeks kassiks (all other cases) _ => -- kass, kassi, ... (det is not a number) } @@ -212,10 +205,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in s = \\nf => case ap.infl of { Invariable|Participle => ap.s ! True ! NCase Sg Nom ++ cn.s ! nf ; --valmis kassile; väsinud kassile - Regular => case nf of { - NCase num (Ess|Abess|Comit|Termin) => ap.s ! True ! NCase num Gen ++ cn.s ! nf ; --suure kassiga, not *suurega kassiga - _ => ap.s ! True ! nf ++ cn.s ! nf - } + Regular => ap.s ! True ! nf ++ cn.s ! nf -- Ess,Abess,Comit,Termin will only get case ending after the CN, so suure kassiga, not *suurega kassiga } } ; diff --git a/src/estonian/ParadigmsEst.gf b/src/estonian/ParadigmsEst.gf index 432f622f..2c859b74 100644 --- a/src/estonian/ParadigmsEst.gf +++ b/src/estonian/ParadigmsEst.gf @@ -276,50 +276,67 @@ oper -- The definitions should not bother the user of the API. So they are -- hidden from the document. - Case = MorphoEst.Case ; + Case = MorphoEst.CasePlus ; Number = MorphoEst.Number ; singular = Sg ; plural = Pl ; - nominative = Nom ; - genitive = Gen ; - partitive = Part ; - illative = Illat ; - inessive = Iness ; - elative = Elat ; - allative = Allat ; - adessive = Adess ; - ablative = Ablat ; - translative = Transl ; - terminative = Termin ; - essive = Ess ; - abessive = Abess ; - comitative = Comit ; + nominative = Nominative ; + genitive = Genitive ; + partitive = Partitive ; + illative = Illative ; + inessive = Inessive ; + elative = Elative ; + allative = Allative ; + adessive = Adessive ; + ablative = Ablative ; + translative = Translative ; + terminative = Terminative ; + essive = Essive ; + abessive = Abessive ; + comitative = Comitative ; + + -- IL 2022-04: after introducing stem+suffixes, 4 other cases have just genitive stems. + -- isActuallyGenitive is needed for those mkN2 and mkN3 instances that take a Prep as an argument, + -- and actual Gen gets isPre=True, and those with genitive stem+suffix should get False. + -- This is confusing and error-prone, consider restructuring/renaming things later. + isActuallyGenitive : MorphoEst.CasePlus -> Bool = \c -> case c of { + {c = MorphoEst.Gen ; suf = ""} => True ; + _ => False + } ; -- combination of stem + suffix, e.g. infDes = {stem = InfD ; suf = "es"} ; InfForm = ResEst.InfForms ; infDa = InfDa ; infMa = InfMa ; infMast = InfMast ; infDes = InfDes ; infMas = InfMas ; infMaks = InfMaks ; infMata = InfMata ; infMine = InfMine ; - prePrep : Case -> Str -> Prep = - \c,p -> {c = NPCase c ; s = p ; isPre = True ; lock_Prep = <>} ; - postPrep : Case -> Str -> Prep = - \c,p -> {c = NPCase c ; s = p ; isPre = False ; lock_Prep = <>} ; - postGenPrep p = { - c = NPCase genitive ; s = p ; isPre = False ; lock_Prep = <>} ; - casePrep : Case -> Prep = - \c -> {c = NPCase c ; s = [] ; isPre = True ; lock_Prep = <>} ; - accPrep = {c = NPAcc ; s = [] ; isPre = True ; lock_Prep = <>} ; + mkPrep : (isPre : Bool) -> Case -> Str -> Prep = \isPre,c,p -> lin Prep { + c = casep2npformp c ; + s = p ; + isPre = isPre + } ; + prePrep : Case -> Str -> Prep = mkPrep True ; + postPrep : Case -> Str -> Prep = mkPrep False ; + postGenPrep : Str -> Prep = postPrep genitive ; + -- The Prep's isPre field is used in a special (hacky) way in mkN3 and mkN2. + -- Used to be able to match whether the Prep's case is Gen, but now several + -- Preps use the genitive stem, so we need to check if it's actually genitive. + casePrep : Case -> Prep = \c -> mkPrep (isActuallyGenitive c) c [] ; + + -- NPAcc is different, it's not formed from a Case(Plus) + accPrep : Prep = lin Prep { + c = case2npformp NPAcc ; + s = [] ; + isPre = True + } ; mkAdv : Str -> Adv = \str -> {s = str ; lock_Adv = <>} ; mkAdV : Str -> AdV = \str -> {s = str ; lock_AdV = <>} ; mkAdN : Str -> AdN = \str -> {s = str ; lock_AdN = <>} ; mkAdA : Str -> AdA = \str -> {s = str ; lock_AdA = <>} ; - - mkConj = overload { mkConj : Str -> Conj = \ja -> lin Conj ((sd2 "" ja) ** {n = Sg}) ; mkConj : Str -> Number -> Conj = \ja,num -> lin Conj ((sd2 "" ja) ** {n = num}) ; @@ -565,7 +582,7 @@ oper lock_N3 = <> } ; - mkIsPre : Prep -> Bool = \p -> case p.c of { + mkIsPre : Prep -> Bool = \p -> case p.c.npf of { NPCase Gen => notB p.isPre ; -- Jussin veli (prep is , isPre becomes False) _ => True -- syyte Jussia vastaan, puhe Jussin puolesta } ; @@ -821,7 +838,7 @@ oper <_,_,_,_> => regVForms jatma jatta jatab jaetakse } ; - caseV c v = {s = v.s ; p = v.p; sc = NPCase c ; lock_V = <>} ; + caseV c v = v ** {sc = NPCase c.c} ; vOlema = verbOlema ** {sc = NPCase Nom ; lock_V = <>} ; vMinema = verbMinema ** {sc = NPCase Nom ; lock_V = <>} ; diff --git a/src/estonian/RelativeEst.gf b/src/estonian/RelativeEst.gf index 4f90bb25..4be5f96a 100644 --- a/src/estonian/RelativeEst.gf +++ b/src/estonian/RelativeEst.gf @@ -32,7 +32,7 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in who = appCompl True p slash.c2 (rp2np (complNumAgr ag) rp) in who ++ cls ; - c = slash.c2.c + c = slash.c2.c.npf } ; FunRP p np rp = { diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index f34eb997..066eeb15 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -15,16 +15,35 @@ resource ResEst = ParamX ** open Prelude in { -- This is the $Case$ as needed for both nouns and $NP$s. param - Case = Nom | Gen | Part + Case = Nom | Gen | Part | Transl | Illat | Iness | Elat | Allat | Adess | Ablat - | Transl | Ess | Termin | Abess | Comit; - + ; NForm = NCase Number Case ; + oper + -- Reduce the Case parameter: many cases use the Genitive stem and just add suffix to it + CasePlus : Type = { + c : Case ; -- e.g. Gen + suf : Str -- e.g. "ga" for comitative + } ; + Nominative = {c = Nom ; suf = []} ; + Genitive = {c = Gen ; suf = []} ; + Partitive = {c = Part ; suf = []} ; + Illative = {c = Illat ; suf = []} ; + Inessive = {c = Iness ; suf = []} ; + Elative = {c = Elat ; suf = []} ; + Allative = {c = Allat ; suf = []} ; + Adessive = {c = Adess ; suf = []} ; + Ablative = {c = Ablat ; suf = []} ; + Translative = {c = Transl ; suf = []} ; + Terminative = {c = Gen ; suf = BIND ++ "ni"} ; + Essive = {c = Gen ; suf = BIND ++ "na"} ; + Abessive = {c = Gen ; suf = BIND ++ "ta"} ; + Comitative = {c = Gen ; suf = BIND ++ "ga"} ; + + param -- Agreement of $NP$ has number*person and the polite second ("te olette valmis"). - - Agr = Ag Number Person | AgPol ; oper @@ -66,6 +85,14 @@ param NPForm = NPCase Case | NPAcc ; oper + NPFormPlus : Type = { + npf : NPForm ; -- e.g. NPCase Gen + suf : Str -- e.g. "ga" for comitative + } ; + + casep2npformp : CasePlus -> NPFormPlus = \cp -> cp ** {npf = NPCase cp.c} ; + case2npformp : NPForm -> NPFormPlus = \npf-> {npf = npf ; suf = []} ; + npform2case : Number -> NPForm -> Case = \n,f -> -- type signature: workaround for gfc bug 9/11/2007 @@ -150,11 +177,11 @@ param --- - Compl : Type = {s : Str ; c : NPForm ; isPre : Bool} ; + Compl : Type = {s : Str ; c : NPFormPlus ; isPre : Bool} ; appCompl : Bool -> Polarity -> Compl -> NP -> Str = \isFin,b,co,np -> let - c = case co.c of { + c = case co.c.npf of { NPAcc => case b of { Neg => NPCase Part ; -- ma ei näe raamatut/sind Pos => case isFin of { @@ -165,25 +192,17 @@ param } } } ; - _ => co.c + _ => co.c.npf } ; -{- - c = case of { - <_, Neg, NPAcc,_> => NPCase Part ; -- en näe taloa/sinua - <_, Pos, NPAcc,True> => NPAcc ; -- näen/täytyy sinut - => NPCase Nom ; -- täytyy nähdä talo - <_,_,coc,_> => coc - } ; --} - nps = np.s ! c + nps = np.s ! c ++ co.c.suf ; -- complement's NPFormPlus may include suffix for the cases based on Gen stem, e.g. comitative "ga" in preOrPost co.isPre co.s nps ; -- Used for passive; c2 of V2/VPSlash becomes sc of VP compl2subjcase : Compl -> NPForm = \compl -> - case compl.c of { + case compl.c.npf of { NPCase Gen => NPCase Nom ; -- valisin koera -> koer valitakse - _ => compl.c -- rääkisin koerale -> koerale räägitakse + _ => compl.c.npf -- rääkisin koerale -> koerale räägitakse } ; -- For $Verb$. @@ -418,7 +437,7 @@ oper -- This is used for subjects of passives: therefore isFin in False. subjForm : NP -> NPForm -> Polarity -> Str = \np,sc,b -> - appCompl False b {s = [] ; c = sc ; isPre = True} np ; + appCompl False b {s = [] ; c = case2npformp sc ; isPre = True} np ; infVP : NPForm -> Polarity -> Agr -> VP -> InfForms -> Str = infVPAnt Simul ; @@ -709,31 +728,23 @@ oper NCase Sg Gen => joe ; NCase Sg Part => joge ; NCase Sg Transl => joe + "ks" ; - NCase Sg Ess => joe + "na" ; NCase Sg Iness => joe + "s" ; NCase Sg Elat => joe + "st" ; NCase Sg Illat => joesse ; NCase Sg Adess => joe + "l" ; NCase Sg Ablat => joe + "lt" ; NCase Sg Allat => joe + "le" ; - NCase Sg Abess => joe + "ta" ; - NCase Sg Comit => joe + "ga" ; - NCase Sg Termin => joe + "ni" ; NCase Pl Nom => joe + "d" ; NCase Pl Gen => jogede ; NCase Pl Part => jogesid ; NCase Pl Transl => jogede + "ks" ; - NCase Pl Ess => jogede + "na" ; NCase Pl Iness => jogede + "s" ; NCase Pl Elat => jogede + "st" ; NCase Pl Illat => jogede + "sse" ; NCase Pl Adess => jogede + "l" ; NCase Pl Ablat => jogede + "lt" ; - NCase Pl Allat => jogede + "le" ; - NCase Pl Abess => jogede + "ta" ; - NCase Pl Comit => jogede + "ga" ; - NCase Pl Termin => jogede + "ni" + NCase Pl Allat => jogede + "le" } --; -- lock_N = <> diff --git a/src/estonian/VerbEst.gf b/src/estonian/VerbEst.gf index 3f5f0c3d..c07c24b1 100644 --- a/src/estonian/VerbEst.gf +++ b/src/estonian/VerbEst.gf @@ -34,7 +34,7 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { insertObj (\\_,b,agr => let n = (complNumAgr agr) in - ap.s ! False ! (NCase n (npform2case n v.c2.c))) --- v.cs.s ignored + ap.s ! False ! (NCase n (npform2case n v.c2.c.npf))) --- v.cs.s ignored (predV v) ; SlashV2S v s = @@ -47,7 +47,7 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { SlashV2A v ap = insertObj (\\fin,b,_ => - ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c))) ----agr to obj + ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c.npf))) ----agr to obj (predV v) ** {c2 = v.c2} ; ComplSlash vp np = insertObjPre (\\fin,b,_ => appCompl fin b vp.c2 np) vp ; From ee5c84297294311ee700fa7d5934c2f3d55de3da Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 14 Apr 2022 20:02:44 +0800 Subject: [PATCH 77/92] (Est) Replace all {lock_C = <>} with lin C {...} --- src/estonian/ConjunctionEst.gf | 1 - src/estonian/LexiconEst.gf | 2 +- src/estonian/MakeStructuralEst.gf | 13 +-- src/estonian/MorphoEst.gf | 1 - src/estonian/NounEst.gf | 9 +- src/estonian/ParadigmsEst.gf | 164 ++++++++++++++---------------- src/estonian/ResEst.gf | 13 +-- src/estonian/StructuralEst.gf | 5 +- 8 files changed, 91 insertions(+), 117 deletions(-) diff --git a/src/estonian/ConjunctionEst.gf b/src/estonian/ConjunctionEst.gf index 330bb50b..d7517733 100644 --- a/src/estonian/ConjunctionEst.gf +++ b/src/estonian/ConjunctionEst.gf @@ -74,7 +74,6 @@ concrete ConjunctionEst of Conjunction = } ; infl = Regular } ; s2 = x ; - lock_ListAP = <> } ; diff --git a/src/estonian/LexiconEst.gf b/src/estonian/LexiconEst.gf index ca2e1cb9..254883cc 100644 --- a/src/estonian/LexiconEst.gf +++ b/src/estonian/LexiconEst.gf @@ -366,7 +366,7 @@ lin oper mkOrd1 : N -> Ord ; - mkOrd1 x = {s = x.s ; lock_Ord = <> } ; + mkOrd1 x = lin Ord x ; cpartitive = casePrep partitive ; ctranslative = casePrep translative ; celative = casePrep elative ; diff --git a/src/estonian/MakeStructuralEst.gf b/src/estonian/MakeStructuralEst.gf index 0b17be12..2ce54b28 100644 --- a/src/estonian/MakeStructuralEst.gf +++ b/src/estonian/MakeStructuralEst.gf @@ -1,11 +1,12 @@ resource MakeStructuralEst = open CatEst, ParadigmsEst, MorphoEst, Prelude in { oper - mkConj : Str -> Str -> ParadigmsEst.Number -> Conj = \x,y,n -> - {s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ; - mkSubj : Str -> Subj = \x -> - {s = x ; lock_Subj = <>} ; - mkIQuant : Str -> IQuant = \s -> - {s = \\n,c => s ; lock_IQuant = <>} ; ---- + mkConj : Str -> Str -> ParadigmsEst.Number -> Conj = \x,y,n -> lin Conj { + s1 = x ; + s2 = y ; + n = n + } ; + mkSubj : Str -> Subj = \x -> lin Subj {s = x} ; + mkIQuant : Str -> IQuant = \s -> lin IQuant {s = \\n,c => s} ; } diff --git a/src/estonian/MorphoEst.gf b/src/estonian/MorphoEst.gf index 18de3683..1cd25c5f 100644 --- a/src/estonian/MorphoEst.gf +++ b/src/estonian/MorphoEst.gf @@ -457,7 +457,6 @@ These used to be here: AAdv => afs.adv_superl } } ; - lock_A = <> } ; nforms2aforms : NForms -> AForms = \nforms -> diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index b641c689..f87ae33f 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -178,13 +178,8 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in UseN2 n = n ; - Use2N3 f = lin N2 { - s = f.s ; - c2 = f.c2 ; - isPre = f.isPre - } ; - Use3N3 f = lin N2 { - s = f.s ; + Use2N3 f = f ; + Use3N3 f = f ** { c2 = f.c3 ; isPre = f.isPre2 } ; diff --git a/src/estonian/ParadigmsEst.gf b/src/estonian/ParadigmsEst.gf index 2c859b74..55f5cc69 100644 --- a/src/estonian/ParadigmsEst.gf +++ b/src/estonian/ParadigmsEst.gf @@ -158,7 +158,7 @@ oper -- Two-place adjectives need a case for the second argument. mkA2 : A -> Prep -> A2 -- e.g. "vihane" (postGenPrep "peale") - = \a,p -> a ** {c2 = p ; lock_A2 = <>}; + = \a,p -> lin A2 (a ** {c2 = p}) ; invA : Str -> A ; -- invariable adjectives, such as genitive attributes ; no agreement to head, no comparison forms. @@ -332,10 +332,10 @@ oper isPre = True } ; - mkAdv : Str -> Adv = \str -> {s = str ; lock_Adv = <>} ; - mkAdV : Str -> AdV = \str -> {s = str ; lock_AdV = <>} ; - mkAdN : Str -> AdN = \str -> {s = str ; lock_AdN = <>} ; - mkAdA : Str -> AdA = \str -> {s = str ; lock_AdA = <>} ; + mkAdv : Str -> Adv = \str -> lin Adv (ss str) ; + mkAdV : Str -> AdV = \str -> lin AdV (ss str) ; + mkAdN : Str -> AdN = \str -> lin AdN (ss str) ; + mkAdA : Str -> AdA = \str -> lin AdA (ss str) ; mkConj = overload { mkConj : Str -> Conj = \ja -> lin Conj ((sd2 "" ja) ** {n = Sg}) ; @@ -344,7 +344,7 @@ oper mkConj : Str -> Str -> Number -> Conj = \nii,kui,num -> lin Conj ((sd2 nii kui) ** {n = num}) ; } ; - mkPConj s = ss s ** {lock_PConj = <>} ; + mkPConj s = lin PConj (ss s) ; mkN = overload { mkN : (nisu : Str) -> N = mk1N ; @@ -360,14 +360,13 @@ oper -- Adjective forms (incl. comp and sup) are derived from noun forms mk1A : Str -> A = \suur -> let aforms = aForms2A (nforms2aforms (hjk_type suur)) - in aforms ** {infl = Regular } ; + in lin A (aforms ** {infl = Regular}) ; mkNA : N -> A = \suur -> let aforms = aForms2A (nforms2aforms (n2nforms suur)) ; - in aforms ** {infl = Regular } ; + in lin A (aforms ** {infl = Regular}) ; - - mk1N : (link : Str) -> N = \s -> nForms2N (hjk_type s) ** {lock_N = <> } ; + mk1N : (link : Str) -> N = \s -> lin N (nForms2N (hjk_type s)) ; -- mk2N, mk3N, mk4N make sure that the user specified forms end up in the paradigm, -- even though the rest is wrong @@ -381,7 +380,7 @@ oper 4 => nfs ! 4 ; 5 => nfs ! 5 } ; - in nForms2N nfs_fixed ** {lock_N = <> } ; + in lin N (nForms2N nfs_fixed) ; mk3N : (tukk,tuku,tukku : Str) -> N = \tukk,tuku,tukku -> @@ -394,7 +393,7 @@ oper 4 => nfs ! 4 ; 5 => nfs ! 5 } ; - in nForms2N nfs_fixed ** {lock_N = <> } ; + in lin N (nForms2N nfs_fixed) ; mk4N : (paat,paadi,paati,paate : Str) -> N = \paat,paadi,paati,paate -> @@ -407,17 +406,17 @@ oper 4 => nfs ! 4 ; 5 => paate } ; - in nForms2N nfs_fixed ** {lock_N = <> } ; + in lin N (nForms2N nfs_fixed) ; mk6N : (oun,ouna,ouna,ounasse,ounte,ounu : Str) -> N = - \a,b,c,d,e,f -> nForms2N (nForms6 a b c d e f) ** {lock_N = <> } ; + \a,b,c,d,e,f -> lin N (nForms2N (nForms6 a b c d e f)) ; - mkStrN : Str -> N -> N = \sora,tie -> { - s = \\c => sora + tie.s ! c ; lock_N = <> + mkStrN : Str -> N -> N = \sora,tie -> tie ** { + s = \\c => sora + tie.s ! c } ; - mkNN : N -> N -> N = \oma,tunto -> { - s = \\c => oma.s ! c + tunto.s ! c ; lock_N = <> + mkNN : N -> N -> N = \oma,tunto -> tunto ** { + s = \\c => oma.s ! c + tunto.s ! c ; } ; ---- TODO: oma in possessive suffix forms @@ -575,12 +574,12 @@ oper mkN2 : N -> Prep -> N2 = mmkN2 } ; - mmkN2 : N -> Prep -> N2 = \n,c -> n ** {c2 = c ; isPre = mkIsPre c ; lock_N2 = <>} ; - mkN3 = \n,c,e -> n ** {c2 = c ; c3 = e ; + mmkN2 : N -> Prep -> N2 = \n,c -> lin N (n ** {c2 = c ; isPre = mkIsPre c}) ; + mkN3 = \n,c,e -> lin N3 (n ** { + c2 = c ; c3 = e ; isPre = mkIsPre c ; -- matka Londonist Pariisi isPre2 = mkIsPre e ; -- Suomen voitto Ruotsista - lock_N3 = <> - } ; + }) ; mkIsPre : Prep -> Bool = \p -> case p.c.npf of { NPCase Gen => notB p.isPre ; -- Jussin veli (prep is , isPre becomes False) @@ -589,37 +588,36 @@ oper mkPN = overload { mkPN : Str -> PN = mkPN_1 ; - mkPN : N -> PN = \s -> {s = \\c => s.s ! NCase Sg c ; lock_PN = <>} ; + mkPN : N -> PN = \s -> lin PN {s = \\c => s.s ! NCase Sg c} ; } ; - mkPN_1 : Str -> PN = \s -> {s = \\c => (mk1N s).s ! NCase Sg c ; lock_PN = <>} ; + mkPN_1 : Str -> PN = \s -> lin PN {s = \\c => (mk1N s).s ! NCase Sg c} ; -- adjectives mkA = overload { mkA : Str -> A = mkA_1 ; - mkA : N -> A = \n -> noun2adjDeg n ** {infl = Regular ; lock_A = <>} ; + mkA : N -> A = \n -> noun2adjDeg n ** {infl = Regular} ; mkA : N -> (parem,parim : Str) -> A = regAdjective ; - mkA : N -> (infl : Infl) -> A = \n,infl -> noun2adjDeg n ** {infl = infl ; lock_A = <>} ; + mkA : N -> (infl : Infl) -> A = \n,infl -> noun2adjDeg n ** {infl = infl} ; -- TODO: temporary usage of regAdjective1 mkA : N -> (valmim,valmeim : Str) -> (infl : Infl) -> A = - \n,c,s,infl -> (regAdjective1 n c s) ** {infl = infl ; lock_A = <>} ; + \n,c,s,infl -> (regAdjective1 n c s) ** {infl = infl} ; } ; - invA balti = {s = \\_,_ => balti ; infl = Invariable ; lock_A = <>} ; + invA balti = lin A {s = \\_,_ => balti ; infl = Invariable} ; - mkA_1 : Str -> A = \x -> noun2adjDeg (mk1N x) ** {infl = Regular ; lock_A = <>} ; + mkA_1 : Str -> A = \x -> noun2adjDeg (mk1N x) ** {infl = Regular } ; -- auxiliaries - mkAdjective : (_,_,_ : Adj) -> A = \hea,parem,parim -> - {s = table { + mkAdjective : (_,_,_ : Adj) -> A = \hea,parem,parim -> lin A ({ + s = table { Posit => hea.s ; Compar => parem.s ; Superl => parim.s } ; infl = Regular ; - lock_A = <> - } ; + }) ; -- Adjectives whose comparison forms are explicitly given. -- The inflection of these forms with the audit-rule always works. @@ -640,7 +638,7 @@ oper -- e.g. lai -> laiem -> laiim? / laieim? -- See also: http://www.eki.ee/books/ekk09/index.php?p=3&p1=4&id=208 -- Rather use "kõige" + Comp instead of the superlative. - noun2adjDeg : Noun -> Adjective = \kaunis -> + noun2adjDeg : Noun -> A = \kaunis -> let kauni = (kaunis.s ! NCase Sg Gen) ; -- Convert the final 'i' to 'e' for the superlative @@ -660,27 +658,13 @@ oper mkV : (aru : Str) -> (saama : V) -> V = mkPV ; -- particle verbs } ; - mk1V : Str -> V = \s -> - let vfs = vforms2V (vForms1 s) in - vfs ** {sc = NPCase Nom ; lock_V = <>} ; - mk2V : (_,_ : Str) -> V = \x,y -> - let - vfs = vforms2V (vForms2 x y) - in vfs ** {sc = NPCase Nom ; lock_V = <>} ; - mk3V : (_,_,_ : Str) -> V = \x,y,z -> - let - vfs = vforms2V (vForms3 x y z) - in vfs ** {sc = NPCase Nom ; lock_V = <>} ; - mk4V : (x1,_,_,x4 : Str) -> V = \a,b,c,d -> - let - vfs = vforms2V (vForms4 a b c d) - in vfs ** {sc = NPCase Nom ; lock_V = <>} ; - mk8V : (x1,_,_,_,_,_,_,x8 : Str) -> V = \a,b,c,d,e,f,g,h -> - let - vfs = vforms2V (vForms8 a b c d e f g h) - in vfs ** {sc = NPCase Nom ; lock_V = <>} ; - mkPV : (aru : Str) -> (saama : V) -> V = \aru,saama -> - {s = saama.s ; p = aru ; sc = saama.sc ; lock_V = <> } ; + vforms2v : ResEst.VForms -> CatEst.V = \vfs -> lin V (vforms2verb vfs ** {sc = NPCase Nom}) ; + mk1V : Str -> V = \s -> vforms2v (vForms1 s) ; + mk2V : (_,_ : Str) -> V = \x,y -> vforms2v (vForms2 x y) ; + mk3V : (_,_,_ : Str) -> V = \x,y,z -> vforms2v (vForms3 x y z) ; + mk4V : (x1,_,_,x4 : Str) -> V = \a,b,c,d -> vforms2v (vForms4 a b c d) ; + mk8V : (x1,_,_,_,_,_,_,x8 : Str) -> V = \a,b,c,d,e,f,g,h -> vforms2v (vForms8 a b c d e f g h) ; + mkPV : (aru : Str) -> (saama : V) -> V = \aru,saama -> saama ** {p=aru} ; -- This used to be the last case: _ => Predef.error (["expected infinitive, found"] ++ ottaa) @@ -840,10 +824,10 @@ oper caseV c v = v ** {sc = NPCase c.c} ; - vOlema = verbOlema ** {sc = NPCase Nom ; lock_V = <>} ; - vMinema = verbMinema ** {sc = NPCase Nom ; lock_V = <>} ; + vOlema = lin V (verbOlema ** {sc = NPCase Nom}) ; + vMinema = lin V (verbMinema ** {sc = NPCase Nom}) ; - mk2V2 : V -> Prep -> V2 = \v,c -> v ** {c2 = c ; lock_V2 = <>} ; + mk2V2 : V -> Prep -> V2 = \v,c -> lin V2 (v ** {c2 = c}) ; caseV2 : V -> Case -> V2 = \v,c -> mk2V2 v (casePrep c) ; dirV2 v = mk2V2 v accPrep ; @@ -860,20 +844,18 @@ oper dirV2 : V -> V2 ; mkV3 = overload { - mkV3 : V -> Prep -> Prep -> V3 = \v,p,q -> v ** {c2 = p ; c3 = q ; lock_V3 = <>} ; - mkV2 : V -> V3 = \v -> v ** {c2 = accPrep ; - c3 = (casePrep allative) ; - lock_V3 = <>} ; - mkV2 : Str -> V3 = \str -> (mkV str) ** {c2 = accPrep ; - c3 = (casePrep allative) ; - lock_V3 = <>} ; - } ; + mkV3 : V -> Prep -> Prep -> V3 = \v,p,q -> lin V3 (v ** {c2 = p ; c3 = q}) ; + mkV3 : V -> V3 = \v -> lin V3 (v ** {c2 = accPrep ; c3 = casePrep allative}) ; + mkV3 : Str -> V3 = \str -> + let v : V = mkV str + in lin V3 (v ** {c2 = accPrep ; c3 = casePrep allative}) + } ; dirV3 v p = mkV3 v accPrep (casePrep p) ; dirdirV3 v = dirV3 v allative ; mkVS = overload { - mkVS : V -> VS = \v -> v ** {lock_VS = <>} ; - mkVS : Str -> VS = \str -> (mkV str) ** {lock_VS = <>} ; + mkVS : V -> VS = \v -> lin VS v ; + mkVS : Str -> VS = \str -> let v : V = mkV str in lin VS v ; } ; mkVV = overload { mkVV : V -> VV = \v -> mkVVf v infDa ; @@ -881,48 +863,50 @@ oper } ; mkVVf v f = lin VV (v ** {vi = f}) ; mkVQ = overload { - mkVQ : V -> VQ = \v -> v ** {lock_VQ = <>} ; - mkVQ : Str -> VQ = \str -> (mkV str) ** {lock_VQ = <>} ; + mkVQ : V -> VQ = \v -> lin VQ v ; + mkVQ : Str -> VQ = \str -> let v : V = mkV str in lin VQ v ; } ; V0 : Type = V ; AS, A2S, AV : Type = A ; A2V : Type = A2 ; - mkV0 v = v ** {lock_V = <>} ; + mkV0 v = v ; mkV2S = overload { - mkV2S : V -> Prep -> V2S = \v,p -> (mk2V2 v p) ** {lock_V2S = <>} ; - mkV2S : Str -> V2S = \str -> (mk2V2 (mkV str) (casePrep allative)) ** {lock_VS = <>} ; + mkV2S : V -> Prep -> V2S = \v,p -> lin V2S (mk2V2 v p) ; + mkV2S : Str -> V2S = \str -> + let v : V = mkV str + in lin V2S (mk2V2 v (casePrep allative)) } ; --- mkV2S v p = mk2V2 v p ** {lock_V2S = <>} ; + mkV2V = overload { mkV2V : V -> Prep -> V2V = \v,p -> mkV2Vf v p infMa ; mkV2V : V -> V2V = \v -> mkV2Vf v (casePrep genitive) infMa ; mkV2V : Str -> V2V = \str -> mkV2Vf (mkV str) (casePrep genitive) infMa ; } ; - mkV2Vf v p f = mk2V2 v p ** {vi = f ; lock_V2V = <>} ; + mkV2Vf v p f = lin V2V (mk2V2 v p ** {vi = f}) ; mkVA = overload { - mkVA : V -> Prep -> VA = \v,p -> v ** {c2 = p ; lock_VA = <>} ; - mkVA : V -> VA = \v -> v ** {c2 = casePrep translative ; lock_VA = <>} ; - mkVA : Str -> VA = \str -> (mkV str) ** {c2 = casePrep translative ; lock_VA = <>} ; + mkVA : V -> Prep -> VA = \v,p -> lin VA (v ** {c2 = p}) ; + mkVA : V -> VA = \v -> lin VA (v ** {c2 = casePrep genitive}) ; + mkVA : Str -> VA = \str -> let v : V = mkV str in + lin VA (v ** {c2 = casePrep genitive}) ; } ; mkV2A = overload { - mkV2A : V -> Prep -> Prep -> V2A = \v,p,q -> v ** {c2 = p ; c3 = q ; lock_V2A = <>} ; - mkV2A : V -> V2A = \v -> v ** {c2 = casePrep genitive ; - c3 = casePrep translative ; - lock_V2A = <>} ; - mkV2A : Str -> V2A = \str -> (mkV str) ** {c2 = casePrep genitive ; - c3 = casePrep translative ; - lock_V2A = <>} ; + mkV2A : V -> Prep -> Prep -> V2A = \v,p,q -> + lin V2A (v ** {c2 = p ; c3 = q}) ; + mkV2A : V -> V2A = \v -> + lin V2A (v ** {c2 = casePrep genitive ; c3 = casePrep translative}) ; + mkV2A : Str -> V2A = \str -> let v : V = mkV str in + lin V2A (v ** {c2 = casePrep genitive ; c3 = casePrep translative}) ; } ; - mkV2Q v p = mk2V2 v p ** {lock_V2Q = <>} ; + mkV2Q v p = lin V2Q (mk2V2 v p) ; - mkAS v = v ** {lock_A = <>} ; - mkA2S v p = mkA2 v p ** {lock_A = <>} ; - mkAV v = v ** {lock_A = <>} ; - mkA2V v p = mkA2 v p ** {lock_A2 = <>} ; + mkAS a = a ; + mkA2S a p = mkA2 a p ; + mkAV a = a ; + mkA2V a p = mkA2 a p ; } ; diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index 066eeb15..6ecc6f5d 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -71,7 +71,7 @@ param Infl = Regular | Participle | Invariable ; oper - Adjective : Type = {s : Degree => AForm => Str; lock_A : {}} ; + Adjective : Type = {s : Degree => AForm => Str} ; --2 Noun phrases -- @@ -495,9 +495,7 @@ oper --Auxiliary for internal use mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> Verb = \tulema,tulla,tuleb,tullakse,tulge,tuli,tulnud,tuldud -> - vforms2V (vForms8 - tulema tulla tuleb tullakse tulge tuli tulnud tuldud - ) ; + vforms2verb (vForms8 tulema tulla tuleb tullakse tulge tuli tulnud tuldud) ; --below moved here from MorphoEst VForms : Type = Predef.Ints 7 => Str ; @@ -515,7 +513,7 @@ oper 7 => tuldud } ; - vforms2V : VForms -> Verb = \vh -> + vforms2verb : VForms -> Verb = \vh -> let tulema = vh ! 0 ; tulla = vh ! 1 ; @@ -624,7 +622,7 @@ oper regVerb : (_,_,_,_ : Str) -> Verb = \kinkima,kinkida,kingib,kingitakse -> - vforms2V (regVForms kinkima kinkida kingib kingitakse) ; + vforms2verb (regVForms kinkima kinkida kingib kingitakse) ; noun2adj : Noun -> Adj = noun2adjComp True ; @@ -746,8 +744,7 @@ oper NCase Pl Ablat => jogede + "lt" ; NCase Pl Allat => jogede + "le" - } --; --- lock_N = <> + } } ; oper diff --git a/src/estonian/StructuralEst.gf b/src/estonian/StructuralEst.gf index 695bc625..51a09332 100644 --- a/src/estonian/StructuralEst.gf +++ b/src/estonian/StructuralEst.gf @@ -34,7 +34,7 @@ concrete StructuralEst of Structural = CatEst ** either7or_DConj = sd2 "kas" "või" ** {n = Sg} ; everybody_NP = makeNP (mkN "igaüks") Sg ; every_Det = mkDet Sg (mkN "iga") ; - everything_NP = makeNP ((mkN "kõik") ** {lock_N = <>}) Sg ; + everything_NP = makeNP (mkN "kõik") Sg ; everywhere_Adv = ss "kõikjal" ; few_Det = mkDet Sg (mkN "mõni") ; --- first_Ord = {s = \\n,c => (mkN "ensimmäinen").s ! NCase n c} ; @@ -257,11 +257,10 @@ oper oper makeNP : N -> MorphoEst.Number -> CatEst.NP ; - makeNP noun num = { + makeNP noun num = lin NP { s = \\c => noun.s ! NCase num (npform2case num c) ; a = agrP3 num ; isPron = False ; - lock_NP = <> } ; lin From e80cd828702fbcb68e777abfc7b681386488fa62 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 15 Apr 2022 10:33:41 +0800 Subject: [PATCH 78/92] (Est) misc small cleanup + better comments --- src/estonian/MorphoEst.gf | 40 +++++++-------------------------------- src/estonian/ResEst.gf | 1 - 2 files changed, 7 insertions(+), 34 deletions(-) diff --git a/src/estonian/MorphoEst.gf b/src/estonian/MorphoEst.gf index 1cd25c5f..fe838023 100644 --- a/src/estonian/MorphoEst.gf +++ b/src/estonian/MorphoEst.gf @@ -416,23 +416,11 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in { (satu + "tud") ; -- PastPartPass - ----------------- -- auxiliaries -- ----------------- -{- Noun internal opers moved to ResEst - -These used to be here: - NForms : Type = Predef.Ints 5 => Str ; - Noun : Type = {s: NForm => Str } ; - nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms ; - n2nforms : Noun -> NForms ; - nForms2N : NForms -> Noun ; - --} - -- Adjective forms AForms : Type = { @@ -472,15 +460,6 @@ These used to be here: adv_superl = suur + "immin" ; } ; -{- Verb internal opers moved to ResEst - -These used to be here: - VForms : Type = Predef.Ints 7 => Str ; - vForms8 : (x1,_,_,_,_,_,_,x8 : Str) -> VForms ; - regVForms : (x1,_,_,x4 : Str) -> VForms ; - vforms2V : VForms -> Verb ; --} - ----------------------- -- for Structural @@ -504,10 +483,9 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> -- Here we define personal and relative pronouns. -- input forms: Nom, Gen, Part - -- Note that the Fin version required 5 input forms, the - -- Est pronouns thus seem to be much simpler. - -- TODO: remove NPAcc? - -- I: keep NPAcc; see appCompl in ResEst, it takes care of finding a right case for various types of complements; incl. when pronouns get different treatment than nouns (PassVP). + -- NPAcc is same as Part for Pron, and same as Gen for other nominals. + -- ResEst.appCompl returns right case for various types of complements, + -- incl. when pronouns get different treatment than nouns (like in PassV2). mkPronoun : (_,_,_ : Str) -> Number -> Person -> {s : NPForm => Str ; a : Agr} = \mina, minu, mind, n, p -> @@ -538,6 +516,10 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> _ => x } ; + -- NB. This doesn't work correctly with stem+suffix based solution: + -- Ess, Abess, Comit, Termin all use the long Gen stem. + -- Alternative 1: let Gen be long form, leaving only Nom and Part actually short + -- Alternative 2: leave Gen short, postprocess Ess, Abess, Comit, Termin in application shortPronoun : (_,_,_,_ : Str) -> Number -> Person -> {s : NPForm => Str ; a : Agr} = \ma, mu, mind, minu, n, p -> @@ -551,15 +533,9 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> in shortMa ** { s = table { NPCase Allat => mulle ; NPCase Transl => minu + "ks" ; - NPCase Ess => minu + "na" ; - NPCase Abess => minu + "ta" ; - NPCase Comit => minu + "ga" ; - NPCase Termin => minu + "ni" ; x => shortMa.s ! x } } ; - - oper relPron : NForm => Str = @@ -572,7 +548,6 @@ oper ProperName = {s : Case => Str} ; - -- TODO: generate using mkPronoun pronSe : ProperName = { s = table { Nom => "see" ; @@ -588,7 +563,6 @@ oper } ; } ; - -- TODO: generate using mkPronoun pronNe : ProperName = { s = table { Nom => "need" ; diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index 6ecc6f5d..d5e3e1bc 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -497,7 +497,6 @@ oper \tulema,tulla,tuleb,tullakse,tulge,tuli,tulnud,tuldud -> vforms2verb (vForms8 tulema tulla tuleb tullakse tulge tuli tulnud tuldud) ; ---below moved here from MorphoEst VForms : Type = Predef.Ints 7 => Str ; vForms8 : (x1,_,_,_,_,_,_,x8 : Str) -> VForms = From a59ed0e0e2cbaa2426307626bb3ee03661b3cfb5 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 15 Apr 2022 10:37:21 +0800 Subject: [PATCH 79/92] (Est) Workaround for short forms of Sg pers. prons Always use long Gen, because other cases are formed from long Gen stem --- src/estonian/MorphoEst.gf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/estonian/MorphoEst.gf b/src/estonian/MorphoEst.gf index fe838023..d8754b51 100644 --- a/src/estonian/MorphoEst.gf +++ b/src/estonian/MorphoEst.gf @@ -520,6 +520,7 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> -- Ess, Abess, Comit, Termin all use the long Gen stem. -- Alternative 1: let Gen be long form, leaving only Nom and Part actually short -- Alternative 2: leave Gen short, postprocess Ess, Abess, Comit, Termin in application + -- Alternative 3: include two Gen stems in NPForm shortPronoun : (_,_,_,_ : Str) -> Number -> Person -> {s : NPForm => Str ; a : Agr} = \ma, mu, mind, minu, n, p -> @@ -531,6 +532,7 @@ caseTable : Number -> Noun -> Case => Str = \n,cn -> } ; in shortMa ** { s = table { + NPCase Gen => minu ; -- this is Alternative 1, see comment above. Comment out for Alternative 2. NPCase Allat => mulle ; NPCase Transl => minu + "ks" ; x => shortMa.s ! x } } ; From 7dd63173f2a5b261314f690fb861995148d10fe3 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 15 Apr 2022 19:12:02 +0800 Subject: [PATCH 80/92] (Est) Fix plural genitive forms for mis --- src/estonian/StructuralEst.gf | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/estonian/StructuralEst.gf b/src/estonian/StructuralEst.gf index 51a09332..f74b092b 100644 --- a/src/estonian/StructuralEst.gf +++ b/src/estonian/StructuralEst.gf @@ -198,27 +198,21 @@ oper } } ; - --TODO does this work? - mikaInt : MorphoEst.Number => (MorphoEst.Case) => Str = + mikaInt : MorphoEst.Number => MorphoEst.Case => Str = let { - mi = mkN "mille" + mi : N = mkN "mis" "mille" "mida" "millesse" "millede" "mida" } in table { Sg => table { - Nom => "mis" ; - Gen => "mille" ; - Part => "mida" ; c => mi.s ! NCase Sg c } ; Pl => table { Nom => "mis" ; - Gen => "mille" ; - Part => "mida" ; c => mi.s ! NCase Pl c } } ; - kukaInt : MorphoEst.Number => (MorphoEst.Case) => Str = + kukaInt : MorphoEst.Number => MorphoEst.Case => Str = let kuka = mkN "kes" "kelle" "keda" "kellesse" "kellede" "keda" ; From bcd7a098648a4839f3d4854aaf7d55bfcc5a4974 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 18 Apr 2022 19:43:38 +0800 Subject: [PATCH 81/92] (Est) Make N2, CN, NP & IP discontinuous Needed for attaching case suffix in right place --- src/estonian/AdjectiveEst.gf | 6 +-- src/estonian/AdverbEst.gf | 2 +- src/estonian/CatEst.gf | 48 +++++++++++----------- src/estonian/ConjunctionEst.gf | 26 +++++++----- src/estonian/ExtendEst.gf | 22 +++++----- src/estonian/ExtraEst.gf | 23 +++++------ src/estonian/IdiomEst.gf | 4 +- src/estonian/NounEst.gf | 74 ++++++++++++++++------------------ src/estonian/ParadigmsEst.gf | 7 +++- src/estonian/PhraseEst.gf | 8 ++-- src/estonian/QuestionEst.gf | 11 +++-- src/estonian/RelativeEst.gf | 8 ++-- src/estonian/ResEst.gf | 69 +++++++++++++++++++++++++++---- src/estonian/StructuralEst.gf | 27 +++++-------- src/estonian/SymbolEst.gf | 18 +++------ src/estonian/VerbEst.gf | 2 +- 16 files changed, 201 insertions(+), 154 deletions(-) diff --git a/src/estonian/AdjectiveEst.gf b/src/estonian/AdjectiveEst.gf index 5cf65d4e..cb43fe1b 100644 --- a/src/estonian/AdjectiveEst.gf +++ b/src/estonian/AdjectiveEst.gf @@ -11,14 +11,14 @@ concrete AdjectiveEst of Adjective = CatEst ** open ResEst, Prelude in { } ; ComparA a np = { s = \\isMod,af => case isMod of { - True => np.s ! NPCase Elat ++ a.s ! Compar ! AN af ; -- minust suurem - _ => a.s ! Compar ! AN af ++ "kui" ++ np.s ! NPCase Nom -- suurem kui mina + True => linNP (NPCase Elat) np ++ a.s ! Compar ! AN af ; -- minust suurem + _ => a.s ! Compar ! AN af ++ "kui" ++ linNP (NPCase Nom) np -- suurem kui mina } ; infl = Regular ; --a.infl } ; CAdvAP ad ap np = { - s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ np.s ! NPCase Nom ; + s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ linNP (NPCase Nom) np ; infl = ap.infl } ; UseComparA a = { diff --git a/src/estonian/AdverbEst.gf b/src/estonian/AdverbEst.gf index 566f3475..8b750f62 100644 --- a/src/estonian/AdverbEst.gf +++ b/src/estonian/AdverbEst.gf @@ -5,7 +5,7 @@ concrete AdverbEst of Adverb = CatEst ** open ResEst, Prelude in { lin PositAdvAdj a = {s = a.s ! Posit ! AAdv} ; ComparAdvAdj cadv a np = { - s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ np.s ! NPCase Nom + s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ linNP (NPCase Nom) np } ; ComparAdvAdjS cadv a s = { s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ s.s diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index 0b8b5cc6..945f55d1 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -20,7 +20,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { -- Question QCl = {s : ResEst.Tense => Anteriority => Polarity => Str} ; - IP = {s : NPForm => Str ; n : Number} ; + IP = ResEst.IPhrase ; IComp = {s : Agr => Str} ; IDet = {s : Case => Str ; n : Number ; isNum : Bool} ; IQuant = {s : Number => Case => Str} ; @@ -28,7 +28,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { -- Relative RCl = {s : ResEst.Tense => Anteriority => Polarity => Agr => Str ; c : NPForm} ; - RP = {s : Number => NPForm => Str ; a : RAgr} ; + RP = ResEst.RelPron ; -- Verb @@ -43,20 +43,14 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { -- The $Infl$ in infl tells whether the adjective inflects as a -- modifier: e.g. "väsinud mehele" vs. "mees muutus väsinuks". - AP = {s : Bool => NForm => Str ; infl : Infl} ; + AP = ResEst.APhrase ; -- Noun - CN = {s : NForm => Str} ; + CN = ResEst.CNoun ; Pron = {s : NPForm => Str ; a : Agr} ; - NP = {s : NPForm => Str ; a : Agr ; isPron : Bool} ; - DAP, Det = { - s : Case => Str ; -- minun kolme - sp : Case => Str ; -- se (substantival form) - n : Number ; -- Pl (agreement feature for verb) - isNum : Bool ; -- True (a numeral is present) - isDef : Bool -- True (verb agrees in Pl, Nom is not Part) --I: actually, can we get rid of this? - } ; + NP = ResEst.NPhrase ; + DAP, Det = ResEst.Determiner ; ---- QuantSg, QuantPl = {s : Case => Str ; isDef : Bool} ; Ord = {s : NForm => Str} ; @@ -75,26 +69,34 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { Conj = {s1,s2 : Str ; n : Number} ; ----b DConj = {s1,s2 : Str ; n : Number} ; Subj = {s : Str} ; - Prep = Compl ; + Prep = ResEst.Compl ; -- Open lexical classes, e.g. Lexicon - V, VS, VQ = Verb1 ; -- = {s : VForm => Str ; sc : Case} ; - V2, VA, V2Q, V2S = Verb2 ; - V2A, V3 = Verb3 ; - VV = Verb1 ** {vi : InfForms} ; - V2V = Verb2 ** {vi : InfForms} ; + V, VS, VQ = ResEst.Verb1 ; -- = {s : VForm => Str ; sc : Case} ; + V2, VA, V2Q, V2S = ResEst.Verb2 ; + V2A, V3 = ResEst.Verb3 ; + VV = ResEst.Verb1 ** {vi : InfForms} ; + V2V = ResEst.Verb2 ** {vi : InfForms} ; - A = Adjective ** {infl : Infl} ; - A2 = A ** {c2 : Compl} ; + A = ResEst.Adjective ** {infl : Infl} ; + A2 = ResEst.Adjective ** {infl : Infl ; c2 : Compl} ; - N = Noun ; - N2 = Noun ** {c2 : Compl ; isPre : Bool} ; - N3 = Noun ** {c2,c3 : Compl ; isPre,isPre2 : Bool} ; + N = ResEst.Noun ; + N2 = ResEst.Noun ** { + postmod : Str ; -- postmod, because N2 can come from N3+complement via ComplN3 + c2 : Compl ; + isPre : Bool} ; + N3 = ResEst.Noun ** { -- no postmod, because N3 can only come from lexical funs + c2,c3 : Compl ; + isPre,isPre2 : Bool + } ; PN = {s : Case => Str} ; linref VP = \vp -> linV vp.v ; + NP = linNP (NPCase Nom) ; + CN = linCN (NCase Sg Nom) ; V,VS,VQ = linV ; V2,VA,V2S,V2Q = linV2 ; diff --git a/src/estonian/ConjunctionEst.gf b/src/estonian/ConjunctionEst.gf index d7517733..51169db4 100644 --- a/src/estonian/ConjunctionEst.gf +++ b/src/estonian/ConjunctionEst.gf @@ -9,11 +9,12 @@ concrete ConjunctionEst of Conjunction = ConjAdv = conjunctDistrSS ; - ConjCN = conjunctDistrTable NForm ; + ConjCN conj ss = conjunctDistrTable NForm conj ss ** ss ; ConjNP conj ss = conjunctDistrTable NPForm conj ss ** { a = conjAgr (Ag conj.n P3) ss.a ; -- P3 is the maximum - isPron = False + isPron = False ; + postmod = ss.postmod } ; ConjAP conj ss = conjunctDistrTableAdj conj ss ; @@ -28,20 +29,20 @@ concrete ConjunctionEst of Conjunction = ConsS = consrSS comma ; BaseAdv = twoSS ; ConsAdv = consrSS comma ; - BaseCN = twoTable NForm ; - ConsCN = consrTable NForm comma ; - BaseNP x y = twoTable NPForm x y ** {a = conjAgr x.a y.a} ; - ConsNP xs x = consrTable NPForm comma xs x ** {a = conjAgr xs.a x.a} ; + BaseCN x y = twoTable NForm (mergeCN x) y ** {postmod = y.postmod} ; + ConsCN x xs = consrTable NForm comma (mergeCN x) xs ** xs ; + BaseNP x y = twoTable NPForm (mergeNP x) y ** {a = conjAgr x.a y.a ; postmod = y.postmod} ; + ConsNP x xs = consrTable NPForm comma (mergeNP x) xs ** {a = conjAgr xs.a x.a ; postmod = xs.postmod} ; BaseAP x y = twoTableAdj x y ; - ConsAP xs x = consrTableAdj comma x xs ; + ConsAP x xs = consrTableAdj comma x xs ; BaseRS x y = twoTable Agr x y ** {c = y.c} ; - ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ; + ConsRS x xs = consrTable Agr comma x xs ** {c = xs.c} ; lincat [S] = {s1,s2 : Str} ; [Adv] = {s1,s2 : Str} ; - [CN] = {s1,s2 : NForm => Str} ; - [NP] = {s1,s2 : NPForm => Str ; a : Agr} ; + [CN] = {s1,s2 : NForm => Str ; postmod : Str} ; + [NP] = {s1,s2 : NPForm => Str ; a : Agr ; postmod : Str} ; [AP] = {s1,s2 : {s : Bool => NForm => Str ; infl : Infl }} ; [RS] = {s1,s2 : Agr => Str ; c : NPForm} ; @@ -53,7 +54,7 @@ concrete ConjunctionEst of Conjunction = s2 = y } ; - consrTableAdj : Str -> [AP] -> {s : Bool => NForm => Str ; infl : Infl} -> [AP] = \c,xs,x -> + consrTableAdj : Str -> APhrase -> [AP] -> [AP] = \c,x,xs -> let ap1 = xs.s1 ; ap2 = xs.s2 @@ -101,4 +102,7 @@ concrete ConjunctionEst of Conjunction = infl = Regular } ; + -- for CN and NP with discontinuous fields, put all stuff in s field + mergeNP : NPhrase -> NPhrase = \np -> np ** {s = \\c => linNP c np} ; + mergeCN : CNoun -> CNoun = \cn -> cn ** {s = \\nf => linCN nf cn} ; } diff --git a/src/estonian/ExtendEst.gf b/src/estonian/ExtendEst.gf index c953be65..b8b2ebd4 100644 --- a/src/estonian/ExtendEst.gf +++ b/src/estonian/ExtendEst.gf @@ -90,7 +90,7 @@ concrete ExtendEst of Extend = RNPList = {s1,s2 : Agr => NPForm => Str} ; oper - rnp2np : Agr -> RNP -> NP = \agr,rnp -> lin NP { + rnp2np : Agr -> RNP -> NPhrase = \agr,rnp -> emptyNP ** { a = agr ; s = rnp.s ! agr ; isPron = False ; -- ?? @@ -159,7 +159,7 @@ concrete ExtendEst of Extend = AdAdV ad adv = AdAdv ad adv ; -- : AP -> CN ; -- a green one ; en grön (Swe) - AdjAsCN ap = {s = ap.s ! True} ; -- True = attributive ; False = predicative + AdjAsCN ap = emptyCN ** {s = ap.s ! True} ; -- True = attributive ; False = predicative -- : AP -> NP AdjAsNP ap = MassNP (AdjAsCN ap) ; @@ -270,14 +270,14 @@ concrete ExtendEst of Extend = lin -- : NP -> Quant ; -- this man's GenNP np = { - s,sp = \\_,_ => np.s ! NPCase Gen ; + s,sp = \\_,_ => linNP (NPCase Gen) np ; isNum = False ; isDef = True ; isNeg = False } ; -- : IP -> IQuant ; -- whose - GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ; + GenIP ip = {s = \\_,_ => linIP (NPCase Gen) ip} ; -- : Num -> CN -> RP ; -- whose car GenRP num cn = { @@ -298,7 +298,7 @@ concrete ExtendEst of Extend = GerundAdv vp = {s = infVPdefault vp InfDes} ; -- : VP -> CN -- publishing of the document (can get a determiner) - GerundCN vp = {s = \\nf => infVPdefault vp InfMine} ; + GerundCN vp = emptyCN ** {s = \\nf => infVPdefault vp InfMine} ; -- : VP -> NP -- publishing the document (by nature definite) GerundNP vp = MassNP (GerundCN vp) ; @@ -331,7 +331,7 @@ concrete ExtendEst of Extend = -- : VPSlash -> NP -> VP ; -- be begged by her to go PassAgentVPSlash vps np = let vp : VP = PassVPSlash vps in vp ** { - adv = vp.adv ++ np.s ! NPCase Gen ++ "poolt" ; + adv = vp.adv ++ appCompl True Pos by8agent_Prep np ; } ; @@ -357,7 +357,7 @@ concrete ExtendEst of Extend = -- : VPSlash -> NP -> AP -- hobisukeldujate poolt leitud (süvaveepomm) PastPartAgentAP vp np = { - s = \\_,_ => np.s ! NPCase Gen ++ "poolt" ++ vp2adv vp True (VIPass Past) ; + s = \\_,_ => appCompl True Pos by8agent_Prep np ++ vp2adv vp True (VIPass Past) ; infl = Invariable } ; @@ -407,11 +407,11 @@ concrete ExtendEst of Extend = UseDAPFem, UseDAPMasc = DetNP ; - UttAccIP ip = {s = ip.s ! NPAcc} ; - UttAccNP np = {s = np.s ! NPAcc} ; + UttAccIP ip = {s = linIP NPAcc ip} ; + UttAccNP np = {s = linNP NPAcc np} ; UttAdV adv = adv ; - UttDatIP ip = {s = ip.s ! NPCase Part} ; -- is partitive a reasonable translation? - UttDatNP np = {s = np.s ! NPCase Part} ; + UttDatIP ip = {s = linIP (NPCase Part) ip} ; -- is partitive a reasonable translation? + UttDatNP np = {s = linNP (NPCase Part) np} ; -- : VP -> Utt ; -- There's no "short form", so just using InfDa instead of InfMa UttVPShort vp = {s = infVPdefault vp InfDa} ; diff --git a/src/estonian/ExtraEst.gf b/src/estonian/ExtraEst.gf index 644d8e9e..4fc96a0b 100644 --- a/src/estonian/ExtraEst.gf +++ b/src/estonian/ExtraEst.gf @@ -3,7 +3,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** flags coding=utf8; lin GenNP np = { - s,sp = \\_,_ => np.s ! NPCase Gen ; + s,sp = \\_,_ => linNP (NPCase Gen) np ; isNum = False ; isDef = True ; --- "Jussin kolme autoa ovat" ; thus "...on" is missing isNeg = False @@ -15,7 +15,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** AbessCN = caseCN Abessive ; -- autota pere TerminCN = caseCN Terminative ; -- maani kleit - GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ; + GenIP ip = {s = \\_,_ => linIP (NPCase Gen) ip} ; GenRP num cn = { s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ; @@ -87,7 +87,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** PassAgentVPSlash vp np = vp ; {- s = {s = vp.s.s ; h = vp.s.h ; p = vp.s.p ; sc = npform2subjcase vp.c2.c} ; - s2 = \\b,p,a => np.s ! NPCase Nom ++ vp.s2 ! b ! p ! a ; + s2 = \\b,p,a => linNP (NPCase Nom) np ++ vp.s2 ! b ! p ! a ; adv = vp.adv ; ext = vp.ext ; vptyp = vp.vptyp ; @@ -95,7 +95,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** AdvExistNP adv np = mkClause (\_ -> adv.s) np.a (insertObj - (\\_,b,_ => np.s ! NPCase Nom) (predV (verbOlema ** {sc = NPCase Nom}))) ; + (\\_,b,_ => linNP (NPCase Nom) np) (predV (verbOlema ** {sc = NPCase Nom}))) ; RelExistNP prep rp np = { s = \\t,ant,bo,ag => @@ -105,7 +105,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** (\_ -> appCompl True Pos prep (rp2np n rp)) np.a (insertObj - (\\_,b,_ => np.s ! NPCase Nom) + (\\_,b,_ => linNP (NPCase Nom) np) (predV (verbOlema ** {sc = NPCase Nom}))) ; in cl.s ! t ! ant ! bo ! SDecl ; @@ -114,26 +114,26 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** AdvPredNP adv v np = mkClause (\_ -> adv.s) np.a (insertObj - (\\_,b,_ => np.s ! NPCase Nom) (predV v)) ; + (\\_,b,_ => linNP (NPCase Nom) np) (predV v)) ; ICompExistNP adv np = let cl = mkClause (\_ -> adv.s ! np.a) np.a (insertObj - (\\_,b,_ => np.s ! NPCase Nom) (predV (verbOlema ** {sc = NPCase Nom}))) ; + (\\_,b,_ => linNP (NPCase Nom) np) (predV (verbOlema ** {sc = NPCase Nom}))) ; in { s = \\t,a,p => cl.s ! t ! a ! p ! SDecl } ; IAdvPredNP iadv v np = let cl = mkClause (\_ -> iadv.s) np.a (insertObj - (\\_,b,_ => np.s ! v.sc) (predV v)) ; + (\\_,b,_ => linNP v.sc np) (predV v)) ; in { s = \\t,a,p => cl.s ! t ! a ! p ! SDecl } ; -- i_implicPron = mkPronoun [] "minun" "minua" "minuna" "minuun" Sg P1 ; - whatPart_IP = { + whatPart_IP = emptyIP ** { s = table { - NPCase Nom | NPAcc => "mitä" ; + NPCase Nom | NPAcc => "mida" ; c => whatSg_IP.s ! c } ; n = Sg @@ -142,12 +142,11 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** PartCN cn = let acn = DetCN (DetQuant IndefArt NumSg) cn - in { + in acn ** { s = table { NPCase Nom | NPAcc => acn.s ! NPCase ResEst.Part ; c => acn.s ! c } ; - a = acn.a ; isPron = False ; isNeg = False } ; diff --git a/src/estonian/IdiomEst.gf b/src/estonian/IdiomEst.gf index 59c1b9ef..8ae3c7ca 100644 --- a/src/estonian/IdiomEst.gf +++ b/src/estonian/IdiomEst.gf @@ -10,7 +10,7 @@ concrete IdiomEst of Idiom = CatEst ** Pos => NPCase Nom ; -- on olemas lammas Neg => NPCase Part -- ei ole olemas lammast } ; - vp = insertObj (\\_,b,_ => "olemas" ++ np.s ! cas b) (predV olla) + vp = insertObj (\\_,b,_ => "olemas" ++ linNP (cas b) np) (predV olla) in existClause noSubj (agrP3 Sg) vp ; @@ -28,7 +28,7 @@ concrete IdiomEst of Idiom = CatEst ** CleftNP np rs = mkClause (\_ -> "see") (agrP3 Sg) (insertExtrapos (rs.s ! np.a) - (insertObj (\\_,_,_ => np.s ! NPCase Nom) (predV olla))) ; + (insertObj (\\_,_,_ => linNP (NPCase Nom) np) (predV olla))) ; -- This gives the almost forbidden "se on Porissa kun Matti asuu". -- Est: "see on Toris, kus Mati elab" (?) diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index f87ae33f..f353b1e6 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -22,7 +22,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in <_, _, True,_> => ; -- kolmeks kassiks (all other cases) _ => -- kass, kassi, ... (det is not a number) } - in { + in cn ** { s = \\c => let k = ncase c ; in @@ -41,7 +41,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in True => Sg ; _ => det.n } ; - in { + in emptyNP ** { s = \\c => let k = npform2case n c in det.sp ! k ; a = agrP3 (case det.isDef of { @@ -51,37 +51,24 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in isPron = False } ; - UsePN pn = { + UsePN pn = emptyNP ** { s = \\c => pn.s ! npform2case Sg c ; a = agrP3 Sg ; isPron = False } ; - UsePron p = p ** {isPron = True} ; + UsePron p = p ** {isPron = True ; postmod = []} ; - PredetNP pred np = { + PredetNP pred np = np ** { s = \\c => pred.s ! complNumAgr np.a ! c ++ np.s ! c ; - a = np.a ; - isPron = np.isPron -- kaikki minun - ni } ; PPartNP np v2 = let num : Number = complNumAgr np.a ; part : Str = v2.s ! (PastPart Pass) ; - adj : NForms = hjk_type_IVb_maakas part ; - partGen : Str = adj ! 1 ; - partEss : Str = partGen + "na" - in { - s = \\c => np.s ! c ++ part ; --partEss ; - a = np.a ; - isPron = np.isPron -- minun täällä - ni - } ; + in np ** {postmod = np.postmod ++ part} ; - AdvNP np adv = { - s = \\c => np.s ! c ++ adv.s ; - a = np.a ; - isPron = np.isPron -- minun täällä - ni - } ; + AdvNP np adv = np ** {postmod = np.postmod ++ adv.s} ; DetQuantOrd quant num ord = { s = \\c => quant.s ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ; @@ -120,7 +107,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in isDef = True --- "minun kolme autoani ovat" ; thus "...on" is missing } ; - PossNP cn np = {s = \\nf => np.s ! NPCase Gen ++ cn.s ! nf }; + PossNP cn np = np ** {s = \\nf => linNP (NPCase Gen) np ++ cn.s ! nf} ; NumSg = {s = \\_,_ => [] ; isNum = False ; n = Sg} ; NumPl = {s = \\_,_ => [] ; isNum = False ; n = Pl} ; @@ -167,36 +154,44 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in let n : Number = Sg ; ncase : Case -> NForm = \c -> NCase n c ; - in { + in cn ** { s = \\c => let k = npform2case n c in cn.s ! ncase k ; a = agrP3 Sg ; isPron = False } ; - UseN n = n ; + UseN n = emptyCN ** { + s = n.s + } ; UseN2 n = n ; - Use2N3 f = f ; + Use2N3 f = f ** { + postmod = [] + } ; Use3N3 f = f ** { c2 = f.c3 ; - isPre = f.isPre2 + isPre = f.isPre2 ; + postmod = [] } ; - ComplN2 f x = { - s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) + ComplN2 f x = let compl : Str = appCompl True Pos f.c2 x in { + s = \\nf => case f.isPre of { + True => f.s ! nf ; -- N2 is pre, so compl goes into postmod + False => compl ++ f.s ! nf -- N2 isn't pre, compl goes in s before the N2 + } ; + postmod = f.postmod ++ if_then_Str f.isPre compl [] } ; - - ComplN3 f x = lin N2 { - s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ; + -- N2 is subtype of CN, so we can reuse result of ComplN2 as a base for our CN. + -- The decision of noun-complement order is only done once, in ComplN2. + ComplN3 f x = let cn : CN = ComplN2 (Use2N3 f) x in cn ** { c2 = f.c3 ; isPre = f.isPre2 } ; - - AdjCN ap cn = { + AdjCN ap cn = cn ** { s = \\nf => case ap.infl of { Invariable|Participle => ap.s ! True ! NCase Sg Nom ++ cn.s ! nf ; --valmis kassile; väsinud kassile @@ -204,19 +199,20 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in } } ; - RelCN cn rs = {s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)} ; + RelCN cn rs = cn ** { -- exception to postmod rule, because RS depends on Agr + s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf) + } ; - RelNP np rs = { - s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; - a = np.a ; + RelNP np rs = np ** { + postmod = np.postmod ++ "," ++ rs.s ! np.a ; isPron = np.isPron ---- correct ? } ; - AdvCN cn ad = {s = \\nf => cn.s ! nf ++ ad.s} ; + AdvCN cn ad = cn ** {postmod = cn.postmod ++ ad.s} ; - SentCN cn sc = {s = \\nf=> cn.s ! nf ++ sc.s} ; + SentCN cn sc = cn ** {postmod = cn.postmod ++ sc.s} ; - ApposCN cn np = {s = \\nf=> cn.s ! nf ++ np.s ! NPCase Nom} ; --- luvun x + ApposCN cn np = cn ** {postmod = cn.postmod ++ linNP (NPCase Nom) np} ; --- luvun x oper numN : NForm -> Number = \nf -> case nf of { diff --git a/src/estonian/ParadigmsEst.gf b/src/estonian/ParadigmsEst.gf index 55f5cc69..45bffe7d 100644 --- a/src/estonian/ParadigmsEst.gf +++ b/src/estonian/ParadigmsEst.gf @@ -574,7 +574,12 @@ oper mkN2 : N -> Prep -> N2 = mmkN2 } ; - mmkN2 : N -> Prep -> N2 = \n,c -> lin N (n ** {c2 = c ; isPre = mkIsPre c}) ; + mmkN2 : N -> Prep -> N2 = \n,c -> lin N2 (n ** { + c2 = c ; + isPre = mkIsPre c ; + postmod = [] + }) ; + mkN3 = \n,c,e -> lin N3 (n ** { c2 = c ; c3 = e ; isPre = mkIsPre c ; -- matka Londonist Pariisi diff --git a/src/estonian/PhraseEst.gf b/src/estonian/PhraseEst.gf index 0557107b..a50c61db 100644 --- a/src/estonian/PhraseEst.gf +++ b/src/estonian/PhraseEst.gf @@ -9,12 +9,12 @@ concrete PhraseEst of Phrase = CatEst ** open ResEst, (P = Prelude) in { UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Ag Pl P2} ; UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! AgPol} ; - UttIP ip = {s = ip.s ! NPCase Nom} ; + UttIP ip = {s = linIP (NPCase Nom) ip} ; UttIAdv iadv = iadv ; - UttNP np = {s = np.s ! NPCase Nom} ; + UttNP np = {s = linNP (NPCase Nom) np} ; UttVP vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfMa} ; UttAdv adv = adv ; - UttCN np = {s = np.s ! NCase Sg Nom} ; + UttCN cn = {s = linCN (NCase Sg Nom) cn} ; UttAP np = {s = np.s ! P.False ! NCase Sg Nom} ; UttCard n = {s = n.s ! Sg ! Nom} ; UttInterj i = i ; @@ -23,6 +23,6 @@ concrete PhraseEst of Phrase = CatEst ** open ResEst, (P = Prelude) in { PConjConj conj = {s = conj.s2} ; NoVoc = {s = []} ; - VocNP np = {s = "," ++ np.s ! NPCase Nom} ; + VocNP np = {s = "," ++ linNP (NPCase Nom) np} ; } diff --git a/src/estonian/QuestionEst.gf b/src/estonian/QuestionEst.gf index 58a69f6b..0df94f21 100644 --- a/src/estonian/QuestionEst.gf +++ b/src/estonian/QuestionEst.gf @@ -40,16 +40,15 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in { PrepIP p ip = {s = appCompl True Pos p (ip ** {a = agrP3 ip.n ; isPron = False})} ; - AdvIP ip adv = { - s = \\c => ip.s ! c ++ adv.s ; - n = ip.n + AdvIP ip adv = ip ** { + postmod = ip.postmod ++ adv.s ; } ; -- The computation of $ncase$ is a special case of that in $NounEst.DetCN$, -- since we don't have possessive suffixes or definiteness. --- It could still be nice to have a common oper... - IdetCN idet cn = let n = idet.n in { + IdetCN idet cn = let n = idet.n in emptyIP ** { s = \\c => let k : Case = npform2case n c ; @@ -67,7 +66,7 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in { n = n } ; - IdetIP idet = let n = idet.n in { + IdetIP idet = let n = idet.n in emptyIP ** { s = \\c => let k = npform2case n c ; @@ -97,6 +96,6 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in { AdvIAdv i a = {s = i.s ++ a.s} ; CompIAdv a = {s = \\_ => a.s} ; - CompIP ip = {s = \\_ => ip.s ! NPCase Nom} ; + CompIP ip = {s = \\_ => linIP (NPCase Nom) ip} ; } diff --git a/src/estonian/RelativeEst.gf b/src/estonian/RelativeEst.gf index 4be5f96a..7cf10c34 100644 --- a/src/estonian/RelativeEst.gf +++ b/src/estonian/RelativeEst.gf @@ -18,8 +18,10 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in RAg a => a } ; cl = mkClause - (subjForm {s = rp.s ! (complNumAgr agr) ; - a = agr ; isPron = False} vp.sc) agr vp + (subjForm + (emptyNP ** {s = rp.s ! complNumAgr agr ; a = agr}) + vp.sc) + agr vp in cl.s ! t ! ant ! b ! SDecl ; c = NPCase Nom @@ -36,7 +38,7 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in } ; FunRP p np rp = { - s = \\n,c => appCompl True Pos p (rp2np n rp) ++ np.s ! c ; --- is c OK? + s = \\n,c => appCompl True Pos p (rp2np n rp) ++ linNP c np ; --- is c OK? a = RAg np.a } ; diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index d5e3e1bc..5e7f45c6 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -57,8 +57,34 @@ resource ResEst = ParamX ** open Prelude in { } ; oper - NP = {s : NPForm => Str ; a : Agr ; isPron : Bool} ; + IPhrase : Type = { + s : NPForm => Str ; -- the noun phrase + premodifiers + postmod : Str ; -- adverb, RS, etc. other postmods + n : Number + } ; + NPhrase : Type = { + s : NPForm => Str ; -- the noun phrase + premodifiers + postmod : Str ; -- adverb, RS, etc. other postmods + a : Agr ; + isPron : Bool + } ; + + emptyNP : NPhrase = { + s = \\_ => [] ; + postmod = [] ; + a = agrP3 Sg ; + isPron = False + } ; + + emptyIP : IPhrase = { + s = \\_ => [] ; + postmod = [] ; + n = Sg ; + } ; + + linNP : NPForm -> NPhrase -> Str = \npf,np -> np.s ! npf ++ np.postmod ; + linIP : NPForm -> IPhrase -> Str = \npf,ip -> ip.s ! npf ++ ip.postmod ; -- --2 Adjectives -- @@ -73,6 +99,8 @@ param oper Adjective : Type = {s : Degree => AForm => Str} ; + APhrase : Type = {s : Bool => NForm => Str ; infl : Infl} ; + --2 Noun phrases -- -- Two forms of *virtual accusative* are needed for nouns in singular, @@ -179,7 +207,9 @@ param Compl : Type = {s : Str ; c : NPFormPlus ; isPre : Bool} ; - appCompl : Bool -> Polarity -> Compl -> NP -> Str = \isFin,b,co,np -> + npfplus2compl : NPFormPlus -> Compl = \npf -> {s = [] ; c = npf ; isPre = False} ; + + appCompl : Bool -> Polarity -> Compl -> NPhrase -> Str = \isFin,b,co,np -> let c = case co.c.npf of { NPAcc => case b of { @@ -196,7 +226,7 @@ param } ; nps = np.s ! c ++ co.c.suf ; -- complement's NPFormPlus may include suffix for the cases based on Gen stem, e.g. comitative "ga" in - preOrPost co.isPre co.s nps ; + preOrPost co.isPre co.s nps ++ np.postmod ; -- Used for passive; c2 of V2/VPSlash becomes sc of VP compl2subjcase : Compl -> NPForm = \compl -> @@ -436,7 +466,7 @@ oper -- This is used for subjects of passives: therefore isFin in False. - subjForm : NP -> NPForm -> Polarity -> Str = \np,sc,b -> + subjForm : NPhrase -> NPForm -> Polarity -> Str = \np,sc,b -> appCompl False b {s = [] ; c = case2npformp sc ; isPre = True} np ; infVP : NPForm -> Polarity -> Agr -> VP -> InfForms -> Str = infVPAnt Simul ; @@ -644,6 +674,15 @@ oper Noun : Type = {s : NForm => Str} ; + CNoun : Type = Noun ** {postmod : Str} ; + + emptyCN : CNoun = { + s = \\nf => [] ; + postmod = [] + } ; + + linCN : NForm -> CNoun -> Str = \nf,cn -> cn.s ! nf ++ cn.postmod ; + -- To form an adjective, it is usually enough to give a noun declension: the -- adverbial form is regular. @@ -666,13 +705,13 @@ oper -- Reflexive pronoun. --- Possessive could be shared with the more general $NounFin.DetCN$. - reflPron : Agr -> NP = \agr -> + reflPron : Agr -> NPhrase = \agr -> let ise = nForms2N (nForms6 "ise" "enda" "ennast" "endasse" "endi" "endid") ; n = case agr of { AgPol => Sg ; Ag n _ => n } ; - in { + in emptyNP ** { s = table { NPAcc => "ennast" ; NPCase c => fixPlNom "endid" ise.s ! NCase n c @@ -747,7 +786,11 @@ oper } ; oper - rp2np : Number -> {s : Number => NPForm => Str ; a : RAgr} -> NP = \n,rp -> { + -- Technically, we could also add a postmod field for RP, + -- because multiple applications of FunRP add multiple complements. + -- But I will only add it if I see a real-world sentence that uses multiple applications of FunRP. + RelPron : Type = {s : Number => NPForm => Str ; a : RAgr} ; + rp2np : Number -> RelPron -> NPhrase = \n,rp -> emptyNP ** { s = rp.s ! n ; a = agrP3 Sg ; -- does not matter (--- at least in Slash) isPron = False -- has no special accusative @@ -755,7 +798,17 @@ oper etta_Conj : Str = "et" ; - heavyDet : PDet -> PDet ** {sp : Case => Str} = \d -> d ** {sp = d.s} ; + Determiner : Type = { + s : Case => Str ; -- minun kolme + sp : Case => Str ; -- se (substantival form) + n : Number ; -- Pl (agreement feature for verb) + isNum : Bool ; -- True (a numeral is present) + isDef : Bool -- True (verb agrees in Pl, Nom is not Part) --I: actually, can we get rid of this? + } ; + + IDeterminer : Type = {s : Case => Str ; n : Number ; isNum : Bool} ; + + heavyDet : PDet -> Determiner = \d -> d ** {sp = d.s} ; PDet : Type = { s : Case => Str ; n : Number ; diff --git a/src/estonian/StructuralEst.gf b/src/estonian/StructuralEst.gf index f74b092b..b5e2857a 100644 --- a/src/estonian/StructuralEst.gf +++ b/src/estonian/StructuralEst.gf @@ -78,10 +78,8 @@ concrete StructuralEst of Structural = CatEst ** quite_Adv = ss "üsna" ; she_Pron = mkPronoun "tema" "tema" "teda" Sg P3 ; so_AdA = ss "nii" ; - somebody_NP = { + somebody_NP = emptyNP ** { s = \\c => jokuPron ! Sg ! npform2case Sg c ; - a = agrP3 Sg ; - isPron = False } ; someSg_Det = heavyDet { s = jokuPron ! Sg ; @@ -92,10 +90,8 @@ concrete StructuralEst of Structural = CatEst ** isNum = False ; isDef = True ; n = Pl } ; - something_NP = { + something_NP = emptyNP ** { s = \\c => mikaInt ! Sg ! npform2case Sg c ; - a = agrP3 Sg ; - isPron = False } ; somewhere_Adv = ss "kuskil" ; that_Quant = heavyQuant { @@ -133,11 +129,11 @@ concrete StructuralEst of Structural = CatEst ** very_AdA = ss "väga" ; want_VV = mkVV (mkV "tahtma") ; we_Pron = mkPronoun "meie" "meie" "meid" Pl P1 ; - whatPl_IP = { + whatPl_IP = emptyIP ** { s = table {NPAcc => "mida" ; c => mikaInt ! Pl ! npform2case Pl c} ; n = Pl } ; - whatSg_IP = { + whatSg_IP = emptyIP ** { s = \\c => mikaInt ! Sg ! npform2case Sg c ; n = Sg } ; @@ -145,11 +141,11 @@ concrete StructuralEst of Structural = CatEst ** when_Subj = ss "kui" ; where_IAdv = ss "kus" ; which_IQuant = { s = mikaInt } ; - whoSg_IP = { + whoSg_IP = emptyIP ** { s = table {NPAcc => "keda" ; c => kukaInt ! Sg ! npform2case Sg c} ; n = Sg } ; - whoPl_IP = { + whoPl_IP = emptyIP ** { s = table {NPAcc => "keda" ; c => kukaInt ! Pl ! npform2case Pl c} ; n = Pl } ; @@ -250,11 +246,10 @@ oper oper - makeNP : N -> MorphoEst.Number -> CatEst.NP ; - makeNP noun num = lin NP { + makeNP : N -> MorphoEst.Number -> NPhrase ; + makeNP noun num = emptyNP ** { s = \\c => noun.s ! NCase num (npform2case num c) ; a = agrP3 num ; - isPron = False ; } ; lin @@ -266,16 +261,14 @@ lin } ; if_then_Conj = {s1 = "kui" ; s2 = "siis" ; n = Sg} ; - nobody_NP = { + nobody_NP = emptyNP ** { s = \\c => "mitte" ++ kukaanPron ! Sg ! npform2case Sg c ; a = agrP3 Sg ; - isPron = False } ; - nothing_NP = { + nothing_NP = emptyNP ** { s = \\c => "mitte" ++ mikaanPron ! Sg ! npform2case Sg c ; a = agrP3 Sg ; - isPron = False } ; at_least_AdN = ss "vähemalt" ; diff --git a/src/estonian/SymbolEst.gf b/src/estonian/SymbolEst.gf index 0d1000a6..df6827d5 100644 --- a/src/estonian/SymbolEst.gf +++ b/src/estonian/SymbolEst.gf @@ -8,20 +8,14 @@ lin FloatPN i = {s = \\c => i.s} ; --- c NumPN i = {s = \\c => i.s!Sg!Nom } ; --- c - CNIntNP cn i = { - s = \\c => cn.s ! NCase Sg (npform2case Sg c) ++ i.s ; - a = agrP3 Sg ; - isPron = False + CNIntNP cn i = let np : NP = NounEst.MassNP cn in np ** { + postmod = np.postmod ++ i.s ; } ; - CNSymbNP det cn xs = let detcn = NounEst.DetCN det cn in { - s = \\c => detcn.s ! c ++ xs.s ; - a = detcn.a ; - isPron = False + CNSymbNP det cn xs = let np : NP = NounEst.DetCN det cn in np ** { + postmod = np.postmod ++ xs.s ; } ; - CNNumNP cn i = { - s = \\c => cn.s ! NCase Sg (npform2case Sg c) ++ i.s ! Sg ! Nom ; - a = agrP3 Sg ; - isPron = False + CNNumNP cn i = let np : NP = NounEst.MassNP cn in np ** { + postmod = np.postmod ++ i.s ! Sg ! Nom ; } ; SymbS sy = sy ; diff --git a/src/estonian/VerbEst.gf b/src/estonian/VerbEst.gf index c07c24b1..2fa22f13 100644 --- a/src/estonian/VerbEst.gf +++ b/src/estonian/VerbEst.gf @@ -87,7 +87,7 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { CompAP = compAP ; CompCN = compCN ; - CompNP np = {s = \\_ => np.s ! NPCase Nom} ; + CompNP np = {s = \\_ => linNP (NPCase Nom) np} ; CompAdv a = {s = \\_ => a.s} ; } From 5a8eda803d152b2921b072754fa7bebf8c41a975 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 18 Apr 2022 19:43:57 +0800 Subject: [PATCH 82/92] (Est) Test cases for comitative --- src/estonian/unittest/comitative.gftest | 146 ++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 src/estonian/unittest/comitative.gftest diff --git a/src/estonian/unittest/comitative.gftest b/src/estonian/unittest/comitative.gftest new file mode 100644 index 00000000..249b4857 --- /dev/null +++ b/src/estonian/unittest/comitative.gftest @@ -0,0 +1,146 @@ +-- Comitative, Essive, Abessive and Terminative cases are not in the inflection table of nominal categories, +-- instead they use the Genitive stem and add a suffix with BIND token. +-- Here are tests for those cases. + +-- NB. Ignore any weirdness with the word "koos". +-- That just happens to be the linearisation of with_Prep, +-- we can as easily replace it with just the case -ga, +-- or in an application, have two versions, one "koos …ga" and other just "…ga". +-- But do point out any other unexpected weirdness/ungrammaticality! + +-- Comitative, case attaches to the noun + +Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant NumSg) (UseN dog_N)))) +LangEng: I play with this dog +LangEst: mina mängin koos selle koera &+ ga + +Lang: PredVP (UsePron we_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant NumPl) (UseN dog_N)))) +LangEng: we play with these dogs +LangEst: meie mängime koos nende koerade &+ ga + +-- Interrogative versions + +-- First, reason why the interrogative pronoun doesn't inflect is this http://www.eki.ee/books/ekk09/index.php?p=5&p1=3&id=452 +-- "Üldse ei ühildu: asesõnad mis (kui ta ei osuta omadusele, vaid on identifitseerivas funktsioonis) [..], +-- nt 'Mis keelt te räägite?' " +-- So because of that, it doesn't inflect in any position. Here is the eki example: + +Lang: QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN language_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a speak_V2)) +LangEng: which language do you speak +LangEst: mis keelt sina räägid + +-- But should the interrogative inflect when PrepIP is applied? Or is "koos mis koeraga" still fine? + +Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant NumSg) (UseN dog_N))) (PredVP (UsePron youSg_Pron) (UseV play_V)) +LangEng: with which dog do you play +LangEst: koos mis koera &+ ga sina mängid + +Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant NumPl) (UseN dog_N))) (PredVP (UsePron youPl_Pron) (UseV play_V)) +LangEng: with which dogs do you play +LangEst: koos mis koerade &+ ga teie mängite + +-- Adding a number, does it affect the behaviour of +-- a) suffix attachment? b) agreement of interrogative? + +Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))) (UseN dog_N)))) +LangEng: I play with these three dogs +LangEst: mina mängin koos nende kolme koera &+ ga + +Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant (NumCard (NumDigits (IDig D_3)))) (UseN dog_N)))) +LangEng: I play with these 3 dogs +LangEst: mina mängin koos nende 3 koera &+ ga + +Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))) (UseN dog_N))) (PredVP (UsePron youPol_Pron) (UseV play_V)) +LangEng: with which three dogs do you play +-- Which one is best? +-- 1) koos mis kolm koeraga teie mängite +-- 2) koos mis kolme koeraga teie mängite +-- 3) koos mille kolme koeraga teie mängite +-- 4) All are ungrammatical (provide more grammatical translation that is still compositional, not paraphrase) + +Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant (NumCard (NumDigits (IDig D_3)))) (UseN dog_N))) (PredVP (UsePron youPl_Pron) (UseV play_V)) +LangEng: with which 3 dogs do you play +-- Which one is best? +-- 1) koos mis 3 koeraga teie mängite +-- 2) koos mille 3 koeraga teie mängite +-- 3) All are ungrammatical (provide more grammatical translation) + +------------------------------------------------------------------------------------------ +-- Now we skip the content word, and make the determiner (possibly with number) into NP/IP +-- The relevant functions are DetNP : Det -> NP and IDetIP : IDet -> IP + +-- No number, case attaches to determiner/interrogative +Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant NumPl)))) +LangEng: I play with these +LangEst: mina mängin koos nende &+ ga + +Lang: QuestIAdv (PrepIP with_Prep whoSg_IP) (PredVP (UsePron youSg_Pron) (UseV sing_V)) +LangEng: with whom do you sing +LangEst: koos kelle &+ ga sina laulad + +Lang: QuestIAdv (PrepIP with_Prep whoPl_IP) (PredVP (UsePron youSg_Pron) (UseV sing_V)) +LangEng: with whom do you sing +LangEst: koos kellede &+ ga sina laulad + +-- Adding a number to a determiner, does this affect the comitative suffix placement? +-- Context of the sentence is an ellipsis, "I sing with these 3 (singers)" + +Lang: PredVP (UsePron i_Pron) (AdvVP (UseV sing_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))))))))) +LangEng: I sing with these three +-- Which one is better? +-- 1) mina laulan koos nende kolmega +-- 2) mina laulan koos nendega kolme + +Lang: PredVP (UsePron i_Pron) (AdvVP (UseV sing_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant (NumCard (NumDigits (IDig D_3))))))) +LangEng: I sing with these 3 +LangEst: mina laulan koos nende 3 &+ ga +-- Which one is better? +-- 1) mina laulan koos nende 3ga +-- 2) mina laulan koos nendega 3 + +-- Adding a number to an interrogative, how does suffix placement + agreement work now? + +Lang: QuestIAdv (PrepIP with_Prep (IdetIP (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))))) (PredVP (UsePron youSg_Pron) (UseV sing_V)) +LangEng: with which three do you sing +-- Which one is best? +-- 1) koos millede kolmega sina laulad +-- 2) koos mille kolmega sina laulad +-- 3) koos mis kolmega sina laulad +-- 4) koos millega kolme sina laulad +-- 5) koos milledega kolme sina laulad +-- 6) All are ungrammatical (provide more grammatical translation) + +Lang: QuestIAdv (PrepIP with_Prep (IdetIP (IdetQuant which_IQuant (NumCard (NumDigits (IDig D_3)))))) (PredVP (UsePron youSg_Pron) (UseV sing_V)) +LangEng: with which 3 do you sing +-- Which one is best? +-- 1) koos millede 3ga sina laulad +-- 2) koos mille 3ga sina laulad +-- 3) koos mis 3ga sina laulad +-- 4) koos millega 3 sina laulad +-- 5) koos milledega 3 sina laulad +-- 6) All are ungrammatical (provide more grammatical translation) + + +-- Adding premodifiers to the number, does that change anything? + +-- Weird sentence, but imagine like, you point to a group of people, "I sing with these at most three", +-- like you are the soloist and want at most 3 backup singers, who are among a group you are pointing at. +-- If there was no ellipsis, the phrase would just be "koos nende kuni kolme lauljatega"? +Lang: PredVP (UsePron i_Pron) (AdvVP (UseV sing_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant (NumCard (AdNum at_most_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))))))) +LangEng: I sing with these at most three +LangEst: mina laulan koos nende kuni kolme &+ ga +-- Which one is better? +-- 1) mina laulan koos nende kuni kolmega +-- 2) mina laulan koos nendega kuni kolme + +Lang: QuestIAdv (PrepIP with_Prep (IdetIP (IdetQuant which_IQuant (NumCard (AdNum at_most_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))))))))) (PredVP (UsePron youSg_Pron) (UseV sing_V)) +LangEng: with which at most three do you sing +LangEst: koos millede kuni kolme &+ ga sina laulad +-- Which one is best? +-- 1) koos millede kuni kolmega sina laulad +-- 2) koos mille kuni kolmega sina laulad +-- 3) koos mis kuni kolmega sina laulad +-- 4) koos millega kuni kolme sina laulad +-- 5) koos milledega kuni kolme sina laulad +-- 6) All are ungrammatical (provide more grammatical translation) + From 2418e8cfcffcc623da7e0474f3d10061b02ffcba Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 19 Apr 2022 15:02:34 +0800 Subject: [PATCH 83/92] (Est) fix wrong forms given to mkN in full_A --- src/estonian/LexiconEst.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/estonian/LexiconEst.gf b/src/estonian/LexiconEst.gf index 254883cc..de064371 100644 --- a/src/estonian/LexiconEst.gf +++ b/src/estonian/LexiconEst.gf @@ -232,7 +232,7 @@ lin correct_A = mkA (mkN "õige" "õige" "õiget" "õigesse" "õigete" "õigeid") ; dry_A = mkA (mkN "kuiv" "kuiva" "kuiva") "kuivem" "kuiveim" ; dull_A = mkA "igav" ; - full_A = mkA (mkN "täis" "täie" "täit" "täide" "täied" "täite") "täiem" "täiim" Invariable ; -- 'täis' is one of the non-inflecting adjectives + full_A = mkA (mkN "täis" "täie" "täit" "täide" "täite" "täisi") "täiem" "täiim" Invariable ; -- 'täis' is one of the non-inflecting adjectives heavy_A = mkA "raske" ; near_A = mkA "lähedane" ; rotten_A = mkA "mäda" ; From 967a8fb8a14d9056c5f9ad0f105ab454fb2e0819 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 11 May 2022 11:30:34 +0800 Subject: [PATCH 84/92] add extra functions to get VPS to work --- src/malay/AllMay.gf | 2 +- src/malay/IdiomMay.gf | 15 +++++++++++---- src/malay/NounMay.gf | 5 +++++ src/malay/PhraseMay.gf | 1 + src/malay/SentenceMay.gf | 3 +++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/malay/AllMay.gf b/src/malay/AllMay.gf index c965d873..2836b818 100644 --- a/src/malay/AllMay.gf +++ b/src/malay/AllMay.gf @@ -3,6 +3,6 @@ concrete AllMay of AllMayAbs = LangMay, ExtendMay - ** { + ** open ParadigmsMay in { lin sing_V2 = mkV2 "nyanyi" ; } ; diff --git a/src/malay/IdiomMay.gf b/src/malay/IdiomMay.gf index 79f6b362..38dbdb71 100644 --- a/src/malay/IdiomMay.gf +++ b/src/malay/IdiomMay.gf @@ -1,7 +1,7 @@ --1 Idiom: Idiomatic Expressions -concrete IdiomMay of Idiom = CatMay ** open Prelude, ResMay, VerbMay, NounMay, StructuralMay in { +concrete IdiomMay of Idiom = CatMay ** open Prelude, ResMay, VerbMay, QuestionMay, NounMay, StructuralMay in { -- This module defines constructions that are formed in fixed ways, -- often different even in closely related languages. @@ -14,10 +14,17 @@ concrete IdiomMay of Idiom = CatMay ** open Prelude, ResMay, VerbMay, NounMay, S subj = [] ; pred = \\vf,pol => vp.s ! Root ! pol -- force no prefix -- TODO check if legit? } ; -{- - -- GenericCl : VP -> Cl ; -- one sleeps - GenericCl = \vp -> predVP impersNP (passVP vp) ; + -- : NP -> Cl ; -- there is a house + ExistNP np = predVP np (useV copula) ; + + -- ExistIP : IP -> QCl ; -- which houses are there + ExistIP ip = QuestVP ip (useV copula) ; + + -- GenericCl : VP -> Cl ; -- one sleeps + GenericCl = \vp -> predVP emptyNP vp ; + +{- CleftNP : NP -> RS -> Cl ; -- it is I who did it CleftAdv : Adv -> S -> Cl ; -- it is here she slept diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index 65a33612..0fc84555 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -174,6 +174,11 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { heavyMod = cn.heavyMod ++ rs.s ! P3 } ; + -- : CN -> Adv -> CN ; + AdvCN cn adv = cn ** { + heavyMod = cn.heavyMod ++ adv.s + } ; + {- -- : CN -> Adv -> CN ; AdvCN cn adv = cn ** { } ; diff --git a/src/malay/PhraseMay.gf b/src/malay/PhraseMay.gf index 3e7c99e4..17c00326 100644 --- a/src/malay/PhraseMay.gf +++ b/src/malay/PhraseMay.gf @@ -10,6 +10,7 @@ concrete PhraseMay of Phrase = CatMay ** open Prelude, ResMay in { UttIP ip = {s = ip.sp ! NF Sg Bare} ; UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ; UttImpPol pol imp = {s = pol.s ++ imp.s ! Sg ! pol.p} ; + UttVP vp = {s = vp.s ! Active ! Pos} ; {- UttImpSg pol imp = UttImpPl pol imp = diff --git a/src/malay/SentenceMay.gf b/src/malay/SentenceMay.gf index e9075f17..c82ae487 100644 --- a/src/malay/SentenceMay.gf +++ b/src/malay/SentenceMay.gf @@ -34,6 +34,9 @@ lin } } ; + -- : VP -> SC ; + EmbedVP vp = {s = vp.s ! Root ! Pos} ; + {- -- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves SlashVS np vs ss = {} ; From a1c85431becbb734f4ee5d8ae4c5320f04d03285 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 11 May 2022 14:46:12 +0800 Subject: [PATCH 85/92] add john_PN to Malay lexicon --- src/malay/LexiconMay.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index e3aa111d..78b8d468 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -190,7 +190,7 @@ lin house_N = mkN "rumah" ; -- lin ice_N = mkN "" ; -- lin industry_N = mkN "" ; -- lin iron_N = mkN "" ; --- lin john_PN = mkPN "" ; +lin john_PN = mkPN "John" ; -- lin jump_V = mkV "" ; -- lin kill_V2 = mkV2 "" ; lin king_N = mkN "raja" ; From 3e79ab25e1d6b0198af2aae0b20913838bf66311 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 11 May 2022 14:56:01 +0800 Subject: [PATCH 86/92] add VPS and VPI to ExtendMay --- src/malay/ExtendMay.gf | 62 ++++++++++++++++++++++++++++++++++++++++-- src/malay/PhraseMay.gf | 2 +- src/malay/ResMay.gf | 2 ++ 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/malay/ExtendMay.gf b/src/malay/ExtendMay.gf index 232940d9..9b46b1c9 100644 --- a/src/malay/ExtendMay.gf +++ b/src/malay/ExtendMay.gf @@ -1,8 +1,64 @@ --# -path=.:../common:../abstract concrete ExtendMay of Extend = CatMay - -- ** ExtendFunctor - [] - -- with (Grammar=GrammarMay) - ** open Prelude, ResMay, NounMay in { + ** ExtendFunctor - [ + VPS -- finite VP's with tense and polarity + , ListVPS + , VPI + , ListVPI -- infinitive VP's (TODO: with anteriority and polarity) + , MkVPS + , PredVPS + + + + -- VPS2 ; -- have loved (binary version of VPS) + -- [VPS2] {2} ; -- has loved, hates" + -- VPI2 ; -- to love (binary version of VPI) + -- [VPI2] {2} ; -- to love, to hate + +] + with (Grammar=GrammarMay) + ** open Prelude, Coordination, ResMay, NounMay in { + lincat + VPS, VPI = SS ; + ListVPS, ListVPI = ListX ; + lin + -- MkVPS : Temp -> Pol -> VP -> VPS ; -- hasn't slept + MkVPS t p vp = { + s = t.s ++ p.s ++ vp.s ! Active ! p.p; + } ; + + -- BaseVPS : VPS -> VPS -> ListVPS ; + BaseVPS vps vps2 = twoSS vps vps2 ; + -- ConsVPS : VPS -> ListVPS -> ListVPS ; + ConsVPS str listvps vps = consSS "," listvps vps ; + -- ConjVPS : Conj -> [VPS] -> VPS ; -- has walked and won't sleep + ConjVPS conj listvps = conjunctX conj listvps ; + -- PredVPS : NP -> VPS -> S ; -- she [has walked and won't sleep] + PredVPS np vps = { + s = np.s ! Bare ++ vps.s ; + } ; + -- SQuestVPS : NP -> VPS -> QS ; -- has she walked + -- QuestVPS : IP -> VPS -> QS ; -- who has walked + -- RelVPS : RP -> VPS -> RS ; -- which won't sleep + + -- MkVPI : VP -> VPI ; -- to sleep (TODO: Ant and Pol) + MkVPI vp = {s = linVP vp} ; + + + -- BaseVPI : VPI -> VPI -> ListVPI ; + BaseVPI vpi vpi2 = twoSS vpi vpi2 ; + -- ConsVPI : VPI -> ListVPI -> ListVPI ; + ConsVPI str listvpi vpi = consSS "," listvpi vpi ; + + + -- MkVPS2 : Temp -> Pol -> VPSlash -> VPS2 ; -- has loved + -- ConjVPS2 : Conj -> [VPS2] -> VPS2 ; -- has loved and now hates + -- ComplVPS2 : VPS2 -> NP -> VPS ; -- has loved and now hates that person + -- ReflVPS2 : VPS2 -> RNP -> VPS ; -- have loved and now hate myself and my car + + -- MkVPI2 : VPSlash -> VPI2 ; -- to love + -- ConjVPI2 : Conj -> [VPI2] -> VPI2 ; -- to love and hate + -- ComplVPI2 : VPI2 -> NP -> VPI ; -- to love and hate that person } ; diff --git a/src/malay/PhraseMay.gf b/src/malay/PhraseMay.gf index 17c00326..a3a03204 100644 --- a/src/malay/PhraseMay.gf +++ b/src/malay/PhraseMay.gf @@ -10,7 +10,7 @@ concrete PhraseMay of Phrase = CatMay ** open Prelude, ResMay in { UttIP ip = {s = ip.sp ! NF Sg Bare} ; UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ; UttImpPol pol imp = {s = pol.s ++ imp.s ! Sg ! pol.p} ; - UttVP vp = {s = vp.s ! Active ! Pos} ; + UttVP vp = {s = linVP vp} ; {- UttImpSg pol imp = UttImpPl pol imp = diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index d70c8f55..0a621724 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -276,6 +276,8 @@ oper s = \\vf,pol => nounneg pol ++ s ; } ; + linVP : VerbPhrase -> Str = \vp -> vp.s ! Active ! Pos; + -- https://www.reddit.com/r/indonesian/comments/gsizsv/when_to_use_tidak_bukan_jangan_belum/ verbneg : Polarity -> Str = \pol -> case pol of { From c712efc8ebb0c13b5a123e11e3bc56bbe35a984b Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 11 May 2022 14:56:48 +0800 Subject: [PATCH 87/92] add functions from BareRGMay to ExtendMay --- src/malay/ExtendMay.gf | 41 +++++++++++++++++++++++++++++++++++++++ src/malay/GrammarMay.gf | 9 ++++----- src/malay/MissingMay.gf | 1 - src/malay/NounMay.gf | 3 +-- src/malay/ParadigmsMay.gf | 1 + src/malay/VerbMay.gf | 4 ++-- 6 files changed, 49 insertions(+), 10 deletions(-) diff --git a/src/malay/ExtendMay.gf b/src/malay/ExtendMay.gf index 9b46b1c9..5e14dccc 100644 --- a/src/malay/ExtendMay.gf +++ b/src/malay/ExtendMay.gf @@ -9,6 +9,16 @@ concrete ExtendMay of Extend = CatMay , MkVPS , PredVPS + -- excluded because RGL funs needed for them not implemented yet + , SlashBareV2S + , PredAPVP + , ComplBareVS + + + ,PresPartAP, PastPartAP + ,GenModNP, GenNP, GenRP + ,CompoundN + ,GerundNP -- VPS2 ; -- have loved (binary version of VPS) @@ -51,6 +61,37 @@ concrete ExtendMay of Extend = CatMay -- ConsVPI : VPI -> ListVPI -> ListVPI ; ConsVPI str listvpi vpi = consSS "," listvpi vpi ; + -- ConjVPI : Conj -> [VPI] -> VPI ; -- to sleep and to walk + -- ComplVPIVV : VV -> VPI -> VP ; -- must sleep and walk + ComplVPIVV vv vpi = useV { + s = \\vf => vv.s ++ vpi.s + } ; + + -- PresPartAP : VP -> AP ; -- (the man) looking at Mary + PresPartAP vp = { + s = linVP vp + } ; + + PastPartAP vp = { + s = linVP vp + } ; + -- GenModNP : Num -> NP -> CN -> NP ; -- this man's car(s) + GenModNP n np cn = variants {}; + + -- GenNP : NP -> Quant ; -- this man's + GenNP np = variants {}; + -- GenRP : Num -> CN -> RP ; -- whose car + GenRP n cn = variants {}; + + -- CompoundN : N -> N -> N ; -- control system / controls system / control-system + CompoundN n1 n2 = n2 ** { + s = \\nf => n1.s ! NF Sg Bare ++ n2.s ! nf + } ; + -- GerundNP : VP -> NP ; -- publishing the document (by nature definite) + GerundNP vp = emptyNP ** { + s = \\_ => linVP vp + } ; + -- MkVPS2 : Temp -> Pol -> VPSlash -> VPS2 ; -- has loved -- ConjVPS2 : Conj -> [VPS2] -> VPS2 ; -- has loved and now hates diff --git a/src/malay/GrammarMay.gf b/src/malay/GrammarMay.gf index 9c643f4b..4bf46f60 100644 --- a/src/malay/GrammarMay.gf +++ b/src/malay/GrammarMay.gf @@ -9,7 +9,7 @@ concrete GrammarMay of Grammar = RelativeMay, ConjunctionMay, PhraseMay, - TextX - [IAdv], + TextX - [AAnter, TFut, TCond, IAdv], StructuralMay, IdiomMay, TenseX - [AAnter, TFut, TCond, IAdv] @@ -17,9 +17,8 @@ concrete GrammarMay of Grammar = flags startcat = Phr ; - lin - AAnter = {s = "sudah" ; a = ParamX.Anter} ; - TFut = {s = "akan" ; t = ParamX.Fut} ; - TCond = {s = "akan" ; t = ParamX.Cond} ; + lin AAnter = {s = "sudah" ; a = ParamX.Anter} ; --# notpresent + TFut = {s = "akan" ; t = ParamX.Fut} ; --# notpresent + TCond = {s = "akan" ; t = ParamX.Cond} ; --# notpresent } ; diff --git a/src/malay/MissingMay.gf b/src/malay/MissingMay.gf index 133ff736..44cc5cd0 100644 --- a/src/malay/MissingMay.gf +++ b/src/malay/MissingMay.gf @@ -114,7 +114,6 @@ oper Use2N3 : N3 -> N2 = notYet "Use2N3" ; oper Use3N3 : N3 -> N2 = notYet "Use3N3" ; oper UseA2 : A2 -> AP = notYet "UseA2" ; oper UseComparA : A -> AP = notYet "UseComparA" ; -oper UsePN : PN -> NP = notYet "UsePN" ; oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ; oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ; oper UttAP : AP -> Utt = notYet "UttAP" ; diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index 0fc84555..76142d54 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -19,8 +19,7 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { } ; -- : PN -> NP ; --- UsePN pn = pn ** { --- } ; + UsePN pn = MassNP (UseN pn) ; -- : Pron -> NP ; UsePron pron = pron ** { diff --git a/src/malay/ParadigmsMay.gf b/src/malay/ParadigmsMay.gf index 5a1732e1..2ffaa712 100644 --- a/src/malay/ParadigmsMay.gf +++ b/src/malay/ParadigmsMay.gf @@ -9,6 +9,7 @@ oper -- should always use these constants instead of the constructors -- defined in $ResSom$. +noPrep : Prep = mkPrep "" ; --2 Nouns diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index b66e508f..77511c0c 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -16,7 +16,7 @@ lin -- : VV -> VP -> VP ; ComplVV vv vp = vp ** useV { - s = \\vf => vv.s ++ vp.s ! Active ! Pos + s = \\vf => vv.s ++ linVP vp } ; -- : VS -> S -> VP ; @@ -101,7 +101,7 @@ lin } ; -- SlashVV vv vp = vp ** useV { - -- s = \\vf => vv.s ++ vp.s ! Active ! Pos ; + -- s = \\vf => vv.s ++ linVP vp ; -- c2 = vp.c2 ; -- passive = vv.s ++ vp.passive; -- adjCompl = vp.adjCompl ; From cff79f72c5392fb7071a340afec635caa59d4762 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 11 May 2022 14:57:21 +0800 Subject: [PATCH 88/92] add Malay to languages.csv --- languages.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/languages.csv b/languages.csv index e4479c7c..6b4ca438 100644 --- a/languages.csv +++ b/languages.csv @@ -27,6 +27,7 @@ Jpn,Japanese,japanese,,,,,,,,y Kor,Korean,korean,,,n,y,y,y,n,n Lat,Latin,latin,,,,,y,y,n,y Lav,Latvian,latvian,,,,,,,y,y +May,Malay,malay,,,y,,,,n,y Mlt,Maltese,maltese,,,,,,,,y Mon,Mongolian,mongolian,,,,,,n,,y Nep,Nepali,nepali,,,,,,n,,y From 85960e0416dfd46082be89f7ebb9e9601974b589 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Fri, 13 May 2022 14:37:19 +0800 Subject: [PATCH 89/92] add changes for Adv functions to Malay rgl --- src/malay/AdjectiveMay.gf | 8 ++++++-- src/malay/MissingMay.gf | 4 ---- src/malay/NounMay.gf | 4 +++- src/malay/ParadigmsMay.gf | 21 ++++++++++++++++++--- src/malay/PhraseMay.gf | 2 +- src/malay/ResMay.gf | 6 ++++++ src/malay/StructuralMay.gf | 10 +++++++--- src/malay/VerbMay.gf | 8 +++++--- 8 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/malay/AdjectiveMay.gf b/src/malay/AdjectiveMay.gf index 2df3e73a..4909f119 100644 --- a/src/malay/AdjectiveMay.gf +++ b/src/malay/AdjectiveMay.gf @@ -4,6 +4,11 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in { lin + -- : AP -> Adv -> AP ; -- warm by nature + AdvAP ap adv = ap ** { + s = ap.s ++ adv.s ; + } ; + -- : A -> AP ; PositA a = a ** { compar = [] ; @@ -58,7 +63,6 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in { -- It can also be postmodified by an adverb, typically a prepositional phrase. - -- : AP -> Adv -> AP ; -- warm by nature - -- AdvAP ap adv = ap ** {} ; + } diff --git a/src/malay/MissingMay.gf b/src/malay/MissingMay.gf index 44cc5cd0..d1a55f58 100644 --- a/src/malay/MissingMay.gf +++ b/src/malay/MissingMay.gf @@ -9,8 +9,6 @@ oper AdjCN : AP -> CN -> CN = notYet "AdjCN" ; oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ; oper AdjOrd : Ord -> AP = notYet "AdjOrd" ; oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ; -oper AdvAP : AP -> Adv -> AP = notYet "AdvAP" ; -oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ; oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ; oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ; oper AdvNP : NP -> Adv -> NP = notYet "AdvNP" ; @@ -191,7 +189,6 @@ oper but_PConj : PConj = notYet "but_PConj" ; oper butter_N : N = notYet "butter_N" ; oper camera_N : N = notYet "camera_N" ; oper can8know_VV : VV = notYet "can8know_VV" ; -oper can_VV : VV = notYet "can_VV" ; oper cap_N : N = notYet "cap_N" ; oper carpet_N : N = notYet "carpet_N" ; oper ceiling_N : N = notYet "ceiling_N" ; @@ -362,7 +359,6 @@ oper mountain_N : N = notYet "mountain_N" ; oper mouth_N : N = notYet "mouth_N" ; oper much_Det : Det = notYet "much_Det" ; oper music_N : N = notYet "music_N" ; -oper must_VV : VV = notYet "must_VV" ; oper n_unit_CN : Card -> CN -> CN -> CN = notYet "n_unit_CN" ; oper n_units_AP : Card -> CN -> A -> AP = notYet "n_units_AP" ; oper n_units_of_NP : Card -> CN -> NP -> NP = notYet "n_units_of_NP" ; diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index 76142d54..90f0b7d5 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -39,7 +39,9 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { -- s = \\c => v2.s ! ??? ++ np.s ! c } ; ---- -- : NP -> Adv -> NP ; -- Paris today ; boys, such as .. - --AdvNP,ExtAdvNP = \np,adv -> np ** {} ; + AdvNP,ExtAdvNP = \np,adv -> np ** { + s = \\pos => np.s ! pos ++ adv.s + } ; -- : NP -> RS -> NP ; -- Paris, which is here RelNP np rs = np ** { diff --git a/src/malay/ParadigmsMay.gf b/src/malay/ParadigmsMay.gf index 2ffaa712..2d20d248 100644 --- a/src/malay/ParadigmsMay.gf +++ b/src/malay/ParadigmsMay.gf @@ -27,7 +27,9 @@ noPrep : Prep = mkPrep "" ; mkA : (adj : Str) -> A ; } ; - -- mkA2 : Str -> Prep -> A2 ; + mkA2 : overload { + mkA2 : (adj : Str) -> Prep -> A2 ; + } ; --2 Verbs @@ -57,8 +59,10 @@ noPrep : Prep = mkPrep "" ; -- = \s -> lin VA (regV s) ; -- mkVQ : Str -> VQ -- = \s -> lin VQ (regV s) ; - -- mkVS : Str -> VS - -- = \s -> lin VS (regV s) ; + mkVS : overload { + mkV : (root : Str) -> V ; -- Verb that takes meng as a active prefix + mkV : (root : Str) -> Prefix -> V -- Root and prefix + } ; -- -- mkV2A : Str -> V2A -- = \s -> lin V2A (regV s ** {c2 = noPrep}) ; @@ -103,6 +107,12 @@ noPrep : Prep = mkPrep "" ; mkN2 : N -> N2 = \n -> lin N2 (n ** {c2 = dirPrep}) ; } ; + mkN3 = overload { + mkN3 : Str -> N3 = \s -> lin N3 (mkNoun s ** {c2,c3 = dirPrep}) ; + mkN3 : N -> N3 = \n -> lin N3 (n ** {c2,c3 = dirPrep}) ; + mkN3 : N -> Prep -> Prep -> N3 = \n,c2,c3 -> lin N3 (n ** {c2,c3 = dirPrep}) ; + } ; + mkPN = overload { mkPN : Str -> PN = \s -> lin PN {s = \\_ => s} ; } ; @@ -111,6 +121,11 @@ noPrep : Prep = mkPrep "" ; mkA : (adj : Str) -> A = \s -> lin A (mkAdj s) ; } ; + mkA2 = overload { + mkA2 : (adj : Str) -> A = \s -> lin A2 (mkAdj s) ; + mkA2 : A -> Prep -> A = \a,p -> lin A2 (a) ; + } ; + mkV = overload { mkV : Str -> V = \v -> lin V (mkVerb v Ber) ; mkV : Str -> Prefix -> V = \v,p -> lin V (mkVerb v p) diff --git a/src/malay/PhraseMay.gf b/src/malay/PhraseMay.gf index a3a03204..4132faaf 100644 --- a/src/malay/PhraseMay.gf +++ b/src/malay/PhraseMay.gf @@ -11,6 +11,7 @@ concrete PhraseMay of Phrase = CatMay ** open Prelude, ResMay in { UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ; UttImpPol pol imp = {s = pol.s ++ imp.s ! Sg ! pol.p} ; UttVP vp = {s = linVP vp} ; + UttAP ap = { s = ap.s } ; {- UttImpSg pol imp = UttImpPl pol imp = @@ -20,7 +21,6 @@ concrete PhraseMay of Phrase = CatMay ** open Prelude, ResMay in { UttAdv adv = {s = } ; UttCN n = {s = } ; UttCard n = {s = } ; - UttAP ap = { s = ap.s ! } ; UttInterj i = i ; -} NoPConj = {s = []} ; diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 0a621724..cbc33ef4 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -60,6 +60,12 @@ oper empty = [] } ; + mkNounPhrase : Str -> NounPhrase = \str -> { + s = \\_ => str ; + a = NotPron ; + empty = [] + } ; + mkIP : Str -> IPhrase = \str -> { s = \\_ => str ; a = NotPron ; diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index a2cb1cb7..e182f6dc 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -57,13 +57,14 @@ lin and_Conj = {s2 = "dan" ; s1 = [] ; n = Pl} ; lin how8many_IDet = mkIdet "berapa" "berapa banyak" "" Sg True; +lin every_Det = mkDet "semua" "semua" Sg ; -- to check + {-} lin all_Predet = {s = ""} ; lin not_Predet = { s = "" } ; lin only_Predet = { s = "" } ; lin most_Predet = {s = ""} ; -lin every_Det = {s = ""} ; lin few_Det = R.indefDet "" pl ; lin many_Det = R.indefDet "" pl ; lin much_Det = R.indefDet "" sg ; @@ -78,6 +79,9 @@ lin which_IQuant = mkQuant "yang mana" ** {isPre = False} ; ----- -- NP + +lin somebody_NP = mkNounPhrase "seorang" ; --todo + {- lin everybody_NP = defNP "" N.NumPl ; lin everything_NP = defNP "" N.NumSg ; @@ -174,8 +178,8 @@ lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** { passive = "diadakan" ; } ; -- lin can8know_VV = can_VV ; -- can (capacity) --- lin can_VV = mkVV "" ; -- can (possibility) --- lin must_VV = mkVV "" ; +lin can_VV = mkVV "boleh" ; -- can (possibility) +lin must_VV = mkVV "perlu" ; lin want_VV = mkVV "mahu" ; ------ diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index 77511c0c..b6985a83 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -118,6 +118,11 @@ lin s = \\vf,pol => vp.s ! vf ! pol ++ adv.s } ; + -- : AdV -> VP -> VP ; -- always sleep + AdVVP adv vp = vp ** { + s = \\vf,pol => vp.s ! vf ! pol ++ adv.s + } ; + {- -- : VPSlash -> Adv -> VPSlash ; -- use (it) here AdvVPSlash = insertAdv ; @@ -125,9 +130,6 @@ lin -- : VP -> Adv -> VP ; -- sleep , even though ... ExtAdvVP vp adv = ; - -- : AdV -> VP -> VP ; -- always sleep - AdVVP adv vp = vp ** {adv = adv} ; - -- : AdV -> VPSlash -> VPSlash ; -- always use (it) AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ; -} From a9c18fc48c5f6ef1f3c495f2c8314fa79f407dec Mon Sep 17 00:00:00 2001 From: Meowyam Date: Fri, 13 May 2022 15:46:08 +0800 Subject: [PATCH 90/92] add John and other lexicon to Malay --- src/malay/LexiconMay.gf | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index 78b8d468..ee6ee3bd 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -30,28 +30,28 @@ lin beer_N = mkN "bir" ; -- lin beg_V2V = mkV2 "" ; -- lin belly_N = mkN "" ; lin big_A = mkA "besar" ; --- lin bike_N = mkN "" ; --- lin bird_N = mkN "" ; +lin bike_N = mkN "basikal" ; +lin bird_N = mkN "burung" ; -- lin bite_V2 = mkV2 "" ; lin black_A = mkA "hitam" ; lin blood_N = mkN "darah" ; -- lin blow_V = mkV "" ; --- lin blue_A = mkA "" ; --- lin boat_N = mkN "" ; --- lin bone_N = mkN "" ; +lin blue_A = mkA "biru" ; +lin boat_N = mkN "perahu" ; +lin bone_N = mkN "tulang" ; -- lin boot_N = mkN "" ; -- lin boss_N = mkN "" ; lin book_N = mkN "buku" ; -- lin boy_N = mkN "" ; --- lin bread_N = mkN "" ; +lin bread_N = mkN "roti" ; lin break_V2 = mkV4 "patah" "kan"; -- TODO figure out if -kan needs to be separated -- lin breast_N = mkN "" ; -- lin breathe_V = mkV "" ; -- lin broad_A = mkA "" ; --- lin brother_N2 = mkN "" ; +-- lin brother_N2 = mkN "abang" Animate; -- lin brown_A = mkA "" ; --- lin burn_V = mkV "" ; --- lin butter_N = mkN "" ; +lin burn_V = mkV "bakar" ; +lin butter_N = mkN "mentega" ; lin buy_V2 = mkV2 "beli" ; ---- @@ -68,10 +68,10 @@ lin cat_N = mkN "kucing" ; -- lin child_N = mkN "" ; -- lin church_N = mkN "" ; -- lin city_N = mkN "" ; --- lin clean_A = mkA "" ; +lin clean_A = mkA "bersih" ; -- lin clever_A = mkA "" ; -- lin close_V2 = mkV2 "" ; --- lin cloud_N = mkN "" ; +lin cloud_N = mkN "awan" ; -- lin coat_N = mkN "" ; -- lin cold_A = mkA "" ; lin come_V = mkV "datang" ; @@ -80,7 +80,7 @@ lin come_V = mkV "datang" ; -- lin count_V2 = mkV2 "" ; -- lin country_N = mkN "" ; -- lin cousin_N = mkN "" ; --- lin cow_N = mkN "" ; +lin cow_N = mkN "embu" ; -- lin cut_V2 = mkV2 "" ; ---- @@ -190,7 +190,7 @@ lin house_N = mkN "rumah" ; -- lin ice_N = mkN "" ; -- lin industry_N = mkN "" ; -- lin iron_N = mkN "" ; -lin john_PN = mkPN "John" ; +lin john_PN = mkPN "Yohanes" ; -- lin jump_V = mkV "" ; -- lin kill_V2 = mkV2 "" ; lin king_N = mkN "raja" ; From edcef16eb19e380d49e8593135990021795fcfdc Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 18 May 2022 15:59:55 +0800 Subject: [PATCH 91/92] fix passive for token ungluing --- src/malay/ResMay.gf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index cbc33ef4..6142f10c 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -237,16 +237,16 @@ oper mkVerb2 : Verb -> Preposition -> Verb2 = \v,pr -> v ** { c2 = pr ; - passive = "di" + v.s ! Root + passive = "di" ++ v.s ! Root } ; mkVerb3 : Verb -> (p,q : Preposition) -> Verb3 = \v,p,q -> mkVerb2 v p ** {c3 = q} ; mkVerb4 : Verb -> Preposition -> Str -> Verb4 = \v,pr,str -> v ** { - s = \\_ => v.s ! Active + str; + s = \\_ => v.s ! Active ++ str; c2 = pr ; - passive = "di" + v.s ! Root + str + passive = "di" ++ v.s ! Root + str } ; copula : Verb = {s = \\_ => "ada"} ; -- TODO From 5c84ce9623d63b9288bcad1dadb4aee7607b8dfe Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 18 May 2022 16:08:35 +0800 Subject: [PATCH 92/92] remove space for passive --- src/malay/ResMay.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 6142f10c..b473ea06 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -237,7 +237,7 @@ oper mkVerb2 : Verb -> Preposition -> Verb2 = \v,pr -> v ** { c2 = pr ; - passive = "di" ++ v.s ! Root + passive = "di" ++ BIND ++ v.s ! Root } ; mkVerb3 : Verb -> (p,q : Preposition) -> Verb3 = \v,p,q -> @@ -246,7 +246,7 @@ oper mkVerb4 : Verb -> Preposition -> Str -> Verb4 = \v,pr,str -> v ** { s = \\_ => v.s ! Active ++ str; c2 = pr ; - passive = "di" ++ v.s ! Root + str + passive = "di" ++ BIND ++ v.s ! Root ++ str } ; copula : Verb = {s = \\_ => "ada"} ; -- TODO