1
0
forked from GitHub/gf-rgl

Merge pull request #420 from Meowyam/master

changes to Malay RGL
This commit is contained in:
Inari Listenmaa
2023-02-23 15:39:46 +08:00
committed by GitHub
8 changed files with 92 additions and 114 deletions

View File

@@ -3,95 +3,17 @@ concrete ConjunctionMay of Conjunction =
flags optimize=all_subs ; flags optimize=all_subs ;
{- Conjunction for category X needs four things: lincat
lincat [X] [Adv],[AdV] = {s1,s2 : Str} ;
lin BaseX [S] = {s1,s2 : Str} ;
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 ;
--}
-- Adverb and other simple {s : Str} types. lin
lincat BaseAdv, BaseAdV = twoSS ;
[Adv],[AdV],[IAdv] = {s1,s2 : Str} ; 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 ;
{-
-- 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 =
-}
} }

View File

@@ -49,6 +49,7 @@ concrete ExtendMay of Extend = CatMay
s = np.s ! Bare ++ vps.s ; s = np.s ! Bare ++ vps.s ;
} ; } ;
-- SQuestVPS : NP -> VPS -> QS ; -- has she walked -- SQuestVPS : NP -> VPS -> QS ; -- has she walked
SQuestVPS np vps = {s = np.s ++ vps.s} ;
-- QuestVPS : IP -> VPS -> QS ; -- who has walked -- QuestVPS : IP -> VPS -> QS ; -- who has walked
-- RelVPS : RP -> VPS -> RS ; -- which won't sleep -- RelVPS : RP -> VPS -> RS ; -- which won't sleep

View File

@@ -9,7 +9,7 @@ oper
-- should always use these constants instead of the constructors -- should always use these constants instead of the constructors
-- defined in $ResSom$. -- defined in $ResSom$.
noPrep : Prep = mkPrep "" ; noPrep : Prep = mkPrep "" ;
--2 Nouns --2 Nouns
@@ -54,15 +54,22 @@ noPrep : Prep = mkPrep "" ;
mkVV : Str -> VV ; mkVV : Str -> VV ;
} ; } ;
-- mkVS : overload {
-- mkVA : Str -> VA mkVS : V -> VS ;
-- = \s -> lin VA (regV s) ; } ;
mkVA : overload {
mkVA : V -> VA ;
} ;
mkV2V : overload {
mkV2V : Str -> V2V ;
mkV2V : V -> Prep -> Prep -> V2V ;
} ;
-- mkVQ : Str -> VQ -- mkVQ : Str -> VQ
-- = \s -> lin VQ (regV s) ; -- = \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 -- mkV2A : Str -> V2A
-- = \s -> lin V2A (regV s ** {c2 = noPrep}) ; -- = \s -> lin V2A (regV s ** {c2 = noPrep}) ;
@@ -123,6 +130,7 @@ noPrep : Prep = mkPrep "" ;
mkA2 = overload { mkA2 = overload {
mkA2 : (adj : Str) -> A = \s -> lin A2 (mkAdj s) ; 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) ; mkA2 : A -> Prep -> A = \a,p -> lin A2 (a) ;
} ; } ;
@@ -156,10 +164,26 @@ noPrep : Prep = mkPrep "" ;
mkV4 : V -> Prep -> Str -> V2 = \v,p,str -> lin V2 (mkVerb4 v p str) mkV4 : V -> Prep -> Str -> V2 = \v,p,str -> lin V2 (mkVerb4 v p str)
} ; } ;
mkVV = overload { mkVV = overload {
mkVV : Str -> VV = \vv -> lin VV (ss vv) 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)
} ;
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" ;
-- } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
} }

View File

