(Ara) Handle defective nouns with sound feminine plural

This commit is contained in:
Inari Listenmaa
2018-12-21 15:53:50 +01:00
parent 487ba5a335
commit b25ae6bff8
2 changed files with 30 additions and 15 deletions

View File

@@ -104,6 +104,8 @@ resource ParadigmsAra = open
sdmN : Str -> Str -> Gender -> Species -> N ; sdmN : Str -> Str -> Gender -> Species -> N ;
--3 Proper names --3 Proper names
mkPN = overload { mkPN = overload {
@@ -185,7 +187,7 @@ resource ParadigmsAra = open
mkSubj : overload { mkSubj : overload {
mkSubj : Str -> Subj ; -- Default order Subord (=noun first and in accusative) mkSubj : Str -> Subj ; -- Default order Subord (=noun first and in accusative)
mkSubj : Str -> Order -> Subj -- Specify word order mkSubj : Str -> Order -> Subj -- Specify word order
} ; } ;
--2 Prepositions --2 Prepositions
-- --
@@ -364,9 +366,9 @@ resource ParadigmsAra = open
= attrN Sg ; = attrN Sg ;
mkN : Number -> N -> N -> N -- Compound nouns where attribute inflects in state, case and number mkN : Number -> N -> N -> N -- Compound nouns where attribute inflects in state, case and number
= attrN ; = attrN ;
mkN : N -> A -> N mkN : N -> A -> N
= mkAN ; = mkAN ;
mkN : N -> AP -> N mkN : N -> AP -> N
= mkAPN = mkAPN
} ; } ;
@@ -543,13 +545,15 @@ resource ParadigmsAra = open
}; };
sdfN = sdfN =
\root,sg,gen,spec -> \root,sg,gen,spec -> let {
let { kalimaStr = mkWord sg root; kalimaStr = case root of {
kalimaRaw : NTable = case gen of { x@? + y@? + "ي" => mkDefectiveAlifMaqsura (mkPat sg) (mkRoot3 root) ;
_ => mkWord sg root } ;
kalimaRaw : NTable = case gen of {
Fem => sndf kalimaStr ; Fem => sndf kalimaStr ;
Masc => sgMsndf kalimaStr } ; Masc => sgMsndf kalimaStr } ; -- TODO this isn't actually the case of gender, add an argument
kalima : NTable = \\n,d,c => kalima : NTable = \\n,d,c =>
rectifyHmz (kalimaRaw ! n ! d ! c) rectifyHmz (kalimaRaw ! n ! d ! c)
} in mkFullN kalima gen spec; } in mkFullN kalima gen spec;
sdmN = sdmN =
@@ -690,7 +694,7 @@ resource ParadigmsAra = open
mkSubj = overload { mkSubj = overload {
mkSubj : Str -> Subj = \s -> lin Subj {s = s ; o = Subord} ; mkSubj : Str -> Subj = \s -> lin Subj {s = s ; o = Subord} ;
mkSubj : Str -> Order -> Subj = \s,o -> lin Subj {s = s ; o = o} ; mkSubj : Str -> Order -> Subj = \s,o -> lin Subj {s = s ; o = o} ;
} ; } ;
dirV2 v = prepV2 v (casePrep acc) ; dirV2 v = prepV2 v (casePrep acc) ;

View File

@@ -55,6 +55,13 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
_ => error ("mkRoot2: too short root" ++ fcl) _ => error ("mkRoot2: too short root" ++ fcl)
}; };
mkPat : Str -> Pattern = \pat ->
case pat of {
w + "ف" + x + "ع" + y + "ل" + z
=> { h = w ; m1 = x; m2 = y; t = z} ;
w + "ف" + x + ("ع"|"ل") + y
=> { h = w ; m1 = x; m2 = ""; t = y}
} ;
--opers to interdigitize (make words out of roots and patterns: --opers to interdigitize (make words out of roots and patterns:
oper oper
@@ -65,6 +72,9 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
mkDefective : Pattern -> Root3 -> Str = \p,fcl -> mkDefective : Pattern -> Root3 -> Str = \p,fcl ->
p.h + fcl.f + p.m1 + fcl.c + p.t; p.h + fcl.f + p.m1 + fcl.c + p.t;
mkDefectiveAlifMaqsura : Pattern -> Root3 -> Str = \p,fcl ->
p.h + fcl.f + p.m1 + fcl.c + p.t + "َى" ;
mkHollow : Pattern -> Root3 -> Str = \p,fcl -> mkHollow : Pattern -> Root3 -> Str = \p,fcl ->
p.h + fcl.f + p.m1 + fcl.l + p.t; p.h + fcl.f + p.m1 + fcl.l + p.t;
@@ -85,14 +95,13 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
--takes a pattern string and root string and makes a word --takes a pattern string and root string and makes a word
mkWord : Str -> Str -> Str =\pS, rS -> mkWord : Str -> Str -> Str =\pS, rS ->
let pat = mkPat pS in
case pS of { case pS of {
w + "ف" + x + "ع" + y + "ل" + z => w + "ف" + x + "ع" + y + "ل" + z =>
let pat = { h = w ; m1 = x; m2 = y; t = z} in
case rS of { case rS of {
x@? + y@? + "ّ" => mkStrong pat (mkRoot3 (x+y+y)) ; -- In principle, shadda shouldn't be in the root, but if someone puts one, this should fix it. /IL 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) } ; _ => mkStrong pat (mkRoot3 rS) } ;
w + "ف" + x + "ع" + y => w + "ف" + x + "ع" + y =>
let pat = { h = w ; m1 = x; m2 = ""; t = y} in
case rS of { case rS of {
x + "ّ" => mkBilit pat (mkRoot2 x) ; -- fc~ x + "ّ" => mkBilit pat (mkRoot2 x) ; -- fc~
x@? + y@? + ("و"|"ي") x@? + y@? + ("و"|"ي")
@@ -1016,7 +1025,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
--takes the sound noun in singular and gives the --takes the sound noun in singular and gives the
--complete noun inflection table of sound feminine plural --complete noun inflection table of sound feminine plural
sndf : Str -> NTable = sndf : Str -> NTable =
\lawHa -> \lawHa ->
table { table {
Sg => sing lawHa ; Sg => sing lawHa ;
@@ -1049,7 +1058,6 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- determine the declension and gives the corresponding inf table -- determine the declension and gives the corresponding inf table
brkPl : 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 (dec1sg ! s ! c) ; -- nisba
lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ; -- 2nd declension lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ; -- 2nd declension
_ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ; _ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ;
lemma + (#hamza|#hamzaseat) lemma + (#hamza|#hamzaseat)
@@ -1219,6 +1227,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
} }
}; };
-- TODO: this isn't actually because of gender, it "just happens".
-- Refactor the whole sdfN and make variant with a parameter
-- whether to insert a و or ه or something else /IL
mkAtMasc : Str -> Str = \x -> mkAtMasc : Str -> Str = \x ->
case x of { case x of {
y + "ة" => y + "ات"; y + "ة" => y + "ات";