1
0
forked from GitHub/gf-rgl

Merge pull request #115 from inariksit/arabic

Arabic
This commit is contained in:
Inari Listenmaa
2019-01-01 18:47:28 +02:00
committed by GitHub
6 changed files with 121 additions and 65 deletions

View File

@@ -29,7 +29,6 @@ concrete ExtendAra of Extend =
ICompAP ap = {s = \\gn => "كَمْ" ++ ap.s ! NoHum ! gn.g ! gn.n ! Indef ! Acc} ; ICompAP ap = {s = \\gn => "كَمْ" ++ ap.s ! NoHum ! gn.g ! gn.n ! Indef ! Acc} ;
lincat lincat
VPS = {s : PerGenNum => Str} ; -- finite VP's with tense and polarity VPS = {s : PerGenNum => Str} ; -- finite VP's with tense and polarity
[VPS] = {s1,s2 : PerGenNum => Str} ; [VPS] = {s1,s2 : PerGenNum => Str} ;
lin lin
@@ -40,14 +39,14 @@ concrete ExtendAra of Extend =
Nominal -- Nominal (=SVO) generalises best for ConjVPS. Nominal -- Nominal (=SVO) generalises best for ConjVPS.
vp.obj.a.isPron vp.obj.a.isPron
(vStr vp pgn t.t p.p Nominal) (vStr vp pgn t.t p.p Nominal)
(case <vp.isPred,vp.obj.a.isPron> of { vp.obj.s -- BIND is taken care of when the VP was made, no need to add one here
<False,True> => BIND ++ vp.obj.s ;
_ => vp.obj.s })
(pred vp pgn t.t p.p) (pred vp pgn t.t p.p)
vp.s2 vp.s2
in vps.before ++ vps.after -- word order is SVO, so this is safe for just this case. in vps.before ++ vps.after -- word order is SVO, so this is safe for just this case.
} ; } ;
-- maybe more robust to use إِيَّا as object carrier if the VPS
-- consists of several VPSs; like it's done in Slash3V3 /IL
BaseVPS = twoTable PerGenNum ; BaseVPS = twoTable PerGenNum ;
ConsVPS = consrTable PerGenNum comma ; ConsVPS = consrTable PerGenNum comma ;
ConjVPS = conjunctDistrTable PerGenNum ; ConjVPS = conjunctDistrTable PerGenNum ;

View File

