1
0
forked from GitHub/gf-rgl

Merge pull request #80 from inariksit/arabic

Arabic
This commit is contained in:
Inari Listenmaa
2018-11-20 16:04:32 +01:00
committed by GitHub
9 changed files with 156 additions and 74 deletions

View File

@@ -44,4 +44,6 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in {
s = \\h,g,n,d,c => a.s ! AComp d c
};
-- : Ord -> AP ; -- warmest
AdjOrd ord = {s = \\h,g,n,s,c => ord.s ! g ! s ! c} ;
}

View File

@@ -79,9 +79,10 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
V, VS, VQ, VA = ResAra.Verb ; -- = {s : VForm => Str} ;
V2, V2A = ResAra.Verb2 ;
VV = ResAra.Verb2 ** {sc : Preposition} ;
VV = ResAra.Verb2 ** {sc : Preposition} ; -- c2 is for verb
V2S, V2Q = ResAra.Verb2 ;
V2V, V3 = ResAra.Verb3 ;
V3 = ResAra.Verb3 ;
V2V = ResAra.Verb3 ** {sc : Preposition} ; -- c3 is for verb, c2 is for dir.obj
A = ResAra.Adj ;
A2 = ResAra.Adj2 ;

View File

@@ -3,11 +3,8 @@ resource MissingAra = open GrammarAra, Prelude in {
-- temporary definitions to enable the compilation of RGL API
oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ;
oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ;
oper AdjOrd : Ord -> AP = notYet "AdjOrd" ;
oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ;
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvS : Adv -> S -> S = notYet "AdvS" ;
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ;
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
@@ -36,8 +33,6 @@ oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;
oper VocNP : NP -> Voc = notYet "VocNP" ;

View File

@@ -114,7 +114,7 @@ resource ParadigmsAra = open
mkN2 : overload {
mkN2 : N -> Preposition -> N2 ; -- ready-made preposition
mkN2 : (mother : N) -> (of_ : Str) -> N2 ; -- preposition given as a string
mkN2 : N -> Str -> N2 ; -- preposition given as a string
mkN2 : N -> N2 ; -- no preposition
mkN2 : Str -> N2 ; -- no preposition, predictable inflection
} ;
@@ -195,21 +195,21 @@ resource ParadigmsAra = open
reflV : V -> V ; -- نَفْس in the proper case and with possessive suffix, e.g. نَفْسَكِ
v1 : Str -> Vowel -> Vowel -> V ; --Verb Form I : fa`ala, fa`ila, fa`ula
v1 : Str -> Vowel -> Vowel -> V ; -- Verb Form I : fa`ala, fa`ila, fa`ula
v2 : Str -> V ; --Verb Form II : fa``ala
v2 : Str -> V ; -- Verb Form II : fa``ala
v3 : Str -> V ; --Verb Form III : faa`ala
v3 : Str -> V ; -- Verb Form III : faa`ala
v4 : Str -> V ; --Verb Form IV : 'af`ala
v4 : Str -> V ; -- Verb Form IV : 'af`ala
v5 : Str -> V ; --Verb Form V : tafa``ala
v5 : Str -> V ; -- Verb Form V : tafa``ala
v6 : Str -> V ; --Verb Form VI : tafaa`ala
v6 : Str -> V ; -- Verb Form VI : tafaa`ala
v7 : Str -> V ; --Verb Form VII : infa`ala
v7 : Str -> V ; -- Verb Form VII : infa`ala
v8 : Str -> V ; --Verb Form VIII ifta`ala
v8 : Str -> V ; -- Verb Form VIII ifta`ala
v10 : Str -> V ; -- Verb Form X 'istaf`ala
@@ -419,6 +419,7 @@ resource ParadigmsAra = open
let root : Root3 = mkRoot3 rootStr ;
verb : Verb = case rootStr of {
? + #hamza + #weak => v4doubleweak root ;
? + #weak + ? => v4hollow root ;
_ + #weak => v4defective root ;
_ => v4sound root } ;
in lin V verb ;
@@ -475,9 +476,10 @@ resource ParadigmsAra = open
\rootStr ->
let {
rbT = mkRoot3 rootStr ;
v10fun = case rbT.c of {
("و"|"ي") => v10hollow ;
_ => v10sound }
v10fun : Root3 -> Verb = case rootStr of {
? + #weak + ? => v10hollow ;
? + ? + #weak => v10defective ;
_ => v10sound }
} in lin V (v10fun rbT) ;
reflV v = lin V (ResAra.reflV v) ;
@@ -686,9 +688,9 @@ resource ParadigmsAra = open
mkV2S v p = lin V2S (prepV2 v (mkPreposition p)) ;
mkV2V = overload {
mkV2V : V -> Str -> Str -> V2V = \v,p,q ->
lin V2V (prepV3 v (mkPreposition p) (mkPreposition q)) ;
lin V2V (prepV3 v (mkPreposition p) (mkPreposition q) ** {sc = noPrep}) ;
mkV2V : V -> Preposition -> Preposition -> V2V = \v,p,q ->
lin V2V (prepV3 v p q) ;
lin V2V (prepV3 v p q ** {sc = noPrep}) ;
mkV2V : VV -> Preposition -> V2V = \vv,p ->
lin V2V (vv ** {c2 = p ; c3 = vv.c2}) ;
} ;

View File

@@ -35,9 +35,13 @@ flags coding=utf8 ;
fuci = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ِ" } ;
fucu = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ُ" } ;
fUc = { h = "" ; m1 = "ُو"; m2 = ""; t = "" } ;
ufAc = { h = "ُ" ; m1 = "َا"; m2 = ""; t = "" } ;
ufca = { h = "ُ" ; m1 = "ْ" ; m2 = ""; t = "َ" } ;
eafAc = fAc ** { h = "أَ" } ;
eafac = fac ** { h = "أَ" } ;
eafIc = fIc ** { h = "أَ" } ;
eafic = fic ** { h = "أَ" } ;
eafAcil = { h = "أَ"; m1 = "َا" ; m2 = "ِ" ; t = "" } ;
eafAcIl = { h = "أَ"; m1 = "َا" ; m2 = "ِي" ; t = "" } ;
eafcilp = { h = "أَ"; m1 = "ْ" ; m2 = "ِ" ; t = "َة" } ;
@@ -47,6 +51,12 @@ flags coding=utf8 ;
eafcul = { h = "أَ"; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
eiftacal = { h = "إِ"; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ;
eufcil = { h = "أُ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ;
eufic = fic ** { h = "أُ" } ;
eufIc = fIc ** { h = "أُ" } ;
ufic = fic ** { h = "ُ" } ;
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 = "" } ;

View File

@@ -649,6 +649,28 @@ v4sound : Root3 -> Verb =
} in
verb eaqnac euqnic uqnic uqnac eaqnic muqnac;
v4hollow : Root3 -> Verb =
\rwd ->
let {
earad = mkHollow eafac rwd ; -- VPerf Act (Per3 Fem Pl) etc.
earAd = mkHollow eafAc rwd ; -- VPerf Act
eurid = mkHollow eufic rwd ; -- VPerf Pas (Per3 Fem Pl) etc.
eurId = mkHollow eufIc rwd ; -- VPerf Pas
urid = mkHollow ufic rwd ; -- VImpf Act (Per2/Per3 Fem Pl)
urId = mkHollow ufIc rwd ; -- VImpf Act
urad = mkHollow ufac rwd ; -- VImpf Pas (Per2/Per3 Fem Pl)
urAd = mkHollow ufAc rwd ; -- VImpf Pas
earid = mkHollow eafic rwd ; -- VImp (Sg Masc / Pl Fem)
earId = mkHollow eafIc rwd ; -- VImp (Pl Masc / Sg Fem)
ppart = "م" + urAd ;
} in verbHollow (toDefForms
earAd earad eurId eurid
urId urid urAd urad
earId earid ppart) ;
v4DefForms : Root3 -> DefForms = \cTy ->
let {
@@ -771,7 +793,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
v10sound : Root3 -> Verb = -- IL 10s -- to be checked
\qtl ->
let {
_staqtal = "ستَ" + mkStrong fcal qtl ;
@@ -785,7 +807,7 @@ v10sound : Root3 -> Verb = ---- IL 10s -- to be checked
} in
verb istaqtal ustuqtil astaqtil astaqtal istaqtil mustaqtal ;
v10hollow : Root3 -> Verb = ---- IL 10h -- to be checked
v10hollow : Root3 -> Verb = -- IL 10h -- to be checked
\xwf ->
let {
_staxaf = "سْتَ" + mkHollow fac xwf ;
@@ -804,10 +826,33 @@ v10hollow : Root3 -> Verb = ---- IL 10h -- to be checked
ustaxAf = "ُ" + _staxAf ; -- VImpf Pas _
ppart = "مُ" + _staxIf -- PPart ("weird anomalies" here too?)
} in verbHollow (toDefForms
} in verbHollow (toDefForms
istaxAf istaxaf ustuxIf ustuxif astaxIf astaxif
ustaxAf ustaxaf istaxif istaxIf ppart) ;
v10defective : Root3 -> Verb = -- IL
\lqy ->
let {
_stalqa = "سْتَ" + mkDefective fca lqy ;
_stalqu = "سْتَ" + mkDefective fcu lqy ;
_stalqi = "سْتَ" + mkDefective fci lqy ;
_stulqi = "سْتُ" + mkDefective fci lqy ;
istalqa = "اِ" + _stalqa ; -- VPerf Act (Per3 Masc Sg)
istalqay = "اِسْتَ" + mkStrong fcal lqy ; -- VPerf Act (Per3 Fem Pl)
ustulqi = "اُ" + _stulqi; -- VPerf Pas (Per3 _ _)
astalqu = "َ" + _stalqu ; -- VImpf Act (Per2/3 Masc Pl)
astalqi = "َ" + _stalqi ; -- VImpf Act _
ustalqa = "ُ" + _stalqa ; -- VImpf Pas _
istalqi = "اِ" + _stalqi; -- VImp (Masc Sg / Fem _)
istalqu = "اِ" + _stalqu; -- VImp Masc Pl
mustalqin = "مُ" + _stalqi + "ت" ;
} in verbDef (toDefForms
istalqa istalqay ustulqi ustulqi ustulqi
astalqi astalqu ustalqa istalqi istalqu mustalqin) i ;
patV1Perf : Vowel => Pattern =
table {
a => facal ; --katab
@@ -1317,20 +1362,23 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
agrNP : Agr -> NP = \agr -> emptyNP ** {a = agr} ;
i_Pron : NP = mkPron "أَنَا" "نِي" "ي" (Per1 Sing) ;
youSgMasc_Pron : NP = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ;
youSgFem_Pron : NP = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ;
youDlMasc_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Masc Dl) ;
youDlFem_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Fem Dl) ;
he_Pron : NP = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ;
she_Pron : NP = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ;
i_Pron : NP = mkPron "أَنَا" "نِي" "ي" (Per1 Sing) ;
we_Pron : NP = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ;
youPlMasc_Pron : NP = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ;
youPlFem_Pron : NP = mkPron "أَنتُنَّ" "كُنَّ" "كُنَّ" (Per2 Fem Sg) ;
theyMasc_Pron : NP = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ;
theyFem_Pron : NP = mkPron "هُنَّ" "هُنَّ" "هُنَّ" (Per3 Fem Pl) ;
youSgMasc_Pron : NP = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ;
youSgFem_Pron : NP = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ;
youDlMasc_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Masc Dl) ;
youDlFem_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Fem Dl) ;
youPlMasc_Pron : NP = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Pl) ;
youPlFem_Pron : NP = mkPron "أَنتُنَّ" "كُنَّ" "كُنَّ" (Per2 Fem Pl) ;
he_Pron : NP = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ;
she_Pron : NP = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ;
theyDlMasc_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Masc Dl) ;
theyDlFem_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Fem Dl) ;
theyDlFem_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Fem Dl) ;
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.
@@ -1538,7 +1586,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
emptyObj : Obj = emptyNP ** {s=[]} ;
insertObj : NP -> VPSlash -> VP = \np,vp -> vp **
{ obj = {s = vp.obj.s ++ vp.c2.s ++ np.s ! vp.c2.c ; a = np.a} };
{ obj = {s = vp.obj.s -- old object, if there was one
++ vp.c2.s ++ np.s ! vp.c2.c -- new object
++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V
a = np.a} };
insertPred : Comp -> VP -> VP = \p,vp -> vp **
{ pred = p;
@@ -1556,11 +1607,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-----------------------------------------------------------------------------
-- Slash categories
VPSlash : Type = VP ** {c2 : Preposition} ;
VPSlash : Type = VP ** {c2 : Preposition ; agrObj : PerGenNum => Str} ;
ClSlash : Type = VPSlash ** {subj : NP} ;
slashV2 : Verb2 -> VPSlash = \v ->
predV v ** {c2 = v.c2} ;
predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ;
-- Add subject string, fix agreement to the subject,
-- but keep the structure as VP, because later on

View File

@@ -86,4 +86,6 @@ concrete SentenceAra of Sentence = CatAra ** open
UseRCl t p cl = {s = \\agr,c => t.s ++ p.s ++ cl.s ! t.t ! p.p ! agr ! c} ;
UseSlash t p cl = UseCl t p (complClSlash cl) ;
AdvS adv s = s ** {s = \\o => adv.s ++ s.s ! o} ;
}