@@ -251,6 +251,16 @@ oper
} ; } ;
copula : Verb = {s = \\_ => "ada"} ; -- TODO 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 -- Adv
@@ -320,6 +330,7 @@ oper
Sentence : Type = {s : Str} ; Sentence : Type = {s : Str} ;
predVP : NounPhrase -> VerbPhrase -> Clause = \np,vp -> { predVP : NounPhrase -> VerbPhrase -> Clause = \np,vp -> {
subj = np.s ! Bare ; subj = np.s ! Bare ;
pred = vp.s pred = vp.s
@@ -328,6 +339,8 @@ oper
predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps -> predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps ->
predVP np <vps : VerbPhrase> ** {c2 = vps.c2} ; predVP np <vps : VerbPhrase> ** {c2 = vps.c2} ;
linS : Sentence -> Str = \sent -> sent.s ;
-- mkClause : Str -> NounPhrase -> VPSlash -> Clause = \str,np,vp -> { -- mkClause : Str -> NounPhrase -> VPSlash -> Clause = \str,np,vp -> {
-- subj = str ++ np.s ! Bare; -- subj = str ++ np.s ! Bare;

View File

@@ -37,13 +37,16 @@ lin
-- : VP -> SC ; -- : VP -> SC ;
EmbedVP vp = {s = vp.s ! Root ! Pos} ; 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 -- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves
SlashVS np vs ss = {} ; SlashVS np vs ss = {} ;
-- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
UseSlash t p cls = {} ;
--2 Imperatives --2 Imperatives
-- : VP -> Imp ; -- : VP -> Imp ;

View File

@@ -42,7 +42,7 @@ lin there_Adv = ss "" ;
-- Conj -- Conj
lin and_Conj = {s2 = "dan" ; s1 = [] ; n = Pl} ; 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 if_then_Conj = mkConj
-- lin both7and_DConj = mkConj "" "" pl ; -- lin both7and_DConj = mkConj "" "" pl ;
-- lin either7or_DConj = {s2 = \\_ => "" ; s1 = "" ; n = Sg} ; -- lin either7or_DConj = {s2 = \\_ => "" ; s1 = "" ; n = Sg} ;
@@ -108,7 +108,7 @@ lin by8means_Prep = mkPrep "dengan" ;
-- lin from_Prep = mkPrep "" ; -- lin from_Prep = mkPrep "" ;
-- lin in8front_Prep = mkPrep "" ; -- lin in8front_Prep = mkPrep "" ;
lin in_Prep = mkPrep "di" ; lin in_Prep = mkPrep "di" ;
-- lin on_Prep = mkPrep "" ; lin on_Prep = mkPrep "pada" ;
-- lin part_Prep = mkPrep ; -- lin part_Prep = mkPrep ;
lin possess_Prep = mkPrep [] ; -- TODO check Mintz p. 39-40, 2.2.1.2 lin possess_Prep = mkPrep [] ; -- TODO check Mintz p. 39-40, 2.2.1.2
-- lin through_Prep = mkPrep ; -- lin through_Prep = mkPrep ;

View File

@@ -19,18 +19,20 @@ lin
s = \\vf => vv.s ++ linVP vp s = \\vf => vv.s ++ linVP vp
} ; } ;
-- : VA -> AP -> VP ; -- they become red
ComplVA va ap = ResMay.insertComp ap (useV va) ;
-- : VS -> S -> VP ; -- : VS -> S -> VP ;
-- ComplVS vs s = ComplVS vs s = ResMay.insertObj (linS s) (useV vs) ;
-- let vps = useV vs ;
-- subord = SubjS {s=""} s ; -- let vps = useV vs ;
-- in vps ** {} ; -- subord = SubjS {s=""} s ;
-- in vps ** {} ;
{- {-
-- : VQ -> QS -> VP ; -- : VQ -> QS -> VP ;s
ComplVQ vq qs = ; ComplVQ vq qs = ;
-- : VA -> AP -> VP ; -- they become red
ComplVA va ap = ResMay.insertComp (CompAP ap).s (useV va) ;
-} -}
-------- --------
@@ -61,8 +63,7 @@ lin
adjCompl = [] adjCompl = []
} ; } ;
-- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp ->
-- insertObj obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ;
SlashV2A v2 adj = useV { SlashV2A v2 adj = useV {
s = \\vf => v2.s ! vf; s = \\vf => v2.s ! vf;
@@ -71,12 +72,23 @@ lin
adjCompl = adj.s 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 = ;
{- {-
-- : V2S -> S -> VPSlash ; -- answer (to him) that it is good -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good
SlashV2S v2s s = SlashV2S v2s s =
-- : V2V -> VP -> VPSlash ; -- beg (her) to go
SlashV2V v2v vp = ;
-- : V2Q -> QS -> VPSlash ; -- ask (him) who came -- : V2Q -> QS -> VPSlash ; -- ask (him) who came
SlashV2Q v2q qs = ; SlashV2Q v2q qs = ;

View File

@@ -13,6 +13,9 @@ Lang: UseCl (TTAnt TFut ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (Use
LangEng: the cat will walk LangEng: the cat will walk
LangMay: kucing akan berjalan 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 -- Conditions