1
0
forked from GitHub/gf-rgl

(Pes) Add Mod to Prep + update appComp. Constructors with Mod for Det.

This commit is contained in:
Inari Listenmaa
2019-03-15 16:39:48 +01:00
parent c61e46be89
commit ad37f1b681
4 changed files with 43 additions and 34 deletions

View File

@@ -28,6 +28,10 @@ oper
subjunctive : VVForm ; -- The verbal complement of VV is in subjunctive subjunctive : VVForm ; -- The verbal complement of VV is in subjunctive
indicative : VVForm ; -- The verbal complement of VV is in indicative indicative : VVForm ; -- The verbal complement of VV is in indicative
Mod : Type ; -- Argument to mkDet and mkPrep
ezafe : Mod ; -- e.g. mkPrep "برای" ezafe
-- poss : Mod ; -- TODO is this needed?
--clitic : Mod ; -- TODO is this needed?
--2 Nouns --2 Nouns
mkN : overload { mkN : overload {
@@ -66,9 +70,11 @@ oper
mkDet = overload { mkDet = overload {
mkDet : Str -> Number -> Det -- Takes a string, number (sg/pl) and returns a det which is not a numeral mkDet : Str -> Number -> Det -- Takes a string, number (sg/pl) and returns a det which is not a numeral
= \s1,n -> lin Det (makeDet s1 n False); = \s,n -> lin Det (makeDet s n False);
mkDet : Str -> Number -> Bool -> Det -- Takes a string, number (sg/pl) and a Boolean for whether the det is a numeral mkDet : Str -> Number -> Bool -> Det -- As above + a Boolean for whether the det is a numeral
= \s1,n,b -> lin Det (makeDet s1 n b) = \s,n,b -> lin Det (makeDet s n b) ;
mkDet : Str -> Number -> Bool -> Mod -> Det -- As above + Mod for which form the determiner expects its argument to be (default bare)
= \s,n,b,m -> lin Det (makeDet s n b ** {mod=m})
}; };
{- {-
@@ -173,8 +179,13 @@ oper
----2 Prepositions ----2 Prepositions
mkPrep : Str -> Prep ; -- Takes a string, returns a preposition. mkPrep = overload {
mkPrep str = lin Prep {s = str ; ra = []} ; mkPrep : Str -> Prep -- Takes a string, returns a preposition.
= \str -> lin Prep {s = str ; ra = [] ; mod = Bare} ;
mkPrep : Str -> Mod -> Prep -- Takes a string and Mod (so far only option is ezafe), returns a preposition.
= \str,m -> lin Prep {s = str ; ra = [] ; mod=m}
} ;
{- {-
--3 Determiners and quantifiers --3 Determiners and quantifiers
@@ -224,6 +235,9 @@ oper
subjunctive = ResPes.Subj ; subjunctive = ResPes.Subj ;
indicative = Indic ; indicative = Indic ;
Mod = ResPes.Mod ;
ezafe = ResPes.Ezafe ;
-- Removed mkV_1, mkV_2, mkN01 and mkN02 from public API, still available for -- Removed mkV_1, mkV_2, mkN01 and mkN02 from public API, still available for
-- any applications that open ParadigmsPes. /IL 2019-02-08 -- any applications that open ParadigmsPes. /IL 2019-02-08
mkV_1 : Str -> V mkV_1 : Str -> V
@@ -329,15 +343,15 @@ oper
mkV2 : V -> Str -> V2 mkV2 : V -> Str -> V2
= \v,ra -> lin V2 (v ** {c2 = prepOrRa ra}) ; = \v,ra -> lin V2 (v ** {c2 = prepOrRa ra}) ;
mkV2 : V -> Str -> Bool -> V2 mkV2 : V -> Str -> Bool -> V2
= \v,p,b -> lin V2 (v ** {c2 = {ra = [] ; s = p}}) ; = \v,p,b -> lin V2 (v ** {c2 = {ra = [] ; s = p ; mod=Bare}}) ;
} ; } ;
prepOrRa : Str -> Compl = \s -> case s of { prepOrRa : Str -> Compl = \s -> case s of {
"را" => {s = [] ; ra = "را"} ; "را" => {s = [] ; ra = "را" ; mod=Bare} ;
prep => {s = prep ; ra = []} prep => {s = prep ; ra = []; mod=Bare}
} ; } ;
mkPost : Str -> Prep = \s -> lin Prep {s=[] ; ra=s} ; mkPost : Str -> Prep = \s -> lin Prep {s=[] ; ra=s ; mod=Bare} ;
mkN2 = overload { mkN2 = overload {
mkN2 : Str -> N2 -- Predictable N2 without complement mkN2 : Str -> N2 -- Predictable N2 without complement

View File

@@ -102,7 +102,7 @@ oper
vp.comp ! agr ++ vp.prefix ++ vp.s ! vf -- vp.ad is missing on purpose! we add it in insertVV. vp.comp ! agr ++ vp.prefix ++ vp.s ! vf -- vp.ad is missing on purpose! we add it in insertVV.
++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp ; ++ vp.obj ++ vp.vComp ! agr ! VVPres ++ vp.embComp ;
Compl : Type = {s : Str ; ra : Str} ; Compl : Type = {s : Str ; ra : Str ; mod : Mod} ;
VPHSlash : Type = VPH ** { VPHSlash : Type = VPH ** {
c2 : Compl ; -- prep or ra for the complement c2 : Compl ; -- prep or ra for the complement
@@ -126,14 +126,14 @@ oper
--------------------- ---------------------
-- VP complementation -- VP complementation
--------------------- ---------------------
appComp : Compl -> Str -> Str = \c2,obj -> appComp : Compl -> (Mod=>Str) -> Str = \c2,obj ->
c2.s ++ obj ++ c2.ra ; c2.s ++ obj ! c2.mod ++ c2.ra ;
insertComp : (Agr => Str) -> VPH -> VPH = \obj,vp -> vp ** { insertComp : (Agr => Str) -> VPH -> VPH = \obj,vp -> vp ** {
comp = \\a => vp.comp ! a ++ obj ! a comp = \\a => vp.comp ! a ++ obj ! a
} ; } ;
insertCompPre : (Agr=>Str) -> VPHSlash -> VPH = \obj,vp -> vp ** { insertCompPre : (Agr=>Mod=>Str) -> VPHSlash -> VPH = \obj,vp -> vp ** {
comp = \\a => appComp vp.c2 (obj ! a) ++ vp.comp ! a comp = \\a => appComp vp.c2 (obj ! a) ++ vp.comp ! a
} ; } ;
@@ -152,8 +152,7 @@ oper
} ; } ;
complSlash : VPHSlash -> NP -> VPH = \vp,np -> vp ** { complSlash : VPHSlash -> NP -> VPH = \vp,np -> vp ** {
comp = \\a => appComp vp.c2 (np.s ! Bare) comp = \\a => appComp vp.c2 np.s ++ vp.comp ! a ;
++ np.compl ++ vp.comp ! a ;
obj = vp.obj ++ vp.agrObj ! np.a -- "beg her to buy", buy agrees with her obj = vp.obj ++ vp.agrObj ! np.a -- "beg her to buy", buy agrees with her
} ; } ;
@@ -264,14 +263,13 @@ oper
-- Reflexive pronouns -- Reflexive pronouns
----------------------------------- -----------------------------------
reflPron : Agr => Str = table { reflPron : Agr => Mod => Str = table {
Ag Sg P1 => "خودم" ; Ag Sg P1 => modTable "خودم" ;
Ag Sg P2 => "خودت" ; Ag Sg P2 => modTable "خودت" ;
Ag Sg P3 => "خودش" ; Ag Sg P3 => modTable "خودش" ;
Ag Pl P1 => "خودمان" ; Ag Pl P1 => modTable "خودمان" ;
Ag Pl P2 => "خودتان" ; Ag Pl P2 => modTable "خودتان" ;
Ag Pl P3 => "خودشان" Ag Pl P3 => modTable "خودشان"
} ; } ;
getPron : Animacy -> Number -> Str = \ani,number -> getPron : Animacy -> Number -> Str = \ani,number ->

View File

@@ -29,7 +29,7 @@ concrete StructuralPes of Structural = CatPes **
-- everything_NP = R.indeclNP ["هر XE"])); -- everything_NP = R.indeclNP ["هر XE"]));
everywhere_Adv = ss ["هر جا"] ; everywhere_Adv = ss ["هر جا"] ;
few_Det = mkDet ["تعداد کمی"] Pl True; -- check few_Det = mkDet ["تعداد کمی"] Pl True; -- check
for_Prep = mkPrep "برای" ; for_Prep = mkPrep "برای" Ezafe ;
from_Prep = mkPrep "از" ; from_Prep = mkPrep "از" ;
he_Pron = R.agr2pron ! Ag Sg P3 ; he_Pron = R.agr2pron ! Ag Sg P3 ;
here_Adv = ss "اینجا" ; here_Adv = ss "اینجا" ;
@@ -44,7 +44,7 @@ concrete StructuralPes of Structural = CatPes **
in_Prep = mkPrep "در" ; in_Prep = mkPrep "در" ;
it_Pron = R.agr2pron ! Ag Sg P3; it_Pron = R.agr2pron ! Ag Sg P3;
less_CAdv = {s = "کمتر" ; p = ""} ; less_CAdv = {s = "کمتر" ; p = ""} ;
many_Det = mkDet ["تعداد زیادی"] Pl True; -- check many_Det = mkDet "بسیار" Pl False Ezafe ;
more_CAdv = {s = "بیشتر" ; p = "" } ; more_CAdv = {s = "بیشتر" ; p = "" } ;
most_Predet = ss "اکثر"; most_Predet = ss "اکثر";
much_Det = mkDet ["مقدار زیادی"] Pl ; much_Det = mkDet ["مقدار زیادی"] Pl ;
@@ -133,9 +133,6 @@ have_V2 = haveVerb ** {
VSubj _ (Ag Pl P2) => "داشته باشید" ; VSubj _ (Ag Pl P2) => "داشته باشید" ;
VSubj _ (Ag Pl P3) => "داشته باشند" ; VSubj _ (Ag Pl P3) => "داشته باشند" ;
x => haveVerb.s ! x } ; x => haveVerb.s ! x } ;
c2 = { c2 = prepOrRa [] -- "را" ; ---- AR 18/9/2017: usually no ra acc. to Nasrin, but this is tricky
s = [] ;
ra = [] --- "را" ; ---- AR 18/9/2017: usually no ra acc. to Nasrin, but this is tricky
}
} ; } ;
} }

