(Ara) Replace two 2-valued params in VP with one 3-valued param.

* is copula / is have_V2 / is neither

There is no difference; all three options are is mutually exclusive. 
There 2 params in the first place only by accident. First one was added 
by AED 10 years agon, second by me only some weeks ago, without thinking 
that the params are mutually exclusive.

Also tested with gftest, no difference found after 2 hours of running.
This commit is contained in:
Inari Listenmaa
2019-01-29 17:54:44 +01:00
parent 08c0b3fe54
commit ac5352f852
4 changed files with 37 additions and 31 deletions

View File

@@ -25,7 +25,7 @@ concrete IdiomAra of Idiom = CatAra ** open
CleftAdv adv s = CleftAdv adv s =
let comp : Comp = CompAdv (lin Adv {s = adv.s ++ s.s ! Verbal}) ; -- no idea about word order /IL let comp : Comp = CompAdv (lin Adv {s = adv.s ++ s.s ! Verbal}) ; -- no idea about word order /IL
pass_V = mkV "مضي" va vi ; -- switch to copula or some other verb if better /IL pass_V = mkV "مضي" va vi ; -- switch to copula or some other verb if better /IL
in predVP emptyNP (UseV pass_V ** {isPred=True ; pred=comp}) ; -- very hacky /IL in predVP emptyNP (UseV pass_V ** {vtype=Copula ; pred=comp}) ; -- very hacky /IL
-- : NP -> Cl ; -- there is a house -- : NP -> Cl ; -- there is a house
ExistNP np = ExistNP np =

View File

@@ -14,7 +14,7 @@ lin
-- : IP -> VP -> QCl ; -- who walks -- : IP -> VP -> QCl ; -- who walks
QuestVP qp vp = QuestVP qp vp =
let np = ip2np qp vp.isPred ; let np = ip2np qp (case vp.vtype of {Copula=>True ; _=>False}) ;
cl = PredVP np vp ; cl = PredVP np vp ;
in { s = \\t,p,qf => cl.s ! t ! p ! toOrder qf } ; in { s = \\t,p,qf => cl.s ! t ! p ! toOrder qf } ;

View File

