diff --git a/src/english/ParseEngAbs.gf b/src/english/ParseEngAbs.gf index bcedf25cd..844526e69 100644 --- a/src/english/ParseEngAbs.gf +++ b/src/english/ParseEngAbs.gf @@ -1,4 +1,4 @@ -abstract ParseEngAbs = +abstract ParseEngAbs = Tense, Cat, Noun - [PPartNP], @@ -51,11 +51,11 @@ fun CompoundSgCN : CN -> CN -> CN ; SlashVPIV2V : V2V -> Pol -> VPI -> VPSlash ; SlashSlashV2V : V2V -> Ant -> Pol -> VPSlash -> VPSlash ; - + ComplVV : VV -> Ant -> Pol -> VP -> VP ; PredVPosv,PredVPovs : NP -> VP -> Cl ; - + that_RP : RP ; who_RP : RP ; diff --git a/src/malay/AdjectiveMay.gf b/src/malay/AdjectiveMay.gf index 4909f119e..621d71661 100644 --- a/src/malay/AdjectiveMay.gf +++ b/src/malay/AdjectiveMay.gf @@ -20,7 +20,9 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in { } ; -- : A2 -> NP -> AP ; -- married to her - -- ComplA2 a2 np = a2 ** { } ; + ComplA2 a2 np = a2 ** { + compl = np.s + } ; -- : A2 -> AP ; -- married to itself -- ReflA2 a2 = a2 ** { } ; diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 61ca8867a..74b5192c1 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -122,10 +122,10 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { PN = ResMay.PNoun ; 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; - Cl = \cl -> cl.subj ++ cl.pred ! Active ! Pos; + CN = linCN ; + ClSlash = linClSlash ; + RCl = linRCl ; + Cl = linCl ; Det = linDet ; } diff --git a/src/malay/ConjunctionMay.gf b/src/malay/ConjunctionMay.gf index 2d817f4ca..d84d20e38 100644 --- a/src/malay/ConjunctionMay.gf +++ b/src/malay/ConjunctionMay.gf @@ -6,14 +6,31 @@ concrete ConjunctionMay of Conjunction = lincat [Adv],[AdV] = {s1,s2 : Str} ; [S] = {s1,s2 : Str} ; - + [AP] = {s1,s2 : Str} ; + [NP] = {s1,s2 : Possession => Str} ; + [CN] = {s1,s2 : NForm => Str ; heavyMod : Str} ; lin BaseAdv, BaseAdV = twoSS ; ConsAdv, ConsAdV = consrSS comma ; ConjAdv, ConjAdV = conjunctDistrSS ; + BaseS = twoSS ; ConsS = consrSS comma ; ConjS = conjunctDistrSS ; + BaseAP = twoSS ; + ConsAP = consrSS comma ; + ConjAP = conjunctDistrSS ; + + BaseNP = twoTable Possession ; + ConsNP = consrTable Possession comma ; + ConjNP co nps = emptyNP ** conjunctDistrTable Possession co nps ; + + BaseCN x y = y ** twoTable NForm (mergeCN x) y ; + ConsCN x xs = xs ** consrTable NForm comma (mergeCN x) xs ; + ConjCN conj ss = ss ** conjunctDistrTable NForm conj ss ; + + oper + mergeCN : CNoun -> CNoun = \cn -> cn ** {s = \\nf => linCN cn} ; -- put postmod in s field } diff --git a/src/malay/ExtendMay.gf b/src/malay/ExtendMay.gf index 58ae1ef58..85fec8244 100644 --- a/src/malay/ExtendMay.gf +++ b/src/malay/ExtendMay.gf @@ -4,21 +4,19 @@ concrete ExtendMay of Extend = CatMay ** ExtendFunctor - [ VPS -- finite VP's with tense and polarity , ListVPS - , VPI + , VPI, MkVPI, ComplVPIVV , ListVPI -- infinitive VP's (TODO: with anteriority and polarity) , MkVPS - , PredVPS + , PredVPS, RelVPS, QuestVPS, SQuestVPS -- excluded because RGL funs needed for them not implemented yet - , SlashBareV2S , PredAPVP - , ComplBareVS ,PresPartAP, PastPartAP ,GenModNP, GenNP, GenRP ,CompoundN - ,GerundNP + ,GerundNP, GerundAdv -- VPS2 ; -- have loved (binary version of VPS) @@ -49,9 +47,13 @@ concrete ExtendMay of Extend = CatMay s = np.s ! Bare ++ vps.s ; } ; -- SQuestVPS : NP -> VPS -> QS ; -- has she walked - SQuestVPS np vps = {s = np.s ++ vps.s} ; + SQuestVPS np vps = {s = "adakah" ++ np.s ! Bare ++ vps.s} ; + -- QuestVPS : IP -> VPS -> QS ; -- who has walked + QuestVPS ip vps = {s = ip.s ! Bare ++ vps.s} ; + -- RelVPS : RP -> VPS -> RS ; -- which won't sleep + RelVPS rp vps = {s = \\person => rp.s ++ vps.s} ; -- MkVPI : VP -> VPI ; -- to sleep (TODO: Ant and Pol) MkVPI vp = {s = linVP vp} ; @@ -93,6 +95,8 @@ concrete ExtendMay of Extend = CatMay s = \\_ => linVP vp } ; + GerundAdv vp = ss (linVP vp) ; + -- MkVPS2 : Temp -> Pol -> VPSlash -> VPS2 ; -- has loved -- ConjVPS2 : Conj -> [VPS2] -> VPS2 ; -- has loved and now hates diff --git a/src/malay/LexiconMay.gf b/src/malay/LexiconMay.gf index ee6ee3bd3..adca31bb0 100644 --- a/src/malay/LexiconMay.gf +++ b/src/malay/LexiconMay.gf @@ -9,7 +9,7 @@ lin airplane_N = mkN "kapal terbang" ; -- lin alas_Interj = mkInterj "" ; lin already_Adv = mkA "sudah" ; lin animal_N = mkN "haiwan" ; --- lin answer_V2S = mkV2S "jawab" ; +lin answer_V2S = mkV2S "jawab" ; lin apartment_N = mkN "pangsapuri" ; lin apple_N = mkN "epal" ; lin art_N = mkN "seni" ; @@ -407,7 +407,7 @@ lin walk_V = mkV "jalan" ; -- lin warm_A = mkA "" ; -- lin wash_V2 = mkV2 "" ; -- lin watch_V2 = mkV2 "" ; --- lin water_N = mkNoun "" ; +lin water_N = mkN "air" ; -- lin wet_A = mkA "" ; -- lin white_A = mkA "" ; -- lin wide_A = mkA "" ; diff --git a/src/malay/MissingMay.gf b/src/malay/MissingMay.gf index d1a55f587..77af89d44 100644 --- a/src/malay/MissingMay.gf +++ b/src/malay/MissingMay.gf @@ -16,14 +16,8 @@ oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ; oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ; oper AdvVPSlash : VPSlash -> Adv -> VPSlash = notYet "AdvVPSlash" ; oper ApposCN : CN -> NP -> CN = notYet "ApposCN" ; -oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ; -oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ; -oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ; -oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ; oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ; -oper BaseNP : NP -> NP -> ListNP = notYet "BaseNP" ; oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ; -oper BaseS : S -> S -> ListS = notYet "BaseS" ; oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ; oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ; oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ; @@ -31,29 +25,16 @@ oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ; oper CompIP : IP -> IComp = notYet "CompIP" ; oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ; oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ; -oper ComplA2 : A2 -> NP -> AP = notYet "ComplA2" ; oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ; oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ; oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ; oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ; oper ComplVS : VS -> S -> VP = notYet "ComplVS" ; -oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ; -oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ; -oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ; -oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ; oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ; oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ; -oper ConjNP : Conj -> ListNP -> NP = notYet "ConjNP" ; oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ; -oper ConjS : Conj -> ListS -> S = notYet "ConjS" ; -oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ; -oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ; -oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ; -oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ; oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ; -oper ConsNP : NP -> ListNP -> ListNP = notYet "ConsNP" ; oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ; -oper ConsS : S -> ListS -> ListS = notYet "ConsS" ; oper CountNP : Det -> NP -> NP = notYet "CountNP" ; oper DetDAP : Det -> DAP = notYet "DetDAP" ; oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ; @@ -102,10 +83,7 @@ oper SelfAdvVP : VP -> VP = notYet "SelfAdvVP" ; oper SelfNP : NP -> NP = notYet "SelfNP" ; oper SentAP : AP -> SC -> AP = notYet "SentAP" ; oper SentCN : CN -> SC -> CN = notYet "SentCN" ; -oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ; oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ; -oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ; -oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ; oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ; oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ; oper Use2N3 : N3 -> N2 = notYet "Use2N3" ; diff --git a/src/malay/ParadigmsMay.gf b/src/malay/ParadigmsMay.gf index c406cc584..2b2094421 100644 --- a/src/malay/ParadigmsMay.gf +++ b/src/malay/ParadigmsMay.gf @@ -66,6 +66,12 @@ oper mkV2V : Str -> V2V ; mkV2V : V -> Prep -> Prep -> V2V ; } ; + + mkV2S : overload { + mkV2S : Str -> V2S ; + mkV2S : V -> Prep -> V2S ; + } ; + -- mkVQ : Str -> VQ -- = \s -> lin VQ (regV s) ; @@ -73,8 +79,6 @@ oper -- -- mkV2A : Str -> V2A -- = \s -> lin V2A (regV s ** {c2 = noPrep}) ; - -- mkV2V : Str -> V2V - -- = \s -> lin V2V (regV s ** {c2 = noPrep}) ; -- mkV2Q : Str -> V2Q -- = \s -> lin V2Q (regV s ** {c2 = noPrep}) ; @@ -129,14 +133,14 @@ oper } ; mkA2 = overload { - mkA2 : (adj : Str) -> A = \s -> lin A2 (mkAdj s) ; + mkA2 : (adj : Str) -> A2 = \s -> lin A2 ((mkAdj s) ** {c2 = emptyPrep}) ; mkA2 : A -> A2 = \a -> lin A2 (a ** {c2 = emptyPrep}) ; - mkA2 : A -> Prep -> A = \a,p -> lin A2 (a) ; + mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** {c2 = p}) ; } ; mkV = overload { - mkV : Str -> V = \v -> lin V (mkVerb v Ber) ; - mkV : Str -> Prefix -> V = \v,p -> lin V (mkVerb v p) + mkV : Str -> V = \v -> lin V (regVerb v Ber) ; + mkV : Str -> Prefix -> V = \v,p -> lin V (regVerb v p) } ; prefixV : V -> V = \v -> v ** { @@ -147,7 +151,7 @@ oper } ; mkV2 = overload { - mkV2 : Str -> V2 = \v2 -> lin V2 (mkVerb2 (mkVerb v2 Meng) dirPrep) ; + mkV2 : Str -> V2 = \v2 -> lin V2 (mkVerb2 (regVerb v2 Meng) dirPrep) ; mkV2 : V -> Prep -> V2 = \v,p -> lin V2 (mkVerb2 v p) } ; @@ -160,7 +164,7 @@ oper mkV4 = overload { mkV4 : Str -> Str -> V2 = \v2,str -> - lin V2 (mkVerb4 (mkVerb v2 Meng) dirPrep str) ; + lin V2 (mkVerb4 (regVerb v2 Meng) dirPrep str) ; mkV4 : V -> Prep -> Str -> V2 = \v,p,str -> lin V2 (mkVerb4 v p str) } ; @@ -177,12 +181,17 @@ oper } ; mkV2V = overload { - mkV2V : Str -> V2V = \v -> lin V2V (mkVerb2 (mkVerb v Meng) dirPrep) ; + mkV2V : Str -> V2V = \v -> lin V2V (mkVerb2 (regVerb v Meng) dirPrep) ; mkV2V : V -> Prep -> Prep -> V2V = \v,p1,p2 -> lin V2V (mkVerb3 v p1 p2) } ; + + mkV2S = overload { + mkV2S : Str -> V2S = \v -> lin V2S (mkVerb2 (regVerb v Meng) dirPrep) ; + mkV2S : V -> Prep -> V2S = \v,p -> lin V22 (mkVerb2 v p) + } ; + -- lin like_V2 = let like' : V2 = mkV2 "suka" in like' ** { --- s = \\_ => "suka" ; --- passive = "disukai" ; +-- s = table {Passive => "disukai" ; _ => "suka"} ; -- } ; -------------------------------------------------------------------------------- diff --git a/src/malay/ParamMay.gf b/src/malay/ParamMay.gf index 0c1533024..5ea50b375 100644 --- a/src/malay/ParamMay.gf +++ b/src/malay/ParamMay.gf @@ -142,6 +142,7 @@ param VForm = Root -- infinitive, imperative, … | Active + | Passive | Imperative ; diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index aaadafdef..2645b4376 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -13,6 +13,7 @@ oper CNoun : Type = Noun ** { heavyMod : Str ; -- heavy stuff like relative clauses after determiner } ; + linCN : CNoun -> Str = \cn -> cn.s ! NF Sg Bare ++ cn.heavyMod ; PNoun : Type = Noun ; @@ -214,7 +215,6 @@ oper } ; Verb2 : Type = Verb ** { c2 : Preposition ; - passive : Str } ; Verb3 : Type = Verb2 ** { @@ -223,22 +223,24 @@ oper Verb4 : Type = Verb ** { c2 : Preposition ; - passive : Str } ; -- VV : Type = Verb ** {vvtype : VVForm} ; - mkVerb : Str -> Prefix -> Verb = \str,p -> { + regVerb : Str -> Prefix -> Verb = \str,p -> + mkVerb str (prefix p str) ("di" + str) (str + "kan") ; + + mkVerb : (makan, memakan, dimakan, makankan : Str) -> Verb = \rt,act,pass,imp -> { s = table { - Root => str ; - Active => prefix p str ; - Imperative => str ++ BIND ++ "kan" + Root => rt ; + Active => act ; + Passive => pass ; + Imperative => imp } } ; mkVerb2 : Verb -> Preposition -> Verb2 = \v,pr -> v ** { c2 = pr ; - passive = "di" ++ BIND ++ v.s ! Root } ; mkVerb3 : Verb -> (p,q : Preposition) -> Verb3 = \v,p,q -> @@ -319,14 +321,19 @@ oper pred : VForm => Polarity => Str -- Cl may become relative clause, need to keep open VForm } ; + linCl : Clause -> Str = \cl -> cl.subj ++ cl.pred ! Active ! Pos ; + RClause : Type = { subj : Str ; pred : Person => Polarity => Str } ; + linRCl : RClause -> Str = \cl -> cl.subj ++ cl.pred ! P1 ! Pos ; + RS : Type = {s : Person => Str} ; ClSlash : Type = Clause ** {c2 : Preposition} ; + linClSlash : ClSlash -> Str = \cl -> cl.subj ++ cl.pred ! Root ! Pos ++ cl.c2.s ; Sentence : Type = {s : Str} ; diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index 0be398aa6..d071aac2e 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -9,7 +9,7 @@ lin UseV = ResMay.useV ; -- : V2 -> VP ; -- be loved - PassV2 v2 = useV {s = \\_ => v2.passive} ; + PassV2 v2 = useV {s = \\_ => v2.s ! Passive} ; -- : VPSlash -> VP ; -- ReflVP = ResMay.insertRefl ; @@ -64,7 +64,6 @@ lin } ; - SlashV2A v2 adj = useV { s = \\vf => v2.s ! vf; } ** { @@ -72,16 +71,20 @@ lin adjCompl = adj.s } ; - -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good - -- SlashV2S v2 s = useV { - -- s = \\vf => v2.s ! vf; - -- } ** { - -- c2 = v2.c2; - -- sCompl = s.s - -- } ; - -- : V2V -> VP -> VPSlash ; -- beg (her) to go - -- SlashV2V v2v vp = ; + SlashV2V v2 vp = vp ** useV { + s = \\vf => v2.s ! vf ++ (linVP vp); + } ** { + c2 = v2.c2; + adjCompl = [] ; + } ; + + + -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good + SlashV2S v2 s = useV v2 ** { + c2 = v2.c2; + adjCompl = "yang" ++ s.s ; -- TODO check /Inari + } ; {- @@ -108,17 +111,9 @@ lin -- : VV -> VPSlash -> VPSlash ; SlashVV vv vps = ComplVV vv vps ** { c2 = vps.c2 ; -- like ComplVV except missing object - passive = vv.s ++ vps.passive; adjCompl = vps.adjCompl ; } ; - -- SlashVV vv vp = vp ** useV { - -- s = \\vf => vv.s ++ linVP vp ; - -- 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 04cfc950e..9e07837e7 100644 --- a/src/malay/unittest/complements.gftest +++ b/src/malay/unittest/complements.gftest @@ -4,3 +4,10 @@ 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 aku kucing + +-- Sentence complements + +-- added by Inari, TODO check +Lang: PredVP (UsePron she_Pron) (ComplSlash (SlashV2S answer_V2S (UseCl (TTAnt TPres ASimul) PPos (PredVP (MassNP (UseN dog_N)) (ComplSlash (SlashV2a eat_V2) (MassNP (UseN cat_N)))))) (UsePron i_Pron)) +LangMay: dia menjawab aku yang anjing makan kucing +