1
0
forked from GitHub/gf-rgl

Merge pull request #64 from inariksit/arabic

(Ara) Question words and structures
This commit is contained in:
Inari Listenmaa
2018-11-05 17:18:08 +01:00
committed by GitHub
5 changed files with 73 additions and 77 deletions

View File

@@ -23,10 +23,9 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
-- Question -- Question
QCl = ResAra.QCl ; -- {s : ResAra.Tense => Polarity => QForm => Str} ; QCl = ResAra.QCl ; -- {s : ResAra.Tense => Polarity => QForm => Str} ;
IP, IDet = ResAra.IDet ; -- {s : Gender => State => Case => Str ; n : Number} ;
IDet, IP = ResAra.IP ; -- {s : (isPred : Bool) => State => Case => Str ; n : Number} ;
IComp = ResAra.IP ; -- {s : Gender => State => Case => Str ; n : ResAra.Number} ; IComp = ResAra.IComp ; --
-- IAdv = {s : Str} ;
IQuant = {s : State => Case => Str} ; IQuant = {s : State => Case => Str} ;
-- --
---- Relative ---- Relative

View File

@@ -11,7 +11,7 @@ concrete PhraseAra of Phrase = CatAra ** open
UttImpSg pol imp = {s = \\g => imp.s ! pol.p ! g ! ResAra.Sg ++ pol.s} ; UttImpSg pol imp = {s = \\g => imp.s ! pol.p ! g ! ResAra.Sg ++ pol.s} ;
UttImpPl,UttImpPol = \pol,imp -> {s = \\g => imp.s ! pol.p ! g ! ResAra.Pl ++ pol.s} ; UttImpPl,UttImpPol = \pol,imp -> {s = \\g => imp.s ! pol.p ! g ! ResAra.Pl ++ pol.s} ;
UttIP ip = {s = \\g => ip.s ! g ! Def ! Nom} ; --IL UttIP ip = {s = \\_g => ip.s ! False ! Def ! Nom} ; --IL
UttAP ap = {s = ResAra.uttAP ap} ; --IL UttAP ap = {s = ResAra.uttAP ap} ; --IL
UttCard c = {s = ResAra.uttNum c} ; --IL UttCard c = {s = ResAra.uttNum c} ; --IL

View File

