(Ara) updates in hamza rules + sound fem. plural noun constructor

This commit is contained in:
Inari Listenmaa
2018-12-06 12:20:35 +02:00
parent dadcd386c9
commit db2560efe4
3 changed files with 75 additions and 27 deletions

View File

@@ -6,8 +6,16 @@ oper
vow : pattern Str = #("َ" | "ِ" | "ُ" | "ً" | "ٍ" | "ٌ") ;
vstar : pattern Str = #("َ"|"ِ"|"ُ"|"ً"|"ٍ"|"ٌ"|"ْ"|"ا"|"ي"|"و") ; -- long or short vowels
astar : pattern Str = #("َ"|"ً"|"ا") ; -- a: short, nunated or long
istar : pattern Str = #("ِ"|"ي"|"يْ") ; -- i: short, long or long with sukun
ustar : pattern Str = #("ُ"|"و"|"وْ") ; -- u: short, long or long with sukun
weak : pattern Str = #("و"|"ي") ;
hamzaseat : pattern Str = #("أ"|"ؤ"|"ئ") ;
-- "Sun letters": assimilate with def. article
sun : pattern Str = #("ت"|"ث"|"د"|"ذ"|"ر"|"ز"|"س"|"ش"|"ص"|"ض"|"ط"|"ظ"|"ل"|"ن") ;
@@ -30,19 +38,19 @@ oper
rectifyHmz : Str -> Str = \word ->
case word of {
l@(""|"ال") + ("أ"|"أَ") + #hamza + "ْ" + tail => l + "آ" + tail;
l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail;
l@(""|"ل"|"ال") + ("أ"|"أَ") + #hamza + "ْ" + tail => l + "آ" + tail;
l@(""|"ل"|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail;
l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail;
l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail;
head + v1@(#vow|"ْ"|"ا"|"ي"|"و")
head + v1@#vstar
+ #hamza + v2@(#vow|"ْ") + tail =>
case v2 of { "ْ" => head + v1 + bHmz v1 v2 + tail ; -- unsure about this /IL
_ => head + v1 + bHmz v1 v2 + v2 + tail } ;
head + v1@(#vow|"ْ"|"ا"|"ي"|"و") -- the same but it ends in vowel
head + v1@#vstar -- the same but it ends in vowel
+ #hamza + v2@(#vow|"ْ") =>
case v2 of { "ْ" => head + v1 + tHmz v1 ;
_ => head + v1 + tHmz v1 + v2 } ;
head + v1@(#vow|"ْ"|"ا"|"ي"|"و") -- the same but it ends without vowel
head + v1@#vstar -- the same but it ends without vowel
+ #hamza => head + v1 + tHmz v1 ;
head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail
@@ -57,21 +65,22 @@ oper
};
--hamza in middle of word (body)
-- relaxing the pattern matching, so that we can call it from ResAra.sing /IL
bHmz : Str -> Str -> Str = \d1,d2 ->
case <d1,d2> of {
<"ِ",_> | <_,"ِ"> => "ئ";
<"ُ",_> | <_,"ُ"> => "ؤ";
<"َ",_> | <_,"َ"> => "أ";
_ => "ء"
<_+#istar,_> | <_,#istar> => "ئ";
<_+#ustar,_> | <_,#ustar> => "ؤ";
<_+"َ" ,_> | <_,"َ"> => "أ"; -- #astar would allow double alif
_ => "ء"
};
--hamza carrier sequence
tHmz : Str -> Str = \d ->
case d of {
"ِ" => "ئ";
"ُ" => "ؤ";
"َ" => "أ";
"ْ"|"ا"|"و"|"ي" => "ء"
"ُ" => "ؤ";
"َ" => "أ";
_ => "ء" -- long vowels and sukun
};
}

View File

@@ -530,12 +530,11 @@ resource ParadigmsAra = open
sdfN =
\root,sg,gen,spec ->
let { kalimaStr = mkWord sg root;
kalimaRaw = sndf kalimaStr;
kalima : NTable = \\n,d,c => case root of {
_ + #hamza + _
=> rectifyHmz (kalimaRaw ! n ! d ! c);
_ => kalimaRaw ! n ! d ! c
};
kalimaRaw : NTable = case gen of {
Fem => sndf kalimaStr ;
Masc => sgMsndf kalimaStr } ;
kalima : NTable = \\n,d,c =>
rectifyHmz (kalimaRaw ! n ! d ! c)
} in mkFullN kalima gen spec;
sdmN =

View File

@@ -75,9 +75,9 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
-- a word, deducing which root consonant is weak
mkWeak : Pattern -> Root3 -> Str = \pat,fcl ->
case <fcl.f,fcl.c,fcl.l> of {
<_,_,("و"|"ي"|"ّ")> => mkDefective pat fcl;
<_,("و"|"ي"),_> => mkHollow pat fcl;
<("و"|"ي"),_,_> => mkAssimilated pat fcl
<_,_,#weak|"ّ"> => mkDefective pat fcl;
<_,#weak,_> => mkHollow pat fcl;
<#weak,_,_> => mkAssimilated pat fcl
};
mkBilit : Pattern -> Root2 -> Str = \p,fcl ->
@@ -990,12 +990,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
APosit Masc n d c => case n of {
Sg => indeclN aHmar ! d ! c ;
Dl => dual aHmar ! d ! c ;
Pl => sing Humr ! d ! c
Pl => brkPl Humr ! d ! c
};
APosit Fem n d c => case n of {
Sg => indeclN HamrA' ! d ! c;
Dl => dual ((tk 2 HamrA') + "و") ! d ! c;
Pl => sing Humr ! d ! c
Pl => brkPl Humr ! d ! c
};
AComp d c => indeclN aHmar ! d ! c
};
@@ -1011,7 +1011,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
table {
Sg => sing kitAb ;
Dl => dual kitAb ;
Pl => sing kutub
Pl => brkPl kutub
};
--takes the sound noun in singular and gives the
@@ -1024,6 +1024,16 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Pl => plurF lawHa
};
--takes the sound noun in singular and gives the
--complete noun inflection table of sound feminine plural
sgMsndf : Str -> NTable =
\lawHa ->
table {
Sg => sing lawHa ;
Dl => dual lawHa ;
Pl => singMplurF lawHa
};
--takes the sound noun in singular and gives the
--complete inflection table of sound masculine plural nominals
sndm : Str -> NTable =
@@ -1034,21 +1044,39 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Pl => plurM muzAric
};
-- takes a singular or broken plural word and tests the ending to
-- determine the declension and gives the corresponding inf table
sing : Str -> State => Case => Str = \word ->
brkPl : Str -> State => Case => Str = \word ->
\\s,c => defArt s c (case word of {
lemma + "ِيّ" => fixShd word (decNisba ! s ! c) ;
lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ;
_ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ;
lemma + ("ء"|"أ"|"ئ"|"ؤ") => word + dec1sgNoDoubleAlif ! s ! c ;
lemma + (#hamza|#hamzaseat)
=> word + dec1sgNoDoubleAlif ! s ! c ;
lemma + "ة" => case s of {
Poss => lemma + "ت" + dec1sg ! s ! c ;
_ => word + dec1sgNoDoubleAlif ! s ! c
} ;
_ => fixShd word (dec1sg ! s ! c)
_ => fixShd word (dec1sg ! s ! c)
}) ;
sing : Str -> State => Case => Str = \word ->
\\s,c => case word of {
-- This only applies for singular indefinite
x + y@? + #hamza => defArt s c (
case <s,c> of { -- if hamza was last, it's now in the body
<Indef,Acc> =>
case y of {
#vstar => word + dec1sgNoDoubleAlif ! Indef ! Acc ;
_ => let an : Str = dec1sg ! Indef ! Acc ;
hmz : Str = bHmz x an ;
in x + y + hmz + an } ;
_ => word + dec1sg ! s ! c }) ;
-- The rest is identical with singulars and broken plurals
_ => brkPl word ! s ! c
} ;
-- takes a singular word and tests the ending to
-- determine the declension and gives the corresponding dual inf table
@@ -1065,6 +1093,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
\kalima ->
\\s,c => defArt s c (mkAt kalima) + f_pl ! s ! c ;
-- takes a singular masculine word and gives the corresponding
-- sound plural feminine table
singMplurF : Str -> State => Case => Str =
\ijra' ->
\\s,c => defArt s c (mkAtMasc ijra') + f_pl ! s ! c ;
-- takes a singular word and gives the corresponding sound
--plural masculine table. FIXME: consider declension 3
plurM : Str -> State => Case => Str =
@@ -1196,6 +1230,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
}
};
mkAtMasc : Str -> Str = \x ->
case x of {
y + "ة" => y + "ات";
y + "ى" => y + "يَات"; -- TODO check does this happen?
_ => x + "ات"
};
mkAt : Str -> Str = \bayDo ->
case bayDo of {