1
0
forked from GitHub/gf-rgl

Merge pull request #78 from inariksit/arabic

Arabic
This commit is contained in:
Inari Listenmaa
2018-11-19 17:22:39 +01:00
committed by GitHub
5 changed files with 62 additions and 58 deletions

View File

@@ -2,22 +2,24 @@ concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in {
flags coding=utf8; flags coding=utf8;
lin lin
PositAdvAdj a = {s = a.s ! APosit Masc Sg Indef Acc} ; PositAdvAdj a = {s = a.s ! APosit Masc Sg Indef Acc} ;
-- ComparAdvAdj cadv a np = { -- ComparAdvAdj cadv a np = {
-- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ np.s ! Gen -- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ np.s ! Gen
-- } ; -- } ;
-- ComparAdvAdjS cadv a s = { -- ComparAdvAdjS cadv a s = {
-- s = cadv.s ++ a.s ! AAdv ++ "تهَن" ++ s.s -- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ s.s
-- } ; -- } ;
PrepNP prep np = {s = prep.s ++ np.s ! prep.c} ; PrepNP prep np = {s = prep.s ++ np.s ! prep.c} ;
-- AdAdv = cc2 ; AdAdv ad av = cc2 av ad ;
--
-- : Subj -> S -> Adv ; -- when she sleeps -- : Subj -> S -> Adv ; -- when she sleeps
SubjS subj s = {s = subj.s ++ s.s ! Subord} ; SubjS subj s = {s = subj.s ++ s.s ! Subord} ;
-- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing -- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing
--
-- AdnCAdv cadv = {s = cadv.s ++ "تهَن"} ; AdnCAdv cadv = {s = cadv.s ++ "مِنْ"} ;
--
} }

View File

@@ -49,14 +49,12 @@ concrete IdiomAra of Idiom = CatAra ** open
-- : VP -> VP ; -- is at home himself; is himself at home -- : VP -> VP ; -- is at home himself; is himself at home
SelfAdvVP, SelfAdvVP,
SelfAdVVP = \vp -> vp ** { SelfAdVVP = \vp -> vp ** {
s = \\pgn,vf => let pron : ResAra.NP = pgn2pron pgn in s = \\pgn,vf => vp.s ! pgn ! vf ++ reflPron Nom pgn
vp.s ! pgn ! vf ++ refl ! Nom ++ pron.s ! Gen
} ; } ;
-- : NP -> NP ; -- the president himself (is at home) -- : NP -> NP ; -- the president himself (is at home)
SelfNP np = np ** { SelfNP np = np ** {
s = let pron : ResAra.NP = np2pron np ; s = \\c => np.s ! c ++ reflPron c (np.a.pgn)
in \\c => np.s ! c ++ refl ! c ++ pron.s ! Gen
} ; } ;
} }

View File

