From b25ae6bff801add6b1c4408194078ec8be699875 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 21 Dec 2018 15:53:50 +0100 Subject: [PATCH 1/3] (Ara) Handle defective nouns with sound feminine plural --- src/arabic/ParadigmsAra.gf | 24 ++++++++++++++---------- src/arabic/ResAra.gf | 21 ++++++++++++++++----- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 8aa944c58..38a9f5961 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -104,6 +104,8 @@ resource ParadigmsAra = open sdmN : Str -> Str -> Gender -> Species -> N ; + + --3 Proper names mkPN = overload { @@ -185,7 +187,7 @@ resource ParadigmsAra = open mkSubj : overload { mkSubj : Str -> Subj ; -- Default order Subord (=noun first and in accusative) mkSubj : Str -> Order -> Subj -- Specify word order - } ; + } ; --2 Prepositions -- @@ -364,9 +366,9 @@ resource ParadigmsAra = open = attrN Sg ; mkN : Number -> N -> N -> N -- Compound nouns where attribute inflects in state, case and number = attrN ; - mkN : N -> A -> N + mkN : N -> A -> N = mkAN ; - mkN : N -> AP -> N + mkN : N -> AP -> N = mkAPN } ; @@ -543,13 +545,15 @@ resource ParadigmsAra = open }; sdfN = - \root,sg,gen,spec -> - let { kalimaStr = mkWord sg root; - kalimaRaw : NTable = case gen of { + \root,sg,gen,spec -> let { + kalimaStr = case root of { + x@? + y@? + "ي" => mkDefectiveAlifMaqsura (mkPat sg) (mkRoot3 root) ; + _ => mkWord sg root } ; + kalimaRaw : NTable = case gen of { Fem => sndf kalimaStr ; - Masc => sgMsndf kalimaStr } ; - kalima : NTable = \\n,d,c => - rectifyHmz (kalimaRaw ! n ! d ! c) + Masc => sgMsndf kalimaStr } ; -- TODO this isn't actually the case of gender, add an argument + kalima : NTable = \\n,d,c => + rectifyHmz (kalimaRaw ! n ! d ! c) } in mkFullN kalima gen spec; sdmN = @@ -690,7 +694,7 @@ resource ParadigmsAra = open mkSubj = overload { mkSubj : Str -> Subj = \s -> lin Subj {s = s ; o = Subord} ; mkSubj : Str -> Order -> Subj = \s,o -> lin Subj {s = s ; o = o} ; - } ; + } ; dirV2 v = prepV2 v (casePrep acc) ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index f39acc207..2218ddc17 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -55,6 +55,13 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { _ => 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: oper @@ -65,6 +72,9 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { mkDefective : Pattern -> Root3 -> Str = \p,fcl -> 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 -> 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 mkWord : Str -> Str -> Str =\pS, rS -> + let pat = mkPat pS in case pS of { w + "ف" + x + "ع" + y + "ل" + z => - let pat = { h = w ; m1 = x; m2 = y; t = z} in 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) } ; w + "ف" + x + "ع" + y => - let pat = { h = w ; m1 = x; m2 = ""; t = y} in case rS of { x + "ّ" => mkBilit pat (mkRoot2 x) ; -- fc~ x@? + y@? + ("و"|"ي") @@ -1016,7 +1025,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> --takes the sound noun in singular and gives the --complete noun inflection table of sound feminine plural - sndf : Str -> NTable = + sndf : Str -> NTable = \lawHa -> table { Sg => sing lawHa ; @@ -1049,7 +1058,6 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> -- determine the declension and gives the corresponding inf table brkPl : Str -> State => Case => Str = \word -> \\s,c => defArt s c (case word of { - lemma + "ِيّ" => fixShd word (dec1sg ! s ! c) ; -- nisba lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ; -- 2nd declension _ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ; 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 -> case x of { y + "ة" => y + "ات"; From 88f425e78839bcb7e753568fabe348bfb83f8a59 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 21 Dec 2018 17:01:04 +0100 Subject: [PATCH 2/3] (Ara) Add EmbedS,QS,VP --- src/arabic/MissingAra.gf | 3 --- src/arabic/SentenceAra.gf | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/arabic/MissingAra.gf b/src/arabic/MissingAra.gf index c8234cbae..fa52d74a5 100644 --- a/src/arabic/MissingAra.gf +++ b/src/arabic/MissingAra.gf @@ -12,9 +12,6 @@ oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ; oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ; oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ; oper DetNP : Det -> NP = notYet "DetNP" ; -oper EmbedQS : QS -> SC = notYet "EmbedQS" ; -oper EmbedS : S -> SC = notYet "EmbedS" ; -oper EmbedVP : VP -> SC = notYet "EmbedVP" ; oper ExistIP : IP -> QCl = notYet "ExistIP" ; oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ; oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 854daaf4c..cea5f38eb 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -58,10 +58,10 @@ concrete SentenceAra of Sentence = CatAra ** open -- SlashVS np vs sslash = TODO --- EmbedS s = {s = conjThat ++ s.s} ; --- EmbedQS qs = {s = qs.s ! QIndir} ; --- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr --- + EmbedS s = {s = "أَنْ" ++ s.s ! Verbal} ; + EmbedQS qs = {s = qs.s ! QIndir} ; + EmbedVP vp = {s = uttVP vp ! Masc} ; + UseCl t p cl = {s = \\o => t.s ++ p.s ++ From 3542a5260dacc670f55da7f1f235458ecaa8f5d5 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 21 Dec 2018 23:06:44 +0100 Subject: [PATCH 3/3] (Ara) Add new mkN constructor, for forcing a number in adjective --- src/arabic/ParadigmsAra.gf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 38a9f5961..988e19286 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -80,6 +80,7 @@ resource ParadigmsAra = open mkN : N -> N -> N ; -- Compound noun with singular genitive attribute, but inflects in state. mkN : Number -> N -> N -> N ; -- Compound noun with genitive attribute, but inflects in state. Attribute's number specified by 1st arg. mkN : N -> A -> N ; -- Force adjective modifier into the noun. Adjective inflects in state, case and number. + mkN : Number -> N -> A -> N ; -- Force adjective modifier into the noun. Adjective inflects in state and case. Adjective's number specified by 1st arg. mkN : N -> AP -> N ; -- Force AP modifier into the noun. AP inflects in state, case and number. --- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural --- = sdfN ; @@ -368,6 +369,8 @@ resource ParadigmsAra = open = attrN ; mkN : N -> A -> N = mkAN ; + mkN : Number -> N -> A -> N + = \num,n,a -> mkAPNumN n (A.PositA a) num ; mkN : N -> AP -> N = mkAPN } ; @@ -385,6 +388,11 @@ resource ParadigmsAra = open ++ ap.s ! n.h ! n.g ! num ! s ! c } ; + mkAPNumN : N -> AP -> Number -> N = \n,ap,forceNum -> n ** { + s2 = \\num,s,c => n.s2 ! num ! s ! c + ++ ap.s ! Hum ! n.g ! forceNum ! s ! c + } ; -- Hum because we want to override the smartness in number agreement + dualN : N -> N = \n -> n ** {isDual=True} ; proDrop : NP -> NP ; -- Force a NP to lose its string, only contributing with its agreement.