View File

@@ -15,12 +15,12 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
ComplVV = insertVV ; ComplVV = insertVV ;
ComplVS v s = embComp (conjThat ++ s.s ! Indic) (predV v) ; ComplVS v s = embComp (conjThat ++ s.s ! Indic) (predV v) ;
ComplVQ v q = embComp (conjThat ++ q.s) (predV v) ; ComplVQ v q = embComp (conjThat ++ q.s) (predV v) ;
ComplVA v ap = insertObj (appComp v.c2 (ap.s ! Bare)) (predV v) ; -- check form of adjective ComplVA v ap = insertObj (appComp v.c2 ap.s) (predV v) ; -- check form of adjective
SlashVV vv vps = vps ** ComplVV vv vps ; SlashVV vv vps = vps ** ComplVV vv vps ;
SlashV2S v s = predVc v ** embComp (conjThat ++ s.s ! Indic) (predV v) ; SlashV2S v s = predVc v ** embComp (conjThat ++ s.s ! Indic) (predV v) ;
SlashV2Q v q = predVc v ** embComp q.s (predV v) ; SlashV2Q v q = predVc v ** embComp q.s (predV v) ;
SlashV2A v ap = predVc v ** insertObj (appComp v.c2 (ap.s ! Bare)) (predV v) ; ---- paint it red , check form of adjective SlashV2A v ap = predVc v ** insertObj (appComp v.c2 ap.s) (predV v) ; ---- paint it red , check form of adjective
-- : V2V -> VP -> VPSlash ; -- beg (her) to go -- : V2V -> VP -> VPSlash ; -- beg (her) to go
SlashV2V v2v vp = predVc v2v ** { SlashV2V v2v vp = predVc v2v ** {
@@ -36,7 +36,7 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
-- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
SlashV2VNP v2v np vps = predVc v2v ** { SlashV2VNP v2v np vps = predVc v2v ** {
comp = \\a => if_then_Str v2v.isAux conjThat [] -- that comp = \\a => if_then_Str v2v.isAux conjThat [] -- that
++ appComp v2v.c2 (np.s ! Bare) ; -- I ++ appComp v2v.c2 np.s ; -- I
-- ∅ is placed in comp -- ∅ is placed in comp
vComp = \\_,_ => showVPH (case v2v.compl of { -- buy vComp = \\_,_ => showVPH (case v2v.compl of { -- buy
Subj => VSubj Pos np.a ; Subj => VSubj Pos np.a ;