forked from GitHub/gf-rgl
@@ -132,7 +132,7 @@ flags
|
||||
meat_N = brkN "لحم" "فَعلة" "فُعُول" Masc NoHum ;
|
||||
milk_N = brkN "حلب" "فَعِيل" "فَعِيل" Masc NoHum ; --no plur
|
||||
moon_N = brkN "قمر" "فَعَل" "أَفعَال" Masc NoHum ;
|
||||
mother_N2 = mkN2 (sdfN "ءم" "فُعَّ" Fem Hum) ;
|
||||
mother_N2 = mkN2 (mkN "أُمّ" "أُمَّات" Fem Hum) ;
|
||||
mountain_N = brkN "جبل" "فَعَل" "فِعَال" Masc NoHum ;
|
||||
music_N = mkN (reg "مُوسِيقَى" "مُوسِيقَى") Fem NoHum ; --no plur
|
||||
narrow_A = sndA "ضيق" "فَعِّل" ;
|
||||
|
||||
@@ -7,16 +7,16 @@ lin
|
||||
DetCN det cn = let {
|
||||
cas : Case -> Case = if_then_else Case det.is1sg Bare ;
|
||||
number = case cn.isDual of {
|
||||
True =>
|
||||
True =>
|
||||
case sizeToNumber det.n of {
|
||||
Sg => Sg ;
|
||||
_ => Dl } ;
|
||||
False => sizeToNumber det.n } ;
|
||||
determiner : Case -> Str = \c ->
|
||||
det.s ! cn.h ! detGender cn.g det.n ! c ;
|
||||
noun : Case -> Str = \c ->
|
||||
cn.s ! number
|
||||
! nounState det.d number
|
||||
noun : Case -> Str = \c ->
|
||||
cn.s ! number
|
||||
! nounState det.d number
|
||||
! nounCase c det.n det.d ;
|
||||
adj : Case -> Str = \c ->
|
||||
cn.s2 ! number
|
||||
@@ -27,14 +27,14 @@ lin
|
||||
let c' = case c of {Dat => Gen ; x => x} in
|
||||
case cnB4det det of {
|
||||
False => determiner c'
|
||||
++ noun c'
|
||||
++ noun c'
|
||||
++ adj c'
|
||||
++ cn.np ! c' ;
|
||||
True => noun (cas c) -- deal with possessive suffix
|
||||
True => noun (cas c) -- deal with possessive suffix + dative hack
|
||||
++ determiner c'
|
||||
++ adj c'
|
||||
++ cn.np ! c'
|
||||
};
|
||||
};
|
||||
a = { pgn = agrP3 cn.h cn.g number;
|
||||
isPron = False } ;
|
||||
empty = []
|
||||
@@ -78,7 +78,7 @@ lin
|
||||
quant.s ! Pl ! h ! g ! c
|
||||
++ num.s ! g ! d ! c
|
||||
--FIXME check this:
|
||||
++ ord.s ! g
|
||||
++ ord.s ! g
|
||||
! case d of {Poss => Def ; _ => d}
|
||||
! c ;
|
||||
n = num.n;
|
||||
@@ -97,7 +97,7 @@ lin
|
||||
None => False;
|
||||
_ => num.isNum
|
||||
} ;
|
||||
isEmpty =
|
||||
isEmpty =
|
||||
case quant.isEmpty of {
|
||||
True => notB num.isNum ;
|
||||
_ => False }
|
||||
@@ -106,7 +106,7 @@ lin
|
||||
PossPron p = baseQuant ** {
|
||||
s = \\_,_,_,_ => BIND ++ p.s ! Gen;
|
||||
d = Poss;
|
||||
is1sg = case p.a.pgn of { Per1 Sing => True ; _ => False } ;
|
||||
is1sg = is1sg p.a ;
|
||||
isPron = True} ;
|
||||
|
||||
NumSg = {
|
||||
@@ -170,7 +170,7 @@ lin
|
||||
} ;
|
||||
|
||||
MassNP cn =
|
||||
{s = \\c => cn2str cn Sg Indef c ;
|
||||
{s = \\c => cn2str cn Sg Indef c ;
|
||||
a = {pgn = Per3 cn.g Sg ; isPron = False} ;
|
||||
empty = []} ;
|
||||
|
||||
@@ -179,12 +179,14 @@ lin
|
||||
Use2N3 n3 = n3 ;
|
||||
Use3N3 n3 = n3 ** {c2 = n3.c3} ;
|
||||
|
||||
ComplN2 n2 np = UseN n2 ** {np = \\c => n2.c2.s ++ bindIf n2.c2.binds ++ 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} ;
|
||||
|
||||
AdjCN ap cn = cn ** {
|
||||
s2 = \\n,d,c => cn.s2 ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c
|
||||
s2 = \\n,d,c => cn.s2 ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c
|
||||
};
|
||||
|
||||
RelCN cn rs = cn ** {
|
||||
@@ -195,13 +197,22 @@ lin
|
||||
AdvCN,
|
||||
SentCN = \cn,ss -> cn ** {s2 = \\n,d,c => cn.s2 ! n ! d ! c ++ ss.s} ;
|
||||
|
||||
ApposCN cn np = cn ** { np = \\c => cn.np ! c ++ np.s ! c } ;
|
||||
ApposCN cn np = cn ** {
|
||||
np = \\c => cn.np ! c ++ np.s ! c
|
||||
} ;
|
||||
|
||||
-- : 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 ;
|
||||
np = \\c => cn.np ! c ++ np.s ! Gen
|
||||
s = \\n,d,c => cn.s ! n ! case d of {Poss=>d ; _=>Const} ! c ;
|
||||
s2 = \\n,d,c => cn.s2 ! n ! case d of {Poss=>d ; _=>Const} ! Gen ;
|
||||
np = \\c => cn.np ! c
|
||||
++ case is1sg np.a of {
|
||||
True => "لَدَي" ++ np.empty ;
|
||||
False =>
|
||||
case np.a.isPron of {
|
||||
True => "لَدَي" ++ BIND ++ np.s ! Gen ;
|
||||
False => np.s ! Gen }
|
||||
}
|
||||
};
|
||||
|
||||
-- : CN -> NP -> CN ; -- glass of wine
|
||||
|
||||
@@ -57,7 +57,7 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
|
||||
|
||||
mkPat : Str -> Pattern = \pat ->
|
||||
case pat of {
|
||||
w + "ف" + x + "ع" + y + "ل" + z
|
||||
w + "ف" + x + "ع" + y + "ل" + z
|
||||
=> { h = w ; m1 = x; m2 = y; t = z} ;
|
||||
w + "ف" + x + ("ع"|"ل") + y
|
||||
=> { h = w ; m1 = x; m2 = ""; t = y}
|
||||
@@ -145,7 +145,7 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
|
||||
liPrep : Preposition = mkPrefix (
|
||||
pre { #pronSuffAndOther => "لِ" ;
|
||||
#pronSuff => "لَ" ;
|
||||
_ => "لِ"
|
||||
_ => "لِ"
|
||||
}) Dat ;
|
||||
biPrep : Preposition = mkPrefix "بِ" ;
|
||||
|
||||
@@ -177,8 +177,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
|
||||
|
||||
-- All fields of NP
|
||||
cn2str : CN -> Number -> State -> Case -> Str = \cn,n,s,c ->
|
||||
cn.s ! n ! s ! c ++
|
||||
cn.s2 ! n ! s ! c ++
|
||||
cn.s ! n ! s ! c ++
|
||||
cn.s2 ! n ! s ! c ++
|
||||
cn.np ! c ;
|
||||
|
||||
useN : Noun -> CN = \n -> n ** {np = \\_ => []} ;
|
||||
@@ -1066,7 +1066,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
Poss => lemma + "ت" + dec1sg ! s ! c ;
|
||||
_ => word + dec1sgNoDoubleAlif ! s ! c
|
||||
} ;
|
||||
_ => fixShd word (dec1sg ! s ! c)
|
||||
_ => fixShd word (dec1sg ! s ! c)
|
||||
}) ;
|
||||
|
||||
sing : Str -> State => Case => Str = \word ->
|
||||
@@ -1074,15 +1074,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
-- This only applies for singular indefinite
|
||||
x + y@? + #hamza => defArt s c (
|
||||
case <s,c> of { -- if hamza was last, it's now in the body
|
||||
<Indef,Acc> =>
|
||||
<Indef,Acc> =>
|
||||
case y of {
|
||||
#vstar => word + dec1sgNoDoubleAlif ! Indef ! Acc ;
|
||||
_ => let an : Str = dec1sg ! Indef ! Acc ;
|
||||
hmz : Str = bHmz x an ;
|
||||
in x + y + hmz + an } ;
|
||||
_ => word + dec1sg ! s ! c }) ;
|
||||
_ => word + dec1sg ! s ! c }) ;
|
||||
-- The rest is identical with singulars and broken plurals
|
||||
_ => brkPl word ! s ! c
|
||||
_ => brkPl word ! s ! c
|
||||
} ;
|
||||
|
||||
|
||||
@@ -1181,11 +1181,17 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
--dual suffixes
|
||||
dl : State => Case => Str =
|
||||
table {
|
||||
(Const|Poss) =>
|
||||
Const =>
|
||||
table {
|
||||
Nom => "َا";
|
||||
_ => "َيْ"
|
||||
};
|
||||
Poss =>
|
||||
table {
|
||||
Nom => "َا" ; -- wrong for 1st person poss. suff
|
||||
Bare => "َيَّ" ; -- this covers 1st person for genitive and accusative
|
||||
_ => "َيْ"
|
||||
};
|
||||
_ =>
|
||||
table {
|
||||
Nom => "َانِ";
|
||||
@@ -1228,7 +1234,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
};
|
||||
|
||||
-- TODO: this isn't actually because of gender, it "just happens".
|
||||
-- Refactor the whole sdfN and make variant with a parameter
|
||||
-- Refactor the whole sdfN and make variant with a parameter
|
||||
-- whether to insert a و or ه or something else /IL
|
||||
mkAtMasc : Str -> Str = \x ->
|
||||
case x of {
|
||||
@@ -1395,6 +1401,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
AAgr = {g : Gender ; n : Number} ;
|
||||
|
||||
agrLite : Agr -> AgrLite = \a -> a ** {gn = pgn2gn a.pgn} ;
|
||||
is1sg : Agr -> Bool = \a ->
|
||||
case a.pgn of {Per1 Sing => True; _ => False} ;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- NP, Pron
|
||||
@@ -1431,7 +1439,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
agrNP : Agr -> NP = \agr -> emptyNP ** {a = agr} ;
|
||||
|
||||
-- e.g. al-jamii3, 2a7ad
|
||||
regNP : Str -> Number -> State -> NP = \word,n,s ->
|
||||
regNP : Str -> Number -> State -> NP = \word,n,s ->
|
||||
agrNP {pgn = Per3 Masc n ; isPron = False} ** {
|
||||
s = \\c => fixShd word (dec1sg ! s ! c) ;
|
||||
} ;
|
||||
@@ -1610,11 +1618,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
};
|
||||
|
||||
-- very unsure about this /IL
|
||||
sc : Preposition = case o of {
|
||||
sc : Preposition = case o of {
|
||||
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 }
|
||||
_ => vp.sc }
|
||||
} ;
|
||||
subj = np.empty ++ sc.s ++ bindIf sc.binds
|
||||
++ case vp.isPred of {
|
||||
@@ -1625,7 +1633,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
vp.obj.a.isPron np.a.isPron
|
||||
(vStr vp pgn t p o)
|
||||
vp.obj.s
|
||||
(pred vp pgn t p)
|
||||
(pred vp pgn t p)
|
||||
vp.s2
|
||||
subj
|
||||
} ;
|
||||
@@ -1635,7 +1643,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
\o,objIsPron,subjIsPron,verb,obj,pred,adv,subj ->
|
||||
let cl = wordOrderNoSubj o objIsPron verb obj pred adv in
|
||||
case o of {
|
||||
Subord =>
|
||||
Subord =>
|
||||
let bind = if_then_Str subjIsPron BIND [] -- in subord. clause, subj. pronoun binds to the main verb
|
||||
in cl.before ++ bind ++ subj ++ cl.after ;
|
||||
_ => cl.before ++ subj ++ cl.after
|
||||
@@ -1647,19 +1655,19 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
VOS => {before = verb ++ obj ++ pred ++ adv; after = []} ;
|
||||
Verbal => case objIsPron of {
|
||||
True => {before = verb ++ obj ; after = adv ++ pred} ; -- obj. clitic attaches directly to the verb
|
||||
False => {before = verb ; after = obj ++ adv ++ pred}
|
||||
False => {before = verb ; after = obj ++ adv ++ pred}
|
||||
} ;
|
||||
(Nominal|Subord) => {before = [] ; after = verb ++ obj ++ adv ++ pred}
|
||||
} ;
|
||||
|
||||
pred : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Str = \vp,pgn,tn,pl ->
|
||||
pred : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Str = \vp,pgn,tn,pl ->
|
||||
let gn = pgn2gn pgn
|
||||
in case <vp.isPred,tn,pl> of {
|
||||
<True, Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
|
||||
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob
|
||||
} ;
|
||||
|
||||
vStr : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Order -> Str = \vp,pgn,tn,pl,o ->
|
||||
vStr : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Order -> Str = \vp,pgn,tn,pl,o ->
|
||||
let kataba = vp.s ! pgn ! VPPerf ;
|
||||
yaktubu = vp.s ! pgn ! VPImpf Ind ;
|
||||
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
|
||||
@@ -1710,11 +1718,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
subj2np : Subj -> NP = \su -> su ** {a = {pgn = emptyNP.a.pgn ; isPron = su.isPron} ; empty=[]} ;
|
||||
emptyObj : Obj = {a = {gn = {g=Masc ; n=Sg} ; isPron = False}; s = []} ;
|
||||
|
||||
insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** {
|
||||
insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** {
|
||||
obj = {s = vp.obj.s -- old object, if there was one
|
||||
++ bindIfPron np vp -- new object, bind if pronoun and not pred
|
||||
++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V
|
||||
a = agrLite np.a}
|
||||
a = agrLite np.a}
|
||||
} ;
|
||||
|
||||
bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ;
|
||||
|
||||
Reference in New Issue
Block a user