From fdeaa9ea701810272d76c996c0363f6a48c3b0c8 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:01:02 +0100 Subject: [PATCH 1/5] (Ara) Changes to nouns and NPs --- src/arabic/CatAra.gf | 1 + src/arabic/NounAra.gf | 35 ++++++++++++++++++----------------- src/arabic/ParadigmsAra.gf | 33 ++++++++++++++++++++------------- src/arabic/ResAra.gf | 18 ++++++++++++++---- 4 files changed, 53 insertions(+), 34 deletions(-) diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 7bc37f088..246c30e9a 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -93,5 +93,6 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { linref CN = \cn -> uttCN cn ! Masc ; + N = \n -> uttCN (useN n) ! Masc ; } diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index 7547064c4..ddb788e3e 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -13,8 +13,8 @@ lin cn.s ! number ! nounState det.d number ! nounCase c det.n det.d ; - adj : Case -> Str = \c -> - cn.adj ! number + adj : NTable -> Case -> Str = \ntable,c -> + ntable ! number ! (definite ! det.d) -- Indef remains Indef, rest become Def ! c } in { @@ -22,30 +22,34 @@ lin case cnB4det det.isPron det.isNum det.n det.d of { False => determiner c ++ noun c - ++ adj c + ++ adj cn.s2 c + ++ adj cn.adj c ++ cn.np ! c ; True => noun (cas c) -- deal with possessive suffix - ++ determiner c - ++ adj c + ++ determiner c + ++ adj cn.s2 c + ++ adj cn.adj c ++ cn.np ! c }; a = { pgn = agrP3 cn.h cn.g number; - isPron = False } + isPron = False } ; + empty = [] }; UsePN pn = { s = pn.s; - a = {pgn = (Per3 pn.g Sg); isPron = False } + a = {pgn = Per3 pn.g Sg ; isPron = False} ; + empty = [] }; UsePron p = p ; - PredetNP pred np = { + PredetNP pred np = np ** { s = \\c => case pred.isDecl of { True => pred.s!c ++ np.s ! Gen ; -- akvaru l-awlAdi False => pred.s!c ++ np.s ! c - }; - a = np.a + } ; + a = np.a ** {isPron=False} } ; {- @@ -167,21 +171,18 @@ lin MassNP cn = ---- AR {s = \\c => cn.s ! Sg ! Indef ! c ++ cn.np ! c ++ cn.adj ! Sg ! Indef ! c ; - a = {pgn = Per3 cn.g Sg ; isPron = False}} ; + a = {pgn = Per3 cn.g Sg ; isPron = False} ; + empty = []} ; -- MassDet = {s = \\_,_,_,_ => [] ; d = Indef; -- isNum = False; isPron = False} ; UseN, - UseN2 = \n -> n ** { - adj = \\_,_,_ => []; - np = \\_ => []}; + UseN2 = useN ; Use2N3 n3 = n3 ; Use3N3 n3 = n3 ** {c2 = n3.c3} ; - ComplN2 n2 np = UseN n2 ** --- IL - {s = \\n,s,c => n2.s ! n ! s ! c ++ n2.c2.s ++ np.s ! n2.c2.c} ; - + ComplN2 n2 np = UseN n2 ** {np=np.s} ; ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 2905bb7f7..d1958ae4d 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -70,7 +70,8 @@ resource ParadigmsAra = open mkN : (sg,pl : Str) -> Gender -> Species -> N ; mkN : NTable -> Gender -> Species -> N ; -- loan words, irregular mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N ; -- broken plural - mkN : N -> (attr : Str) -> N ; -- Compound nouns + mkN : N -> (attr : Str) -> N ; -- Compound noun with invariant attribute + mkN : N -> N -> N ; -- Compound noun where both parts inflect --- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural --- = sdfN ; } ; @@ -97,6 +98,8 @@ resource ParadigmsAra = open mkPN = overload { mkPN : Str -> PN -- Fem Hum if ends with ة, otherwise Masc Hum = smartPN ; + mkPN : N -> PN + = \n -> lin PN (n ** {s = \\c => n.s ! Sg ! Const ! Bare}) ; -- no idea /IL mkPN : Str -> Gender -> Species -> PN = mkFullPN ; } ; @@ -343,7 +346,12 @@ resource ParadigmsAra = open mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural = brkN ; mkN : N -> (attr : Str) -> N -- Compound nouns - = \n,attr -> n ** { s = \\num,s,c => n.s ! num ! s ! c ++ attr } ; --- IL (TODO: all kinds of compounds) + = \n,attr -> n ** {s2 = \\n,s,c => attr} ; + mkN : N -> N -> N -- Compound nouns + = \n1,n2 -> n1 ** {s2 = + \\n,s,c => n1.s2 ! n ! s ! c -- card + ++ n2.s ! n ! s ! c -- type + ++ n2.s2 ! n ! s ! c} ; -- blood } ; mkV = overload { @@ -464,6 +472,7 @@ resource ParadigmsAra = open mkFullN nsc gen spec = { s = nsc; --NTable + s2 = emptyNTable; g = gen; h = spec; lock_N = <> @@ -476,14 +485,12 @@ resource ParadigmsAra = open } in mkFullN (reg kitAb kutub) gen spec; brkN root sg pl gen spec = - let { raw = brkN' root sg pl gen spec} in + let { raw = brkN' root sg pl gen spec} in raw ** { s = \\n,d,c => case root of { _ + #hamza + _ => rectifyHmz(raw.s ! n ! d ! c); _ => raw.s ! n ! d ! c - }; - g = gen; - h = spec ; lock_N = <> + } }; sdfN = @@ -525,31 +532,31 @@ resource ParadigmsAra = open lin N3 (n ** {c2 = mkPreposition p ; c3 = mkPreposition q}) ; } ; - mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> - { s = + mkPron : (_,_,_ : Str) -> PerGenNum -> Pron = \ana,nI,I,pgn -> + lin Pron { s = table { Acc => BIND ++ nI; -- object suffix Gen => BIND ++ I; -- possessive suffix _ => ana }; a = {pgn = pgn; isPron = True }; - lock_NP = <> + empty = [] }; proDrop : NP -> NP = ResAra.proDrop ; -- Force a NP to lose its string, only contributing with its agreement. -- e.g. al-jamii3, 2a7ad - regNP : Str -> Number -> NP = \word,n -> + regNP : Str -> Number -> NP = \word,n -> lin NP { s = \\c => fixShd word (dec1sg ! Def ! c) ; a = {pgn = Per3 Masc n; isPron = False }; - lock_NP = <> + empty = [] }; -- e.g. hadha, dhaalika - indeclNP : Str -> Number -> NP = \word,n -> + indeclNP : Str -> Number -> NP = \word,n -> lin NP { s = \\c => word ; a = {pgn = Per3 Masc n; isPron = False }; - lock_NP = <> + empty = [] }; mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant = diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 9fdb5c91c..50d9dc68b 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -106,9 +106,10 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { --types of open classes: NTable = Number => State => Case => Str; + emptyNTable : NTable = \\n,s,c => [] ; Preposition : Type = {s : Str ; c : Case} ; - Noun : Type = {s : NTable ; g : Gender; h : Species} ; + Noun : Type = {s,s2 : NTable ; g : Gender; h : Species} ; Noun2 : Type = Noun ** {c2 : Preposition} ; Noun3 : Type = Noun2 ** {c3 : Preposition} ; @@ -129,8 +130,13 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Def ! Nom ; ----IL CN : Type = Noun ** {adj : NTable ; np : Case => Str}; + + useN : Noun -> CN = \n -> n ** {adj = \\_,_,_ => []; np = \\_ => []} ; + uttCN : CN -> (Gender => Str) ; - uttCN cn = \\_ => cn.s ! Sg ! Indef ! Bare ; + uttCN cn = \\_ => cn.s ! Sg ! Indef ! Bare ++ + cn.s2 ! Sg ! Indef ! Bare ++ + cn.adj ! Sg ! Indef ! Bare ; NumOrdCard : Type = { s : Gender => State => Case => Str ; @@ -1206,7 +1212,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> NP : Type = { s : Case => Str ; - a : Agr + a : Agr ; + empty : Str -- to prevent ambiguities with prodrop } ; proDrop : NP -> NP = \np -> @@ -1215,7 +1222,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> _ => np } ; - emptyNP : NP = {s = \\_ => [] ; a = {pgn = Per3 Masc Sg ; isPron = False}} ; + emptyNP : NP = { + s = \\_ => [] ; + a = {pgn = Per3 Masc Sg ; isPron = False} ; + empty = []} ; IP : Type = { s : Bool -- different forms for "what is this" and "what do you do" From faf6c83b74cff75df30e62bcd4c0635901b05274 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:01:19 +0100 Subject: [PATCH 2/5] (Ara) Add stuff to ExtendAra and ConstructionAra --- src/arabic/ConstructionAra.gf | 147 ++++++++++++++++++++++++++++++++++ src/arabic/ExtendAra.gf | 28 ++++++- 2 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 src/arabic/ConstructionAra.gf diff --git a/src/arabic/ConstructionAra.gf b/src/arabic/ConstructionAra.gf new file mode 100644 index 000000000..8d9357661 --- /dev/null +++ b/src/arabic/ConstructionAra.gf @@ -0,0 +1,147 @@ +concrete ConstructionAra of Construction = CatAra ** open + ParadigmsAra, + SyntaxAra, + SymbolicAra, + StructuralAra, + (R=ResAra), + (L=LexiconAra) in { + +lincat + Timeunit = N ; + Weekday = N ; + Monthday = NP ; + Month = N ; + Year = NP ; + +lin + + timeunitAdv n time = + let n_card : Card = n ; + n_hours_NP : NP = mkNP n_card time ; + in SyntaxAra.mkAdv during_Prep n_hours_NP | ParadigmsAra.mkAdv (n_hours_NP.s ! R.Nom) ; + + -- random guesses + weekdayPunctualAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- on Sunday + weekdayHabitualAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- on Sundays + weekdayNextAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- next Sunday + weekdayLastAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- last Sunday + + monthAdv m = SyntaxAra.mkAdv in_Prep (mkNP m) ; + yearAdv y = SyntaxAra.mkAdv in_Prep y ; + + -- dummy + dayMonthAdv d m = SyntaxAra.mkAdv on_Prep (mkNP d) ; -- on 17 May + monthYearAdv m y = SyntaxAra.mkAdv on_Prep (mkNP m) ; -- in May 2012 + dayMonthYearAdv d m y = SyntaxAra.mkAdv on_Prep y ; -- on 17 May 2013 + + intYear = symb ; + intMonthday = symb ; + +-- n_units_AP + + -- : NP -> NP -> Cl + have_name_Cl pe nm = + let subjPron : Pron = case pe.a.isPron of { + True => pe ; + False => case (R.pgn2gn pe.a.pgn).g of { + R.Fem => she_Pron ; + R.Masc => he_Pron } + } ; + + myName : NP = mkNP (mkDet subjPron) L.name_N ; + in mkCl myName nm ; --TODO: now it only works for pronouns, drops the NP + +-- what_name_QCl = + +-- how_old_QCl + +-- hungry_VP = +-- thirsty_VP = + +lincat Language = N ; + +lin InLanguage l = mkAdv in_Prep (mkNP l) ; + +lin + weekdayN w = w ; + monthN m = m ; + + weekdayPN w = mkPN w ; + monthPN m = mkPN m ; + + languageCN l = mkCN l ; + languageNP l = mkNP l ; + + +oper mkLanguage : Str -> N = mkN ; + +---------------------------------------------- +---- lexicon of special names + +-- TODO in arabic +lin second_Timeunit = mkN "second" ; +lin minute_Timeunit = mkN "minute" ; +lin hour_Timeunit = mkN "hour" ; +lin day_Timeunit = mkN "day" ; +lin week_Timeunit = mkN "week" ; +lin month_Timeunit = mkN "month" ; +lin year_Timeunit = mkN "year" ; + +lin monday_Weekday = mkN "Monday" ; +lin tuesday_Weekday = mkN "Tuesday" ; +lin wednesday_Weekday = mkN "Wednesday" ; +lin thursday_Weekday = mkN "Thursday" ; +lin friday_Weekday = mkN "Friday" ; +lin saturday_Weekday = mkN "Saturday" ; +lin sunday_Weekday = mkN "Sunday" ; + +lin january_Month = mkN "January" ; +lin february_Month = mkN "February" ; +lin march_Month = mkN "March" ; +lin april_Month = mkN "April" ; +lin may_Month = mkN "May" ; +lin june_Month = mkN "June" ; +lin july_Month = mkN "July" ; +lin august_Month = mkN "August" ; +lin september_Month = mkN "September" ; +lin october_Month = mkN "October" ; +lin november_Month = mkN "November" ; +lin december_Month = mkN "December" ; + +-- lin afrikaans_Language = mkLanguage "Afrikaans" ; +-- lin amharic_Language = mkLanguage "Amharic" ; +lin arabic_Language = mkLanguage "عَرَبِيَّة" ; +-- lin bulgarian_Language = mkLanguage "Bulgarian" ; +-- lin catalan_Language = mkLanguage "Catalan" ; +-- lin chinese_Language = mkLanguage "Chinese" ; +-- lin danish_Language = mkLanguage "Danish" ; +-- lin dutch_Language = mkLanguage "Dutch" ; +lin english_Language = mkLanguage "إنْجلِيزيْة" ; +-- lin estonian_Language = mkLanguage "Estonian" ; +lin finnish_Language = mkLanguage "فِنْلَنْدِيّة" ; +-- lin french_Language = mkLanguage "French" ; +-- lin german_Language = mkLanguage "German" ; +-- lin greek_Language = mkLanguage "Greek" ; +-- lin hebrew_Language = mkLanguage "Hebrew" ; +-- lin hindi_Language = mkLanguage "Hindi" ; +-- lin japanese_Language = mkLanguage "Japanese" ; +-- lin italian_Language = mkLanguage "Italian" ; +-- lin latin_Language = mkLanguage "Latin" ; +-- lin latvian_Language = mkLanguage "Latvian" ; +-- lin maltese_Language = mkLanguage "Maltese" ; +-- lin nepali_Language = mkLanguage "Nepali" ; +-- lin norwegian_Language = mkLanguage "Norwegian" ; +lin persian_Language = mkLanguage "فَارِسيّة" ; +-- lin polish_Language = mkLanguage "Polish" ; +-- lin punjabi_Language = mkLanguage "Punjabi" ; +-- lin romanian_Language = mkLanguage "Romanian" ; +-- lin russian_Language = mkLanguage "Russian" ; +-- lin sindhi_Language = mkLanguage "Sindhi" ; +-- lin spanish_Language = mkLanguage "Spanish" ; +-- lin swahili_Language = mkLanguage "Swahili" ; +lin swedish_Language = mkLanguage "سُويدِيّة" ; +-- lin thai_Language = mkLanguage "Thai" ; +-- lin turkish_Language = mkLanguage "Turkish" ; +-- lin urdu_Language = mkLanguage "Urdu" ; + +} diff --git a/src/arabic/ExtendAra.gf b/src/arabic/ExtendAra.gf index 43c35f592..cdd6e9167 100644 --- a/src/arabic/ExtendAra.gf +++ b/src/arabic/ExtendAra.gf @@ -4,16 +4,36 @@ concrete ExtendAra of Extend = CatAra ** ExtendFunctor - [ GenNP, SlashBareV2S, PredAPVP, GenModNP, ExistsNP, StrandRelSlash, ExistPluralCN, ExistMassCN, ExistCN, EmptyRelSlash, DetNPMasc, DetNPFem, - ComplBareVS, ComplDirectVS, ComplDirectVQ + ComplBareVS, ComplDirectVS, ComplDirectVQ, + ICompAP, + VPS, MkVPS ] with (Grammar=GrammarAra) ** open Prelude, - ResAra + ResAra, + ParamX in { lin - GenNP np = { s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum, isPron = False } ; -} ; + GenNP np = {s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum,isPron,is1sg = False} ; + + -- : AP -> IComp ; -- "how old" + ICompAP ap = {s = \\gn => "كَمْ" ++ ap.s ! NoHum ! gn.g ! gn.n ! Indef ! Acc} ; + + lincat + + VPS = VP ; -- finite VP's with tense and polarity + + lin + -- : Temp -> Pol -> VP -> VPS ; -- hasn't slept + MkVPS t p vp = lin VPS (vp ** { + s = \\pgn,vf => case of { --- IL guessed tenses + <(Pres|Fut),Simul> => vp.s ! pgn ! VPImpf Ind ; + => vp.s ! pgn ! VPImpf Cnj ; + <_ ,_ > => vp.s ! pgn ! VPPerf + } + }) ; +} From c19c727f40ed6e688bf15e24b084a2097695a390 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:01:35 +0100 Subject: [PATCH 3/5] (Ara) yet another hamza fix --- src/arabic/OrthoAra.gf | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/arabic/OrthoAra.gf b/src/arabic/OrthoAra.gf index edf4f0f81..8bd8f4f3c 100644 --- a/src/arabic/OrthoAra.gf +++ b/src/arabic/OrthoAra.gf @@ -34,10 +34,16 @@ oper l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail; l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail; l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail; - head + v1@("ِ"|"ُ"|"َ"|"ْ"|"ا"|"ي"|"و") + head + v1@(#vow|"ْ"|"ا"|"ي"|"و") + #hamza + v2@(#vow|"ْ") + tail => - case v2 of { "ْ" => head + v1 + tHmz v1 + tail ; -- unsure about this /IL - _ => head + v1 + tHmz v1 + v2 + tail } ; + case v2 of { "ْ" => head + v1 + bHmz v1 v2 + tail ; -- unsure about this /IL + _ => head + v1 + bHmz v1 v2 + v2 + tail } ; + head + v1@(#vow|"ْ"|"ا"|"ي"|"و") -- the same but it ends in vowel + + #hamza + v2@(#vow|"ْ") => + case v2 of { "ْ" => head + v1 + tHmz v1 ; + _ => head + v1 + tHmz v1 + v2 } ; + head + v1@(#vow|"ْ"|"ا"|"ي"|"و") -- the same but it ends without vowel + + #hamza => head + v1 + tHmz v1 ; head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail _ => word From eb43758d3770b22d310c8f609dfb5e36a72226fd Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:02:57 +0100 Subject: [PATCH 4/5] (Ara) Add variable gender to IP --- src/arabic/PhraseAra.gf | 2 +- src/arabic/QuestionAra.gf | 18 ++++++++++-------- src/arabic/ResAra.gf | 16 +++++++++------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/arabic/PhraseAra.gf b/src/arabic/PhraseAra.gf index 5e11b5e5a..6e0abc7f3 100644 --- a/src/arabic/PhraseAra.gf +++ b/src/arabic/PhraseAra.gf @@ -11,7 +11,7 @@ concrete PhraseAra of Phrase = CatAra ** open UttImpSg pol imp = {s = \\g => imp.s ! pol.p ! g ! ResAra.Sg ++ pol.s} ; UttImpPl,UttImpPol = \pol,imp -> {s = \\g => imp.s ! pol.p ! g ! ResAra.Pl ++ pol.s} ; - UttIP ip = {s = \\_g => ip.s ! False ! Def ! Nom} ; --IL + UttIP ip = {s = \\g => ip.s ! False ! g ! Def ! Nom} ; --IL UttAP ap = {s = ResAra.uttAP ap} ; --IL UttCard c = {s = ResAra.uttNum c} ; --IL diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index bc01b0a7a..f8afc2da4 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -29,14 +29,15 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA -- : IComp -> NP -> QCl QuestIComp ic np = let vp = kaan (CompNP np) ; - ip : ResAra.IP = np ** { - s = \\_,_,_ => ic.s ! pgn2gn np.a.pgn } ; + ip : ResAra.IP = np ** { -- NP's s is already present in VP, we only want its agr + s = \\_,_,_,_ => ic.s ! pgn2gn np.a.pgn } ; in QuestVP ip vp ; -- : IP -> IComp ; CompIP ip = ip ** { - s = \\_ => ip.s ! True -- True=IP will be a subject of predicative sentence - ! Def ! Nom ; -- IP will be a subject + s = \\gn => ip.s ! True -- True=IP will be a subject of predicative sentence + ! gn.g -- IComp agrees in gender with eventual head + ! Def ! Nom ; -- IP will be a subject } ; CompIAdv iadv = { s = \\_ => iadv.s ; a = ResAra.Sg } ; @@ -46,28 +47,29 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA s = \\t,p,qf => let cl : ResAra.Cl = complClSlash cls ; -- dummy conversion to Cl o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing - in cls.c2.s ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o + in cls.c2.s ++ ip.s ! False ! Masc ! Def ! Nom ++ cl.s ! t ! p ! o } ; --IL guessed PrepIP p ip = { s = p.s ++ ip.s ! False -- not used as a subject of predicative sentence + ! Masc ---- ! Def ! Gen } ; AdvIP ip adv = ip ** { - s = \\g,s,c => ip.s ! g ! s ! c ++ adv.s ; + s = \\isPred,g,s,c => ip.s ! isPred ! g ! s ! c ++ adv.s ; } ; -- : IDet -> IP IdetIP idet = idet ** { - s = \\isPred => idet.s ! Masc ; + s = \\isPred => idet.s ; a = { pgn = agrP3 NoHum Masc idet.n ; isPron = False } } ; -- : IDet -> CN -> IP IdetCN idet cn = { - s = \\isPred,s,c + s = \\isPred,g,s,c => idet.s ! cn.g ! s ! c ++ cn.s ! idet.n ! Indef ! Gen ; --idaafa a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False } diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 50d9dc68b..ea1e8de72 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1141,12 +1141,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> mkIP = overload { mkIP : Str -> Number -> IP = \maa,n -> { - s = \\_p,_s,_c => maa ; + s = \\_p,_g,_s,_c => maa ; a = { pgn = agrP3 NoHum Masc n ; isPron = False } } ; mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> { - s = table { True => \\_s,_c => maa ; - False => \\_s,_c => maadhaa } ; + s = table { True => \\_g,_s,_c => maa ; + False => \\_g,_s,_c => maadhaa } ; a = { pgn = agrP3 NoHum Masc n ; isPron = False } } } ; @@ -1229,13 +1229,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> IP : Type = { s : Bool -- different forms for "what is this" and "what do you do" - => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative + => Gender -- because an IP can be made into an IComp + => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative => Str ; - a : Agr -- can be both subject and object of a QCl, needs full agr. info + a : Agr -- can be both subject and object of a QCl, needs full agr. info (stupid given that s depends on gender but meh) } ; - ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Def } ; - + ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Masc ! Def ; empty = [] } ; + np2ip : NP -> IP = \np -> np ** {s = \\_,_,_ => np.s} ; + IDet : Type = { s : Gender -- IdetCN needs to choose the gender of the CN => State => Case => Str ; From c14e87922437039ebf834080ce027cfefffcb246 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:03:32 +0100 Subject: [PATCH 5/5] (Ara) Misc fixes to tenses, NPs, VPs --- src/arabic/RelativeAra.gf | 2 +- src/arabic/ResAra.gf | 20 ++++++++++++-------- src/arabic/SentenceAra.gf | 12 ++++++------ src/arabic/SymbolAra.gf | 2 ++ src/arabic/VerbAra.gf | 3 ++- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/arabic/RelativeAra.gf b/src/arabic/RelativeAra.gf index e3a9969c4..12bf8e6c9 100644 --- a/src/arabic/RelativeAra.gf +++ b/src/arabic/RelativeAra.gf @@ -13,7 +13,7 @@ concrete RelativeAra of Relative = CatAra ** s = \\t,p,agr,c => let npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ; - np = {s = npS ; a = agr} ; + np = emptyNP ** {s = npS ; a = agr} ; cl = Se.PredVP np vp ; in cl.s ! t ! p ! Nominal diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index ea1e8de72..3df3a117b 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1301,7 +1301,6 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> } }; - predVP : NP -> VP -> Cl = \np,vp -> { s =\\t,p,o => let { @@ -1323,24 +1322,29 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> => "لَيسَ" ;--same here, just add negation particle <_, Past, Pos> => kataba ; <_, Past, Neg> => "لَمْ" ++ yaktub ; - <_, _Fut, Pos> => "سَ" ++ yaktubu ; - <_, _Fut, Neg> => "لَنْ" ++ yaktuba + <_, Cond, _ > => yaktuba ; + <_, Fut, Pos> => "سَ" ++ yaktubu ; + <_, Fut, Neg> => "لَنْ" ++ yaktuba }; pred : ParamX.Tense -> Polarity -> Str = \tn,pl -> case of { => vp.pred.s ! gn ! Nom; --xabar marfooc _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob }; + subj = np.empty + ++ case of { + => [] ; -- prodrop if it's not predicative + _ => np.s ! Nom + } ; } in - -- If you want prodrop, use proDrop : NP -> NP for your subject. /IL case o of { Verbal => vStr t p ++ case vp.obj.a.isPron of { - True => vp.obj.s ++ np.s ! Nom ; -- obj. clitic attaches directly to the verb - False => np.s ! Nom ++ vp.obj.s } + True => vp.obj.s ++ subj ; -- obj. clitic attaches directly to the verb + False => subj ++ vp.obj.s } ++ vp.s2 ++ pred t p ; - Nominal => np.s ! Nom ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ; - VOS => vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ++ np.s ! Nom + Nominal => subj ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ; + VOS => vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ++ subj } } ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 23181603b..408b34681 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -68,18 +68,18 @@ concrete SentenceAra of Sentence = CatAra ** open UseCl t p cl = {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 + => cl.s ! Pres ! p.p ! Nominal ; + => cl.s ! Past ! p.p ! Nominal ; + => cl.s ! x ! p.p ! Nominal } }; UseQCl t p qcl = {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 + => qcl.s ! Pres ! p.p ! q ; + => qcl.s ! Past ! p.p ! q ; + => qcl.s ! x ! p.p ! q } }; diff --git a/src/arabic/SymbolAra.gf b/src/arabic/SymbolAra.gf index c239b087a..43bf160aa 100644 --- a/src/arabic/SymbolAra.gf +++ b/src/arabic/SymbolAra.gf @@ -17,10 +17,12 @@ lin let g = cn.g ; n = sizeToNumber det.n in { s = \\c => det.s ! NoHum ! g ! c ++ cn.s ! Sg ! Def ! c ++ cn.adj ! n ! Def ! c ++ xs.s; ----IL word order?? Seems to be nontrivial according to ResAra comments. a = dummyAgrP3 n ; + empty = [] } ; CNNumNP cn i = { s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ; a = dummyAgrP3 Sg ; + empty = [] } ; SymbS sy = sy ; diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 0f7210317..110059dd9 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -26,7 +26,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { vp ** { s = \\pgn,vpf => vvVP.s ! pgn ! vpf ++ vv.c2.s -- أَنْ - ++ vp.s ! pgn ! VPImpf Cnj + ++ vp.s ! pgn ! VPImpf Cnj ; + isPred = False } ; -- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ;