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} ;
lincat
VPS = {s : PerGenNum => Str} ; -- finite VP's with tense and polarity
[VPS] = {s1,s2 : PerGenNum => Str} ;
lin
@@ -40,14 +39,14 @@ concrete ExtendAra of Extend =
Nominal -- Nominal (=SVO) generalises best for ConjVPS.
vp.obj.a.isPron
(vStr vp pgn t.t p.p Nominal)
(case <vp.isPred,vp.obj.a.isPron> of {
<False,True> => BIND ++ vp.obj.s ;
_ => vp.obj.s })
vp.obj.s -- BIND is taken care of when the VP was made, no need to add one here
(pred vp pgn t.t p.p)
vp.s2
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 ;
ConsVPS = consrTable PerGenNum comma ;
ConjVPS = conjunctDistrTable PerGenNum ;

View File

@@ -448,7 +448,7 @@ resource ParadigmsAra = open
\rootStr,vPerf,vImpf ->
let root = mkRoot3 rootStr
in case rootStr of {
_ + "ّ" => v1geminate rootStr vPerf vImpf ;
x@? + y@? + "ّ" => v1geminate (x+y+y) vPerf vImpf ;
? + #hamza + #weak => v1doubleweak root ;
? + ? + #weak => case vPerf of {
i => v1defective_i root vImpf ;
@@ -519,10 +519,10 @@ resource ParadigmsAra = open
v7 =
\rootStr ->
let {
fcl = mkRoot3 rootStr ;
v7fun = v7geminate ; -- TODO add rest
} in lin V (v7fun fcl) ;
let verb = case rootStr of {
x@? + y@? + "ّ" => v7geminate (x+y+y) ;
_ => v7sound (mkRoot3 rootStr) }
in lin V verb ;
v8 =
\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} ;
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
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
case pS of {
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
_ => mkStrong pat (mkRoot3 rS) } ;
w + "ف" + x + "ع" + y =>
@@ -171,7 +171,7 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
AP : Type = {s : Species => Gender => NTable } ;
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};
@@ -193,7 +193,7 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
} ;
uttNum : NumOrdCard -> (Gender => Str) ;
uttNum n = \\g => n.s ! g ! Def ! Bare ; ----IL
uttNum n = \\g => n.s ! g ! Const ! Bare ;
param
VForm =
@@ -219,7 +219,7 @@ oper
--macro for sound verb
--PerfAct, PerfPas, ImpfAct, ImpfPas, Imp, PPart
verb : (_,_,_,_,_,_ : Str) -> Verb =
verb : (x1,_,_,_,_,x6 : Str) -> Verb =
\katab,kutib,aktub,uktab,euktub,maktUb -> {
s = \\vf => rectifyHmz (case vf of {
VPerf Act pgn => katab + suffixPerf ! pgn ;
@@ -232,7 +232,14 @@ oper
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
suffixPerf : PerGenNum => Str =
@@ -316,12 +323,14 @@ oper
}
} ;
--macro for geminate verbs: same behaviour as hollow verbs, except for jussive.
-- IL -- to be tested: there are no geminate verbs in LexiconAra
-- macro for geminate verbs: same behaviour as hollow verbs,
-- except for jussive and imperative. /IL
verbGeminate : DefForms -> Verb = \vforms ->
let verbHol = verbHollow vforms
in { s = table {
let verbHol = verbHollow vforms ;
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 ;
VImp g n => patImp ! g ! n + suffixImpfCJ Cnj ! Per2 g n ;
x => verbHol.s ! x
}
} ;
@@ -462,7 +471,7 @@ oper
--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 ->
let {
qf = {f = fcl.c ; c = fcl.l} ;
@@ -482,7 +491,10 @@ v1sound : Root3 -> Vowel -> Vowel -> Verb =
};
maktUb = mkStrong mafcUl fcl
} 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 =
\xwf,vowImpf ->
@@ -522,8 +534,11 @@ fvc : Vowel => Pattern =
a => fac
} ;
v1geminate : Str -> Vowel -> Vowel -> Verb =
\r,vp,vi ->
verbGeminate (v1geminateForms r vp vi) ;
v1geminateForms : Str -> Vowel -> Vowel -> DefForms =
\rootStr,vowPerf,vowImpf ->
let {
mdd = mkRoot3 rootStr ; --fcc
@@ -540,9 +555,8 @@ v1geminate : Str -> Vowel -> Vowel -> Verb =
umdad = "ُ" + mkStrong fcal mdd ;
Umdud = (prefixImp ! vowImpf) + mdud;
mamdUd = mkStrong mafcUl mdd
} in verbGeminate (toDefForms
madd madad mudd mudid amudd amdud
umadd umdad Umdud mudd' mamdUd) ;
} in toDefForms madd madad mudd mudid amudd amdud
umadd umdad Umdud mudd' mamdUd ;
patGem1 : Vowel => Pattern =
table {
@@ -568,16 +582,23 @@ patGem3 : Vowel => Pattern =
-- IL -- Defective, hollow and geminate verbs all need 11 forms.
{- NB. the numbers don't always refer to the same forms!
The verb(Def|Hollow|Geminate) constructors pick the right forms. -}
SoundForms : Type = Predef.Ints 5 => 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 =
\a,b,c,d,e,f,g,h,i,j,k ->
table {
0 => a ; 1 => b ; 2 => c ; 3 => d ; 4 => e ; 5 => f ; 6 => g ;
7 => h ; 8 => i ; 9 => j ; 10 => k
0 => a ; 1 => b ; 2 => c ; 3 => d ; 4 => e ; 5 => f ;
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 {
_rmi = mkDefective (patDef1 ! 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 ;
v1defective_a : Root3 -> Vowel -> Verb = \rmy,vowImpf ->
let vforms = v1DefForms_perfA rmy vowImpf
let vforms = v1defForms_perfA rmy vowImpf
in verbDef vforms vowImpf ;
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 ;
baqiy = mkDefective facil bqy ;
vforms_i = table { 0 => baqI ;
@@ -609,8 +630,8 @@ v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4)
v1doubleweak : Root3 -> Verb = \r'y ->
let ry = r'y ** {c = ""} ;
vforms_doubleweak : DefForms = \\x => rmSukun (v1DefForms_perfA ry a ! x) ; -- only remove the first sukun
vforms_weak : DefForms = v1DefForms_perfA r'y a ;
vforms_doubleweak : DefForms = \\x => rmSukun (v1defForms_perfA ry a ! x) ; -- only remove the first sukun
vforms_weak : DefForms = v1defForms_perfA r'y a ;
vforms = table { 0 => vforms_weak ! 0 ; -- all perfect forms
1 => vforms_weak ! 1 ;
2 => vforms_weak ! 2 ;
@@ -642,7 +663,7 @@ v2sound : Root3 -> Verb = \qsm ->
uqassam = "ُ" + qassam ;
muqassam = "مُ" + qassam
} in
verb qassam qussim uqassim uqassam qassim muqassam;
verb qassam qussim uqassim uqassam qassim muqassam ;
v2defective : Root3 -> Verb = \gny ->
let {
@@ -751,32 +772,41 @@ v6sound : Root3 -> Verb =
mutafAqam = "م" + utafAqam
} in verb tafAqam tufUqim atafAqam utafAqam tafAqam mutafAqam;
-- v7sound : Root3 -> Verb = -- TODO 7s
-- \fcl ->
-- let {
-- _facal = mkStrong facal fcl ;
-- _facil = mkStrong facil fcl;
-- infacal = "اِنْ" + _facal ; -- VPerf Act
-- ; -- VPerf Pas
-- anfacil = "َنْ" + _facil ; -- VImpf _ Act
-- ; -- VImpf _ Pas
-- ; -- VImp
-- -- VPPart
-- } in
-- verb ;
v7sound : Root3 -> Verb = \fcl ->
let vforms = v1soundForms fcl a i ;
_nfacil = "نْ" + mkStrong facil fcl ;
infacal = "اِنْ" + vforms ! 0 ;
anfacil = "َ" + _nfacil ;
infacil = "اِ" + _nfacil ;
munfacil = "مُ" + _nfacil ;
in verb' (table {
0 => infacal ;
2 => anfacil ;
4 => infacil ;
5 => munfacil ;
n => "ُنْ" + vforms ! n -- doesn't exist for form 7
}) ;
v7geminate : Root3 -> Verb = -- IL 7g -- very likely wrong
\fcl ->
let {
_nfacc = "نْ" + mkHollow facc fcl ;
infacal = "اِنْ" + mkStrong facal fcl ; -- VPerf Act -- TODO use another constructor, this is wrong for 3rd person
unfucc = "اُنْ" + mkHollow fucc fcl ; -- VPerf Pas
anfacc = "َ" + _nfacc ; -- VImpf _ Act
unfacc = "ُ" + _nfacc ; -- VImpf _ Pas
infacc = "اِ" + _nfacc ; -- VImp
munfacc = "مُ" +_nfacc -- VPPart
} in
verb infacal unfucc anfacc unfacc infacc munfacc ;
v7geminate : Str -> Verb = \fcl ->
let vforms = v1geminateForms fcl a i ;
_nfacc = "نْ" + vforms ! 0 ;
_nfacic = "نْ" + mkStrong facil (mkRoot3 fcl) ;
infacc = "اِ" + _nfacc ; -- VPerf Act
infacac = "اِنْ" + vforms ! 1 ; -- VPerf Act Pl3F
anfacc = "َ" + _nfacc ; -- VImpf Act
anfacic = "َ" + _nfacic ; -- VImpf Act Pl3F
infacic = "اِ" + _nfacic ; -- VImp PlF
munfacc = "مُ" + _nfacc ; -- VPPart
in verbGeminate (table {
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 =
\rbT ->
@@ -974,6 +1004,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\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
caseTbl : Case => Str =
@@ -1466,7 +1502,6 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
theyMasc_Pron : NP = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ;
theyFem_Pron : NP = mkPron "هُنَّ" "هُنَّ" "هُنَّ" (Per3 Fem Pl) ;
-- Used e.g. to encode the subject as an object clitic
-- or to find a possessive suffix corresponding to the NP.
-- 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) ----
}
} ;
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
@@ -1729,8 +1781,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ;
bindIfPron : NP -> {c2:Preposition; isPred:Bool} -> Str = \np,vp ->
let bind = case vp.isPred of {
False => bindIf (orB np.a.isPron vp.c2.binds) ;
let notNom : Case -> Bool = \c -> case c of {Nom => False; _=>True} ;
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 => [] }
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 ;
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 = \\_ => "العربية"} ;

View File

@@ -5,7 +5,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
lin
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
SlashV2V v2v vp = let v2vVP = predV v2v in -- IL