diff --git a/src/arabic/AdjectiveAra.gf b/src/arabic/AdjectiveAra.gf index baae0935e..ec15d5355 100644 --- a/src/arabic/AdjectiveAra.gf +++ b/src/arabic/AdjectiveAra.gf @@ -21,7 +21,7 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in { -- $SuperlA$ belongs to determiner syntax in $Noun$. -- ComplA2 a np = { - s = \\sp,g,n,st,c => a.s ! APosit g n st c ++ a.c2 ++ np.s ! Gen ; + s = \\sp,g,n,st,c => a.s ! APosit g n st c ++ a.c2.s ++ np.s ! a.c2.c ; } ; -- -- ReflA2 a = { diff --git a/src/arabic/AdverbAra.gf b/src/arabic/AdverbAra.gf index d7a90387a..d6f8eb9f3 100644 --- a/src/arabic/AdverbAra.gf +++ b/src/arabic/AdverbAra.gf @@ -10,7 +10,7 @@ concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in { -- s = cadv.s ++ a.s ! AAdv ++ "تهَن" ++ s.s -- } ; - PrepNP prep np = {s = prep.s ++ np.s ! Gen} ; + PrepNP prep np = {s = prep.s ++ np.s ! prep.c} ; -- AdAdv = cc2 ; -- diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index d1fe2f494..95e4aed61 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -12,31 +12,31 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { S = {s : Str} ; QS = {s : QForm => Str} ; --- RS = {s : Agr => Str} ; + RS = {s : Agr => Case => Str} ; -- Sentence - Cl = ResAra.Cl ; -- {s : ResAra.Tense => Polarity => Order => Str} ; + Cl = ResAra.Cl ; -- {s : Tense => Polarity => Order => Str} ; ClSlash = ResAra.ClSlash ; Imp = {s : Polarity => Gender => ResAra.Number => Str} ; -- Question - QCl = ResAra.QCl ; -- {s : ResAra.Tense => Polarity => QForm => Str} ; + QCl = ResAra.QCl ; -- {s : Tense => Polarity => QForm => Str} ; IDet = ResAra.IDet ; -- {s : Gender => State => Case => Str ; n : Number} ; IP = ResAra.IP ; -- {s : (isPred : Bool) => State => Case => Str ; n : Number} ; IComp = ResAra.IComp ; -- IQuant = {s : State => Case => Str} ; --- ----- Relative --- --- RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ; --- RP = {s : Case => Str ; a : RAgr} ; --- + +-- Relative + + RCl = ResAra.RCl ; + RP = ResAra.RP ; + -- Verb VP = ResAra.VP ; - VPSlash = ResAra.VPSlash ; -- VP ** {c2:Str} + VPSlash = ResAra.VPSlash ; -- VP ** {c2:Preposition} Comp = ResAra.Comp ; --{s : AAgr => Case => Str} ; -- SC = {s : Str} ; -- @@ -72,21 +72,21 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { Conj = {s : Str ; n : ResAra.Number} ; -- DConj = {s1,s2 : Str ; n : ResAra.Number} ; -- Subj = {s : Str} ; - Prep = {s : Str} ; + Prep = ResAra.Preposition ; -- Open lexical classes, e.g. Lexicon V, VS, VQ, VA = ResAra.Verb ; -- = {s : VForm => Str} ; - V2, V2A = ResAra.Verb ** {c2 : Str} ; - VV, V2V, V2S, V2Q = ResAra.Verb ** {c2 : Str} ; --- AR - V3 = ResAra.Verb ** {c2, c3 : Str} ; + V2, V2A = ResAra.Verb2 ; + VV, V2S, V2Q = ResAra.Verb2 ; + V2V, V3 = ResAra.Verb3 ; A = ResAra.Adj ; - A2 = ResAra.Adj ** {c2 : Str} ; + A2 = ResAra.Adj2 ; N = ResAra.Noun ; - N2 = ResAra.Noun ** {c2 : Str} ; - N3 = ResAra.Noun ** {c2, c3 : Str} ; + N2 = ResAra.Noun2 ; + N3 = ResAra.Noun3 ; PN = {s : Case => Str; g : Gender; h : Species} ; linref diff --git a/src/arabic/LexiconAra.gf b/src/arabic/LexiconAra.gf index 8178ce9f7..4f3cff580 100644 --- a/src/arabic/LexiconAra.gf +++ b/src/arabic/LexiconAra.gf @@ -24,7 +24,7 @@ flags beautiful_A = sndA "جمل" "فَعِيل" ; become_VA = mkVA (v4 "صبح") ; beer_N = sdfN "بير" "فِعلة" Fem NoHum ; - beg_V2V = dirV2 (v5 "وسل") ; + beg_V2V = mkV2V (mkVV (v5 "وسل")) noPrep ; big_A = sndA "كبر" "فَعِيل" ; bike_N = sdfN "درج" "فَعّالة" Fem NoHum ; bird_N = brkN "طير" "فَعل" "فُعُول" Masc NoHum; diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index d20b3e787..834b9ad9f 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -90,7 +90,7 @@ lin } ; DetQuant quant num = quant ** { - s = \\h,g,c => quant.s ! Pl ! h ! g ! c + s = \\h,g,c => quant.s ! sizeToNumber num.n ! h ! g ! c ++ num.s ! g ! (toDef quant.d num.n) ! c ; n = num.n; isNum = -- Num may come from NumCard : Card -> Num @@ -180,7 +180,7 @@ lin Use3N3 n3 = n3 ** {c2 = n3.c3} ; ComplN2 n2 np = UseN n2 ** --- IL - {s = \\n,s,c => n2.s ! n ! s ! c ++ n2.c2 ++ np.s ! Gen} ; + {s = \\n,s,c => n2.s ! n ! s ! c ++ n2.c2.s ++ np.s ! n2.c2.c} ; ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; @@ -188,7 +188,8 @@ lin AdjCN ap cn = cn ** { adj = \\n,d,c => ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c }; - -- RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ; + + RelCN cn rs = cn ** {s = \\n,s,c => cn.s ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c}; -- AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ; -- -- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ; diff --git a/src/arabic/OrthoAra.gf b/src/arabic/OrthoAra.gf index 0e5d7e196..c5968270d 100644 --- a/src/arabic/OrthoAra.gf +++ b/src/arabic/OrthoAra.gf @@ -6,6 +6,8 @@ flags coding=utf8 ; vow : pattern Str = #("َ" | "ِ" | "ُ" | "ً" | "ٍ" | "ٌ") ; + weak : pattern Str = #("و"|"ي") ; + -- "Sun letters": assimilate with def. article sun : pattern Str = #("ت"|"ث"|"د"|"ذ"|"ر"|"ز"|"س"|"ش"|"ص"|"ض"|"ط"|"ظ"|"ل"|"ن") ; @@ -17,6 +19,12 @@ flags coding=utf8 ; _ => word + suffix } ; + -- IL: using this to reuse patterns for weak verbs, might be strange/wrong + rmSukun : Str -> Str = \s -> case s of { + x + "ْ" + y => x + y ; + _ => s + } ; + -- Hamza hamza : pattern Str = #("ء"|"؟") ; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 035903273..962c0158d 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -35,9 +35,16 @@ resource ParadigmsAra = open oper --- Prepositions are used in many-argument functions for rection. + Case : Type ; + nom : Case ; + acc : Case ; + gen : Case ; +-- Prepositions are used in many-argument functions for rection. Preposition : Type ; + noPrep : Preposition ; + casePrep : Case -> Preposition ; + --- TODO: continue, add all over the grammar Gender : Type ; masc : Gender ; @@ -100,13 +107,17 @@ resource ParadigmsAra = open --3 Relational nouns - mkN2 = overload { - mkN2 : N -> Preposition -> N2 = prepN2 ; - mkN2 : N -> N2 = \n -> lin N2 (n ** {c2 = []}) ; - mkN2 : Str -> N2 = \str -> lin N2 (smartN str ** {c2 = []}) + mkN2 : overload { + mkN2 : N -> Preposition -> N2 ; -- ready-made preposition + mkN2 : (mother : N) -> (of_ : Str) -> N2 ; -- preposition given as a string + mkN2 : N -> N2 ; -- no preposition + mkN2 : Str -> N2 ; -- no preposition, predictable inflection } ; - mkN3 : N -> Preposition -> Preposition -> N3 ; + mkN3 : overload { + mkN3 : N -> Preposition -> Preposition -> N3 ; -- ready-made prepositions + mkN3 : N -> Str -> Str -> N3 ; -- prepositions given as strings + } ; --2 Adjectives @@ -135,7 +146,10 @@ resource ParadigmsAra = open -- -- Two-place adjectives need a preposition for their second argument. - mkA2 : A -> Preposition -> A2 ; + mkA2 : overload { + mkA2 : A -> Preposition -> A2 ; + mkA2 : A -> Str -> A2 + } ; --2 Adverbs @@ -152,14 +166,12 @@ resource ParadigmsAra = open --2 Prepositions -- -- A preposition as used for rection in the lexicon, as well as to --- build $PP$s in the resource API, just requires a string. - - mkPrep : Str -> Prep - = \s -> lin Prep {s = mkPreposition s} ; -- preposition in the sense of RGL abstract syntax - - mkPreposition : Str -> Preposition ; -- just a string, for internal use - +-- build $PP$s in the resource API. Requires a string and a case. + mkPrep : overload { + mkPrep : Str -> Prep ; + mkPrep : Str -> Case -> Prep + } ; -- preposition in the sense of RGL abstract syntax --2 Verbs -- Overloaded operations @@ -212,10 +224,11 @@ resource ParadigmsAra = open -- Two-place verbs need a preposition, except the special case with direct object. -- (transitive verbs). Notice that a particle comes from the $V$. - mkV2 = overload { - mkV2 : V -> V2 = dirV2 ; - mkV2 : V -> Preposition -> V2 = prepV2 ; - mkV2 : Str -> V2 = strV2; + mkV2 : overload { + mkV2 : V -> V2 ; -- No preposition + mkV2 : V -> Str -> V2 ; -- Preposition as string, default case genitive + mkV2 : V -> Preposition -> V2 ; -- Ready-made preposition + mkV2 : Str -> V2 ; -- Predictable verb conjugation, no preposition } ; dirV2 : V -> V2 ; @@ -225,9 +238,15 @@ resource ParadigmsAra = open -- Three-place (ditransitive) verbs need two prepositions, of which -- the first one or both can be absent. - mkV3 : V -> Preposition -> Preposition -> V3 ; -- speak, with, about - dirV3 : V -> Preposition -> V3 ; -- give,_,to - dirdirV3 : V -> V3 ; -- give,_,_ + mkV3 : overload { + mkV3 : V -> Preposition -> Preposition -> V3 ; -- speak, with, about + mkV3 : V -> (to : Str) -> (about:Str) -> V3 -- like above, but with strings as arguments (default complement case genitive) + } ; + dirV3 : overload { + dirV3 : V -> Preposition -> V3 ; -- give,_,to + dirV3 : V -> (to : Str) -> V3 -- like above, but with string as argument (default complement case genitive) + } ; + dirdirV3 : V -> V3 ; -- give,_,_ --3 Other complement patterns -- @@ -241,7 +260,11 @@ resource ParadigmsAra = open mkVV : V -> VV = regVV ; mkVV : V -> Str -> VV = c2VV } ; - mkV2V : V -> Str -> Str -> V2V ; + mkV2V : overload { + mkV2V : V -> Str -> Str -> V2V ; + mkV2V : V -> Preposition -> Preposition -> V2V ; + mkV2V : VV -> Preposition -> V2V + } ; mkVA : V -> VA ; mkV2A : V -> Str -> V2A ; mkVQ : V -> VQ ; @@ -266,9 +289,16 @@ resource ParadigmsAra = open -- The definitions should not bother the user of the API. So they are -- hidden from the document. + Case = ResAra.Case ; + nom = ResAra.Nom ; + acc = ResAra.Acc ; + gen = ResAra.Gen ; +-- Prepositions are used in many-argument functions for rection. - Preposition = Str ; + Preposition = ResAra.Preposition ; + noPrep = {s=[]; c=nom} ; + casePrep c = {s=[]; c=c} ; Gender = ResAra.Gender ; masc = ResAra.Masc ; @@ -283,6 +313,24 @@ resource ParadigmsAra = open vu = ResAra.u ; vi = ResAra.i ; + mkPrep = overload { + mkPrep : Str -> Prep = \s -> + lin Prep (mkPreposition s) ; + mkPrep : Str -> Case -> Prep = \s,c -> + lin Prep (mkPreposition s c) + } ; + + + mkV2 = overload { + mkV2 : V -> V2 = dirV2 ; + mkV2 : V -> Str -> V2 = \v,p -> prepV2 v (mkPreposition p); + mkV2 : V -> Preposition -> V2 = prepV2 ; + mkV2 : Str -> V2 = strV2; + } ; + + prepV2 : V -> Preposition -> V2 = \v,p -> v ** {s = v.s ; c2 = p ; lock_V2 = <>} ; + strV2 : Str -> V2 = \str -> dirV2 (mkV str) ; + mkN = overload { mkN : (sg : Str) -> N -- non-human regular nouns = smartN ; @@ -330,8 +378,6 @@ resource ParadigmsAra = open lock_V = <> } ; - - v1' : Str -> Vowel -> Vowel -> Verb = \rootStr,vPerf,vImpf -> let { root = mkRoot3 rootStr } in @@ -351,7 +397,7 @@ resource ParadigmsAra = open } in { s = case root.l of { - "و"|"ي" => (v2defective root).s; + #weak => (v2defective root).s; _ => (v2sound root).s }; lock_V = <> @@ -368,16 +414,12 @@ resource ParadigmsAra = open v4 = \rootStr -> - let { - root = mkRoot3 rootStr - } in { - s = - case root.l of { - "و"|"ي" => (v4defective root).s; - _ => (v4sound root).s - }; - lock_V = <> - }; + let root : Root3 = mkRoot3 rootStr ; + verb : Verb = case rootStr of { + ? + #hamza + #weak => v4doubleweak root ; + _ + #weak => v4defective root ; + _ => v4sound root } ; + in lin V verb ; v5 = @@ -473,10 +515,21 @@ resource ParadigmsAra = open lock_PN = <> }; + mkN2 = overload { + mkN2 : N -> Preposition -> N2 = prepN2 ; + mkN2 : N -> Str -> N2 = \n,s -> prepN2 n (mkPreposition s); + mkN2 : N -> N2 = \n -> lin N2 (n ** {c2 = noPrep}) ; + mkN2 : Str -> N2 = \str -> lin N2 (smartN str ** {c2 = noPrep}) + } ; - prepN2 : N -> Str -> N2 = \n,p -> lin N2 (n ** {c2 = p}) ; + prepN2 : N -> Preposition -> N2 = \n,p -> lin N2 (n ** {c2 = p}) ; - mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ; + mkN3 = overload { + mkN3 : N -> Preposition -> Preposition -> N3 = \n,p,q -> + lin N3 (n ** {c2 = p ; c3 = q}) ; + mkN3 : N -> Str -> Str -> N3 = \n,p,q -> + lin N3 (n ** {c2 = mkPreposition p ; c3 = mkPreposition q}) ; + } ; mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> { s = @@ -575,45 +628,67 @@ resource ParadigmsAra = open s = clr eaHmar HamrA' Humr; }; - mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ; + mkA2 = overload { + mkA2 : A -> Preposition -> A2 = prepA2 ; + mkA2 : A -> Str -> A2 = \a,p -> prepA2 a (mkPreposition p) + } ; - mkAdv x = ss x ** {lock_Adv = <>} ; - mkAdV x = ss x ** {lock_AdV = <>} ; - mkAdA x = ss x ** {lock_AdA = <>} ; + prepA2 : A -> Preposition -> A2 = \a,p -> lin A2 (a ** {c2 = p}) ; - mkPreposition p = p ; + mkAdv x = lin Adv (ss x) ; + mkAdV x = lin AdV (ss x) ; + mkAdA x = lin AdA (ss x) ; - prepV2 : V -> Preposition -> V2 = \v,p -> v ** {s = v.s ; c2 = p ; lock_V2 = <>} ; - strV2 : Str -> V2 = \str -> dirV2 (mkV str) ; - dirV2 v = prepV2 v [] ; + dirV2 v = prepV2 v (casePrep acc) ; - mkV3 v p q = v ** {s = v.s ; c2 = p ; c3 = q ; lock_V3 = <>} ; - dirV3 v p = mkV3 v [] p ; - dirdirV3 v = dirV3 v [] ; + mkV3 = overload { + mkV3 : V -> Preposition -> Preposition -> V3 = \v,p,q -> + lin V3 (prepV3 v p q) ; + mkV3 : V -> Str -> Str -> V3 = \v,p,q -> + lin V3 (v ** {s = v.s ; c2 = mkPreposition p ; c3 = mkPreposition q}) + } ; + + prepV3 : V -> Preposition -> Preposition -> Verb3 = \v,p,q -> + v ** {s = v.s ; c2 = p ; c3 = q} ; + + dirV3 = overload { + dirV3 : V -> Preposition -> V3 = \v,p -> mkV3 v (casePrep acc) p ; + dirV3 : V -> Str -> V3 = \v,s -> mkV3 v (casePrep acc) (mkPreposition s) + } ; + + dirdirV3 v = dirV3 v (casePrep acc) ; mkVS v = v ** {lock_VS = <>} ; mkVQ v = v ** {lock_VQ = <>} ; - regVV : V -> VV = \v -> lin VV v ** {c2 = "أَنْ"} ; - c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = prep} ; + regVV : V -> VV = \v -> lin VV v ** {c2 = mkPreposition "أَنْ"} ; + c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = noPrep} ; V0 : Type = V ; ---- V2S, V2V, V2Q, V2A : Type = V2 ; AS, A2S, AV : Type = A ; A2V : Type = A2 ; - mkV0 v = v ** {lock_V = <>} ; - mkV2S v p = mkV2 v p ** {lock_V2S = <>} ; - mkV2V v p t = mkV2 v p ** {s4 = t ; lock_V2V = <>} ; - mkVA v = v ** {lock_VA = <>} ; - mkV2A v p = mkV2 v p ** {lock_V2A = <>} ; - mkV2Q v p = mkV2 v p ** {lock_V2Q = <>} ; + mkV0 v = v ; + mkV2S v p = lin V2S (prepV2 v (mkPreposition p)) ; + mkV2V = overload { + mkV2V : V -> Str -> Str -> V2V = \v,p,q -> + lin V2V (prepV3 v (mkPreposition p) (mkPreposition q)) ; + mkV2V : V -> Preposition -> Preposition -> V2V = \v,p,q -> + lin V2V (prepV3 v p q) ; + mkV2V : VV -> Preposition -> V2V = \vv,p -> + lin V2V (vv ** {c2 = p ; c3 = vv.c2}) ; + } ; + mkVA v = v ** {lock_VA = <>} ; + mkV2A v p = lin V2A (prepV2 v (mkPreposition p)); + mkV2Q v p = lin V2Q (prepV2 v (mkPreposition p)); + + mkAS, + mkAV = \a -> a ; + mkA2S, + mkA2V = \a,p -> prepA2 a (mkPreposition p) ; - mkAS v = v ** {lock_A = <>} ; - mkA2S v p = mkA2 v p ** {lock_A = <>} ; - mkAV v = v ** {lock_A = <>} ; - mkA2V v p = mkA2 v p ** {lock_A2 = <>} ; smartN : Str -> N = \s -> case s of { diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index ecfa1f8c1..af35450c5 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -8,7 +8,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA s = \\t,p => table { QIndir => "إِذا" ++ cl.s ! t ! p ! Verbal ; - QDir => "هَل" ++ cl.s ! t ! p ! Verbal + QDir => "هَلْ" ++ cl.s ! t ! p ! Verbal } }; @@ -44,11 +44,11 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA CompIAdv iadv = { s = \\_ => iadv.s ; n = ResAra.Sg } ; - -- QCl = {s : R.Tense => Polarity => QForm => Str} ; + -- QCl = {s : Tense => Polarity => QForm => Str} ; QuestSlash ip cl = { ----IL just guessing s = \\t,p,qf => let o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing - in cl.c2 ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o + in cl.c2.s ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o } ; --IL guessed diff --git a/src/arabic/RelativeAra.gf b/src/arabic/RelativeAra.gf index 3cc0a9cd2..f3a0645b2 100644 --- a/src/arabic/RelativeAra.gf +++ b/src/arabic/RelativeAra.gf @@ -1,35 +1,45 @@ -concrete RelativeAra of Relative = CatAra ** open ResAra in { - flags coding=utf8; --- --- flags optimize=all_subs ; --- --- lin --- --- RelCl cl = { --- s = \\t,a,p,_ => "سُعه" ++ "تهَت" ++ cl.s ! t ! a ! p ! ODir --- } ; --- --- RelVP rp vp = { --- s = \\t,ant,b,ag => --- let --- agr = case rp.a of { --- RNoAg => ag ; --- RAg a => a --- } ; --- cl = mkClause (rp.s ! Nom) agr vp --- in --- cl.s ! t ! ant ! b ! ODir --- } ; --- +concrete RelativeAra of Relative = CatAra ** open ResAra, SentenceAra in { + flags coding=utf8; + + lin + + -- RelCl cl = { + -- s = \\t,p,agr,c => IdRP.s ! agr2ragr agr c ++ cl.s ! t ! p ! Nominal + -- } ; + + -- : RP -> VP -> RCl ; -- who loves John + RelVP rp vp = { + s = \\t,p,agr,c => + let + npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ; + np = {s = npS ; a = agr} ; + cl = PredVP np vp ; + in + cl.s ! t ! p ! Nominal + } ; + + -- : RP -> ClSlash -> RCl ; -- whom John loves + -- TODO: add resumptive pronouns -- RelSlash rp slash = { --- s = \\t,a,p,_ => slash.c2 ++ rp.s ! Acc ++ slash.s ! t ! a ! p ! ODir -- } ; -- -- FunRP p np rp = { -- s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ; -- a = RAg np.a -- } ; --- --- IdRP = mkIP "وهِعه" "وهِعه" "وهْسي" Sg ** {a = RNoAg} ; --- + + IdRP = + { s = table { + RSg Masc => "اَلَّذِي" ; + RSg Fem => "اَلَّتِي" ; + RPl Masc => "اَلَّذِين" ; + RPl Fem => "اَللَّاتِي" ; + RDl Masc Bare => "اَللَّذَيْن" ; + RDl Masc Nom => "اَللَّذَانِ" ; + RDl Masc _ => "اَللَّذَيْنِ" ; + RDl Fem Bare => "اَللَّتَيْن" ; + RDl Fem Nom => "اَللَّتَانِ" ; + RDl Fem _ => "اَللَّتَيْنِ" + } + } ; } diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 73b423c2a..7841118e4 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -19,7 +19,6 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { Gender = Masc | Fem ; Case = Nom | Acc | Gen | Bare ; -- 1st person poss. suff. overrides case - Person = P1 | P2 | P3 ; Species = NoHum | Hum ; State = Def | Indef | Const | Poss ; -- ة turns into ت @@ -27,7 +26,6 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { -- case vowel retained Mood = Ind | Cnj | Jus ; Voice = Act | Pas ; - Tense = Pres | Past | Fut ; Order = Verbal | Nominal ; oper @@ -108,10 +106,22 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { NTable = Number => State => Case => Str; + Preposition : Type = {s : Str ; c : Case} ; Noun : Type = {s : NTable ; g : Gender; h : Species} ; --- Adj : Type = {s : Gender => NTable} ; + Noun2 : Type = Noun ** {c2 : Preposition} ; + Noun3 : Type = Noun2 ** {c3 : Preposition} ; + + mkPreposition = overload { + mkPreposition : Str -> Case -> Preposition = \s,c -> {s=s;c=c} ; + mkPreposition : Str -> Preposition = \s -> {s=s;c=Gen} ; + } ; + Adj : Type = {s : AForm => Str} ; + Adj2 : Type = Adj ** {c2 : Preposition} ; + Verb : Type = {s : VForm => Str} ; + Verb2 : Type = Verb ** {c2 : Preposition} ; + Verb3 : Type = Verb2 ** {c3 : Preposition} ; AP : Type = {s : Species => Gender => NTable } ; uttAP : AP -> (Gender => Str) ; @@ -127,7 +137,6 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { isNum : Bool } ; - uttNum : NumOrdCard -> (Gender => Str) ; uttNum n = \\g => n.s ! g ! Def ! Nom ; ----IL @@ -263,8 +272,11 @@ oper } ; --macro for defective verbs: - verbDef : DefForms -> Vowel -> Verb = - \vforms,vowImpf -> + verbDef : DefForms -> Vowel -> Verb = verbDefBool False ; + verbDoubleDef : DefForms -> Vowel -> Verb = verbDefBool True ; + + verbDefBool : Bool -> DefForms -> Vowel -> Verb = + \isDoubleDef,vforms,vowImpf -> let { rama = vforms ! 0 ; -- VPerf Act (Per3 Masc Sg) ramay = vforms ! 1 ; -- VPerf Act (Per3 Fem Pl) @@ -280,13 +292,14 @@ oper patPerf = patDefPerf rama ramay rumi rumu rumiy ; patImpfAct = patDefImpfAct armi armu ; - patImp = patDefImp Irmi Irmu + patImp = patDefImp Irmi Irmu ; + suffixImpf = case isDoubleDef of {True => suffixImpfDoubleDef ; _ => suffixImpfDef} } in { s = table { - VPerf v pgn => patPerf ! v ! pgn + suffixPerfDef v ! pgn ; - VImpf m Act pgn => prefixImpf ! pgn + patImpfAct ! pgn + suffixImpfDef Act vowImpf ! m ! pgn ; - VImpf m Pas pgn => prefixImpf ! pgn + urma + suffixImpfDef Pas vowImpf ! m ! pgn ; - VImp g n => patImp ! g ! n + suffixImpfDef Act vowImpf ! Jus ! Per2 g n ; + VPerf v pgn => patPerf ! v ! pgn + suffixPerfDef v ! pgn ; + VImpf m Act pgn => prefixImpf ! pgn + patImpfAct ! pgn + suffixImpf Act vowImpf ! m ! pgn ; + VImpf m Pas pgn => prefixImpf ! pgn + urma + suffixImpf Pas vowImpf ! m ! pgn ; + VImp g n => patImp ! g ! n + suffixImpf Act vowImpf ! Jus ! Per2 g n ; VPPart => ppart } } ; @@ -352,7 +365,6 @@ oper Per1 Plur => "نَا" } ; - suffixImpfDef : Voice -> Vowel -> Mood => PerGenNum => Str = \vc,vw -> let { default : Mood -> Str = \m -> @@ -389,6 +401,10 @@ oper } } ; + -- does this even happen other than with رءي? /IL + suffixImpfDoubleDef : Voice -> Vowel -> Mood => PerGenNum => Str = \vc,vw -> + \\m,p => rmSukun (suffixImpfDef vc vw ! m ! p) ; + --now is used for the sound, assimilated (weak C1), and when C1 = hamza: v1sound : Root3 -> Vowel -> Vowel -> Verb = @@ -406,8 +422,8 @@ v1sound : Root3 -> Vowel -> Vowel -> Verb = }; uktab = mkStrong ufcal fcl ; euktub = case fcl.f of { - "؟"|"و"|"ي" => qif ; - _ => prefixImp ! vowImpf + ktub + "ء"|"و"|"ي" => qif ; + _ => prefixImp ! vowImpf + ktub }; maktUb = mkStrong mafcUl fcl } in @@ -506,7 +522,7 @@ toDefForms : (x1,_,_,_,_,_,_,_,_,_,x11 : Str) -> DefForms = 7 => h ; 8 => i ; 9 => j ; 10 => k } ; -def1Forms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf -> +v1DefForms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf -> let { _rmi = mkDefective (patDef1 ! vowImpf) rmy ; _rmu = mkDefective (patDef2 ! vowImpf) rmy ; @@ -524,11 +540,11 @@ def1Forms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf -> } in toDefForms rama ramay rumi rumu rumiy armi armu urma eirmi eirmu marmiy ; v1defective_a : Root3 -> Vowel -> Verb = \rmy,vowImpf -> - let vforms = def1Forms_perfA rmy vowImpf + let vforms = v1DefForms_perfA rmy vowImpf in verbDef vforms vowImpf ; v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4) - let vforms_a = def1Forms_perfA bqy vowImpf ; + let vforms_a = v1DefForms_perfA bqy vowImpf ; baqI = mkDefective facIl bqy ; baqiy = mkDefective facil bqy ; vforms_i = table { 0 => baqI ; @@ -599,23 +615,32 @@ v4sound : Root3 -> Verb = verb eaqnac euqnic uqnic uqnac eaqnic muqnac; -v4defective : Root3 -> Verb = \cTy -> + v4DefForms : Root3 -> DefForms = \cTy -> let { - cTa = mkDefective fca cTy; - cTu = mkDefective fcu cTy; - cTi = mkDefective fci cTy; - eacTa = "أَ" + cTa; - eacTay = mkStrong eafcal cTy ; - ucTi = "ُ" + cTi; - eucTi = "أُ" + cTi; - ucTu = "ُ" + cTu; - eucTu = "أُ" + cTu; - eucTiy = mkStrong eufcil cTy ; - ucTa = "ُ" + cTa; - eacTi = "أَ" + cTi; - eacTu = "أَ" + cTu; + _cTa = mkDefective fca cTy; + _cTu = mkDefective fcu cTy; + _cTi = mkDefective fci cTy; + eacTa = "أَ" + _cTa; -- VPerf Act (Per3 Masc Sg) + eacTay = mkStrong eafcal cTy ; -- VPerf Act (Per3 Fem Pl) + eucTi = "أُ" + _cTi; -- VPerf Pas (Per3 _ Sg) + eucTu = "أُ" + _cTu; -- VPerf Pas (Per3 Masc Pl) + eucTiy = mkStrong eufcil cTy ; -- VPerf Pas (Per3 Fem Pl) + ucTi = "ُ" + _cTi; -- VImpf Act + ucTu = "ُ" + _cTu; -- VImpf Act (Per2/3 Masc Pl) + ucTa = "ُ" + _cTa; -- VImpf Pas + eacTi = "أَ" + _cTi; -- VImp (Masc Sg / Fem _) + eacTu = "أَ" + _cTu; -- VImp Masc Pl mucTaY = "م" + ucTa +"ى" - } in verbDef (toDefForms eacTa eacTay eucTi eucTu eucTiy ucTi ucTu ucTa eacTi eacTu mucTaY) i; + } in toDefForms eacTa eacTay eucTi eucTu eucTiy ucTi ucTu ucTa eacTi eacTu mucTaY ; + +v4defective : Root3 -> Verb = \cTy -> + verbDef (v4DefForms cTy) i ; + +v4doubleweak : Root3 -> Verb = \r'y -> + let ry = r'y ** {c = ""} ; + vforms : DefForms = \\x => rmSukun (v4DefForms ry ! x) ; -- only remove the first sukun + in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef + v5sound : Root3 -> Verb = \nfs -> @@ -723,8 +748,8 @@ endVowel : Mood => Str = prefixImp : Vowel => Str = table { - u => "أُ" ; - _ => "إِ" + u => "اُ" ; + _ => "اِ" } ; patHollowPerf : (_,_,_,_ :Str) -> Voice => PerGenNum => Str = \xAf,xif,xIf,xuf -> @@ -1237,7 +1262,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> isPred = False }; - predVSlash : Verb ** {c2 : Str} -> VPSlash = \v -> + predVSlash : Verb2 -> VPSlash = \v -> predV v ** {c2 = v.c2} ; -- in verbal sentences, the verb agrees with the subject @@ -1249,7 +1274,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> }; insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** - { obj = {s = vp.obj.s ++ vp.c2 ++ np.s ! Acc ; a = np.a} }; + { obj = {s = vp.obj.s ++ vp.c2.s ++ np.s ! vp.c2.c ; a = np.a} }; insertPred : {s : AAgr => Case => Str} -> VP -> VP = \p,vp -> vp ** { pred = p; @@ -1263,12 +1288,40 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> insertPred xabar (predV (v1hollow {f = "ك"; c = "و" ; l = "ن"} u) ); -- Slash categories - VPSlash : Type = VP ** {c2 : Str} ; - ClSlash : Type = Cl ** {c2 : Str} ; + VPSlash : Type = VP ** {c2 : Preposition} ; + ClSlash : Type = Cl ** {c2 : Preposition} ; Cl : Type = {s : Tense => Polarity => Order => Str} ; QCl : Type = {s : Tense => Polarity => QForm => Str} ; + -- Relative + param + RAgr = RSg Gender | RPl Gender | RDl Gender Case ; + + oper + agr2ragr = overload { + agr2ragr : Agr -> Case -> RAgr = \a,c -> + let gn = pgn2gn a.pgn in case of { + => RSg x ; + => RPl x ; + => RDl x c ; + _ => Predef.error "agr2ragr"} ; + agr2ragr : Number -> Case -> Gender -> RAgr = \n,c,g -> + case n of { + Sg => RSg g ; + Dl => RDl g c ; + Pl => RPl g } + } ; + + -- ragr2agr : Number -> Case -> Gender -> RAgr = \ra -> + -- case ra of { + -- RSg x => Per3 Sg x ; + -- RPl x => Per3 Pl x ; + -- RDl x => Per3 Dl x } ; + + RCl : Type = {s : Tense => Polarity => Agr => Case => Str} ; + RP : Type = {s : RAgr => Str } ; + --TODO: slashRCl : ClSlash -> RP -> RCl ; param diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 1a26da8cf..159e1cea9 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -39,20 +39,20 @@ concrete SentenceAra of Sentence = CatAra ** open yaktubu = vp.s ! pgn ! VPImpf Ind ; yaktuba = vp.s ! pgn ! VPImpf Cnj ; yaktub = vp.s ! pgn ! VPImpf Jus ; - vStr : ResAra.Tense -> Polarity -> Str = + vStr : ParamX.Tense -> Polarity -> Str = \tn,pl -> case of { - => yaktubu ; - => "لَا" ++ yaktubu ; - => "" ; --no verb "to be" in present - => "لَيسَ" ;--same here, just add negation particle - <_, ResAra.Past, Pos> => kataba ; - <_, ResAra.Past, Neg> => "لَمْ" ++ yaktub ; - <_, ResAra.Fut, Pos> => "سَ" ++ yaktubu ; - <_, ResAra.Fut, Neg> => "لَنْ" ++ yaktuba + => yaktubu ; + => "لَا" ++ yaktubu ; + => "" ; --no verb "to be" in present + => "لَيسَ" ;--same here, just add negation particle + <_, Past, Pos> => kataba ; + <_, Past, Neg> => "لَمْ" ++ yaktub ; + <_, _Fut, Pos> => "سَ" ++ yaktubu ; + <_, _Fut, Neg> => "لَنْ" ++ yaktuba }; - pred : ResAra.Tense -> Polarity -> Str = + pred : ParamX.Tense -> Polarity -> Str = \tn,pl -> case of { - => vp.pred.s ! gn ! Nom; --xabar marfooc + => vp.pred.s ! gn ! Nom; --xabar marfooc _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob }; @@ -102,7 +102,7 @@ concrete SentenceAra of Sentence = CatAra ** open SlashVP np vps = PredVP np vps ** { c2 = vps.c2 } ; AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ; - SlashPrep cl prep = cl ** {c2 = prep.s} ; + SlashPrep cl prep = cl ** {c2 = prep} ; -- SlashVS np vs sslash = TODO @@ -113,22 +113,23 @@ concrete SentenceAra of Sentence = CatAra ** open -- UseCl t p cl = - {s = case of { --- IL guessed tenses - <(Pres|Cond),Simul> => cl.s ! ResAra.Pres ! p.p ! Verbal ; - => cl.s ! ResAra.Fut ! p.p ! Verbal ; - <_ ,_ > => cl.s ! ResAra.Past ! p.p ! Verbal + {s = t.s ++ p.s ++ + case of { --- IL guessed tenses + <(Pres|Cond),Simul> => cl.s ! Pres ! p.p ! Nominal ; + => cl.s ! Fut ! p.p ! Nominal ; + <_ ,_ > => cl.s ! Past ! p.p ! Nominal } }; UseQCl t p qcl = - {s = \\q => - case of { --- IL guessed tenses - <(Pres|Cond),Simul> => qcl.s ! ResAra.Pres ! p.p ! q ; - => qcl.s ! ResAra.Fut ! p.p ! q ; - <_ ,_ > => qcl.s ! ResAra.Past ! p.p ! q + {s = \\q => t.s ++ p.s ++ + case of { --- IL guessed tenses + <(Pres|Cond),Simul> => qcl.s ! Pres ! p.p ! q ; + => qcl.s ! Fut ! p.p ! q ; + <_ ,_ > => qcl.s ! Past ! p.p ! q } }; --- UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ; + UseRCl t p cl = {s = \\agr,c => t.s ++ p.s ++ cl.s ! t.t ! p.p ! agr ! c} ; } diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 505e6bc45..59bdce40f 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -4,8 +4,8 @@ concrete StructuralAra of Structural = CatAra ** flags optimize=all ; coding=utf8 ; lin - above_Prep = ss "فَوْقَ" ; - after_Prep = ss "بَعْدَ" ; + above_Prep = mkPrep "فَوْقَ" ; + after_Prep = mkPrep "بَعْدَ" ; all_Predet = mkPredet "كُلّ" True ; almost_AdA = ss "تَقْرِيباً"; almost_AdN = ss "حَوَالي" ; -- or "تَقرِيبا" @@ -13,20 +13,20 @@ concrete StructuralAra of Structural = CatAra ** -- always_AdV = ss "َلوَيس" ; and_Conj = ss "وَ" ** {n = Pl} ; -- because_Subj = ss "بعَُسي" ; - before_Prep = ss "قَبْلَ" ; - behind_Prep = ss "خَلْفَ" ; - between_Prep = ss "بَيْنَ" ; + before_Prep = mkPrep "قَبْلَ" ; + behind_Prep = mkPrep "خَلْفَ" ; + between_Prep = mkPrep "بَيْنَ" ; -- both7and_DConj = sd2 "بْته" "َند" ** {n = Pl} ; -- but_PConj = ss "بُت" ; - by8agent_Prep = ss "بِ" ; - by8means_Prep = ss "بِ" ; + by8agent_Prep = mkPrep "بِ" ; + by8means_Prep = mkPrep "بِ" ; can_VV = mkVV (mkV "طوع" FormX) ; -- can8know_VV = { -- s = table VVForm [["بي َبلي تْ"] ; "عَن" ; "عُْلد" ; -- ["بّن َبلي تْ"] ; ["بِنغ َبلي تْ"] ; "عَنءت" ; "عُْلدنءت"] ; -- isAux = True -- } ; - during_Prep = ss "خِلَالَ" ; + during_Prep = mkPrep "خِلَالَ" ; -- either7or_DConj = sd2 "ِتهر" "ْر" ** {n = Sg} ; everybody_NP = regNP "الجَمِيع" Pl ; every_Det = mkDet "كُلّ" Sg Const ; @@ -34,7 +34,7 @@ concrete StructuralAra of Structural = CatAra ** -- everywhere_Adv = ss "ثريوهري" ; few_Det = mkDet "بَعض" Pl Const ; -- first_Ord = ss "فِرست" ; - from_Prep = ss "مِنَ" ; + from_Prep = mkPrep "مِنَ" ; he_Pron = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ; here_Adv = ss "هُنا" ; -- here7to_Adv = ss ["تْ هري"] ; @@ -42,9 +42,9 @@ concrete StructuralAra of Structural = CatAra ** how_IAdv = ss "كَيفَ" ; -- how8many_IDet = mkDet "كَمْ" Pl Const ; -- IL: check (was ["هْو مَني"]) ; -- if_Subj = ss "ِف" ; - in8front_Prep = ss "مُقَابِلَ" ; + in8front_Prep = mkPrep "مُقَابِلَ" ; i_Pron = mkPron "أَنَا" "نِي" "ي" (Per1 Sing); - in_Prep = ss "فِي" ; + in_Prep = mkPrep "فِي" ; it_Pron = he_Pron ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg); -- less_CAdv = ss "لسّ" ; many_Det = mkDet "جَمِيع" Pl Const ; @@ -57,14 +57,14 @@ concrete StructuralAra of Structural = CatAra ** -- isAux = True -- } ; no_Utt = {s = \\_ => "لا"} ; - on_Prep = ss "عَلى" ; + on_Prep = mkPrep "عَلى" ; --- DEPREC one_Quant = mkQuantNum "واحِد" Sg Indef ; only_Predet = mkPredet "فَقَط" False; -- or_Conj = ss "ْر" ** {n = Sg} ; -- otherwise_PConj = ss "ْتهروِسي" ; - part_Prep = ss "مِنَ" ; + part_Prep = mkPrep "مِنَ" ; -- please_Voc = ss "ةلَسي" ; - possess_Prep = ss "ل" ; + possess_Prep = mkPrep "ل" ; -- quite_Adv = ss "قُِتي" ; she_Pron = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ; -- so_AdA = ss "سْ" ; @@ -84,10 +84,10 @@ concrete StructuralAra of Structural = CatAra ** this_Quant = mkQuant7 "هَذا" "هَذِهِ" "هَذَان" "هَذَيْن" "هَاتَان" "هَاتَيْن" "هَؤُلَاء" Def; ----b this_NP = indeclNP "هَذا" Sg ; ----b those_NP = indeclNP "هَؤُلَاءكَ" Pl ; - through_Prep = ss "عَبْرَ" ; + through_Prep = mkPrep "عَبْرَ" ; -- too_AdA = ss "تّْ" ; - to_Prep = ss "إِلى" ; - under_Prep = ss "تَحْتَ" ; + to_Prep = mkPrep "إِلى" ; + under_Prep = mkPrep "تَحْتَ" ; -- very_AdA = ss "ثري" ; -- want_VV = P.mkVV (P.regV "وَنت") ; we_Pron = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ; @@ -110,8 +110,8 @@ concrete StructuralAra of Structural = CatAra ** whoSg_IP = mkIP "مَنْ" "مَنْ" Sg ; whoPl_IP = mkIP "مَنْ" "مَنْ" Pl ; -- why_IAdv = ss "وهي" ; - without_Prep = ss "بِدُونِ" ; - with_Prep = ss "مَع" ; + without_Prep = mkPrep "بِدُونِ" ; + with_Prep = mkPrep "مَع" ; yes_Utt = {s = \\_ => "نَعَم"} ; youSg_Pron = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ; youPl_Pron = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ; diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 23878f9b6..6c98e5b84 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -6,6 +6,11 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { UseV = predV ; SlashVV vv vps = vps ** predV vv ; ----IL + + -- TODO: --c3 is for verb, c2 is for dir.obj + --SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go + --SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy + SlashV2a v = predVSlash v ; Slash3V3 v np = insertObj np (predVSlash v) ** {c2 = v.c3}; @@ -20,7 +25,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { ComplVV vv vp = let vvVP = predV vv in --- IL vp ** { s = \\pgn,vpf => vvVP.s ! pgn ! vpf - ++ vv.c2 -- أَنْ + ++ vv.c2.s -- أَنْ ++ vp.s ! pgn ! VPImpf Cnj } ;