@@ -1,4 +1,4 @@
concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbAra in { concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbAra, SentenceAra in {
flags optimize=all_subs ; coding = utf8 ; flags optimize=all_subs ; coding = utf8 ;
@@ -14,90 +14,61 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
-- ComplSlashIP vps ip = {} ; -- ComplSlashIP vps ip = {} ;
-- AR copied from PredVP --IL guessed
QuestVP qp vp = QuestVP qp vp =
{ s =\\t,p,_ => let np = { s = qp.s ! vp.isPred ! Def ;
let { a = { pgn = Per3 Masc qp.n ;
---- o = Verbal ; ---- AR isPron = False }
objgn = pgn2gn vp.obj.a.pgn ; } ;
np = {s = qp.s ! objgn.g ! Def ; ----IL just guessing state cl = PredVP np vp ;
a ={pgn = Per3 Masc qp.n ; isPron = False}} ; in { s = \\t,p,_qf => cl.s ! t ! p ! Nominal } ;
pgn = np.a.pgn ;
gn = pgn2gn pgn;
kataba = vp.s ! pgn ! VPPerf ;
yaktubu = vp.s ! pgn ! VPImpf Ind ;
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
yaktub = vp.s ! pgn ! VPImpf Jus ;
vStr : ResAra.Tense -> Polarity -> Str =
\tn,pl -> case<vp.isPred,tn,pl> of {
<False, ResAra.Pres, Pos> => yaktubu ;
<False, ResAra.Pres, Neg> => "لَا" ++ yaktubu ;
<True, ResAra.Pres, Pos> => "" ; --no verb "to be" in present
<True, ResAra.Pres, Neg> => "لَيسَ" ;--same here, just add negation particle
<_, ResAra.Past, Pos> => kataba ;
<_, ResAra.Past, Neg> => "لَمْ" ++ yaktub ;
<_, ResAra.Fut, Pos> => "سَ" ++ yaktubu ;
<_, ResAra.Fut, Neg> => "لَنْ" ++ yaktuba
};
pred : ResAra.Tense -> Polarity -> Str =
\tn,pl -> case <vp.isPred,tn,pl> of {
<True, ResAra.Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob
} ;
} in
--- case o of {
---- _ =>
case <False, np.a.isPron> of {
---- AR workaround 18/12/2008 case <vp.obj.a.isPron, np.a.isPron> of {
-- ya2kuluhu
<False,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p);
-- ya2kuluhu al-waladu, yakuluhu al-2awlaadu
<False,False> => (vStr t p) ++ np.s ! Nom ++ vp.obj.s ++ vp.s2 ++ (pred t p);
<True,False> => (vStr t p) ++ vp.obj.s ++ np.s ! Nom ++ vp.s2 ++ (pred t p);
<True,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p)
};
---- Nominal =>
---- np.s ! Nom ++ (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p)
}
; ---- };
---- AR guessed ---- AR guessed
QuestIAdv iadv cl = {s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! Verbal} ; QuestIAdv iadv cl = {s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! Verbal} ;
---- IL guessed ---- IL guessed
QuestIComp icomp np = -- : IComp -> NP -> QCl
let vp = kaan (CompNP np) in QuestIComp ic np =
QuestVP icomp vp ; let vp = kaan (CompNP np) ;
ip = ic ** { s : Bool => State => Case => Str = \\_,_,_ => ic.s ! pgn2gn np.a.pgn } ;
in QuestVP ip vp ;
CompIP ip = ip ; -- : IP -> IComp ;
-- old, when IComp = Comp { s = \\{g=g ; n=_},c => ip.s ! g ! Def ! c } ; ---- CompIP ip = {
s = \\_ => ip.s ! True -- True=IP will be a subject of predicative sentence
! Def ! Nom ; -- IP will be a subject
n = ip.n
} ;
CompIAdv iadv = mkIP iadv.s ResAra.Sg ; CompIAdv iadv = { s = \\_ => iadv.s ; n = ResAra.Sg } ;
-- QCl = {s : R.Tense => Polarity => QForm => Str} ; -- QCl = {s : R.Tense => Polarity => QForm => Str} ;
QuestSlash ip cl = { ----IL just guessing QuestSlash ip cl = { ----IL just guessing
s = \\t,p,qf => case qf of { s = \\t,p,qf =>
QDir => cl.s ! t ! p ! Verbal ++ cl.c2 ++ ip.s ! Masc ! Def ! Nom ; --VSO (purely guessing) let o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing
QIndir => cl.s ! t ! p ! Nominal ++ cl.c2 ++ ip.s ! Masc ! Def ! Nom } --SVO (purely guessing) in cl.c2 ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o
} ; } ;
PrepIP p ip = {s = p.s ++ ip.s ! Masc ! Def ! Acc} ; ----IL --IL guessed
PrepIP p ip = {
s = p.s ++ ip.s ! False -- not used as a subject of predicative sentence
! Def ! Gen
} ;
AdvIP ip adv = ip ** { AdvIP ip adv = ip ** {
s = \\g,s,c => ip.s ! g ! s ! c ++ adv.s ; s = \\g,s,c => ip.s ! g ! s ! c ++ adv.s ;
n = ip.n } ;
} ;
----IL guessed with help of L and Google translate
-- : IDet -> IP -- : IDet -> IP
IdetIP idet = idet ; -- Gender still matters if turned into IComp IdetIP idet = idet ** { s = \\isPred => idet.s ! Masc } ;
-- : IDet -> CN -> IP -- : IDet -> CN -> IP
IdetCN idet cn = idet ** { IdetCN idet cn = idet ** {
s = \\g,s,c => idet.s ! cn.g ! s ! c ++ -- gender is determined by the CN s = \\isPred,s,c
cn.s ! idet.n ! Indef ! Gen ; --idaafa => idet.s ! cn.g ! s ! c ++
cn.s ! idet.n ! Indef ! Gen ; --idaafa
} ; } ;
-- : IQuant -> Num -> IDet -- : IQuant -> Num -> IDet

View File

@@ -1102,8 +1102,17 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
}; };
mkIP : Str -> Number -> IP = mkIP = overload {
\s,n -> {s = \\_g,_s,_c => s ; n = n} ; mkIP : Str -> Number -> IP = \maa,n -> {
s = \\_p,_s,_c => maa ;
n = n
} ;
mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> {
s = table { True => \\_s,_c => maa ;
False => \\_s,_c => maadhaa } ;
n = n
}
} ;
mkOrd : (_,_ : Str) -> Size -> NumOrdCard = mkOrd : (_,_ : Str) -> Size -> NumOrdCard =
\aysar,yusra,sz -> \aysar,yusra,sz ->
@@ -1151,6 +1160,13 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
s : AAgr => Case => Str s : AAgr => Case => Str
} ; } ;
IComp : Type = {
s : AAgr -- "how old": masc or fem for adjective
-- no need for Case, IComp is only used by QuestIComp, as grammatical subject
=> Str ;
n : Number
} ;
Obj : Type = { Obj : Type = {
s : Str ; s : Str ;
a : Agr a : Agr
@@ -1162,12 +1178,22 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
} ; } ;
IP : Type = { IP : Type = {
s : Gender -- because of CompIP s : Bool -- different forms for "what is this" and "what do you do"
=> State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative
=> Str ; => Str ;
n : Number n : Number
} ; } ;
IDet : Type = {
s : Gender -- IdetCN needs to choose the gender of the CN
=> State => Case => Str ;
n : Number
} ;
IQuant : Type = {
s : State => Case => Str
} ;
param VPForm = param VPForm =
VPPerf VPPerf
| VPImpf Mood | VPImpf Mood

