From e1eb288c29b6366c3b4fd0ed8c9fd9db045b39ce Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 22 Jan 2019 09:31:31 +0100 Subject: [PATCH 01/10] (Ara) Cleanup in verbDefBool --- src/arabic/MorphoAra.gf | 200 +++++++++++++++++----------------------- 1 file changed, 87 insertions(+), 113 deletions(-) diff --git a/src/arabic/MorphoAra.gf b/src/arabic/MorphoAra.gf index 890d0faf..91d337f8 100644 --- a/src/arabic/MorphoAra.gf +++ b/src/arabic/MorphoAra.gf @@ -652,136 +652,110 @@ oper normalAlif : Root3 -> Bool = \r -> case r.l of {"و" => True ; _ => False} ; verbDefBool : Bool -> Bool -> DefForms -> Vowel -> Verb = - \isDoubleDef,alif,vforms,vowImpf -> - let { - rama = vforms ! 0 ; -- VPerf Act (Per3 Masc Sg) - ramay = vforms ! 1 ; -- VPerf Act (Per3 Fem Pl) - rumi = vforms ! 2 ; -- VPerf Pas (Per3 _ Sg) - rumu = vforms ! 3 ; -- VPerf Pas (Per3 Masc Pl) - rumiy = vforms ! 4 ; -- VPerf Pas (Per3 Fem Pl) - armi = vforms ! 5 ; -- VImpf _ Act (Per1 _ _ | Per3 Fem _ | Per2/3 Masc Sg) - armu = vforms ! 6 ; -- VImpf _ Act (Per2/3 Masc Pl) - ad3i = vforms ! 7 ; -- VImpf _ Act (Per2 Fem) - urma = vforms ! 8 ; -- VImpf _ Pas - Irmi = vforms ! 9 ; -- VImp Masc Sg | VImp Fem _ - Irmu = vforms ! 10 ; -- VImp Masc Pl - ppart = vforms ! 11 ; -- VPPart - masdar = vforms ! 12 ; -- verbal noun + \isDoubleDef,normalAlif,vforms,vowImpf -> { s = table { + VPerf v pgn => patPerf ! v ! pgn + suffixPerf v ! pgn ; + VImpf m Act pgn => prefixImpf ! pgn + patImpfAct ! pgn + suffixImpf Act ! m ! pgn ; + VImpf m Pas pgn => prefixImpf ! pgn + urma + suffixImpf Pas ! m ! pgn ; + VImp g n => patImp ! g ! n + suffixImpf Act ! Jus ! Per2 g n ; + VPPart => ppart ; + Masdar => masdar } + } where { + rama = vforms ! 0 ; -- VPerf Act (Per3 Masc Sg) + ramay = vforms ! 1 ; -- VPerf Act (Per3 Fem Pl) + rumi = vforms ! 2 ; -- VPerf Pas (Per3 _ Sg) + rumu = vforms ! 3 ; -- VPerf Pas (Per3 Masc Pl) + rumiy = vforms ! 4 ; -- VPerf Pas (Per3 Fem Pl) + armi = vforms ! 5 ; -- VImpf _ Act (Per1 _ _ | Per3 Fem _ | Per2/3 Masc Sg) + armu = vforms ! 6 ; -- VImpf _ Act (Per2/3 Masc Pl) + ad3i = vforms ! 7 ; -- VImpf _ Act (Per2 Fem) + urma = vforms ! 8 ; -- VImpf _ Pas + Irmi = vforms ! 9 ; -- VImp Masc Sg | VImp Fem _ + Irmu = vforms ! 10 ; -- VImp Masc Pl + ppart = vforms ! 11 ; -- VPPart + masdar = vforms ! 12 ; -- verbal noun - patPerf = patDefPerf rama ramay rumi rumu rumiy ; - patImpfAct = patDefImpfAct armi armu ad3i ; - patImp = patDefImp Irmi Irmu ; - suffixImpf = case isDoubleDef of {True => suffixImpfDoubleDef ; _ => suffixImpfDef} - } in - { s = table { - VPerf v pgn => patPerf ! v ! pgn + suffixPerfDef v alif ! 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 ; - Masdar => masdar - } - } ; - - patDefPerf : (_,_,_,_,_ :Str) -> Voice => PerGenNum => Str = \rama,ramay,rumi,rumu,rumy -> - table { - Act => - table { - Per3 Fem Pl => ramay ; - Per3 _ _ => rama ; - _ => ramay - } ; - Pas => - table { - Per3 Masc Pl => rumu ; - Per3 Fem Pl => rumy ; - Per3 _ _ => rumi ; - _ => rumy - } + patPerf : Voice => PerGenNum => Str = table { + Act => table { + Per3 Fem Pl => ramay ; + Per3 _ _ => rama ; + _ => ramay } ; + Pas => table { + Per3 Masc Pl => rumu ; + Per3 Fem Pl => rumiy ; + Per3 _ _ => rumi ; + _ => rumiy } } ; - --now includes the vowel=u case, eg "دعو" /IL 2019-01-18 - patDefImpfAct : (x1,_,x3 : Str) -> PerGenNum => Str = \rmi,rmu,d3i -> - table { - Per3 Masc Pl => rmu ; - Per2 Masc Pl => rmu ; - Per2 Fem Sg => d3i ; -- for 1d3: d3i different, rmi = rmu - _ => rmi -- for others: rmu different, rmi = d3i + patImpfAct : PerGenNum => Str = table { + Per3 Masc Pl => armu ; + Per2 Masc Pl => armu ; + Per2 Fem Sg => ad3i ; -- for 1d3: d3i different, rmi = rmu + _ => armi -- for others: rmu different, rmi = d3i } ; + patImp : Gender => Number => Str = \\g,n => + case of { => Irmu ; _ => Irmi } ; - patDefImp : (_,_ : Str) -> Gender => Number => Str = \rmi, rmu -> - table { - Masc => table {Pl => rmu ; _ => rmi} ; - _ => table {_ => rmi} - } ; - - - suffixPerfDef : Voice -> Bool -> PerGenNum => Str = \v,normalAlif -> - let p3ms = case v of { + suffixPerf : Voice -> PerGenNum => Str = \vc -> + let p3ms = case vc of { Act => if_then_Str normalAlif "ا" "ى" ; Pas => "يَ" } ; - ya = case v of { + ya = case vc of { Act => "" ; Pas => "يَ" } - in - table { - Per3 Masc Sg => p3ms ; - Per3 Masc Dl => "يَا" ; - Per3 Masc Pl => "وْا" ; - Per3 Fem Sg => ya + "تْ" ; - Per3 Fem Dl => ya + "تَا" ; - Per3 Fem Pl => "نَ" ; - Per2 Masc Sg => "تَ" ; - Per2 _ Dl => "تُمَا" ; - Per2 Masc Pl => "تُمْ" ; - Per2 Fem Sg => "تِ" ; - Per2 Fem Pl => "تُنَّ" ; - Per1 Sing => "تُ" ; - Per1 Plur => "نَا" - } ; + in table { + Per3 Masc Sg => p3ms ; + Per3 Masc Dl => "يَا" ; + Per3 Masc Pl => "وْا" ; + Per3 Fem Sg => ya + "تْ" ; + Per3 Fem Dl => ya + "تَا" ; + Per3 Fem Pl => "نَ" ; + Per2 Masc Sg => "تَ" ; + Per2 _ Dl => "تُمَا" ; + Per2 Masc Pl => "تُمْ" ; + Per2 Fem Sg => "تِ" ; + Per2 Fem Pl => "تُنَّ" ; + Per1 Sing => "تُ" ; + Per1 Plur => "نَا" + } ; - suffixImpfDef : Voice -> Vowel -> Mood => PerGenNum => Str = \vc,vw -> - let { - default : Mood -> Str = \m -> - case vc of { + suffixImpfDef : Voice -> Mood => PerGenNum => Str = \vc -> + let default : Mood -> Str = \m -> case vc of { Pas => case m of {Jus => "" ; _ => "ى"} ; - Act => case vw of { + Act => case vowImpf of { u => case m of {Ind => "و" ; Cnj => "وَ" ; Jus => ""} ; i => case m of {Ind => "ي" ; Cnj => "يَ" ; Jus => ""} ; - a => case m of {Ind => "ى" ; Cnj => "ى" ; Jus => ""} - } - } - } in - table { - Ind => - table { - Per3 Masc Pl => "وْنَ" ; - Per2 Masc Pl => "وْنَ" ; - (Per3 _ Dl|Per2 _ Dl) => case vw of { - u => "وَانِ" ; - _ => "يَانِ" } ; - Per3 Fem Pl => "يْنَ" ; - Per2 Fem _ => "يْنَ" ; - _ => default Ind - } ; - m => -- TODO: check whether to remove sukuns - table { - Per3 Masc Pl => "وْا" ; - Per2 Masc Pl => "وْا" ; - (Per3 _ Dl|Per2 _ Dl) => case vw of { - u => "وَا" ; - _ => "يَا" } ; - Per3 Fem Pl => "يْنَ" ; - Per2 Fem Pl => "يْنَ" ; - Per2 Fem Sg => "ي" ; - _ => default m + a => case m of {Ind => "ى" ; Cnj => "ى" ; Jus => ""} } } + in table { -- TODO: check whether to remove sukuns + Ind => table { + Per3 Masc Pl => "وْنَ" ; + Per2 Masc Pl => "وْنَ" ; + (Per3 _ Dl|Per2 _ Dl) => case vowImpf of { + u => "وَانِ" ; + _ => "يَانِ" } ; + Per3 Fem Pl => "يْنَ" ; + Per2 Fem _ => "يْنَ" ; + _ => default Ind + } ; + mood => table { + Per3 Masc Pl => "وْا" ; + Per2 Masc Pl => "وْا" ; + (Per3 _ Dl|Per2 _ Dl) => case vowImpf of { + u => "وَا" ; + _ => "يَا" } ; + Per3 Fem Pl => "يْنَ" ; + Per2 Fem Pl => "يْنَ" ; + Per2 Fem Sg => "ي" ; + _ => default mood + } } ; - -- does this even happen other than with رءي? /IL - suffixImpfDoubleDef : Voice -> Vowel -> Mood => PerGenNum => Str = \vc,vw -> - \\m,p => rmSukun (suffixImpfDef vc vw ! m ! p) ; + suffixImpf : Voice -> Mood => PerGenNum => Str = \vc -> case isDoubleDef of { + False => suffixImpfDef vc ; + True => \\m,p => rmSukun (suffixImpfDef vc ! m ! p) } ; + + } ; ------------------------------------------------------------ -- Common affixes From fd0a7da79aefab2f36449ca92f3735d308503046 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 22 Jan 2019 15:08:34 +0100 Subject: [PATCH 02/10] (Ara) Remove Preposition from API, only use Prep Preposition still used internally in ResAra and MorphoAra; Prep is a subtype. For the API it makes sense to only have Prep, not two types. --- src/arabic/ParadigmsAra.gf | 73 +++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 4592cc94..d8b4cbb5 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -42,11 +42,6 @@ resource ParadigmsAra = open 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 ; @@ -156,7 +151,7 @@ resource ParadigmsAra = open -- Two-place adjectives need a preposition for their second argument. mkA2 : overload { - mkA2 : A -> Preposition -> A2 ; + mkA2 : A -> Prep -> A2 ; mkA2 : A -> Str -> A2 } ; @@ -185,9 +180,14 @@ resource ParadigmsAra = open -- 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 + mkPrep : Str -> Prep ; -- Build a preposition out of the given string, with genitive case. + mkPrep : Str -> Case -> Prep ; -- Build a preposition out of the given string and case. + mkPrep : Case -> Prep ; -- Just a case, no preposition. + } ; + + liPrep : Prep ; -- The preposition لِ, binding to its head. Vowel assimilation and def. article elision implemented. + biPrep : Prep ; -- The preposition بِ, binding to its head. + noPrep : Prep ; -- No preposition at all, "complement case" is nominative. --2 Conjunctions mkConj : overload { @@ -242,8 +242,8 @@ resource ParadigmsAra = open 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 : V -> Str -> V2 ; -- Prep as string, default case genitive + mkV2 : V -> Prep -> V2 ; -- Ready-made preposition mkV2 : Str -> V2 ; -- Predictable verb conjugation, no preposition } ; @@ -255,11 +255,11 @@ resource ParadigmsAra = open -- the first one or both can be absent. mkV3 : overload { - mkV3 : V -> Preposition -> Preposition -> V3 ; -- speak, with, about + mkV3 : V -> Prep -> Prep -> 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 -> Prep -> V3 ; -- give,_,to dirV3 : V -> (to : Str) -> V3 -- like above, but with string as argument (default complement case genitive) } ; dirdirV3 : V -> V3 ; -- give,_,_ @@ -278,13 +278,13 @@ resource ParadigmsAra = open mkVV = overload { mkVV : V -> VV = regVV ; mkVV : V -> Str -> VV = c2VV ; - mkVV : V -> Preposition -> VV = prepVV ; - mkVV : V -> Preposition -> Preposition -> VV = prep2VV + mkVV : V -> Prep -> VV = prepVV ; + mkVV : V -> Prep -> Prep -> VV = prep2VV } ; mkV2V : overload { mkV2V : V -> Str -> Str -> V2V ; - mkV2V : V -> Preposition -> Preposition -> V2V ; - mkV2V : VV -> Preposition -> V2V + mkV2V : V -> Prep -> Prep -> V2V ; + mkV2V : VV -> Prep -> V2V } ; mkVA : V -> VA ; mkV2A : V -> Str -> V2A ; @@ -315,12 +315,6 @@ resource ParadigmsAra = open acc = ResAra.Acc ; gen = ResAra.Gen ; --- Prepositions are used in many-argument functions for rection. - - Preposition = ResAra.Preposition ; - noPrep = {s=[]; c=nom; binds=False} ; - casePrep c = {s=[]; c=c; binds=False} ; - Gender = ResAra.Gender ; masc = ResAra.Masc ; fem = ResAra.Fem ; @@ -342,14 +336,21 @@ resource ParadigmsAra = open mkPrep : Str -> Prep = \s -> lin Prep (mkPreposition s) ; mkPrep : Str -> Case -> Prep = \s,c -> - lin Prep (mkPreposition s c) + lin Prep (mkPreposition s c) ; + mkPrep : Case -> Prep = \c -> + lin Prep (casePrep c) ; } ; + noPrep = lin Prep {s=[]; c=nom; binds=False} ; + biPrep = lin Prep ResAra.biPrep ; + liPrep = lin Prep ResAra.liPrep ; + + casePrep : Case -> Prep = \c -> lin Prep {s=[]; c=c; binds=False} ; mkV2 = overload { mkV2 : V -> V2 = dirV2 ; mkV2 : V -> Str -> V2 = \v,p -> prepV2 v (mkPreposition p); - mkV2 : V -> Preposition -> V2 = prepV2 ; + mkV2 : V -> Prep -> V2 = prepV2 ; mkV2 : Str -> V2 = strV2; } ; @@ -609,7 +610,7 @@ resource ParadigmsAra = open }; mkN2 = overload { - mkN2 : N -> Preposition -> N2 = prepN2 ; + mkN2 : N -> Prep -> 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}) @@ -618,7 +619,7 @@ resource ParadigmsAra = open prepN2 : N -> Preposition -> N2 = \n,p -> lin N2 (n ** {c2 = p}) ; mkN3 = overload { - mkN3 : N -> Preposition -> Preposition -> N3 = \n,p,q -> + mkN3 : N -> Prep -> Prep -> 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}) ; @@ -742,7 +743,7 @@ resource ParadigmsAra = open }; mkA2 = overload { - mkA2 : A -> Preposition -> A2 = prepA2 ; + mkA2 : A -> Prep -> A2 = prepA2 ; mkA2 : A -> Str -> A2 = \a,p -> prepA2 a (mkPreposition p) } ; @@ -761,7 +762,7 @@ resource ParadigmsAra = open dirV2 v = prepV2 v (casePrep acc) ; mkV3 = overload { - mkV3 : V -> Preposition -> Preposition -> V3 = \v,p,q -> + mkV3 : V -> Prep -> Prep -> 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}) @@ -771,7 +772,7 @@ resource ParadigmsAra = open v ** {s = v.s ; c2 = p ; c3 = q} ; dirV3 = overload { - dirV3 : V -> Preposition -> V3 = \v,p -> mkV3 v (casePrep acc) p ; + dirV3 : V -> Prep -> V3 = \v,p -> mkV3 v (casePrep acc) p ; dirV3 : V -> Str -> V3 = \v,s -> mkV3 v (casePrep acc) (mkPreposition s) } ; @@ -785,8 +786,8 @@ resource ParadigmsAra = open regVV : V -> VV = \v -> lin VV v ** {c2 = mkPreposition "أَنْ" ; sc = noPrep} ; c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = mkPreposition prep ; sc = noPrep} ; - prepVV : V -> Preposition -> VV = \v,prep -> regVV v ** {c2=prep; sc=noPrep} ; - prep2VV : V -> (_,_ : Preposition) -> VV = \v,p1,p2 -> regVV v ** {c2=p1; sc=p2} ; + prepVV : V -> Prep -> VV = \v,prep -> regVV v ** {c2=prep; sc=noPrep} ; + prep2VV : V -> (_,_ : Prep) -> VV = \v,p1,p2 -> regVV v ** {c2=p1; sc=p2} ; V0 : Type = V ; ---- V2S, V2V, V2Q, V2A : Type = V2 ; AS, A2S, AV : Type = A ; @@ -799,13 +800,13 @@ resource ParadigmsAra = open lin V2V (prepV3 v (mkPreposition p) (mkPreposition q) ** {sc = noPrep}) ; mkV2V : V2 -> V2V = \v2 -> lin V2V (v2 ** {c2 = v2.c2 ; c3,sc = noPrep}) ; - mkV2V : V2 -> Preposition -> V2V = \v2,p -> + mkV2V : V2 -> Prep -> V2V = \v2,p -> lin V2V (v2 ** {c2 = v2.c2 ; c3 = p ; sc = noPrep}) ; - mkV2V : V2 -> Preposition -> Preposition -> V2V = \v2,p,q-> + mkV2V : V2 -> Prep -> Prep -> V2V = \v2,p,q-> lin V2V (v2 ** {c2 = v2.c2 ; c3 = p ; sc = q}) ; - mkV2V : V -> Preposition -> Preposition -> V2V = \v,p,q -> + mkV2V : V -> Prep -> Prep -> V2V = \v,p,q -> lin V2V (prepV3 v p q ** {sc = noPrep}) ; - mkV2V : VV -> Preposition -> V2V = \vv,p -> + mkV2V : VV -> Prep -> V2V = \vv,p -> lin V2V (vv ** {c2 = p ; c3 = vv.c2}) ; } ; mkVA v = v ** {lock_VA = <>} ; From 29cc78439d5551572fb6e65fe53e0b6a7f3f6382 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 22 Jan 2019 15:34:21 +0100 Subject: [PATCH 03/10] (Ara) Ignore this, I'm learning to use git cherry-pick. --- src/arabic/ParadigmsAra.gf | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index d8b4cbb5..7d2eed59 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -138,13 +138,15 @@ resource ParadigmsAra = open = \s,a -> a ** {s = table {af => s ++ a.s ! af}} } ; - idaafaA : N -> A -> A ; -- first argument will be in constructus but inflect in case, adjective in genitive, but inflect in gender, number and definiteness. e.g. غَيْرُ طَيِّبٍ + nisbaA : Str -> Adj ; -- Forms relative adjectives with the suffix ِيّ. Takes either the stem and adds يّ, or the whole word ending in يّ and just adds declension. - degrA : (masc,fem,plur : Str) -> A ; -- adjective where masculine singular is also the comparative form. + idaafaA : N -> A -> A ; -- Forms adjectives of type غَيْرُ طَيِّبٍ 'not good'. Noun is in constructus but inflects in case. Adjective is in genitive, but inflects in gender, number and definiteness. - irregFemA : (masc : A) -> (fem : A) -> A ; -- adjective with irregular feminine. Takes two adjectives (masc. "regular" and fem. "regular") and puts them together. + degrA : (masc,fem,plur : Str) -> A ; -- Adjective where masculine singular is also the comparative form. Indeclinable singular, basic triptote declension for dual and plural. - nisbaA : Str -> Adj ; -- forms relative adjectives by adding the suffix ِيّ + irregFemA : (masc : A) -> (fem : A) -> A ; -- Adjective with irregular feminine. Takes two adjectives (masc. regular and fem. "regular", with fem. forms in the masc fields,) and puts them together. + + invarGenderA : A -> A ; -- Forms an adjective that has no feminine form. Takes a regular adjective and forces the masculine forms into the fem. table. --3 Two-place adjectives -- @@ -722,6 +724,9 @@ resource ParadigmsAra = open x => m.s ! x } } ; + invarGenderA = \m -> + irregFemA m m ; + nisbaA Haal = let Haaliyy : Str = case Haal of { x + "يّ" => Haal ; -- if the ending is already given, don't add it From a5d1dda8c57b2a10ed91ab3eecac67f4481651b1 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 22 Jan 2019 16:20:01 +0100 Subject: [PATCH 04/10] (Ara) Fix wrong information in mkV : (root,masdar:Str) -> VerbForm -> V --- src/arabic/ParadigmsAra.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 7d2eed59..6f01536c 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -205,7 +205,7 @@ resource ParadigmsAra = open mkV : (imperfect : Str) -> V ; -- The verb in Per3 Sg Masc imperfect tense gives the most information mkV : (root : Str) -> (perf,impf : Vowel) -> (masdar : Str) -> V ; -- Verb form I. Vowel is one of {va,vi,vu}. Unpredictable masdar given as an argument. mkV : (root : Str) -> (perf,impf : Vowel) -> V ; -- Like above, but dummy masdar inserted. This function is here only to keep compatibility for the old API; for new grammars, use the constructor with masdar as an argument. - mkV : (root,masdar : Str) -> VerbForm -> V ; -- FormI…FormXI (no IX). XI is quadriliteral. For FormI, default vowels are va and vu, and dummy masdar is inserted. Forms II-XI have predictable masdar, so this constructor works fine. + mkV : (root,masdar : Str) -> VerbForm -> V ; -- FormI…FormXI (no IX). XI is quadriliteral. For FormI, default vowels are va and vu. The given masdar is used for FormI, but currently ignored for Forms II-XI. mkV : (root : Str) -> VerbForm -> V ; -- Like above, but dummy masdar inserted for FormI verbs. No difference for FormII-FormXI, because they have predictable masdar. mkV : V -> (particle : Str) -> V -- V with a non-inflecting particle/phrasal verb } ; From 1c4db86736a72d39c388570826c65882296cfd30 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 23 Jan 2019 10:49:20 +0100 Subject: [PATCH 05/10] (Ara) Add all forms of the negative copula --- src/arabic/ResAra.gf | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 74a33cbb..ca33f65f 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -385,6 +385,23 @@ oper } } ; + laysa : PerGenNum => Str = table { + Per1 Sing => "لَسْتُ" ; + Per1 Plur => "لَسْنَا" ; + Per2 Fem Sg => "لَسْتِ" ; + Per2 Masc Sg => "لَسْتَ" ; + Per2 _ Dl => "لَسْتُمَا" ; + Per2 Fem Pl => "لَسْتُنَّ" ; + Per2 Masc Pl => "لَسْتُمْ" ; + Per3 Fem Sg => "لَيْسَتْ" ; + Per3 Masc Sg => "لَيْسَ" ; + Per3 Fem Dl => "لَيْسَتَا" ; + Per3 Masc Dl => "لَيْسَا" ; + Per3 Fem Pl => "لَسْنَ" ; + Per3 Masc Pl => "لَيْسُوا" + } ; + + ladaa_V : Verb = let laday : PerGenNum -> Str = \pgn -> case pgn of { Per1 Sing => "لَدَيَّ" ; @@ -592,7 +609,6 @@ oper yaktub = vp.s ! pgn ! VPImpf Jus ; -- Various negative particles la = "لَا" ; - laysa = "لَيسَ" ; -- "neg. copula" lam = "لَمْ" ; -- neg. past alla = "أَلَّا" ; -- neg. subjunctive lan = "لَنْ" ; -- neg. future @@ -600,7 +616,7 @@ oper => yaktubu ; => la ++ yaktubu ; => [] ; --no verb "to be" in present - => laysa ; --same here, just add negation particle + => laysa ! pgn ; -- negative copula <_, Past, Pos, _> => kataba ; <_, Past, Neg, _> => lam ++ yaktub ; <_, Cond, Pos, _> => yaktuba ; From fa5f4fe829c0a040ca8654049f69e8f7ea576cc0 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 23 Jan 2019 13:57:26 +0100 Subject: [PATCH 06/10] (Ara) force also imperative forms in forcePerson --- src/arabic/ResAra.gf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index ca33f65f..108aca30 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -423,10 +423,12 @@ oper -- Sometimes a verb is only used in one form (per3 masc sg); -- ideally, one would use an impersonal syntactic construction, -- less ideally, hardcode the verb to only contain forms of one person. - forcePerson : PerGenNum -> Verb -> Verb = \pgn,verb -> verb ** { + forcePerson : PerGenNum -> Verb -> Verb = \pgn,verb -> + let gn = pgn2gn pgn in verb ** { s = \\vf => case vf of { VPerf v _ => verb.s ! VPerf v pgn ; VImpf m v _ => verb.s ! VImpf m v pgn ; + VImp _g _n => verb.s ! VImp gn.g gn.n ; _ => verb.s ! vf } } ; From d5084f90418fdc73f362dff7f8d045124a3aa613 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 23 Jan 2019 16:24:25 +0100 Subject: [PATCH 07/10] (Ara) Sorry again, still don't know how to use git. --- src/arabic/MorphoAra.gf | 2 ++ src/arabic/ParadigmsAra.gf | 16 ++++++++-------- src/arabic/ResAra.gf | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/arabic/MorphoAra.gf b/src/arabic/MorphoAra.gf index 91d337f8..808223b4 100644 --- a/src/arabic/MorphoAra.gf +++ b/src/arabic/MorphoAra.gf @@ -70,6 +70,8 @@ oper _ => "لِ" }) Dat ; biPrep : Preposition = mkPrefix "بِ" ; + accPrep : Preposition = mkPreposition [] Acc ; -- default object case in VP + genPrep : Preposition = mkPreposition [] Gen ; -- default object case in N2 pronSuff : pattern Str = #("كَ"|"كِ"|"كُمَا"|"كُمْ"|"كُنَّ"|"هُ"|"ها"|"هُمَا"|"هُمْ"|"هُنَّ") ; pronSuffAndOther : pattern Str = #( "كَم" ) ; -- TODO list words that begin like pron.suff. but aren't diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 6f01536c..359934f4 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -107,10 +107,10 @@ resource ParadigmsAra = open --3 Relational nouns mkN2 : overload { - mkN2 : N -> Preposition -> N2 ; -- ready-made preposition - mkN2 : N -> Str -> N2 ; -- preposition given as a string - mkN2 : N -> N2 ; -- no preposition - mkN2 : Str -> N2 ; -- no preposition, predictable inflection + mkN2 : N -> Prep -> N2 ; -- Noun and a ready-made preposition. + mkN2 : N -> Str -> N2 ; -- Noun, preposition given as a string, complement case genitive. + mkN2 : N -> N2 ; -- Noun, no preposition, complement case genitive. + mkN2 : Str -> N2 ; -- Predictable inflection, no preposition, complement case genitive. } ; mkN3 : overload { @@ -343,7 +343,7 @@ resource ParadigmsAra = open lin Prep (casePrep c) ; } ; - noPrep = lin Prep {s=[]; c=nom; binds=False} ; + noPrep = lin Prep ResAra.noPrep ; biPrep = lin Prep ResAra.biPrep ; liPrep = lin Prep ResAra.liPrep ; @@ -614,8 +614,8 @@ resource ParadigmsAra = open mkN2 = overload { mkN2 : N -> Prep -> 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}) + mkN2 : N -> N2 = \n -> prepN2 n genPrep; + mkN2 : Str -> N2 = \str -> prepN2 (smartN str) genPrep; } ; prepN2 : N -> Preposition -> N2 = \n,p -> lin N2 (n ** {c2 = p}) ; @@ -764,7 +764,7 @@ resource ParadigmsAra = open mkSubj : Str -> Order -> Subj = \s,o -> lin Subj {s = s ; o = o} ; } ; - dirV2 v = prepV2 v (casePrep acc) ; + dirV2 v = prepV2 v accPrep ; mkV3 = overload { mkV3 : V -> Prep -> Prep -> V3 = \v,p,q -> diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 108aca30..196923f8 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -643,7 +643,7 @@ oper ClSlash : Type = VPSlash ** {subj : Subj} ; emptyVPslash : VP -> VPSlash = \vp -> vp ** { - c2 = noPrep ; agrObj = \\_ => [] + c2 = accPrep ; agrObj = \\_ => [] } ; slashV2 : Verb2 -> VPSlash = \v -> From 674b13292df23494990fc2dedc74644b645922f8 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 23 Jan 2019 16:24:41 +0100 Subject: [PATCH 08/10] (Ara) Add documentation for mkVV constructors --- src/arabic/ParadigmsAra.gf | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 359934f4..b317d31c 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -278,10 +278,14 @@ resource ParadigmsAra = open } ; mkV2S : V -> Str -> V2S ; mkVV = overload { - mkVV : V -> VV = regVV ; - mkVV : V -> Str -> VV = c2VV ; - mkVV : V -> Prep -> VV = prepVV ; - mkVV : V -> Prep -> Prep -> VV = prep2VV + mkVV : V -> VV -- Make VV out of a V; أَنْ as the complementiser, default subject case (nominative). + = regVV ; + mkVV : V -> Str -> VV -- String argument as the complementiser, default subject case (nominative). + = c2VV ; + mkVV : V -> Prep -> VV -- Prep argument as the complementiser, default subject case (nominative). + = prepVV ; + mkVV : V -> Prep -> Prep -> VV -- First Prep argument is the complementiser, second Prep is subject case. For instance, أَنْ and لِ to get "يُمْكِنُ أَنْ يَفْعَلَ لِشَيْءٍ". + = prep2VV } ; mkV2V : overload { mkV2V : V -> Str -> Str -> V2V ; From 83c6883711da8da07e52e20230cafa7b5ce77f01 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 23 Jan 2019 16:25:33 +0100 Subject: [PATCH 09/10] (Ara) Add a field to VP: whether to use negative copula for negation --- src/arabic/ResAra.gf | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 196923f8..06d776e6 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -444,13 +444,14 @@ oper sc : Preposition ; -- subject case: e.g. يُمْكِنُ *لِ*Xِ obj : Obj; pred : Comp; - isPred : Bool; --indicates if there is a predicate (xabar) + isPred : Bool; -- indicates if there is a predicate (xabar) s2 : Str } ; VP : Type = BaseVP ** { - s : PerGenNum => VPForm => Str ; - } ; + s : PerGenNum => VPForm => Str ; + isPoss : Bool; -- special case for have_V2, to get negation right /IL + } ; uttVP : VPForm -> VP -> (Gender=>Str) = \vpf,vp -> \\g => vp.s ! Per3 g Sg ! vpf @@ -470,7 +471,7 @@ oper obj = emptyObj ; s2 = []; pred = {s = \\_,_ => []} ; - isPred = False + isPred,isPoss = False }; passPredV : Verb -> VP = \v -> @@ -614,7 +615,8 @@ oper lam = "لَمْ" ; -- neg. past alla = "أَلَّا" ; -- neg. subjunctive lan = "لَنْ" ; -- neg. future - in case of { + in case of { + => laysa ! Per3 Masc Sg ++ yaktubu ; -- special case for have_V2 => yaktubu ; => la ++ yaktubu ; => [] ; --no verb "to be" in present @@ -647,7 +649,12 @@ oper } ; slashV2 : Verb2 -> VPSlash = \v -> - predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ; + predV v ** { + c2 = v.c2 ; agrObj = \\_ => [] ; + isPoss = case v.c2.c of { + Nom => True ; -- for have_V2 + _ => False } ; + } ; -- Add subject string, fix agreement to the subject, -- but keep the structure as VP, because later on From 137384038966bf17d845afca9f8fb2ae649780db Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 23 Jan 2019 16:26:00 +0100 Subject: [PATCH 10/10] (Ara) Add some comments --- src/arabic/QuestionAra.gf | 6 ++---- src/arabic/ResAra.gf | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index aa059ebd..b92675c1 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -8,20 +8,18 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA s = \\t,p => table { QIndir => "إِذا" ++ cl.s ! t ! p ! toOrder QIndir ; - QDir => "هَلْ" ++ cl.s ! t ! p ! toOrder QDir + QDir => "هَلْ" ++ cl.s ! t ! p ! Verbal -- yes/no question } }; -- ComplSlashIP vps ip = {} ; - --IL guessed QuestVP qp vp = let np = ip2np qp vp.isPred ; cl = PredVP np vp ; in { s = \\t,p,qf => cl.s ! t ! p ! toOrder qf } ; ----- AR guessed - QuestIAdv iadv cl = {s = \\t,p,qf => iadv.s ++ cl.s ! t ! p ! toOrder qf} ; + QuestIAdv iadv cl = {s = \\t,p,qf => iadv.s ++ cl.s ! t ! p ! Verbal} ; -- Verbal word order, because there is no pre-existing question word /IL ---- IL guessed -- : IComp -> NP -> QCl diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 06d776e6..4046973f 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -681,8 +681,8 @@ oper -- these are chosen in many places, trying to be consistent toOrder : QForm -> Order = \qf -> - case qf of { QIndir => Nominal ; - QDir => Verbal } ; + case qf of { QDir => Nominal ; -- works for wh-questions, not for y/n + QIndir => Verbal } ; ----------------------------------------------------------------------------- -- Relative