1
0
forked from GitHub/gf-rgl

Merge pull request #86 from inariksit/arabic

Arabic
This commit is contained in:
Inari Listenmaa
2018-11-27 18:44:25 +02:00
committed by GitHub
6 changed files with 35 additions and 23 deletions

View File

@@ -10,7 +10,9 @@ concrete IdiomAra of Idiom = CatAra ** open
-- : VP -> Cl ; -- it is hot -- : VP -> Cl ; -- it is hot
ImpersCl vp = ImpersCl vp =
let it : ResAra.NP = pron2np (pgn2pron vp.obj.a.pgn) ; -- if no obj, Per3 Masc Sg chosen by default let it : ResAra.NP = case vp.isPred of {
True => pron2np (pgn2pron vp.obj.a.pgn) ;
False => pgn2pron vp.obj.a.pgn } ; -- if no obj, Per3 Masc Sg chosen by default
in predVP it vp ; in predVP it vp ;
-- : VP -> Cl ; -- one sleeps -- : VP -> Cl ; -- one sleeps
@@ -21,8 +23,9 @@ concrete IdiomAra of Idiom = CatAra ** open
-- : Adv -> S -> Cl ; -- it is here she slept -- : Adv -> S -> Cl ; -- it is here she slept
CleftAdv adv s = CleftAdv adv s =
let comp : Comp = CompAdv adv in let comp : Comp = CompAdv (lin Adv {s = adv.s ++ s.s ! Verbal}) ; -- no idea about word order /IL
predVP he_Pron (UseComp comp) ; pass_V = mkV "مضي" va vi ; -- switch to copula or some other verb if better /IL
in predVP emptyNP (UseV pass_V ** {isPred=True ; pred=comp}) ; -- very hacky /IL
-- : NP -> Cl ; -- there is a house -- : NP -> Cl ; -- there is a house
ExistNP np = ExistNP np =

View File

@@ -174,7 +174,7 @@ lin
Use2N3 n3 = n3 ; Use2N3 n3 = n3 ;
Use3N3 n3 = n3 ** {c2 = n3.c3} ; Use3N3 n3 = n3 ** {c2 = n3.c3} ;
ComplN2 n2 np = UseN n2 ** {np=np.s} ; ComplN2 n2 np = UseN n2 ** {np = \\c => n2.c2.s ++ np.s ! n2.c2.c} ;
ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ;

View File

@@ -1546,9 +1546,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
} in wordOrder o } in wordOrder o
vp.obj.a.isPron np.a.isPron vp.obj.a.isPron np.a.isPron
(vStr vp pgn t p) (vStr vp pgn t p)
(case <vp.isPred,vp.obj.a.isPron> of { vp.obj.s
<False,True> => BIND ++ vp.obj.s ;
_ => vp.obj.s })
(pred vp pgn t p) (pred vp pgn t p)
vp.s2 vp.s2
subj subj
@@ -1626,11 +1624,18 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
subj2np : Subj -> NP = \su -> su ** {a = {pgn = emptyNP.a.pgn ; isPron = su.isPron} ; empty=[]} ; subj2np : Subj -> NP = \su -> su ** {a = {pgn = emptyNP.a.pgn ; isPron = su.isPron} ; empty=[]} ;
emptyObj : Obj = emptyNP ** {s=[]} ; emptyObj : Obj = emptyNP ** {s=[]} ;
insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** {
{ obj = {s = vp.obj.s -- old object, if there was one obj = {s = vp.obj.s -- old object, if there was one
++ vp.c2.s ++ np.s ! vp.c2.c -- new object ++ bindIfPron np vp -- new object, bind if pronoun and not pred
++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V ++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V
a = np.a} }; a = np.a}
} ;
bindIfPron : NP -> {c2:Preposition; isPred:Bool} -> Str = \np,vp ->
let bind = case <vp.isPred,np.a.isPron> of {
<False,True> => BIND ;
_ => [] }
in vp.c2.s ++ bind ++ np.s ! vp.c2.c ;
insertPred : Comp -> VP -> VP = \p,vp -> vp ** insertPred : Comp -> VP -> VP = \p,vp -> vp **
{ pred = p; { pred = p;
@@ -1651,6 +1656,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
VPSlash : Type = VP ** {c2 : Preposition ; agrObj : PerGenNum => Str} ; VPSlash : Type = VP ** {c2 : Preposition ; agrObj : PerGenNum => Str} ;
ClSlash : Type = VPSlash ** {subj : Subj} ; ClSlash : Type = VPSlash ** {subj : Subj} ;
emptyVPslash : VP -> VPSlash = \vp -> vp ** {
c2 = noPrep ; agrObj = \\_ => []
} ;
slashV2 : Verb2 -> VPSlash = \v -> slashV2 : Verb2 -> VPSlash = \v ->
predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ; predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ;

View File

@@ -52,10 +52,8 @@ concrete SentenceAra of Sentence = CatAra ** open
SlashVP = predVPSlash ; SlashVP = predVPSlash ;
AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ; AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ;
-- SlashPrep : Cl -> Prep -> ClSlash -- : Cl -> Prep -> ClSlash
-- Will be awkward to implement in the way ClSlash is now. -- SlashPrep cl prep = TODO
-- ClSlash is implemented the way it is now for a good reason:
-- we need to support different word orders.
-- SlashVS np vs sslash = TODO -- SlashVS np vs sslash = TODO

View File

@@ -46,7 +46,7 @@ concrete StructuralAra of Structural = CatAra **
n = Pl ; d = Def n = Pl ; d = Def
} ; -- IL } ; -- IL
-- if_Subj = ss "ِف" ; if_Subj = mkSubj "إِذَا" Verbal ;
in8front_Prep = mkPrep "مُقَابِلَ" ; in8front_Prep = mkPrep "مُقَابِلَ" ;
i_Pron = ResAra.i_Pron ; i_Pron = ResAra.i_Pron ;
in_Prep = mkPrep "فِي" ; in_Prep = mkPrep "فِي" ;

View File

@@ -14,17 +14,19 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
agrObj = \\pgn => v2v.c3.s -- أَنْ agrObj = \\pgn => v2v.c3.s -- أَنْ
++ vp.s ! pgn ! VPImpf Cnj ; ++ vp.s ! pgn ! VPImpf Cnj ;
isPred = False ; isPred = False ;
c2 = v2v.c2 ; -- for the direct object c2 = v2v.c2 ; -- preposition for the direct object
sc = v2v.sc sc = v2v.sc
} ; } ;
-- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
SlashV2VNP v2v np vps = let v2vVP = predV v2v in -- IL SlashV2VNP v2v np vps = let v2vVP = slashV2 v2v in -- IL
vps ** { vps ** {
s = \\pgn,vpf => v2vVP.s ! pgn ! vpf s = \\pgn,vpf => v2vVP.s ! pgn ! vpf -- main verb agrees with subject
++ v2v.c2.s ++ np.s ! v2v.c2.c ++ bindIfPron np v2vVP
++ v2v.c3.s -- أَنْ ++ v2v.c3.s -- أَنْ
++ vps.s ! pgn ! VPImpf Cnj ; ++ vps.s ! np.a.pgn ! VPImpf Cnj -- verb from old VP agrees with object
++ vps.obj.s ; -- otherwise obj appears in a weird place /IL
obj = emptyObj ;
isPred = False ; isPred = False ;
-- preposition for the direct object comes from VP -- preposition for the direct object comes from VP
sc = v2v.sc sc = v2v.sc