@@ -185,51 +185,33 @@ resource ParadigmsAra = open
-- Overloaded operations -- Overloaded operations
mkV : overload { mkV : overload {
mkV : (imperfect : Str) -> V ; mkV : (imperfect : Str) -> V ; -- The verb in Per3 Sg Masc imperfect tense gives the most information
mkV : (root : Str) -> (perf,impf : Vowel) -> V ; -- verb form I ; vowel = a|i|u mkV : (root : Str) -> (perf,impf : Vowel) -> V ; -- verb form I ; vowel = a|i|u
mkV : (root : Str) -> VerbForm -> V ; -- FormI .. FormX (no VII, IX) ; default vowels a u for I mkV : (root : Str) -> VerbForm -> V ; -- FormI .. FormX (no VII, IX) ; default vowels a u for I
mkV : V -> (particle : Str) -> V -- V with a non-inflecting particle/phrasal verb mkV : V -> (particle : Str) -> V -- V with a non-inflecting particle/phrasal verb
} ; } ;
-- The verb in the imperfect tense gives the most information -- regV : Str -> V ;
regV : Str -> V ; reflV : V -> V ; -- نَفْس in the proper case and with possessive suffix, e.g. نَفْسَكِ
--Verb Form I : fa`ala, fa`ila, fa`ula v1 : Str -> Vowel -> Vowel -> V ; --Verb Form I : fa`ala, fa`ila, fa`ula
v1 : Str -> Vowel -> Vowel -> V ; v2 : Str -> V ; --Verb Form II : fa``ala
--Verb Form II : fa``ala v3 : Str -> V ; --Verb Form III : faa`ala
v2 : Str -> V ; v4 : Str -> V ; --Verb Form IV : 'af`ala
--Verb Form III : faa`ala v5 : Str -> V ; --Verb Form V : tafa``ala
v3 : Str -> V ; v6 : Str -> V ; --Verb Form VI : tafaa`ala
--Verb Form IV : 'af`ala v7 : Str -> V ; --Verb Form VII : infa`ala
v4 : Str -> V ; v8 : Str -> V ; --Verb Form VIII ifta`ala
--Verb Form V : tafa``ala v10 : Str -> V ; -- Verb Form X 'istaf`ala
v5 : Str -> V ;
--Verb Form VI : tafaa`ala
v6 : Str -> V ;
--Verb Form VII : tafaa`ala
v7 : Str -> V ;
--Verb Form VIII infa`ala
v8 : Str -> V ;
-- Verb Form X 'istaf`ala
v10 : Str -> V ;
--3 Two-place verbs --3 Two-place verbs
@@ -359,10 +341,11 @@ resource ParadigmsAra = open
mkN : N -> (attr : Str) -> N -- Compound nouns mkN : N -> (attr : Str) -> N -- Compound nouns
= \n,attr -> n ** {s2 = \\n,s,c => attr} ; = \n,attr -> n ** {s2 = \\n,s,c => attr} ;
mkN : N -> N -> N -- Compound nouns mkN : N -> N -> N -- Compound nouns
= \n1,n2 -> n1 ** {s2 = = \n1,n2 -> n1 ** {
\\n,s,c => n1.s2 ! n ! s ! c s = \\n,_,c => n1.s ! n ! Const ! c ;
++ n2.s ! n ! s ! c s2 = \\n,s,c => n1.s2 ! n ! s ! c
++ n2.s2 ! n ! s ! c} ; ++ n2.s ! n ! s ! c
++ n2.s2 ! n ! s ! c} ;
} ; } ;
dualN : N -> N = \n -> n ** {isDual=True} ; dualN : N -> N = \n -> n ** {isDual=True} ;
@@ -497,6 +480,8 @@ resource ParadigmsAra = open
_ => v10sound } _ => v10sound }
} in lin V (v10fun rbT) ; } in lin V (v10fun rbT) ;
reflV v = lin V (ResAra.reflV v) ;
mkFullN nsc gen spec = lin N mkFullN nsc gen spec = lin N
{ s = nsc; --NTable { s = nsc; --NTable
s2 = emptyNTable; s2 = emptyNTable;

View File

@@ -972,9 +972,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
lemma + "ِيّ" => fixShd word (decNisba ! s ! c) ; lemma + "ِيّ" => fixShd word (decNisba ! s ! c) ;
lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ; lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ;
_ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ; _ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ;
lemma + ("ء"|"أ"|"ئ"|"ؤ") => word + dec1sgNoDoubleAlif ! s ! c ;
lemma + "ة" => case s of { lemma + "ة" => case s of {
Poss => lemma + "ت" + dec1sg ! s ! c ; Poss => lemma + "ت" + dec1sg ! s ! c ;
_ => word + dec1sg ! s ! c _ => word + dec1sgNoDoubleAlif ! s ! c
} ; } ;
_ => fixShd word (dec1sg ! s ! c) _ => fixShd word (dec1sg ! s ! c)
}) ; }) ;
@@ -1026,13 +1027,20 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
table { table {
Bare => []; Bare => [];
Nom => "ٌ"; Nom => "ٌ";
Acc => "ً"; Acc => "اً";
_Gen => "ٍ" _Gen => "ٍ"
}; };
_ => caseTbl --think of ?axU, ?axA, (the five nouns) _ => caseTbl --think of ?axU, ?axA, (the five nouns)
}; };
-- if a word ends in ء or ة, don't add alif for indef acc.
dec1sgNoDoubleAlif : State => Case => Str = \\s,c =>
case <s,c> of {
<Indef,Acc> => "ً" ;
_ => dec1sg ! s ! c
};
--indeclinables (mamnuu3 mina S-Sarf) --indeclinables (mamnuu3 mina S-Sarf)
indecl : Case => Str = indecl : Case => Str =
table { table {
@@ -1287,7 +1295,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn ->
{ s = { s =
table { table {
Nom => ana; (Nom|Bare) => ana;
Acc => BIND ++ nI; -- object suffix Acc => BIND ++ nI; -- object suffix
Gen => BIND ++ I; -- possessive suffix Gen => BIND ++ I; -- possessive suffix
Dat => I -- will only be used with preposition لِ, which already has a BIND Dat => I -- will only be used with preposition لِ, which already has a BIND
@@ -1354,8 +1362,18 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
a = np.a ** {isPron=False} -- hack, sometimes we *don't* want prodrop a = np.a ** {isPron=False} -- hack, sometimes we *don't* want prodrop
} ; } ;
refl : Case => Str = \\c => "نَفْس" + caseTbl ! c ; reflPron : Case -> PerGenNum -> Str = \c,pgn ->
let pron : NP = pgn2pron pgn
in "نَفْس" + caseTbl ! c ++ pron.s ! Gen ;
reflV : Verb -> Verb = \v -> v ** {
s = \\vf => case vf of {
VPerf _ pgn => v.s ! vf ++ reflPron Acc pgn ;
VImpf _ _ pgn => v.s ! vf ++ reflPron Acc pgn ;
VImp g n => v.s ! vf ++ reflPron Acc (Per2 g n) ;
VPPart => v.s ! vf ++ reflPron Acc (Per3 Masc Sg) ----
}
} ;
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- IP, questions -- IP, questions
@@ -1471,7 +1489,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
<_, Past, Pos> => kataba ; <_, Past, Pos> => kataba ;
<_, Past, Neg> => "لَمْ" ++ yaktub ; <_, Past, Neg> => "لَمْ" ++ yaktub ;
<_, Cond, _ > => yaktuba ; <_, Cond, _ > => yaktuba ;
<_, Fut, Pos> => "سَ" ++ yaktubu ; <_, Fut, Pos> => glue "سَ" yaktubu ;
<_, Fut, Neg> => "لَنْ" ++ yaktuba <_, Fut, Neg> => "لَنْ" ++ yaktuba
}; };
pred : ParamX.Tense -> Polarity -> Str = pred : ParamX.Tense -> Polarity -> Str =
@@ -1616,7 +1634,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
NCard => table { NCard => table {
Masc => \\s,c => (sing wAhid) ! s ! c ; Masc => \\s,c => (sing wAhid) ! s ! c ;
--all fem are first declension: --all fem are first declension:
Fem => \\s,c => defArt s c wAhida + dec1sg ! s ! c Fem => \\s,c => defArt s c wAhida + dec1sgNoDoubleAlif ! s ! c
}; };
NOrd => table { NOrd => table {
Masc => \\s,c => defArt s c awwal + dec1sg ! s ! c; Masc => \\s,c => defArt s c awwal + dec1sg ! s ! c;

View File

@@ -52,7 +52,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
AdvVP vp adv = insertStr adv.s vp ; AdvVP vp adv = insertStr adv.s vp ;
-- AdVVP adv vp = insertAdV adv.s vp ; AdVVP adv = insertStr adv.s ;
AdVVPSlash adv vps = vps ** insertStr adv.s vps ;
-- --
-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ; -- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;
-- --