View File

@@ -91,8 +91,8 @@ concrete StructuralAra of Structural = CatAra **
-- very_AdA = ss "ثري" ; -- very_AdA = ss "ثري" ;
-- want_VV = P.mkVV (P.regV "وَنت") ; -- want_VV = P.mkVV (P.regV "وَنت") ;
we_Pron = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ; we_Pron = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ;
whatPl_IP = mkIP "ماذا" Pl ; whatPl_IP = mkIP "ما" "ماذا" Pl ;
whatSg_IP = mkIP "ماذا" Sg ; whatSg_IP = mkIP "ما" "ماذا" Sg ;
when_IAdv = ss "مَتَى" ; when_IAdv = ss "مَتَى" ;
-- when_Subj = ss "وهن" ; -- when_Subj = ss "وهن" ;
where_IAdv = ss "أَينَ" ; where_IAdv = ss "أَينَ" ;
@@ -107,8 +107,8 @@ concrete StructuralAra of Structural = CatAra **
<Gen,_> => "أيِّ" <Gen,_> => "أيِّ"
} }
} ; } ;
whoSg_IP = mkIP "مَنْ" Sg ; whoSg_IP = mkIP "مَنْ" "مَنْ" Sg ;
whoPl_IP = mkIP "مَنْ" Pl ; whoPl_IP = mkIP "مَنْ" "مَنْ" Pl ;
-- why_IAdv = ss "وهي" ; -- why_IAdv = ss "وهي" ;
without_Prep = ss "بِدُونِ" ; without_Prep = ss "بِدُونِ" ;
with_Prep = ss "مَع" ; with_Prep = ss "مَع" ;