@@ -448,7 +448,7 @@ resource ParadigmsAra = open
\rootStr,vPerf,vImpf -> \rootStr,vPerf,vImpf ->
let root = mkRoot3 rootStr let root = mkRoot3 rootStr
in case rootStr of { in case rootStr of {
_ + "ّ" => v1geminate rootStr vPerf vImpf ; x@? + y@? + "ّ" => v1geminate (x+y+y) vPerf vImpf ;
? + #hamza + #weak => v1doubleweak root ; ? + #hamza + #weak => v1doubleweak root ;
? + ? + #weak => case vPerf of { ? + ? + #weak => case vPerf of {
i => v1defective_i root vImpf ; i => v1defective_i root vImpf ;
@@ -519,10 +519,10 @@ resource ParadigmsAra = open
v7 = v7 =
\rootStr -> \rootStr ->
let { let verb = case rootStr of {
fcl = mkRoot3 rootStr ; x@? + y@? + "ّ" => v7geminate (x+y+y) ;
v7fun = v7geminate ; -- TODO add rest _ => v7sound (mkRoot3 rootStr) }
} in lin V (v7fun fcl) ; in lin V verb ;
v8 = v8 =
\rootStr -> \rootStr ->

View File

@@ -12,7 +12,7 @@ concrete PhraseAra of Phrase = CatAra ** open
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} ;
UttInterj i = {s = \\g => i.s} ; UttInterj i = {s = \\g => i.s} ;
UttIP ip = {s = \\g => ip.s ! False ! g ! Def ! Nom} ; --IL UttIP ip = {s = \\g => ip.s ! False ! g ! Const ! 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

@@ -98,7 +98,7 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
let pat = mkPat pS in let pat = mkPat pS in
case pS of { case pS of {
w + "ف" + x + "ع" + y + "ل" + z => w + "ف" + x + "ع" + y + "ل" + z =>
case rS of { case rS of { -- TODO: reconsider shadda, maybe handling it should be moved 100% to ParadigmsAra /IL 2019-01-01
x@? + y@? + "ّ" => mkStrong pat (mkRoot3 (x+y+y)) ; -- In principle, shadda shouldn't be in the root when dealing with strong inflection, but if someone puts one, this should fix it. /IL x@? + y@? + "ّ" => mkStrong pat (mkRoot3 (x+y+y)) ; -- In principle, shadda shouldn't be in the root when dealing with strong inflection, but if someone puts one, this should fix it. /IL
_ => mkStrong pat (mkRoot3 rS) } ; _ => mkStrong pat (mkRoot3 rS) } ;
w + "ف" + x + "ع" + y => w + "ف" + x + "ع" + y =>
@@ -171,7 +171,7 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
AP : Type = {s : Species => Gender => NTable } ; AP : Type = {s : Species => Gender => NTable } ;
uttAP : AP -> (Gender => Str) ; uttAP : AP -> (Gender => Str) ;
uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Indef ! Bare ; ----IL uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Const ! Bare ; ----IL
CN : Type = Noun ** {np : Case => Str}; CN : Type = Noun ** {np : Case => Str};
@@ -193,7 +193,7 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
} ; } ;
uttNum : NumOrdCard -> (Gender => Str) ; uttNum : NumOrdCard -> (Gender => Str) ;
uttNum n = \\g => n.s ! g ! Def ! Bare ; ----IL uttNum n = \\g => n.s ! g ! Const ! Bare ;
param param
VForm = VForm =
@@ -219,7 +219,7 @@ oper
--macro for sound verb --macro for sound verb
--PerfAct, PerfPas, ImpfAct, ImpfPas, Imp, PPart --PerfAct, PerfPas, ImpfAct, ImpfPas, Imp, PPart
verb : (_,_,_,_,_,_ : Str) -> Verb = verb : (x1,_,_,_,_,x6 : Str) -> Verb =
\katab,kutib,aktub,uktab,euktub,maktUb -> { \katab,kutib,aktub,uktab,euktub,maktUb -> {
s = \\vf => rectifyHmz (case vf of { s = \\vf => rectifyHmz (case vf of {
VPerf Act pgn => katab + suffixPerf ! pgn ; VPerf Act pgn => katab + suffixPerf ! pgn ;
@@ -232,7 +232,14 @@ oper
VPPart => maktUb VPPart => maktUb
}) })
} ; } ;
verb' : SoundForms -> Verb = \vforms ->
let katab = vforms ! 0 ;
kutib = vforms ! 1 ;
aktub = vforms ! 2 ;
uktab = vforms ! 3 ;
euktub = vforms ! 4 ;
maktUb = vforms ! 5 ;
in verb katab kutib aktub uktab euktub maktUb ;
--affixes of sound verbs --affixes of sound verbs
suffixPerf : PerGenNum => Str = suffixPerf : PerGenNum => Str =
@@ -316,12 +323,14 @@ oper
} }
} ; } ;
--macro for geminate verbs: same behaviour as hollow verbs, except for jussive. -- macro for geminate verbs: same behaviour as hollow verbs,
-- IL -- to be tested: there are no geminate verbs in LexiconAra -- except for jussive and imperative. /IL
verbGeminate : DefForms -> Verb = \vforms -> verbGeminate : DefForms -> Verb = \vforms ->
let verbHol = verbHollow vforms let verbHol = verbHollow vforms ;
in { s = table { patImp = patGeminateImp (vforms ! 8) (vforms ! 9)
in { s = table { -- Jussive and imperative have fatha instead of sukun
VImpf Jus v pgn => verbHol.s ! VImpf Cnj v pgn ; VImpf Jus v pgn => verbHol.s ! VImpf Cnj v pgn ;
VImp g n => patImp ! g ! n + suffixImpfCJ Cnj ! Per2 g n ;
x => verbHol.s ! x x => verbHol.s ! x
} }
} ; } ;
@@ -462,7 +471,7 @@ oper
--now is used for the sound, assimilated (weak C1), and when C1 = hamza: --now is used for the sound, assimilated (weak C1), and when C1 = hamza:
v1sound : Root3 -> Vowel -> Vowel -> Verb = v1soundForms : Root3 -> Vowel -> Vowel -> SoundForms =
\fcl,vowPerf,vowImpf -> \fcl,vowPerf,vowImpf ->
let { let {
qf = {f = fcl.c ; c = fcl.l} ; qf = {f = fcl.c ; c = fcl.l} ;
@@ -482,7 +491,10 @@ v1sound : Root3 -> Vowel -> Vowel -> Verb =
}; };
maktUb = mkStrong mafcUl fcl maktUb = mkStrong mafcUl fcl
} in } in
verb katab kutib aktub uktab euktub maktUb ; toSoundForms katab kutib aktub uktab euktub maktUb ;
v1sound : Root3 -> Vowel -> Vowel -> Verb = \fcl,vp,vi ->
verb' (v1soundForms fcl vp vi) ;
v1hollow : Root3 -> Vowel -> Verb = v1hollow : Root3 -> Vowel -> Verb =
\xwf,vowImpf -> \xwf,vowImpf ->
@@ -522,8 +534,11 @@ fvc : Vowel => Pattern =
a => fac a => fac
} ; } ;
v1geminate : Str -> Vowel -> Vowel -> Verb = v1geminate : Str -> Vowel -> Vowel -> Verb =
\r,vp,vi ->
verbGeminate (v1geminateForms r vp vi) ;
v1geminateForms : Str -> Vowel -> Vowel -> DefForms =
\rootStr,vowPerf,vowImpf -> \rootStr,vowPerf,vowImpf ->
let { let {
mdd = mkRoot3 rootStr ; --fcc mdd = mkRoot3 rootStr ; --fcc
@@ -540,9 +555,8 @@ v1geminate : Str -> Vowel -> Vowel -> Verb =
umdad = "ُ" + mkStrong fcal mdd ; umdad = "ُ" + mkStrong fcal mdd ;
Umdud = (prefixImp ! vowImpf) + mdud; Umdud = (prefixImp ! vowImpf) + mdud;
mamdUd = mkStrong mafcUl mdd mamdUd = mkStrong mafcUl mdd
} in verbGeminate (toDefForms } in toDefForms madd madad mudd mudid amudd amdud
madd madad mudd mudid amudd amdud umadd umdad Umdud mudd' mamdUd ;
umadd umdad Umdud mudd' mamdUd) ;
patGem1 : Vowel => Pattern = patGem1 : Vowel => Pattern =
table { table {
@@ -568,16 +582,23 @@ patGem3 : Vowel => Pattern =
-- IL -- Defective, hollow and geminate verbs all need 11 forms. -- IL -- Defective, hollow and geminate verbs all need 11 forms.
{- NB. the numbers don't always refer to the same forms! {- NB. the numbers don't always refer to the same forms!
The verb(Def|Hollow|Geminate) constructors pick the right forms. -} The verb(Def|Hollow|Geminate) constructors pick the right forms. -}
SoundForms : Type = Predef.Ints 5 => Str ;
DefForms : Type = Predef.Ints 10 => Str ; DefForms : Type = Predef.Ints 10 => Str ;
toSoundForms : (x1,_,_,_,_,x6 : Str) -> SoundForms =
\a,b,c,d,e,f ->
table {
0 => a ; 1 => b ; 2 => c ; 3 => d ; 4 => e ; 5 => f
} ;
toDefForms : (x1,_,_,_,_,_,_,_,_,_,x11 : Str) -> DefForms = toDefForms : (x1,_,_,_,_,_,_,_,_,_,x11 : Str) -> DefForms =
\a,b,c,d,e,f,g,h,i,j,k -> \a,b,c,d,e,f,g,h,i,j,k ->
table { table {
0 => a ; 1 => b ; 2 => c ; 3 => d ; 4 => e ; 5 => f ; 6 => g ; 0 => a ; 1 => b ; 2 => c ; 3 => d ; 4 => e ; 5 => f ;
7 => h ; 8 => i ; 9 => j ; 10 => k 6 => g ; 7 => h ; 8 => i ; 9 => j ; 10 => k
} ; } ;
v1DefForms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf -> v1defForms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf ->
let { let {
_rmi = mkDefective (patDef1 ! vowImpf) rmy ; _rmi = mkDefective (patDef1 ! vowImpf) rmy ;
_rmu = mkDefective (patDef2 ! vowImpf) rmy ; _rmu = mkDefective (patDef2 ! vowImpf) rmy ;
@@ -595,11 +616,11 @@ v1DefForms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf ->
} in toDefForms rama ramay rumi rumu rumiy armi armu urma eirmi eirmu marmiy ; } in toDefForms rama ramay rumi rumu rumiy armi armu urma eirmi eirmu marmiy ;
v1defective_a : Root3 -> Vowel -> Verb = \rmy,vowImpf -> v1defective_a : Root3 -> Vowel -> Verb = \rmy,vowImpf ->
let vforms = v1DefForms_perfA rmy vowImpf let vforms = v1defForms_perfA rmy vowImpf
in verbDef vforms vowImpf ; in verbDef vforms vowImpf ;
v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4) v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4)
let vforms_a = v1DefForms_perfA bqy vowImpf ; let vforms_a = v1defForms_perfA bqy vowImpf ;
baqI = mkDefective facIl bqy ; baqI = mkDefective facIl bqy ;
baqiy = mkDefective facil bqy ; baqiy = mkDefective facil bqy ;
vforms_i = table { 0 => baqI ; vforms_i = table { 0 => baqI ;
@@ -609,8 +630,8 @@ v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4)
v1doubleweak : Root3 -> Verb = \r'y -> v1doubleweak : Root3 -> Verb = \r'y ->
let ry = r'y ** {c = ""} ; let ry = r'y ** {c = ""} ;
vforms_doubleweak : DefForms = \\x => rmSukun (v1DefForms_perfA ry a ! x) ; -- only remove the first sukun vforms_doubleweak : DefForms = \\x => rmSukun (v1defForms_perfA ry a ! x) ; -- only remove the first sukun
vforms_weak : DefForms = v1DefForms_perfA r'y a ; vforms_weak : DefForms = v1defForms_perfA r'y a ;
vforms = table { 0 => vforms_weak ! 0 ; -- all perfect forms vforms = table { 0 => vforms_weak ! 0 ; -- all perfect forms
1 => vforms_weak ! 1 ; 1 => vforms_weak ! 1 ;
2 => vforms_weak ! 2 ; 2 => vforms_weak ! 2 ;
@@ -751,32 +772,41 @@ v6sound : Root3 -> Verb =
mutafAqam = "م" + utafAqam mutafAqam = "م" + utafAqam
} in verb tafAqam tufUqim atafAqam utafAqam tafAqam mutafAqam; } in verb tafAqam tufUqim atafAqam utafAqam tafAqam mutafAqam;
-- v7sound : Root3 -> Verb = -- TODO 7s v7sound : Root3 -> Verb = \fcl ->
-- \fcl -> let vforms = v1soundForms fcl a i ;
-- let { _nfacil = "نْ" + mkStrong facil fcl ;
-- _facal = mkStrong facal fcl ; infacal = "اِنْ" + vforms ! 0 ;
-- _facil = mkStrong facil fcl; anfacil = "َ" + _nfacil ;
-- infacal = "اِنْ" + _facal ; -- VPerf Act infacil = "اِ" + _nfacil ;
-- ; -- VPerf Pas munfacil = "مُ" + _nfacil ;
-- anfacil = "َنْ" + _facil ; -- VImpf _ Act in verb' (table {
-- ; -- VImpf _ Pas 0 => infacal ;
-- ; -- VImp 2 => anfacil ;
-- -- VPPart 4 => infacil ;
-- } in 5 => munfacil ;
-- verb ; n => "ُنْ" + vforms ! n -- doesn't exist for form 7
}) ;
v7geminate : Root3 -> Verb = -- IL 7g -- very likely wrong v7geminate : Str -> Verb = \fcl ->
\fcl -> let vforms = v1geminateForms fcl a i ;
let { _nfacc = "نْ" + vforms ! 0 ;
_nfacc = "نْ" + mkHollow facc fcl ; _nfacic = "نْ" + mkStrong facil (mkRoot3 fcl) ;
infacal = "اِنْ" + mkStrong facal fcl ; -- VPerf Act -- TODO use another constructor, this is wrong for 3rd person infacc = "اِ" + _nfacc ; -- VPerf Act
unfucc = "اُنْ" + mkHollow fucc fcl ; -- VPerf Pas infacac = "اِنْ" + vforms ! 1 ; -- VPerf Act Pl3F
anfacc = "َ" + _nfacc ; -- VImpf _ Act anfacc = "َ" + _nfacc ; -- VImpf Act
unfacc = "ُ" + _nfacc ; -- VImpf _ Pas anfacic = "َ" + _nfacic ; -- VImpf Act Pl3F
infacc = "اِ" + _nfacc ; -- VImp infacic = "اِ" + _nfacic ; -- VImp PlF
munfacc = "مُ" +_nfacc -- VPPart munfacc = "مُ" + _nfacc ; -- VPPart
} in in verbGeminate (table {
verb infacal unfucc anfacc unfacc infacc munfacc ; 0 => infacc ;
1 => infacac ;
4 => anfacc ;
5 => anfacic ;
8 => infacc ;
9 => infacic ;
10 => munfacc ;
n => "ُنْ" + vforms ! n -- doesn't exist for form 7
}) ;
v8sound : Root3 -> Verb = v8sound : Root3 -> Verb =
\rbT -> \rbT ->
@@ -974,6 +1004,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Fem => table { Pl => xaf ; _ => xAf} Fem => table { Pl => xaf ; _ => xAf}
} ; } ;
patGeminateImp : (_,_ :Str) -> Gender => Number => Str = \facc,facic ->
\\g,n => case <g,n> of {
<Fem,Pl> => facic ;
_ => facc
} ;
--Nominal Morphology --Nominal Morphology
caseTbl : Case => Str = caseTbl : Case => Str =
@@ -1466,7 +1502,6 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
theyMasc_Pron : NP = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ; theyMasc_Pron : NP = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ;
theyFem_Pron : NP = mkPron "هُنَّ" "هُنَّ" "هُنَّ" (Per3 Fem Pl) ; theyFem_Pron : NP = mkPron "هُنَّ" "هُنَّ" "هُنَّ" (Per3 Fem Pl) ;
-- Used e.g. to encode the subject as an object clitic -- Used e.g. to encode the subject as an object clitic
-- or to find a possessive suffix corresponding to the NP. -- or to find a possessive suffix corresponding to the NP.
-- If the NP is a pronoun, just use itself. -- If the NP is a pronoun, just use itself.
@@ -1512,6 +1547,23 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
VPPart => v.s ! vf ++ reflPron Acc (Per3 Masc Sg) ---- VPPart => v.s ! vf ++ reflPron Acc (Per3 Masc Sg) ----
} }
} ; } ;
ladaa_V : Verb =
let laday : PerGenNum -> Str = \pgn -> case pgn of {
Per1 Sing => "لَدَيَّ" ;
Per3 Masc Sg => "لَدَيْهِ" ; -- vowel assimilation
Per3 Masc Dl => "لَدَيْهِمَا" ; -- vowel assimilation
Per3 Masc Pl => "لَدَيْهِم" ; -- vowel assimilation
Per3 Fem Pl => "لَدَيْهِنَّ" ; -- vowel assimilation
_ => "لَدَيْ" + (pgn2pron pgn).s ! Gen
} ;
in { s = table {
VImpf Ind Act pgn => laday pgn ;
vf@(VImpf _ _ pgn) => copula.s ! vf ++ laday pgn ;
vf@(VPerf _ pgn) => copula.s ! vf ++ laday pgn ;
vf@(VImp g n) => copula.s ! vf ++ laday (Per2 g n) ;
VPPart => copula.s ! VPPart ++ "لَدَى" }
} ;
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- IP, questions -- IP, questions
@@ -1729,8 +1781,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ; bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ;
bindIfPron : NP -> {c2:Preposition; isPred:Bool} -> Str = \np,vp -> bindIfPron : NP -> {c2:Preposition; isPred:Bool} -> Str = \np,vp ->
let bind = case vp.isPred of { let notNom : Case -> Bool = \c -> case c of {Nom => False; _=>True} ;
False => bindIf (orB np.a.isPron vp.c2.binds) ; bind = case vp.isPred of {
False => bindIf (
orB (andB np.a.isPron (notNom vp.c2.c)) --if np is pron, not in nominative
vp.c2.binds) ;
True => [] } True => [] }
in vp.c2.s ++ bind ++ np.s ! vp.c2.c ; in vp.c2.s ++ bind ++ np.s ! vp.c2.c ;