@@ -469,19 +469,25 @@ param
| VPImp | VPImp
| VPGer ; | VPGer ;
VType = -- indicates if there is a predicate (xabar):
Copula -- 1) disappears in equational sentences
-- 2) its argument ('xabar') is in the pred field
-- 3) it is negated with laysa
| Have -- stays in eq. sentence, argument is in obj field, but is negated with laysa.
| NotPred ; -- any other verb but copula and have_V2
oper oper
BaseVP : Type = { -- to minimise duplication of code for VPS BaseVP : Type = { -- to minimise duplication of code for VPS
sc : Preposition ; -- subject case: e.g. يُمْكِنُ *لِ*Xِ sc : Preposition ; -- subject case: e.g. يُمْكِنُ *لِ*Xِ
obj : Obj; obj : Obj;
pred : Comp; pred : Comp;
isPred : Bool; -- indicates if there is a predicate (xabar) vtype : VType ; -- copula, have_V2 or normal verb
s2 : Str s2 : Str
} ; } ;
VP : Type = BaseVP ** { VP : Type = BaseVP ** {
s : PerGenNum => VPForm => Str ; s : PerGenNum => VPForm => Str ;
isPoss : Bool; -- special case for have_V2, to get negation right /IL
} ; } ;
uttVP : VPForm -> VP -> (Gender=>Str) = \vpf,vp -> uttVP : VPForm -> VP -> (Gender=>Str) = \vpf,vp ->
@@ -502,7 +508,7 @@ oper
obj = emptyObj ; obj = emptyObj ;
s2 = []; s2 = [];
pred = {s = \\_,_ => []} ; pred = {s = \\_,_ => []} ;
isPred,isPoss = False vtype = NotPred
}; };
passPredV : Verb -> VP = \v -> passPredV : Verb -> VP = \v ->
@@ -543,18 +549,18 @@ oper
bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ; bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ;
bindIfPron : NP -> {c2:Preposition; isPred:Bool} -> Str = \np,vp -> bindIfPron : NP -> {c2:Preposition; vtype:VType} -> Str = \np,vp ->
let notNom : Case -> Bool = \c -> case c of {Nom => False; _=>True} ; let notNom : Case -> Bool = \c -> case c of {Nom => False; _=>True} ;
bind = case vp.isPred of { bind = case vp.vtype of {
False => bindIf ( Copula => [] ;
orB (andB np.a.isPron (notNom vp.c2.c)) --if np is pron, not in nominative _ => bindIf (orB (andB np.a.isPron (notNom vp.c2.c)) --if np is pron, not in nominative
vp.c2.binds) ; vp.c2.binds)
True => [] } }
in vp.c2.s ++ bind ++ np.s ! vp.c2.c ; in vp.c2.s ++ bind ++ np.s ! vp.c2.c ;
insertPred : Comp -> VP -> VP = \p,vp -> vp ** insertPred : Comp -> VP -> VP = \p,vp -> vp **
{ pred = p; { pred = p;
isPred = True vtype = Copula
}; };
insertStr : Str -> VP -> VP = \str,vp -> vp ** insertStr : Str -> VP -> VP = \str,vp -> vp **
@@ -584,9 +590,9 @@ oper
_ => vp.sc } _ => vp.sc }
} ; } ;
subj = np.empty ++ sc.s ++ bindIf sc.binds subj = np.empty ++ sc.s ++ bindIf sc.binds
++ case vp.isPred of { ++ case vp.vtype of {
False => (proDrop np).s ! sc.c ; -- prodrop if it's not predicative Copula => np.s ! sc.c ;
True => np.s ! sc.c _ => (proDrop np).s ! sc.c -- prodrop if it's not predicative
} ; } ;
in wordOrder o in wordOrder o
vp.obj.a.isPron np.a.isPron np.isHeavy vp.obj.a.isPron np.a.isPron np.isHeavy
@@ -631,9 +637,9 @@ oper
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 let gn = pgn2gn pgn
in case <vp.isPred,tn,pl> of { in case <vp.vtype,tn,pl> of {
<True, Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc <Copula, Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob _ => 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 ->
@@ -646,12 +652,12 @@ oper
lam = "لَمْ" ; -- neg. past lam = "لَمْ" ; -- neg. past
alla = "أَلَّا" ; -- neg. subjunctive alla = "أَلَّا" ; -- neg. subjunctive
lan = "لَنْ" ; -- neg. future lan = "لَنْ" ; -- neg. future
in case <vp.isPred,tn,pl,o,vp.isPoss> of { in case <vp.vtype,tn,pl,o> of {
<False, Pres, Neg, _, True> => laysa ! Per3 Masc Sg ++ yaktubu ; -- special case for have_V2 <Have, Pres, Neg, _,> => laysa ! Per3 Masc Sg ++ yaktubu ; -- special case for have_V2
<False, Pres, Pos, _> => yaktubu ; <Copula, Pres, Pos, _> => [] ; --no verb "to be" in present
<False, Pres, Neg, _> => la ++ yaktubu ; <Copula, Pres, Neg, _> => laysa ! pgn ; -- negative copula
<True, Pres, Pos, _> => [] ; --no verb "to be" in present <_, Pres, Pos, _> => yaktubu ;
<True, Pres, Neg, _> => laysa ! pgn ; -- negative copula <_, Pres, Neg, _> => la ++ yaktubu ;
<_, Past, Pos, _> => kataba ; <_, Past, Pos, _> => kataba ;
<_, Past, Neg, _> => lam ++ yaktub ; <_, Past, Neg, _> => lam ++ yaktub ;
<_, Cond, Pos, _> => yaktuba ; <_, Cond, Pos, _> => yaktuba ;
@@ -682,9 +688,9 @@ oper
slashV2 : Verb2 -> VPSlash = \v -> slashV2 : Verb2 -> VPSlash = \v ->
predV v ** { predV v ** {
c2 = v.c2 ; agrObj = \\_ => [] ; c2 = v.c2 ; agrObj = \\_ => [] ;
isPoss = case v.c2.c of { vtype = case v.c2.c of {
Nom => True ; -- for have_V2 Nom => Have ; -- for have_V2
_ => False } ; _ => NotPred } ;
} ; } ;
-- Add subject string, fix agreement to the subject, -- Add subject string, fix agreement to the subject,

View File

@@ -16,7 +16,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
++ vp.s ! pgn ! VPImpf Cnj -- this will agree with the object added by ComplSlash ++ vp.s ! pgn ! VPImpf Cnj -- this will agree with the object added by ComplSlash
++ vp.obj.s ; ++ vp.obj.s ;
obj = emptyObj ; obj = emptyObj ;
isPred = False ; vtype = NotPred ;
c2 = v2v.c2 ; -- preposition for the direct object c2 = v2v.c2 ; -- preposition for the direct object
sc = v2v.sc sc = v2v.sc
} ; } ;
@@ -30,7 +30,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
++ vps.s ! np.a.pgn ! VPImpf Cnj -- verb from old VP agrees with object ++ vps.s ! np.a.pgn ! VPImpf Cnj -- verb from old VP agrees with object
++ vps.obj.s ; -- otherwise obj appears in a weird place /IL ++ vps.obj.s ; -- otherwise obj appears in a weird place /IL
obj = emptyObj ; obj = emptyObj ;
isPred = False ; vtype = NotPred ;
-- preposition for the direct object comes from VP -- preposition for the direct object comes from VP
sc = v2v.sc sc = v2v.sc
} ; } ;
@@ -68,7 +68,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
s = \\pgn,vpf => vvVP.s ! pgn ! vpf s = \\pgn,vpf => vvVP.s ! pgn ! vpf
++ vv.s2 -- أَنْ ++ vv.s2 -- أَنْ
++ vp.s ! pgn ! VPImpf Cnj ; ++ vp.s ! pgn ! VPImpf Cnj ;
isPred = False ; vtype = NotPred ;
sc = vv.sc sc = vv.sc
} ; } ;
@@ -92,7 +92,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
UseComp xabar = UseComp xabar =
case xabar.isNP of { case xabar.isNP of {
False => kaan xabar ; False => kaan xabar ;
True => predV copula ** {obj = xabar.obj ; isPred=True} True => predV copula ** {obj = xabar.obj ; vtype=Copula}
} ; } ;
UseCopula = predV copula ; UseCopula = predV copula ;