mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 17:08:54 -06:00
(Ara) updates in hamza rules + sound fem. plural noun constructor
This commit is contained in:
@@ -6,8 +6,16 @@ oper
|
|||||||
|
|
||||||
vow : pattern Str = #("َ" | "ِ" | "ُ" | "ً" | "ٍ" | "ٌ") ;
|
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 = #("و"|"ي") ;
|
weak : pattern Str = #("و"|"ي") ;
|
||||||
|
|
||||||
|
hamzaseat : pattern Str = #("أ"|"ؤ"|"ئ") ;
|
||||||
|
|
||||||
-- "Sun letters": assimilate with def. article
|
-- "Sun letters": assimilate with def. article
|
||||||
sun : pattern Str = #("ت"|"ث"|"د"|"ذ"|"ر"|"ز"|"س"|"ش"|"ص"|"ض"|"ط"|"ظ"|"ل"|"ن") ;
|
sun : pattern Str = #("ت"|"ث"|"د"|"ذ"|"ر"|"ز"|"س"|"ش"|"ص"|"ض"|"ط"|"ظ"|"ل"|"ن") ;
|
||||||
|
|
||||||
@@ -30,19 +38,19 @@ oper
|
|||||||
|
|
||||||
rectifyHmz : Str -> Str = \word ->
|
rectifyHmz : Str -> Str = \word ->
|
||||||
case word of {
|
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;
|
||||||
l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail;
|
l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail;
|
||||||
head + v1@(#vow|"ْ"|"ا"|"ي"|"و")
|
head + v1@#vstar
|
||||||
+ #hamza + v2@(#vow|"ْ") + tail =>
|
+ #hamza + v2@(#vow|"ْ") + tail =>
|
||||||
case v2 of { "ْ" => head + v1 + bHmz v1 v2 + tail ; -- unsure about this /IL
|
case v2 of { "ْ" => head + v1 + bHmz v1 v2 + tail ; -- unsure about this /IL
|
||||||
_ => head + v1 + bHmz v1 v2 + v2 + tail } ;
|
_ => 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|"ْ") =>
|
+ #hamza + v2@(#vow|"ْ") =>
|
||||||
case v2 of { "ْ" => head + v1 + tHmz v1 ;
|
case v2 of { "ْ" => head + v1 + tHmz v1 ;
|
||||||
_ => head + v1 + tHmz v1 + v2 } ;
|
_ => 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 ;
|
+ #hamza => head + v1 + tHmz v1 ;
|
||||||
|
|
||||||
head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail
|
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)
|
--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 ->
|
bHmz : Str -> Str -> Str = \d1,d2 ->
|
||||||
case <d1,d2> of {
|
case <d1,d2> of {
|
||||||
<"ِ",_> | <_,"ِ"> => "ئ";
|
<_+#istar,_> | <_,#istar> => "ئ";
|
||||||
<"ُ",_> | <_,"ُ"> => "ؤ";
|
<_+#ustar,_> | <_,#ustar> => "ؤ";
|
||||||
<"َ",_> | <_,"َ"> => "أ";
|
<_+"َ" ,_> | <_,"َ"> => "أ"; -- #astar would allow double alif
|
||||||
_ => "ء"
|
_ => "ء"
|
||||||
};
|
};
|
||||||
|
|
||||||
--hamza carrier sequence
|
--hamza carrier sequence
|
||||||
tHmz : Str -> Str = \d ->
|
tHmz : Str -> Str = \d ->
|
||||||
case d of {
|
case d of {
|
||||||
"ِ" => "ئ";
|
"ِ" => "ئ";
|
||||||
"ُ" => "ؤ";
|
"ُ" => "ؤ";
|
||||||
"َ" => "أ";
|
"َ" => "أ";
|
||||||
"ْ"|"ا"|"و"|"ي" => "ء"
|
_ => "ء" -- long vowels and sukun
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -530,12 +530,11 @@ resource ParadigmsAra = open
|
|||||||
sdfN =
|
sdfN =
|
||||||
\root,sg,gen,spec ->
|
\root,sg,gen,spec ->
|
||||||
let { kalimaStr = mkWord sg root;
|
let { kalimaStr = mkWord sg root;
|
||||||
kalimaRaw = sndf kalimaStr;
|
kalimaRaw : NTable = case gen of {
|
||||||
kalima : NTable = \\n,d,c => case root of {
|
Fem => sndf kalimaStr ;
|
||||||
_ + #hamza + _
|
Masc => sgMsndf kalimaStr } ;
|
||||||
=> rectifyHmz (kalimaRaw ! n ! d ! c);
|
kalima : NTable = \\n,d,c =>
|
||||||
_ => kalimaRaw ! n ! d ! c
|
rectifyHmz (kalimaRaw ! n ! d ! c)
|
||||||
};
|
|
||||||
} in mkFullN kalima gen spec;
|
} in mkFullN kalima gen spec;
|
||||||
|
|
||||||
sdmN =
|
sdmN =
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
|
|||||||
-- a word, deducing which root consonant is weak
|
-- a word, deducing which root consonant is weak
|
||||||
mkWeak : Pattern -> Root3 -> Str = \pat,fcl ->
|
mkWeak : Pattern -> Root3 -> Str = \pat,fcl ->
|
||||||
case <fcl.f,fcl.c,fcl.l> of {
|
case <fcl.f,fcl.c,fcl.l> of {
|
||||||
<_,_,("و"|"ي"|"ّ")> => mkDefective pat fcl;
|
<_,_,#weak|"ّ"> => mkDefective pat fcl;
|
||||||
<_,("و"|"ي"),_> => mkHollow pat fcl;
|
<_,#weak,_> => mkHollow pat fcl;
|
||||||
<("و"|"ي"),_,_> => mkAssimilated pat fcl
|
<#weak,_,_> => mkAssimilated pat fcl
|
||||||
};
|
};
|
||||||
|
|
||||||
mkBilit : Pattern -> Root2 -> Str = \p,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 {
|
APosit Masc n d c => case n of {
|
||||||
Sg => indeclN aHmar ! d ! c ;
|
Sg => indeclN aHmar ! d ! c ;
|
||||||
Dl => dual 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 {
|
APosit Fem n d c => case n of {
|
||||||
Sg => indeclN HamrA' ! d ! c;
|
Sg => indeclN HamrA' ! d ! c;
|
||||||
Dl => dual ((tk 2 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
|
AComp d c => indeclN aHmar ! d ! c
|
||||||
};
|
};
|
||||||
@@ -1011,7 +1011,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
|||||||
table {
|
table {
|
||||||
Sg => sing kitAb ;
|
Sg => sing kitAb ;
|
||||||
Dl => dual kitAb ;
|
Dl => dual kitAb ;
|
||||||
Pl => sing kutub
|
Pl => brkPl kutub
|
||||||
};
|
};
|
||||||
|
|
||||||
--takes the sound noun in singular and gives the
|
--takes the sound noun in singular and gives the
|
||||||
@@ -1024,6 +1024,16 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
|||||||
Pl => plurF lawHa
|
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
|
--takes the sound noun in singular and gives the
|
||||||
--complete inflection table of sound masculine plural nominals
|
--complete inflection table of sound masculine plural nominals
|
||||||
sndm : Str -> NTable =
|
sndm : Str -> NTable =
|
||||||
@@ -1034,21 +1044,39 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
|||||||
Pl => plurM muzAric
|
Pl => plurM muzAric
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
-- takes a singular or broken plural word and tests the ending to
|
-- takes a singular or broken plural word and tests the ending to
|
||||||
-- determine the declension and gives the corresponding inf table
|
-- 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 {
|
\\s,c => defArt s c (case word of {
|
||||||
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 + (#hamza|#hamzaseat)
|
||||||
|
=> word + dec1sgNoDoubleAlif ! s ! c ;
|
||||||
lemma + "ة" => case s of {
|
lemma + "ة" => case s of {
|
||||||
Poss => lemma + "ت" + dec1sg ! s ! c ;
|
Poss => lemma + "ت" + dec1sg ! s ! c ;
|
||||||
_ => word + dec1sgNoDoubleAlif ! 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
|
-- takes a singular word and tests the ending to
|
||||||
-- determine the declension and gives the corresponding dual inf table
|
-- determine the declension and gives the corresponding dual inf table
|
||||||
@@ -1065,6 +1093,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
|||||||
\kalima ->
|
\kalima ->
|
||||||
\\s,c => defArt s c (mkAt kalima) + f_pl ! s ! c ;
|
\\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
|
-- takes a singular word and gives the corresponding sound
|
||||||
--plural masculine table. FIXME: consider declension 3
|
--plural masculine table. FIXME: consider declension 3
|
||||||
plurM : Str -> State => Case => Str =
|
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 ->
|
mkAt : Str -> Str = \bayDo ->
|
||||||
case bayDo of {
|
case bayDo of {
|
||||||
|
|||||||
Reference in New Issue
Block a user