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"