forked from GitHub/gf-rgl
(Ara) New category for ClSlash; update related functions
This commit is contained in:
@@ -49,6 +49,7 @@ oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
|
||||
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
|
||||
oper SentAP : AP -> SC -> AP = notYet "SentAP" ;
|
||||
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
|
||||
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
|
||||
oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
|
||||
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
|
||||
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
|
||||
|
||||
@@ -42,10 +42,11 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
|
||||
CompIAdv iadv = { s = \\_ => iadv.s ; a = ResAra.Sg } ;
|
||||
|
||||
-- QCl = {s : Tense => Polarity => QForm => Str} ;
|
||||
QuestSlash ip cl = { ----IL just guessing
|
||||
QuestSlash ip cls = { ----IL just guessing
|
||||
s = \\t,p,qf =>
|
||||
let o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing
|
||||
in cl.c2.s ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o
|
||||
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
|
||||
} ;
|
||||
|
||||
--IL guessed
|
||||
|
||||
@@ -20,12 +20,13 @@ concrete RelativeAra of Relative = CatAra **
|
||||
} ;
|
||||
|
||||
-- : RP -> ClSlash -> RCl ; -- whom John loves
|
||||
RelSlash rp cl = cl ** {
|
||||
RelSlash rp cls = cls ** {
|
||||
s = \\t,p,agr,c =>
|
||||
let obj = case (pgn2gn agr.pgn).g of {
|
||||
Fem => St.she_Pron ;
|
||||
Fem => St.she_Pron ; -- head is repeated as a clitic object pronoun
|
||||
Masc => St.he_Pron } ;
|
||||
in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! Nominal ++ cl.c2.s ++ obj.s ! cl.c2.c
|
||||
cl : ResAra.Cl = complClSlash obj cls ;
|
||||
in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! VOS
|
||||
} ;
|
||||
--
|
||||
-- FunRP p np rp = {
|
||||
|
||||
@@ -26,7 +26,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
|
||||
-- case vowel retained
|
||||
Mood = Ind | Cnj | Jus ;
|
||||
Voice = Act | Pas ;
|
||||
Order = Verbal | Nominal ;
|
||||
Order = Verbal | Nominal
|
||||
| VOS ; -- Relative clauses with resumptive pronouns
|
||||
|
||||
oper
|
||||
|
||||
@@ -1181,6 +1182,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
Agr = { pgn : PerGenNum; isPron : Bool} ;
|
||||
AAgr = { g : Gender ; n : Number} ;
|
||||
|
||||
|
||||
|
||||
Comp : Type = {
|
||||
s : AAgr => Case => Str
|
||||
} ;
|
||||
@@ -1236,7 +1239,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
oper
|
||||
|
||||
VP : Type = {
|
||||
s : PerGenNum => VPForm => Str;
|
||||
s : PerGenNum => VPForm => Str ;
|
||||
obj : Obj;
|
||||
pred : Comp;
|
||||
isPred : Bool; --indicates if there is a predicate (xabar)
|
||||
@@ -1282,8 +1285,48 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
};
|
||||
|
||||
|
||||
predVSlash : Verb2 -> VPSlash = \v ->
|
||||
predV v ** {c2 = v.c2} ;
|
||||
predVP : NP -> VP -> Cl = \np,vp ->
|
||||
{ s =\\t,p,o =>
|
||||
let {
|
||||
pgn =
|
||||
case <o,np.a.isPron> of {
|
||||
<Verbal, False> => verbalAgr np.a.pgn;
|
||||
_ => np.a.pgn
|
||||
};
|
||||
gn = pgn2gn pgn;
|
||||
kataba = vp.s ! pgn ! VPPerf ;
|
||||
yaktubu = vp.s ! pgn ! VPImpf Ind ;
|
||||
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
|
||||
yaktub = vp.s ! pgn ! VPImpf Jus ;
|
||||
vStr : ParamX.Tense -> Polarity -> Str =
|
||||
\tn,pl -> case <vp.isPred,tn,pl> of {
|
||||
<False, Pres, Pos> => yaktubu ;
|
||||
<False, Pres, Neg> => "لَا" ++ yaktubu ;
|
||||
<True, Pres, Pos> => "" ; --no verb "to be" in present
|
||||
<True, Pres, Neg> => "لَيسَ" ;--same here, just add negation particle
|
||||
<_, Past, Pos> => kataba ;
|
||||
<_, Past, Neg> => "لَمْ" ++ yaktub ;
|
||||
<_, _Fut, Pos> => "سَ" ++ yaktubu ;
|
||||
<_, _Fut, Neg> => "لَنْ" ++ yaktuba
|
||||
};
|
||||
pred : ParamX.Tense -> Polarity -> Str =
|
||||
\tn,pl -> 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
|
||||
};
|
||||
|
||||
} 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 }
|
||||
++ 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
|
||||
|
||||
}
|
||||
} ;
|
||||
|
||||
-- in verbal sentences, the verb agrees with the subject
|
||||
-- in Gender but not in number
|
||||
@@ -1305,11 +1348,30 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
{ s2 = vp.s2 ++ str };
|
||||
|
||||
kaan : {s : AAgr => Case => Str} -> VP = \xabar ->
|
||||
insertPred xabar (predV (v1hollow {f = "ك"; c = "و" ; l = "ن"} u) );
|
||||
insertPred xabar (predV copula);
|
||||
|
||||
copula : Verb = v1hollow {f = "ك"; c = "و" ; l = "ن"} u ;
|
||||
-- Slash categories
|
||||
|
||||
VPSlash : Type = VP ** {c2 : Preposition} ;
|
||||
ClSlash : Type = Cl ** {c2 : Preposition} ;
|
||||
ClSlash : Type = VPSlash ** {subj : NP} ;
|
||||
|
||||
slashV2 : Verb2 -> VPSlash = \v ->
|
||||
predV v ** {c2 = v.c2} ;
|
||||
|
||||
-- Add subject string, fix agreement to the subject,
|
||||
-- but keep the structure as VP, because later on
|
||||
-- we might need different word orders for the ClSlash.
|
||||
predVPSlash : NP -> VPSlash -> ClSlash = \np,v -> v ** {
|
||||
subj = np
|
||||
} ;
|
||||
|
||||
complClSlash = overload {
|
||||
complClSlash : NP -> ClSlash -> Cl = \obj,cls ->
|
||||
predVP cls.subj (insertObj obj cls) ;
|
||||
complClSlash : ClSlash -> Cl = \cls ->
|
||||
predVP cls.subj (insertObj emptyNP cls) -- Empty subject and object
|
||||
} ;
|
||||
|
||||
Cl : Type = {s : Tense => Polarity => Order => Str} ;
|
||||
QCl : Type = {s : Tense => Polarity => QForm => Str} ;
|
||||
@@ -1323,9 +1385,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
agr2ragr : Agr -> Case -> RAgr = \a,c ->
|
||||
let gn = pgn2gn a.pgn in case <gn.n,gn.g,a> of {
|
||||
<Sg,x> => RSg x ;
|
||||
<Pl,x> => RPl x ;
|
||||
<Dl,x> => RDl x c ;
|
||||
_ => Predef.error "agr2ragr"} ;
|
||||
<Pl,x> => RPl x } ;
|
||||
agr2ragr : Number -> Case -> Gender -> RAgr = \n,c,g ->
|
||||
case n of {
|
||||
Sg => RSg g ;
|
||||
|
||||
@@ -26,58 +26,7 @@ concrete SentenceAra of Sentence = CatAra ** open
|
||||
}
|
||||
};
|
||||
-}
|
||||
PredVP np vp =
|
||||
{ s =\\t,p,o =>
|
||||
let {
|
||||
pgn =
|
||||
case <o,np.a.isPron> of {
|
||||
<Verbal, False> => verbalAgr np.a.pgn;
|
||||
_ => np.a.pgn
|
||||
};
|
||||
gn = pgn2gn pgn;
|
||||
kataba = vp.s ! pgn ! VPPerf ;
|
||||
yaktubu = vp.s ! pgn ! VPImpf Ind ;
|
||||
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
|
||||
yaktub = vp.s ! pgn ! VPImpf Jus ;
|
||||
vStr : ParamX.Tense -> Polarity -> Str =
|
||||
\tn,pl -> case<vp.isPred,tn,pl> of {
|
||||
<False, Pres, Pos> => yaktubu ;
|
||||
<False, Pres, Neg> => "لَا" ++ yaktubu ;
|
||||
<True, Pres, Pos> => "" ; --no verb "to be" in present
|
||||
<True, Pres, Neg> => "لَيسَ" ;--same here, just add negation particle
|
||||
<_, Past, Pos> => kataba ;
|
||||
<_, Past, Neg> => "لَمْ" ++ yaktub ;
|
||||
<_, _Fut, Pos> => "سَ" ++ yaktubu ;
|
||||
<_, _Fut, Neg> => "لَنْ" ++ yaktuba
|
||||
};
|
||||
pred : ParamX.Tense -> Polarity -> Str =
|
||||
\tn,pl -> 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
|
||||
};
|
||||
|
||||
} in
|
||||
case o of {
|
||||
Verbal =>
|
||||
--case <False, np.a.isPron> of { ---- AR workaround 18/12/2008
|
||||
case <vp.obj.a.isPron, np.a.isPron> of {
|
||||
{- IL: I don't think we should do prodrop here. vStr drops the copula in present tense,
|
||||
so there's hardly anything left for a predicative clause: e.g.
|
||||
PredVP (UsePron i_Pron) (UseComp (CompCN (UseN car_N))) "I am a car"
|
||||
would be linearised just as "car", if we have both prodrop and copula drop.
|
||||
Leaving it up to someone who knows Arabic to decide what is better.
|
||||
Original here:
|
||||
<True,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p) ;
|
||||
-- ya2kuluhu
|
||||
<False,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p); -}
|
||||
-- ya2kuluhu al-waladu, yakuluhu al-2awlaadu
|
||||
<False> => (vStr t p) ++ np.s ! Nom ++ vp.obj.s ++ vp.s2 ++ (pred t p);
|
||||
<True> => (vStr t p) ++ vp.obj.s ++ np.s ! Nom ++ vp.s2 ++ (pred t p)
|
||||
};
|
||||
Nominal =>
|
||||
np.s ! Nom ++ (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p)
|
||||
}
|
||||
};
|
||||
PredVP = predVP ;
|
||||
|
||||
-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
|
||||
|
||||
@@ -100,9 +49,13 @@ concrete SentenceAra of Sentence = CatAra ** open
|
||||
|
||||
-- ClSlash
|
||||
|
||||
SlashVP np vps = PredVP np vps ** { c2 = vps.c2 } ;
|
||||
SlashVP = predVPSlash ;
|
||||
AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ;
|
||||
SlashPrep cl prep = cl ** {c2 = prep} ;
|
||||
|
||||
-- SlashPrep : Cl -> Prep -> ClSlash
|
||||
-- Will be awkward to implement in the way ClSlash is now.
|
||||
-- ClSlash is implemented the way it is now for a good reason:
|
||||
-- we need to support different word orders.
|
||||
|
||||
-- SlashVS np vs sslash = TODO
|
||||
|
||||
@@ -111,8 +64,8 @@ concrete SentenceAra of Sentence = CatAra ** open
|
||||
-- EmbedQS qs = {s = qs.s ! QIndir} ;
|
||||
-- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr
|
||||
--
|
||||
UseSlash,
|
||||
UseCl = \t,p,cl ->
|
||||
|
||||
UseCl t p cl =
|
||||
{s = t.s ++ p.s ++
|
||||
case <t.t,t.a> of { --- IL guessed tenses
|
||||
<(Pres|Cond),Simul> => cl.s ! Pres ! p.p ! Nominal ;
|
||||
@@ -132,4 +85,5 @@ concrete SentenceAra of Sentence = CatAra ** open
|
||||
|
||||
UseRCl t p cl = {s = \\agr,c => t.s ++ p.s ++ cl.s ! t.t ! p.p ! agr ! c} ;
|
||||
|
||||
UseSlash t p cl = UseCl t p (complClSlash cl) ;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
|
||||
--SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go
|
||||
--SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
|
||||
|
||||
SlashV2a v = predVSlash v ;
|
||||
Slash3V3 v np = insertObj np (predVSlash v) ** {c2 = v.c3};
|
||||
SlashV2a = slashV2 ;
|
||||
Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3};
|
||||
|
||||
ComplSlash vp np = insertObj np vp ;
|
||||
|
||||
@@ -38,6 +38,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
|
||||
--
|
||||
UseComp xabar = kaan xabar ;
|
||||
|
||||
UseCopula = predV copula ;
|
||||
|
||||
AdvVP vp adv = insertStr adv.s vp ;
|
||||
|
||||
-- AdVVP adv vp = insertAdV adv.s vp ;
|
||||
|
||||
Reference in New Issue
Block a user