diff --git a/src/malay/RelativeMay.gf b/src/malay/RelativeMay.gf index a0354bba..5dbf128a 100644 --- a/src/malay/RelativeMay.gf +++ b/src/malay/RelativeMay.gf @@ -17,8 +17,10 @@ lin subj = rp.s -- yang ++ cls.subj ; -- saya pred = \\per,pol => - cls.pred ! Root ! pol -- ikut sama - ++ cls.c2.obj ! per -- dengan+nya (depends on the head, not known yet) + cls.pred ! Root ! pol -- ikut sama + ++ case cls.c2.isPoss of { + True => [] ; + False => 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 0425f9c3..6df4f1e0 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -102,7 +102,7 @@ oper Preposition : Type = { s : Str ; -- dengan obj : Person => Str ; -- dengan+nya -- needed in relative clauses to refer to the object - isPoss : Bool ; + isPoss : Bool ; -- TODO rename, the name is confusing } ; mkPrep : Str -> Preposition = \dengan -> { diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index d16d453d..42cb4648 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -48,10 +48,14 @@ lin c2 = v3.c3 -- Now the VPSlash is missing only the indirect object } ; -{- -- : V3 -> NP -> VPSlash ; -- give (it) to her - Slash3V3 v3 iobj = + Slash3V3 v3 iobj = useV { + s = \\vf => v3.s ! vf ++ applyPrep v3.c3 iobj + } ** { + c2 = v3.c2 -- Now the VPSlash is missing only the direct object + } ; + {- -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good SlashV2S v2s s = diff --git a/src/malay/unittest/relative.gftest b/src/malay/unittest/relative.gftest index 89557570..ec890f8f 100644 --- a/src/malay/unittest/relative.gftest +++ b/src/malay/unittest/relative.gftest @@ -12,4 +12,41 @@ LangMay: susu yang kucing minum 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 \ No newline at end of file +LangMay: kucing yang anjing jalan dengannya + +-------------------------------------------------------------- +-- 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))) +LangMay: bapanya memberi buku kepadanya + +-- 2. A book that her father 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))) (Slash2V3 give_V3 (UsePron she_Pron)))))) +LangMay: buku yang bapanya beri kepadanya + +-- 3. A book that her father gave to me +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 i_Pron)))))) +LangMay: buku yang bapanya beri kepadaku + +-- The preposition "kepada" comes from the definition of give_V3 in LexiconMay.gf. +-- If "buku yang bapanya beri kepadaku" is correct in the general sense, but sometimes +-- we want to say "buku yang bapanya beri", we can create a coercion function +-- from V3 to V2: just drop the indirect object preposition. +-- This is easy to do in an application grammar. + +-- If we want to do this consistently: always drop the indirect object in a relative clause, +-- i.e. never say "buku yang bapanya beri kepada(ku/mu/nya)" +-- then we can do it in the resource grammar. + +-- I want to read the book that my father gave me +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 kepadaku + +-- 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 + +-- bonus tree: we can also generate "bapa saya", 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