1
0
forked from GitHub/gf-rgl

Merge pull request #116 from inariksit/arabic

Arabic
This commit is contained in:
Inari Listenmaa
2019-01-02 14:00:29 +02:00
committed by GitHub
4 changed files with 115 additions and 34 deletions

View File

@@ -5,8 +5,19 @@ flags optimize = all ;--noexpand;
oper
mkDet : Str -> Number -> State -> Det
= mkDetDecl True ;
mkDet = overload {
mkDet : Str -> Number -> State -> Det
= mkDetDecl True ;
mkDet : (m,f : Str) -> Number -> State -> Det
= \m,f,n,d ->
let detM = mkDetDecl True m n d ;
detF = mkDetDecl True f n d ;
in detM ** {
s = \\h,g,c => case g of {
Fem => detF.s ! h ! g ! c ;
Masc => detM.s ! h ! g ! c }
}
} ;
mkDetDecl : Bool -> Str -> Number -> State -> Det
= \decl,word,num,state -> baseQuant **

View File

@@ -448,7 +448,7 @@ resource ParadigmsAra = open
\rootStr,vPerf,vImpf ->
let root = mkRoot3 rootStr
in case rootStr of {
x@? + y@? + "ّ" => v1geminate (x+y+y) vPerf vImpf ;
f@? + c@? + "ّ" => v1geminate (f+c+c) vPerf vImpf ;
? + #hamza + #weak => v1doubleweak root ;
? + ? + #weak => case vPerf of {
i => v1defective_i root vImpf ;
@@ -519,32 +519,34 @@ resource ParadigmsAra = open
v7 =
\rootStr ->
let verb = case rootStr of {
x@? + y@? + "ّ" => v7geminate (x+y+y) ;
_ => v7sound (mkRoot3 rootStr) }
in lin V verb ;
let {
fcl = mkRoot3 rootStr ;
verb : Verb = case rootStr of {
f@? + c@? + "ّ" => v7geminate (f+c+c) ;
_ => v7sound fcl }
} in lin V verb ;
v8 =
\rootStr ->
let {
rbT = mkRoot3 rootStr ;
v8fun = case rbT.f of {
("و"|"ي"|"ّ") => v8assimilated ;
_ =>
case rbT.c of {
#weak => v8hollow ;
_ => v8sound }}
} in lin V (v8fun rbT) ;
fcl = mkRoot3 rootStr ;
verb : Verb = case rootStr of {
f@? + c@? + "ّ" => v8geminate (f+c+c) ;
#weak + ? + ? => v8assimilated fcl ;
? + #weak + ? => v8hollow fcl ;
_ => v8sound fcl }
} in lin V verb ;
v10 =
\rootStr ->
let {
rbT = mkRoot3 rootStr ;
v10fun : Root3 -> Verb = case rootStr of {
? + #weak + ? => v10hollow ;
? + ? + #weak => v10defective ;
_ => v10sound }
} in lin V (v10fun rbT) ;
fcl = mkRoot3 rootStr ;
verb : Verb = case rootStr of {
f@? + c@? + "ّ" => v10geminate (f+c+c) ;
? + #weak + ? => v10hollow fcl ;
? + ? + #weak => v10defective fcl ;
_ => v10sound fcl }
} in lin V verb ;
reflV v = lin V (ResAra.reflV v) ;
@@ -815,6 +817,6 @@ formV : (root : Str) -> VerbForm -> V = \s,f -> case f of {
} ;
param VerbForm =
FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVII | FormVIII | FormX ;
FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVII | FormVIII | FormX ;
} ;

View File