View File

@@ -120,7 +120,7 @@ concrete StructuralAra of Structural = CatAra **
yes_Utt = {s = \\_ => "نَعَم"} ;
youSg_Pron = youSgMasc_Pron ;
youPl_Pron = youPlMasc_Pron ;
youPol_Pron = youSgFem_Pron ; -- arbitrary?
youPol_Pron = youPlFem_Pron ; -- arbitrary?
have_V2 = dirV2 (regV "يَملِك") ;

View File

@@ -7,12 +7,31 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
SlashVV vv vps = vps ** predV vv ; ----IL
-- TODO: --c3 is for verb, c2 is for dir.obj
--SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go
--SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
-- : V2V -> VP -> VPSlash ; -- beg (her) to go
SlashV2V v2v vp = let v2vVP = predV v2v in -- IL
vp ** {
s = v2vVP.s ;
agrObj = \\pgn => v2v.c3.s -- أَنْ
++ vp.s ! pgn ! VPImpf Cnj ;
isPred = False ;
c2 = v2v.c2 ; -- for the direct object
sc = v2v.sc
} ;
-- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
SlashV2VNP v2v np vps = let v2vVP = predV v2v in -- IL
vps ** {
s = \\pgn,vpf => v2vVP.s ! pgn ! vpf
++ v2v.c2.s ++ np.s ! v2v.c2.c
++ v2v.c3.s -- أَنْ
++ vps.s ! pgn ! VPImpf Cnj ;
isPred = False ;
-- preposition for the direct object comes from VP
sc = v2v.sc
} ;
SlashV2a = slashV2 ;
Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3};
Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3 ; agrObj = \\_ => []};
ComplSlash vp np = insertObj np vp ;