From 61ffe8e9a4a4a8ec8334ba448d712da3aabc0eb8 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 19 Aug 2020 18:47:42 +0200 Subject: [PATCH] (May) Split VP negations into bukan and tidak --- src/malay/AdverbMay.gf | 4 +-- src/malay/GrammarMay.gf | 4 +-- src/malay/RelativeMay.gf | 8 +++--- src/malay/ResMay.gf | 33 ++++++++++++++++-------- src/malay/SentenceMay.gf | 6 ++--- src/malay/VerbMay.gf | 40 ++++++++++++++---------------- src/malay/unittest/negation.gftest | 15 +++++++++++ 7 files changed, 66 insertions(+), 44 deletions(-) create mode 100644 src/malay/unittest/negation.gftest diff --git a/src/malay/AdverbMay.gf b/src/malay/AdverbMay.gf index b2fd2d59..29d905c9 100644 --- a/src/malay/AdverbMay.gf +++ b/src/malay/AdverbMay.gf @@ -1,6 +1,6 @@ concrete AdverbMay of Adverb = CatMay ** open ResMay, ParamMay, ParadigmsMay, Prelude in { ---lin +lin -- : A -> Adv ; --PositAdvAdj adj = { } ; @@ -11,7 +11,7 @@ concrete AdverbMay of Adverb = CatMay ** open ResMay, ParamMay, ParadigmsMay, Pr -- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs -- : Prep -> NP -> Adv ; - -- PrepNP = + PrepNP = cc2 ; -- Adverbs can be modified by 'adadjectives', just like adjectives. diff --git a/src/malay/GrammarMay.gf b/src/malay/GrammarMay.gf index 3781049a..aa5dafd0 100644 --- a/src/malay/GrammarMay.gf +++ b/src/malay/GrammarMay.gf @@ -12,13 +12,11 @@ concrete GrammarMay of Grammar = TextX, StructuralMay, IdiomMay, - TenseX - [AAnter, PNeg] + TenseX - [AAnter] ** open ParamX in { flags startcat = Phr ; lin AAnter = {s = "sudah" ; a = ParamX.Anter} ; - PNeg = {s = "tidak" ; p = ParamX.Neg} ; - } ; diff --git a/src/malay/RelativeMay.gf b/src/malay/RelativeMay.gf index b6657f5c..a0354bba 100644 --- a/src/malay/RelativeMay.gf +++ b/src/malay/RelativeMay.gf @@ -9,16 +9,16 @@ lin -- : RP -> VP -> RCl ; RelVP rp vp = { subj = rp.s ; - pred = \\_ => vp.s ! Root ; + pred = \\per => vp.s ! Root ; } ; -- : RP -> ClSlash -> RCl ; -- who I went with RelSlash rp cls = { subj = rp.s -- yang ++ cls.subj ; -- saya - pred = - \\p => cls.pred ! Root -- ikut sama - ++ cls.c2.obj ! p -- dengan+nya (depends on the head, not known yet) + pred = \\per,pol => + cls.pred ! Root ! pol -- ikut sama + ++ cls.c2.obj ! per -- dengan+nya (depends on the head, not known yet) } ; -- : RP ; diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 667bca95..198add32 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -153,29 +153,42 @@ oper ------------------ -- VP - VerbPhrase : Type = Verb ** { - -- vComp : Str-- Maybe needed later? - -- {subjunc : Str ; -- inflected verb complement - -- inf : Str ; -- infinitive verb complement - -- subcl : Str} -- clause complement + VerbPhrase : Type = { + s : VForm => Polarity => Str ; -- tidak or bukan } ; - VPSlash : Type = Verb2 ; + VPSlash : Type = VerbPhrase ** { + c2 : Preposition ; + } ; useV : Verb -> VerbPhrase = \v -> v ** { - vComp = [] ; -- maybe needed later? - } ; + s = \\vf,pol => verbneg pol ++ v.s ! vf + } ; + + useComp : Str -> VerbPhrase = \s -> { + s = \\vf,pol => nounneg pol ++ s ; + } ; + + verbneg : Polarity -> Str = \pol -> case pol of { + Neg => "tidak" ; -- or "tak"? + Pos => [] + } ; + + nounneg : Polarity -> Str = \pol -> case pol of { + Neg => "bukan" ; + Pos => [] + } ; -------------------------------------------------------------------------------- -- Cl, S Clause : Type = { subj : Str ; - pred : VForm => Str -- Cl may become relative clause, need to keep open + pred : VForm => Polarity => Str -- Cl may become relative clause, need to keep open VForm } ; RClause : Type = { subj : Str ; - pred : Person => Str + pred : Person => Polarity => Str } ; RS : Type = {s : Person => Str} ; diff --git a/src/malay/SentenceMay.gf b/src/malay/SentenceMay.gf index 82771743..28a39f11 100644 --- a/src/malay/SentenceMay.gf +++ b/src/malay/SentenceMay.gf @@ -51,17 +51,17 @@ lin -- : Temp -> Pol -> Cl -> S ; UseCl t p cl = { - s = cl.subj ++ t.s ++ p.s ++ cl.pred ! Active ; + s = cl.subj ++ t.s ++ p.s ++ cl.pred ! Active ! p.p; } ; -- : Temp -> Pol -> QCl -> QS ; UseQCl t p cl = { - s = cl.subj ++ t.s ++ p.s ++ cl.pred ! Active ; + s = cl.subj ++ t.s ++ p.s ++ cl.pred ! Active ! p.p ; } ; -- : Temp -> Pol -> RCl -> RS ; UseRCl t p cl = { - s = \\per => cl.subj ++ t.s ++ p.s ++ cl.pred ! per ; + s = \\per => cl.subj ++ t.s ++ p.s ++ cl.pred ! per ! p.p ; } ; -- AdvS : Adv -> S -> S ; -- then I will go home diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index f3db82d4..8253ab76 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -9,17 +9,14 @@ lin UseV = ResMay.useV ; -- : V2 -> VP ; -- be loved - PassV2 v2 = { - s = \\_ => v2.passive - -- Root => v2.s ! Root ; -- TODO: passive + verbal complements = ??? - } ; + PassV2 v2 = useV {s = \\_ => v2.passive} ; -- : VPSlash -> VP ; -- ReflVP = ResMay.insertRefl ; -- : VV -> VP -> VP ; - ComplVV vv vp = vp ** { - s = \\vf => vv.s ++ vp.s ! Root + ComplVV vv vp = vp ** useV { + s = \\vf => vv.s ++ vp.s ! Root ! Pos } ; -- : VS -> S -> VP ; @@ -40,12 +37,15 @@ lin -- Slash -- : V2 -> VPSlash - SlashV2a v2 = v2 ; + SlashV2a v2 = useV v2 ** { + c2 = v2.c2 + } ; -- : V3 -> NP -> VPSlash ; -- give it (to her) - Slash2V3 v3 dobj = v3 ** { - s = \\vf => v3.s ! vf ++ v3.c2.s ++ dobj.s ; - c2 = v3.c3 -- Now the VPSlash is missing only the indirect object + Slash2V3 v3 dobj = useV { + s = \\vf => v3.s ! vf ++ v3.c2.s ++ dobj.s + } ** { + c2 = v3.c3 -- Now the VPSlash is missing only the indirect object } ; {- @@ -65,7 +65,9 @@ lin SlashV2A v2a ap = ; -} -- : VPSlash -> NP -> VP - ComplSlash vps np = {s = \\vf => vps.s ! vf ++ vps.c2.s ++ np.s} ; + ComplSlash vps np = vps ** { + s = \\vf,pol => vps.s ! vf ! pol ++ vps.c2.s ++ np.s + } ; -- : VV -> VPSlash -> VPSlash ; SlashVV vv vps = ComplVV vv vps ** { @@ -103,24 +105,18 @@ lin -- Adjectival phrases, noun phrases, and adverbs can be used. -- : AP -> Comp ; - CompAP ap = ap ; + CompAP ap = useV ap ; -- : CN -> Comp ; - CompCN cn = { - s = \\_ => cn.s ! NF Sg Bare ; - } ; + CompCN cn = useComp (cn.s ! NF Sg Bare) ; -- NP -> Comp ; - CompNP np = { - s = \\_ => np.s ; - } ; + CompNP np = useComp np.s ; -- : Adv -> Comp ; - CompAdv adv = { - s = \\_ => adv.s ; - } ; + CompAdv adv = useV {s = \\_ => adv.s} ; -- : VP -- Copula alone; - --UseCopula = useV copula ; + UseCopula = useV copula ; } diff --git a/src/malay/unittest/negation.gftest b/src/malay/unittest/negation.gftest new file mode 100644 index 00000000..5af20f57 --- /dev/null +++ b/src/malay/unittest/negation.gftest @@ -0,0 +1,15 @@ +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)) (UseComp (CompCN (UseN dog_N)))) +LangEng: a cat isn't a dog +LangMay: kucing bukan anjing + +Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseV walk_V)) +LangEng: the cat doesn't walk +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 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 +LangMay: kucing-kucing itu tidak di rumah