@@ -57,8 +57,6 @@ flags coding=utf8 ;
ufIc = fIc ** { h = "ُ" } ;
ufac = fac ** { h = "ُ" } ;
ufAc = fAc ** { h = "ُ" } ;
euftucil = { h = "أُ"; m1 = "ْتُ" ; m2 = "ِ" ; t = "" } ;
euttucil = euftucil ** { h = "اُتُّ" ; m1 = "ِ" } ; ---- IL assimilated VIII
afcul = { h = "َ" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
faccalo = { h = "" ; m1 = "َ" ; m2 = "َّ" ; t = "ْ" } ;
facal = { h = "" ; m1 = "َ" ; m2 = "َ" ; t = "" } ;
@@ -86,11 +84,15 @@ flags coding=utf8 ;
ficl = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "" } ;
ficAl = { h = "" ; m1 = "ِ" ; m2 = "َا" ; t = "" } ;
ficlp = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "َة" } ;
ftacc = facc ** {m1 = "ْتَ"} ;
ftucc = facc ** {m1 = "ْتُ"} ;
ftacal = { h = "" ; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ;
ftical = ftacal ** { m1 = "ْتِ" } ; -- IL hollow VIII
ftAcal = ftacal ** { m1 = "ْتَا" } ; -- IL hollow VIII
ftIcal = ftacal ** { m1 = "ْتِي" } ; -- IL hollow VIII
ftacil = { h = "" ; m1 = "ْتَ" ; m2 = "ِ" ; t = "" } ;
ftucil = fucil ** { m1 = "ْتُ" } ;
euttucil = { h = "اُتُّ" ; m1 = "ِ" ; m2 = "" ; t = "" } ; ---- IL assimilated VIII
ttacal = ftacal ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII
ttacil = ftacil ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII
fuccAl = { h = "" ; m1 = "ُ" ; m2 = "َّا" ; t = "" } ;

View File

@@ -555,8 +555,10 @@ v1geminateForms : Str -> Vowel -> Vowel -> DefForms =
umdad = "ُ" + mkStrong fcal mdd ;
Umdud = (prefixImp ! vowImpf) + mdud;
mamdUd = mkStrong mafcUl mdd
} in toDefForms madd madad mudd mudid amudd amdud
umadd umdad Umdud mudd' mamdUd ;
} in toDefForms
madd madad mudd mudid -- VPerf
amudd amdud umadd umdad -- VImpf
Umdud mudd' mamdUd ;
patGem1 : Vowel => Pattern =
table {
@@ -613,7 +615,10 @@ v1defForms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf ->
eirmi = prefixImp ! vowImpf + _rmi;
eirmu = prefixImp ! vowImpf + _rmu;
marmiy = mkStrong mafcil rmy
} in toDefForms rama ramay rumi rumu rumiy armi armu urma eirmi eirmu marmiy ;
} in toDefForms
rama ramay rumi rumu rumiy -- VPerf
armi armu urma -- VImpf
eirmi eirmu marmiy ;
v1defective_a : Root3 -> Vowel -> Verb = \rmy,vowImpf ->
let vforms = v1defForms_perfA rmy vowImpf
@@ -678,7 +683,10 @@ v2defective : Root3 -> Verb = \gny ->
ugannu = "ُ" + gannu;
uganna = "ُ" + ganna;
mugannaY = "مُ" + ganna + "ى"
} in verbDef (toDefForms ganna gannay gunni gunnu gunniy uganni ugannu uganna ganni gannu mugannaY) i;
} in verbDef (toDefForms
ganna gannay gunni gunnu gunniy -- VPerf
uganni ugannu uganna -- VImpf
ganni gannu mugannaY) i ;
v3sound : Root3 -> Verb =
\tbc ->
@@ -722,8 +730,8 @@ v4hollow : Root3 -> Verb =
ppart = "م" + urAd ;
} in verbHollow (toDefForms
earAd earad eurId eurid
urId urid urAd urad
earAd earad eurId eurid -- VPerf
urId urid urAd urad -- VImpf
earId earid ppart) ;
v4DefForms : Root3 -> DefForms = \cTy ->
@@ -742,7 +750,9 @@ v4hollow : Root3 -> Verb =
eacTi = "أَ" + _cTi; -- VImp (Masc Sg / Fem _)
eacTu = "أَ" + _cTu; -- VImp Masc Pl
mucTaY = "م" + ucTa +"ى"
} in toDefForms eacTa eacTay eucTi eucTu eucTiy ucTi ucTu ucTa eacTi eacTu mucTaY ;
} in toDefForms eacTa eacTay eucTi eucTu eucTiy -- VPerf
ucTi ucTu ucTa -- VImpf
eacTi eacTu mucTaY ;
v4defective : Root3 -> Verb = \cTy ->
verbDef (v4DefForms cTy) i ;
@@ -808,13 +818,39 @@ v7geminate : Str -> Verb = \fcl ->
n => "ُنْ" + vforms ! n -- doesn't exist for form 7
}) ;
v8geminate : Str -> Verb =
\rootStr ->
let {
mdd = mkRoot3 rootStr ; --fcc
md = mkRoot2 rootStr ; --fc
_mtadd = mkBilit ftacc md ;
_mtadad = mkStrong ftacal mdd ;
_mtadid = mkStrong ftacil mdd ;
_mtudd = mkBilit ftucc md ;
_mtudid = mkStrong ftucil mdd ;
imtadd = "اِ" + _mtadd ;
imtadad = "اِ" + _mtadad ;
umtudd = "اُ" + _mtudd ;
umtudid = "اُ" + _mtudid ;
amtadd = "َ" + _mtadd ;
amtadid = "َ" + _mtadid ;
umtadd = "ُ" + _mtadd ;
umtadad = "ُ" + _mtadad ;
imtadid = "اِ" + _mtadid ;
mumtadd = "مُ" + _mtadd ;
} in verbGeminate (toDefForms
imtadd imtadad umtudd umtudid -- VPerf
amtadd amtadid umtadd umtadad -- VPres
imtadd imtadid mumtadd) ;
v8sound : Root3 -> Verb =
\rbT ->
let {
rtabiT = mkStrong ftacil rbT ;
rtabaT = mkStrong ftacal rbT ;
eirtabaT = "إِ" + rtabaT ;
eurtubiT = mkStrong euftucil rbT ;
eurtubiT = "أُ" + mkStrong ftucil rbT ;
artabiT = "َ" + rtabiT ;
urtabaT = "ُ" + rtabaT ;
eirtabiT = "إِ" + rtabiT ;
@@ -827,7 +863,7 @@ v8assimilated : Root3 -> Verb = --- IL 8a1
ttafiq = mkWeak ttacil wfq ;
ttafaq = mkWeak ttacal wfq ;
eittafaq = "إِ" + ttafaq ;
euttufiq = mkWeak euttucil wfq ;
euttufiq = mkWeak euttucil wfq ; -- TODO check
attafiq = "َ" + ttafiq ;
uttafaq = "ُ" + ttafaq ;
eittafiq = "إِ" + ttafiq ;
@@ -856,6 +892,7 @@ v8hollow : Root3 -> Verb = -- IL
} in verbHollow (toDefForms
iHtAj iHtaj uHtIj uHtij aHtAj aHtaj
uHtAj uHtaj iHtAj iHtaj ppart) ;
v10sound : Root3 -> Verb = -- IL 10s -- to be checked
\qtl ->
let {
@@ -916,6 +953,31 @@ v10defective : Root3 -> Verb = -- IL
istalqa istalqay ustulqi ustulqi ustulqi
astalqi astalqu ustalqa istalqi istalqu mustalqin) i ;
v10geminate : Str -> Verb = \fcl ->
let vforms = v1geminateForms fcl a i ;
_stafacc = "سْتَ" + vforms ! 0 ;
_stafcac = "سْتَ" + mkStrong fcal (mkRoot3 fcl) ;
_staficc = "سْت" + vforms ! 4 ; -- vowel is in the stem from vforms
_stafcic = "سْت" + vforms ! 5 ; -- vowel is in the stem from vforms
istafacc = "اِ" + _stafacc ; -- VPerf Act
istafcac = "اِ" + _stafcac ; -- VPerf Act Pl3F
astaficc = "َ" + _staficc ; -- VImpf Act
astafcic = "َ" + _stafcic ; -- VImpf Act Pl3F
istaficc = "اِ" + _staficc ; -- VImp
istafcic = "اِ" + _stafcic ; -- VImp PlF
mustafacc = "مُ" + _stafacc ; -- VPPart
in verbGeminate (table {
0 => istafacc ;
1 => istafcac ;
4 => astaficc ;
5 => astafcic ;
8 => istaficc ;
9 => istafcic ;
10 => mustafacc ;
n@(2|3) => "ُسْتُ" + vforms ! n ; -- ???
n@(6|7) => "ُسْتَ" + vforms ! n -- ???
}) ;
patV1Perf : Vowel => Pattern =
table {
a => facal ; --katab
@@ -1121,7 +1183,6 @@ patGeminateImp : (_,_ :Str) -> Gender => Number => Str = \facc,facic ->
_ => brkPl word ! s ! c
} ;
-- takes a singular word and tests the ending to
-- determine the declension and gives the corresponding dual inf table
dual : Str -> State => Case => Str = \caSaA ->
@@ -1449,6 +1510,11 @@ patGeminateImp : (_,_ :Str) -> Gender => Number => Str = \facc,facic ->
empty : Str -- to prevent ambiguities with prodrop
} ;
-- hack, but better to have it here than to define ad hoc in every application grammar /IL
forceCase : NP -> Case -> NP = \np,c -> np ** {
s = \\_ => np.s ! c
} ;
mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn ->
{ s =
table {