From f71e504f9cc2f24d8f75e496a782cee48f82312e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 29 Nov 2018 15:51:57 +0100 Subject: [PATCH 1/2] (Ara) Fixes in prepositions binding to words --- src/arabic/AdjectiveAra.gf | 2 +- src/arabic/AdverbAra.gf | 2 +- src/arabic/NounAra.gf | 10 +++++----- src/arabic/ParadigmsAra.gf | 4 ++-- src/arabic/QuestionAra.gf | 4 +++- src/arabic/ResAra.gf | 30 +++++++++++++++++++----------- 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/arabic/AdjectiveAra.gf b/src/arabic/AdjectiveAra.gf index 93c64a428..b955246a2 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.s ++ np.s ! a.c2.c ; + s = \\sp,g,n,st,c => a.s ! APosit g n st c ++ a.c2.s ++ bindIf a.c2.binds ++ np.s ! a.c2.c ; } ; -- -- ReflA2 a = { diff --git a/src/arabic/AdverbAra.gf b/src/arabic/AdverbAra.gf index c02aa5939..473175771 100644 --- a/src/arabic/AdverbAra.gf +++ b/src/arabic/AdverbAra.gf @@ -11,7 +11,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 ! prep.c} ; + PrepNP prep np = {s = prep.s ++ bindIf prep.binds ++ np.s ! prep.c} ; AdAdv ad av = cc2 av ad ; diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index 174a1d817..c1d99ad51 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -49,10 +49,10 @@ lin DetNP det = emptyNP ** {s = det.s ! NoHum ! Masc} ; ---- - 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 + PredetNP det np = np ** { + s = \\c => case det.isDecl of { + True => det.s ! c ++ bindIf np.a.isPron ++ np.s ! Gen ; -- akvaru l-awlAdi + False => det.s ! c ++ np.s ! c } ; a = np.a ** {isPron=False} } ; @@ -174,7 +174,7 @@ lin Use2N3 n3 = n3 ; Use3N3 n3 = n3 ** {c2 = n3.c3} ; - ComplN2 n2 np = UseN n2 ** {np = \\c => n2.c2.s ++ np.s ! n2.c2.c} ; + ComplN2 n2 np = UseN n2 ** {np = \\c => n2.c2.s ++ bindIf n2.c2.binds ++ np.s ! n2.c2.c} ; ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index b00c18448..6859260c2 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -303,8 +303,8 @@ resource ParadigmsAra = open -- Prepositions are used in many-argument functions for rection. Preposition = ResAra.Preposition ; - noPrep = {s=[]; c=nom} ; - casePrep c = {s=[]; c=c} ; + noPrep = {s=[]; c=nom; binds=False} ; + casePrep c = {s=[]; c=c; binds=False} ; Gender = ResAra.Gender ; masc = ResAra.Masc ; diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index e6bcf6a64..6e1212156 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -47,7 +47,9 @@ 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 = toOrder qf - in cls.c2.s ++ ip.s ! False ! Masc ! Def ! Nom ++ cl.s ! t ! p ! o + in cls.c2.s ++ bindIf cls.c2.binds + ++ ip.s ! False ! Masc ! Def ! Nom + ++ cl.s ! t ! p ! o } ; --IL guessed diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 62d118fd4..879d51523 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -111,7 +111,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { NTable = Number => State => Case => Str; emptyNTable : NTable = \\n,s,c => [] ; - Preposition : Type = {s : Str ; c : Case} ; + Preposition : Type = {s : Str ; c : Case ; binds : Bool} ; + Noun : Type = { s,s2 : NTable ; g : Gender ; @@ -122,17 +123,22 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { 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} ; - } ; + mkPreposition : Str -> Case -> Preposition = \s,c -> {s=s; c=c; binds=False} ; + mkPreposition : Str -> Preposition = \s -> {s=s; c=Gen; binds=False} ; + } ; + + mkPrefix = overload { + mkPrefix : Str -> Preposition = \s -> {s=s; c=Gen; binds=True} ; + mkPrefix : Str -> Case -> Preposition = \s,c -> {s=s; c=c; binds=True} + } ; noPrep : Preposition = mkPreposition [] Nom ; - liPrep : Preposition = mkPreposition ( + liPrep : Preposition = mkPrefix ( pre { #pronSuffAndOther => "لِ" ; #pronSuff => "لَ" ; _ => "لِ" - } ++ BIND) Dat ; - biPrep : Preposition = mkPreposition ("بِ"++BIND) ; + }) Dat ; + biPrep : Preposition = mkPrefix "بِ" ; pronSuff : pattern Str = #("كَ"|"كِ"|"كُمَا"|"كُمْ"|"كُنَّ"|"هُ"|"ها"|"هُمَا"|"هُمْ"|"هُنَّ") ; pronSuffAndOther : pattern Str = #( "كَم" ) ; -- TODO list words that begin like pron.suff. but aren't @@ -1537,7 +1543,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> -- very unsure about this /IL sc : Preposition = case o of { - Subord => {s=[]; c=Acc} ; + Subord => {s=[]; c=Acc; binds=False} ; _ => case np.a.isPron of { True => noPrep ; -- to prevent weird stuff with VVs, might be overly specific _ => vp.sc } @@ -1643,10 +1649,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> a = np.a} } ; + bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ; + bindIfPron : NP -> {c2:Preposition; isPred:Bool} -> Str = \np,vp -> - let bind = case of { - => BIND ; - _ => [] } + let bind = case vp.isPred of { + False => bindIf (orB np.a.isPron vp.c2.binds) ; + True => [] } in vp.c2.s ++ bind ++ np.s ! vp.c2.c ; insertPred : Comp -> VP -> VP = \p,vp -> vp ** From ccfa60cbba26dd2fdaafea0616628506d1de7339 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 29 Nov 2018 15:52:17 +0100 Subject: [PATCH 2/2] (Ara) Fixes in noun attributes --- src/arabic/NounAra.gf | 2 +- src/arabic/ParadigmsAra.gf | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index c1d99ad51..27edb0d4f 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -195,7 +195,7 @@ lin -- : CN -> NP -> CN ; -- house of Paris, house of mine PossNP cn np = cn ** { s = \\n,_d,c => cn.s ! n ! Const ! c ; - s2 = \\n,_d,c => cn.s2 ! n ! Const ! Gen ; -- unsure about this /IL + s2 = \\n,_d,c => cn.s2 ! n ! Const ! Gen ; np = \\c => cn.np ! c ++ np.s ! Gen }; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 6859260c2..f13c1664d 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -362,10 +362,9 @@ resource ParadigmsAra = open attrN : Number -> N -> N -> N = \num,n1,n2 -> n1 ** { s = \\n,_,c => n1.s ! n ! Const ! c ; - s2 = \\n,s,c => let c' = case c of {Dat => Gen; _ => c} in -- the Dat with liPrep hack only applies to the first word - n1.s2 ! num ! s ! c' -- attribute doesn't change - ++ n2.s ! num ! s ! c' - ++ n2.s2 ! num ! s ! c'} ; + s2 = \\n,s,_ => n1.s2 ! num ! s ! Gen -- attribute doesn't change + ++ n2.s ! num ! s ! Gen + ++ n2.s2 ! num ! s ! Gen} ; dualN : N -> N = \n -> n ** {isDual=True} ;