From a741e192e2ef0da3dc7d51b1ff52c09c6f853799 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 22 Feb 2023 11:37:43 +0800 Subject: [PATCH 1/6] add ListS, insertObj --- src/malay/ConjunctionMay.gf | 7 ++++--- src/malay/StructuralMay.gf | 2 ++ src/malay/VerbMay.gf | 10 +++++++--- src/malay/unittest/tenses.gftest | 3 +++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/malay/ConjunctionMay.gf b/src/malay/ConjunctionMay.gf index 75d43702a..f00f67321 100644 --- a/src/malay/ConjunctionMay.gf +++ b/src/malay/ConjunctionMay.gf @@ -31,11 +31,12 @@ concrete ConjunctionMay of Conjunction = -- Adverb and other simple {s : Str} types. lincat [Adv],[AdV],[IAdv] = {s1,s2 : Str} ; + [S] = {s1,s2 : Str} ; lin - BaseAdv, BaseAdV, BaseIAdv = twoSS ; - ConsAdv, ConsAdV, ConsIAdv = consrSS comma ; - ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ; + BaseAdv, BaseAdV, BaseIAdv, BaseS = twoSS ; + ConsAdv, ConsAdV, ConsIAdv, ConsS = consrSS comma ; + ConjAdv, ConjAdV, ConjIAdv, ConjS = conjunctDistrSS ; {- diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 3a5430dfe..3bbc3a12e 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -178,6 +178,8 @@ lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** { -- lin can8know_VV = can_VV ; -- can (capacity) lin can_VV = mkVV "boleh" ; -- can (possibility) lin must_VV = mkVV "perlu" ; +lin may_VV = mkVV "mungkin" ; +lin shall_VV = mkVV "hendaklah" ; lin want_VV = mkVV "mahu" ; ------ diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index b6985a832..cb19a1dd3 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -62,7 +62,8 @@ lin } ; -- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp -> - -- insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ; + insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ; + SlashV2A v2 adj = useV { s = \\vf => v2.s ! vf; @@ -71,12 +72,15 @@ lin adjCompl = adj.s } ; + -- : V2V -> VP -> VPSlash ; -- beg (her) to go + SlashV2V v2v vp = ; + + {- -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good SlashV2S v2s s = - -- : V2V -> VP -> VPSlash ; -- beg (her) to go - SlashV2V v2v vp = ; + -- : V2Q -> QS -> VPSlash ; -- ask (him) who came SlashV2Q v2q qs = ; diff --git a/src/malay/unittest/tenses.gftest b/src/malay/unittest/tenses.gftest index 51ef0bf69..da1b8df10 100644 --- a/src/malay/unittest/tenses.gftest +++ b/src/malay/unittest/tenses.gftest @@ -13,6 +13,9 @@ Lang: UseCl (TTAnt TFut ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (Use LangEng: the cat will walk LangMay: kucing akan berjalan +Lang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2V beg_V2V (UseV go_V)) (UsePron she_Pron)) +LangEng: I begged her to go + ------------- -- Conditions From f53078dbadeb608073a07f1a648dd577e61226ad Mon Sep 17 00:00:00 2001 From: Meowyam Date: Wed, 22 Feb 2023 13:35:09 +0800 Subject: [PATCH 2/6] remove shall_VV --- src/malay/ConjunctionMay.gf | 9 ++++++--- src/malay/StructuralMay.gf | 2 -- src/malay/VerbMay.gf | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/malay/ConjunctionMay.gf b/src/malay/ConjunctionMay.gf index f00f67321..1bc122ff4 100644 --- a/src/malay/ConjunctionMay.gf +++ b/src/malay/ConjunctionMay.gf @@ -34,9 +34,12 @@ lincat [S] = {s1,s2 : Str} ; lin - BaseAdv, BaseAdV, BaseIAdv, BaseS = twoSS ; - ConsAdv, ConsAdV, ConsIAdv, ConsS = consrSS comma ; - ConjAdv, ConjAdV, ConjIAdv, ConjS = conjunctDistrSS ; + BaseAdv, BaseAdV, BaseIAdv = twoSS ; + ConsAdv, ConsAdV, ConsIAdv = consrSS comma ; + ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ; + BaseS = twoSS ; + ConsS = consrSS comma ; + ConjS = conjunctDistrSS ; {- diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 3bbc3a12e..3a5430dfe 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -178,8 +178,6 @@ lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** { -- lin can8know_VV = can_VV ; -- can (capacity) lin can_VV = mkVV "boleh" ; -- can (possibility) lin must_VV = mkVV "perlu" ; -lin may_VV = mkVV "mungkin" ; -lin shall_VV = mkVV "hendaklah" ; lin want_VV = mkVV "mahu" ; ------ diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index cb19a1dd3..cf5497c00 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -62,7 +62,7 @@ lin } ; -- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp -> - insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ; + -- insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ; SlashV2A v2 adj = useV { @@ -73,7 +73,7 @@ lin } ; -- : V2V -> VP -> VPSlash ; -- beg (her) to go - SlashV2V v2v vp = ; + -- SlashV2V v2v vp = ; {- From ee01aa1cd5021826aeb740f73d8a131453817529 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Thu, 23 Feb 2023 14:08:14 +0800 Subject: [PATCH 3/6] add ListS and ComplVA --- src/malay/ConjunctionMay.gf | 102 ++++-------------------------------- src/malay/ExtendMay.gf | 1 + src/malay/ParadigmsMay.gf | 6 ++- src/malay/ResMay.gf | 11 +++- src/malay/StructuralMay.gf | 4 +- src/malay/VerbMay.gf | 15 ++++-- 6 files changed, 38 insertions(+), 101 deletions(-) diff --git a/src/malay/ConjunctionMay.gf b/src/malay/ConjunctionMay.gf index 1bc122ff4..2d817f4ca 100644 --- a/src/malay/ConjunctionMay.gf +++ b/src/malay/ConjunctionMay.gf @@ -3,99 +3,17 @@ concrete ConjunctionMay of Conjunction = flags optimize=all_subs ; - {- Conjunction for category X needs four things: - lincat [X] - lin BaseX - lin ConsX - lin ConjX - - For example, if X is defined as - - lincat X = {s : Number => Str ; g : Gender} ; - - then [X] will split its s field into two, and retain its other fields as is: - - lincat [X] = {s1,s2 : Number => Str ; g : Gender} ; - - Let us look at a simple case: Adv is of type {s : Str} - Then [Adv] is {s1,s2 : Str}. - BaseAdv, ConsAdv and ConjAdv can all use functions defined in prelude/Coordination: - - BaseAdv = twoSS ; - ConsAdv = consrSS comma ; - ConjAdv = conjunctSS ; - - --} + lincat + [Adv],[AdV] = {s1,s2 : Str} ; + [S] = {s1,s2 : Str} ; --- Adverb and other simple {s : Str} types. -lincat - [Adv],[AdV],[IAdv] = {s1,s2 : Str} ; - [S] = {s1,s2 : Str} ; + lin + BaseAdv, BaseAdV = twoSS ; + ConsAdv, ConsAdV = consrSS comma ; + ConjAdv, ConjAdV = conjunctDistrSS ; + BaseS = twoSS ; + ConsS = consrSS comma ; + ConjS = conjunctDistrSS ; -lin - BaseAdv, BaseAdV, BaseIAdv = twoSS ; - ConsAdv, ConsAdV, ConsIAdv = consrSS comma ; - ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ; - BaseS = twoSS ; - ConsS = consrSS comma ; - ConjS = conjunctDistrSS ; - - -{- --- RS depends on X, Y and Z, otherwise exactly like previous. --- RS can modify CNs, which are open for …, and have inherent … -lincat - [RS] = {s1,s2 : … => Str} ; - -lin - BaseRS = twoTable3 … ; - ConsRS = consrTable3 … comma ; - ConjRS = conjunctRSTable ; - - -lincat - [S] = {} ; - -lin - BaseS x y = y ** { } ; - ConsS x xs = - xs ** { } ; - ConjS co xs = {} ; - -lincat - [AP] = {} ; - -lin - BaseAP x y = twoTable … x y ** y ; --choose all the other fields from second argument - ConsAP as a = consrTable … comma as a ** as ; - ConjAP co as = conjunctDistrTable … co as ** as ; - -lincat - [CN] = { } ; - -lin - BaseCN = {} ; - ConsCN = {} ; - ConjCN co cs = conjunctDistrTable Agr co cs ** cs ; - -lincat - [DAP] = - -lin - BaseDAP x y = x ** - ConsDAP xs x = xs ** - ConjDet conj xs = xs ** - - --- Noun phrases -lincat - [NP] = - -lin - BaseNP x y = - ConsNP x xs = - ConjNP conj xs = - --} } diff --git a/src/malay/ExtendMay.gf b/src/malay/ExtendMay.gf index 5e14dccc9..58ae1ef58 100644 --- a/src/malay/ExtendMay.gf +++ b/src/malay/ExtendMay.gf @@ -49,6 +49,7 @@ 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} ; -- QuestVPS : IP -> VPS -> QS ; -- who has walked -- RelVPS : RP -> VPS -> RS ; -- which won't sleep diff --git a/src/malay/ParadigmsMay.gf b/src/malay/ParadigmsMay.gf index 2d20d248c..ac781e5da 100644 --- a/src/malay/ParadigmsMay.gf +++ b/src/malay/ParadigmsMay.gf @@ -55,8 +55,9 @@ noPrep : Prep = mkPrep "" ; } ; -- - -- mkVA : Str -> VA - -- = \s -> lin VA (regV s) ; + mkVA : overload { + mkVA : V -> VA ; + } ; -- mkVQ : Str -> VQ -- = \s -> lin VQ (regV s) ; mkVS : overload { @@ -123,6 +124,7 @@ noPrep : Prep = mkPrep "" ; mkA2 = overload { mkA2 : (adj : Str) -> A = \s -> lin A2 (mkAdj s) ; + mkA2 : A -> A2 = \a -> lin A2 (a ** {c2 = emptyPrep}) ; mkA2 : A -> Prep -> A = \a,p -> lin A2 (a) ; } ; diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 307a7e6f7..2be6ab522 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -251,6 +251,16 @@ oper } ; copula : Verb = {s = \\_ => "ada"} ; -- TODO + + -- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp -> + -- insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ; + insertObj : Str -> VerbPhrase -> VerbPhrase = \str,vp -> vp ** { + s = \\vf,pol => vp.s ! Active ! Pos ++ str ; + } ; + + insertComp : AdjPhrase -> VerbPhrase -> VerbPhrase = \ap,vp -> vp ** { + s = \\vf,pol => vp.s ! Active ! Pos ++ ap.s ; + } ; ------------------ -- Adv @@ -328,7 +338,6 @@ 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 3a5430dfe..88c2cedb5 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -42,7 +42,7 @@ lin there_Adv = ss "" ; -- Conj lin and_Conj = {s2 = "dan" ; s1 = [] ; n = Pl} ; --- lin or_Conj = {s2 = \\_ => "" ; s1 = [] ; n = Sg} ; +lin or_Conj = {s2 = "atau" ; s1 = [] ; n = Sg} ; -- lin if_then_Conj = mkConj -- lin both7and_DConj = mkConj "" "" pl ; -- lin either7or_DConj = {s2 = \\_ => "" ; s1 = "" ; n = Sg} ; @@ -108,7 +108,7 @@ lin by8means_Prep = mkPrep "dengan" ; -- lin from_Prep = mkPrep "" ; -- lin in8front_Prep = mkPrep "" ; lin in_Prep = mkPrep "di" ; --- lin on_Prep = mkPrep "" ; +lin on_Prep = mkPrep "pada" ; -- lin part_Prep = mkPrep ; lin possess_Prep = mkPrep [] ; -- TODO check Mintz p. 39-40, 2.2.1.2 -- lin through_Prep = mkPrep ; diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index cf5497c00..8bbf55b88 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -19,6 +19,9 @@ lin s = \\vf => vv.s ++ linVP vp } ; + -- : VA -> AP -> VP ; -- they become red + ComplVA va ap = ResMay.insertComp ap (useV va) ; + -- : VS -> S -> VP ; -- ComplVS vs s = -- let vps = useV vs ; @@ -29,8 +32,6 @@ lin -- : VQ -> QS -> VP ; ComplVQ vq qs = ; - -- : VA -> AP -> VP ; -- they become red - ComplVA va ap = ResMay.insertComp (CompAP ap).s (useV va) ; -} -------- @@ -61,8 +62,6 @@ lin adjCompl = [] } ; - -- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp -> - -- insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ; SlashV2A v2 adj = useV { @@ -72,6 +71,14 @@ 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 = ; From fd51156369d04731cf8e3877517b15ed1b6017b1 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Thu, 23 Feb 2023 15:06:14 +0800 Subject: [PATCH 4/6] add mkVS --- src/malay/ParadigmsMay.gf | 24 ++++++++++++++++-------- src/malay/ResMay.gf | 4 ++++ src/malay/VerbMay.gf | 11 ++++++----- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/malay/ParadigmsMay.gf b/src/malay/ParadigmsMay.gf index ac781e5da..783114145 100644 --- a/src/malay/ParadigmsMay.gf +++ b/src/malay/ParadigmsMay.gf @@ -9,7 +9,7 @@ oper -- should always use these constants instead of the constructors -- defined in $ResSom$. -noPrep : Prep = mkPrep "" ; + noPrep : Prep = mkPrep "" ; --2 Nouns @@ -54,16 +54,17 @@ noPrep : Prep = mkPrep "" ; mkVV : Str -> VV ; } ; + mkVS : overload { + mkVS : V -> VS ; + } ; -- mkVA : overload { mkVA : V -> VA ; } ; -- mkVQ : Str -> VQ -- = \s -> lin VQ (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}) ; @@ -158,10 +159,17 @@ noPrep : Prep = mkPrep "" ; mkV4 : V -> Prep -> Str -> V2 = \v,p,str -> lin V2 (mkVerb4 v p str) } ; - mkVV = overload { - mkVV : Str -> VV = \vv -> lin VV (ss vv) - } ; + mkVV = overload { + mkVV : Str -> VV = \vv -> lin VV (ss vv) + } ; + mkVS = overload { + mkVS : V -> VS = \v -> lin VS (v) + } ; + + mkVA = overload { + mkVA : V -> VA = \v -> lin VA (v) + } ; -------------------------------------------------------------------------------- } diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 2be6ab522..aaadafdef 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -330,6 +330,7 @@ oper Sentence : Type = {s : Str} ; + predVP : NounPhrase -> VerbPhrase -> Clause = \np,vp -> { subj = np.s ! Bare ; pred = vp.s @@ -338,6 +339,9 @@ oper predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps -> predVP np ** {c2 = vps.c2} ; + linS : Sentence -> Str = \sent -> sent.s ; + + -- mkClause : Str -> NounPhrase -> VPSlash -> Clause = \str,np,vp -> { -- subj = str ++ np.s ! Bare; -- pred = vp.s diff --git a/src/malay/VerbMay.gf b/src/malay/VerbMay.gf index 8bbf55b88..0be398aa6 100644 --- a/src/malay/VerbMay.gf +++ b/src/malay/VerbMay.gf @@ -23,13 +23,14 @@ lin ComplVA va ap = ResMay.insertComp ap (useV va) ; -- : VS -> S -> VP ; - -- ComplVS vs s = - -- let vps = useV vs ; - -- subord = SubjS {s=""} s ; - -- in vps ** {} ; + ComplVS vs s = ResMay.insertObj (linS s) (useV vs) ; + + -- let vps = useV vs ; + -- subord = SubjS {s=""} s ; + -- in vps ** {} ; {- - -- : VQ -> QS -> VP ; + -- : VQ -> QS -> VP ;s ComplVQ vq qs = ; From 5ed93e6a03ff63cb0666c7c67668f2e082ac6493 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Thu, 23 Feb 2023 15:27:56 +0800 Subject: [PATCH 5/6] add mkV2V is str and v prep prep --- src/malay/ParadigmsMay.gf | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/malay/ParadigmsMay.gf b/src/malay/ParadigmsMay.gf index 783114145..c406cc584 100644 --- a/src/malay/ParadigmsMay.gf +++ b/src/malay/ParadigmsMay.gf @@ -57,10 +57,15 @@ oper mkVS : overload { mkVS : V -> VS ; } ; - -- + mkVA : overload { mkVA : V -> VA ; } ; + + mkV2V : overload { + mkV2V : Str -> V2V ; + mkV2V : V -> Prep -> Prep -> V2V ; + } ; -- mkVQ : Str -> VQ -- = \s -> lin VQ (regV s) ; @@ -170,6 +175,15 @@ oper mkVA = overload { mkVA : V -> VA = \v -> lin VA (v) } ; + + mkV2V = overload { + mkV2V : Str -> V2V = \v -> lin V2V (mkVerb2 (mkVerb v Meng) dirPrep) ; + mkV2V : V -> Prep -> Prep -> V2V = \v,p1,p2 -> lin V2V (mkVerb3 v p1 p2) + } ; +-- lin like_V2 = let like' : V2 = mkV2 "suka" in like' ** { +-- s = \\_ => "suka" ; +-- passive = "disukai" ; +-- } ; -------------------------------------------------------------------------------- } From ebd4a462eb46e21b0167233c4c95bfcd829fe960 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Thu, 23 Feb 2023 15:31:36 +0800 Subject: [PATCH 6/6] add UseSlash --- src/malay/SentenceMay.gf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/malay/SentenceMay.gf b/src/malay/SentenceMay.gf index c82ae4878..ddda07696 100644 --- a/src/malay/SentenceMay.gf +++ b/src/malay/SentenceMay.gf @@ -37,13 +37,16 @@ lin -- : VP -> SC ; EmbedVP vp = {s = vp.s ! Root ! Pos} ; + -- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen + UseSlash t p cl = { + s = cl.subj ++ t.s ++ p.s ++ cl.pred ! Active ! p.p; + } ; + {- -- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves SlashVS np vs ss = {} ; - -- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen - UseSlash t p cls = {} ; --2 Imperatives -- : VP -> Imp ;