View File

@@ -122,7 +122,8 @@ concrete StructuralAra of Structural = CatAra **
youPl_Pron = youPlMasc_Pron ; youPl_Pron = youPlMasc_Pron ;
youPol_Pron = youPlFem_Pron ; -- arbitrary? youPol_Pron = youPlFem_Pron ; -- arbitrary?
have_V2 = dirV2 (regV "يَملِك") ; have_V2 = mkV2 ladaa_V (casePrep nom) ; -- "X has Y" literally "Y<nom> is on X<nom>"
--have_V2 = dirV2 (regV "يَملِك") ; -- "X<nom> owns/possesses Y<acc>"
lin language_title_Utt = {s = \\_ => "العربية"} ; lin language_title_Utt = {s = \\_ => "العربية"} ;

View File

@@ -5,7 +5,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
lin lin
UseV = predV ; UseV = predV ;
SlashVV vv vps = vps ** predV vv ; ----IL -- : VV -> VPSlash -> VPSlash
SlashVV vv vps = vps ** ComplVV vv vps ;
-- : V2V -> VP -> VPSlash ; -- beg (her) to go -- : V2V -> VP -> VPSlash ; -- beg (her) to go
SlashV2V v2v vp = let v2vVP = predV v2v in -- IL SlashV2V v2v vp = let v2vVP = predV v2v in -- IL