completely redesigned VP. Added ReflVP in bulgarian-1.4

This commit is contained in:
krasimir
2008-06-15 08:35:52 +00:00
parent dbfe4c94e4
commit 20209ce716
6 changed files with 188 additions and 182 deletions

View File

@@ -51,15 +51,8 @@ concrete CatBul of Cat = open ResBul, Prelude, (R = ParamX) in {
-- Verb
VP = {
s : ResBul.Tense => Anteriority => Polarity => Agr => Bool => Aspect => Str ;
imp : Polarity => Number => Aspect => Str ;
ad : Bool => Str ;
compl : Agr => Str ;
subjRole : Role
} ;
VPSlash = ResBul.VP ** {c2 : Preposition} ;
VP = ResBul.VP ;
VPSlash = ResBul.VPSlash ;
Comp = {s : Agr => Str} ;
AdV = {s : Str} ; --lock_AdV : {}} ;

View File

@@ -55,16 +55,12 @@ concrete IdiomBul of Idiom = CatBul ** open Prelude, ParadigmsBul, ResBul in {
(mkClause "there" (agrP3 ip.n) (predAux auxBe)) ;
-}
ProgrVP vp = {
s = \\t,a,p,agr,q,asp => vp.s ! t ! a ! p ! agr ! q ! Imperf ;
imp = \\p,n,_ => vp.imp ! p ! n ! Imperf ;
s = \\_ => vp.s ! Imperf ;
ad = vp.ad ;
compl = vp.compl ;
subjRole = vp.subjRole
vtype = vp.vtype
} ;
ImpPl1 vp = {s = "íåêà" ++
vp.s ! Pres ! Simul ! Pos ! {gn = GPl ; p = P1} ! False ! Imperf ++
vp.compl ! {gn = GPl ; p = P1}
} ;
ImpPl1 vp = {s = "íåêà" ++ daComplex vp ! Perf ! {gn = GPl ; p = P1}} ;
}

View File

@@ -12,10 +12,7 @@ concrete PhraseBul of Phrase = CatBul ** open Prelude, ResBul in {
UttIP ip = {s = ip.s ! RSubj} ;
UttIAdv iadv = {s = iadv.s1} ;
UttNP np = {s = np.s ! RSubj} ;
UttVP vp = {s = vp.ad ! False ++
"äà" ++
vp.s ! Pres ! Simul ! Pos ! agrP3 (GSg Neut) ! False ! Perf ++
vp.compl ! agrP3 (GSg Neut)} ;
UttVP vp = {s = daComplex vp ! Perf ! agrP3 (GSg Neut)} ;
UttAdv adv = adv ;
NoPConj = {s = []} ;

View File

@@ -196,99 +196,60 @@ resource ResBul = ParamX ** open Prelude in {
} ;
VP : Type = {
s : Tense => Anteriority => Polarity => Agr => Bool => Aspect => Str ;
imp : Polarity => Number => Aspect => Str ;
ad : Bool => Str ; -- sentential adverb
s : Aspect => VTable ;
ad : {isEmpty : Bool; s : Str} ; -- sentential adverb
compl : Agr => Str ;
subjRole : Role
vtype : VType
} ;
VPSlash = {
s : Aspect => VTable ;
ad : {isEmpty : Bool; s : Str} ; -- sentential adverb
compl1 : Agr => Str ;
compl2 : Agr => Str ;
vtype : VType ;
c2 : Preposition
} ;
predV : Verb -> VP =
\verb ->
{ s = \\t,a,p,agr,q,asp =>
let clitic = case verb.vtype of {
VNormal => {s=[]; agr=agr} ;
VMedial c => {s=reflClitics ! c; agr=agr} ;
VPhrasal c => {s=personalClitics ! c ! agr.gn ! agr.p; agr={gn=GSg Neut; p=P3}}
} ;
predV : Verb -> VP = \verb -> {
s = verb.s ;
ad = {isEmpty=True; s=[]} ;
compl = \\_ => [] ;
vtype = verb.vtype ;
} ;
present = verb.s ! asp ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ;
presentImperf = verb.s ! Imperf ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ;
aorist = verb.s ! asp ! (VAorist (numGenNum clitic.agr.gn) clitic.agr.p) ;
perfect = verb.s ! asp ! (VPerfect (aform clitic.agr.gn Indef (RObj Acc))) ;
auxPres = auxBe ! VPres (numGenNum clitic.agr.gn) clitic.agr.p ;
auxAorist = auxBe ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ;
auxCond = auxWould ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ;
apc : Str -> Str = \s ->
case <numGenNum clitic.agr.gn, clitic.agr.p> of {
<Sg, P3> => clitic.s++s++auxPres ;
_ => auxPres++s++clitic.s
} ;
li = case q of {True => "ëè"; False => []} ;
vf1 : Str -> {s1 : Str; s2 : Str} = \s ->
case p of {
Pos => case q of {True => {s1=[]; s2="ëè"++apc []};
False => {s1=apc []; s2=[]}} ;
Neg => {s1="íå"++apc li; s2=[]}
} ;
vf2 : Str -> {s1 : Str; s2 : Str} = \s ->
case p of {
Pos => case q of {True => {s1=[]; s2="ëè"++s};
False => {s1=s; s2=[]}} ;
Neg => case verb.vtype of
{VNormal => {s1="íå"; s2=li} ;
_ => {s1="íå"++s++li; s2=[]}}
} ;
vf3 : Str -> {s1 : Str; s2 : Str} = \s ->
case p of {
Pos => {s1="ùå"++s; s2=li} ;
Neg => {s1="íÿìà"++li++"äà"++s; s2=[]}
} ;
vf4 : Str -> {s1 : Str; s2 : Str} = \s ->
case p of {
Pos => {s1= s++li++clitic.s; s2=[]} ;
Neg => {s1="íå"++s++li++clitic.s; s2=[]}
} ;
verbs : {aux:{s1:Str; s2:Str}; main:Str}
= case <t,a> of {
<Pres,Simul> => {aux=vf2 clitic.s; main=presentImperf} ;
<Pres,Anter> => {aux=vf1 clitic.s; main=perfect} ;
<Past,Simul> => {aux=vf2 clitic.s; main=aorist} ;
<Past,Anter> => {aux=vf4 auxAorist; main=perfect} ;
<Fut, Simul> => {aux=vf3 clitic.s; main=present} ;
<Fut, Anter> => {aux=vf3 (apc []); main=perfect} ;
<Cond,_ > => {aux=vf4 auxCond ; main=perfect}
}
in verbs.aux.s1 ++ verbs.main ++ verbs.aux.s2 ;
imp = \\p,n,asp =>
case p of {
Pos => verb.s ! asp ! VImperative n ;
Neg => "íå" ++ verb.s ! Imperf ! VImperative n
} ;
ad = \\_ => [] ;
compl = \\_ => [] ;
subjRole = case verb.vtype of {
VNormal => RSubj ;
VMedial _ => RSubj ;
VPhrasal c => RObj c
}
} ;
slashV : Verb -> Preposition -> VPSlash = \verb,prep -> {
s = verb.s ;
ad = {isEmpty=True; s=[]} ;
compl1 = \\_ => [] ;
compl2 = \\_ => [] ;
vtype = verb.vtype ;
c2 = prep ;
} ;
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
s = vp.s ;
imp = vp.imp ;
ad = vp.ad ;
compl = \\a => vp.compl ! a ++ obj ! a ;
subjRole = vp.subjRole
vtype = vp.vtype
} ;
insertSlashObj1 : (Agr => Str) -> VPSlash -> VPSlash = \obj,slash -> {
s = slash.s ;
ad = slash.ad ;
compl1 = \\a => slash.compl1 ! a ++ obj ! a ;
compl2 = slash.compl2 ;
vtype = slash.vtype ;
c2 = slash.c2
} ;
insertSlashObj2 : (Agr => Str) -> VPSlash -> VPSlash = \obj,slash -> {
s = slash.s ;
ad = slash.ad ;
compl1 = slash.compl1 ;
compl2 = \\a => slash.compl2 ! a ++ obj ! a ;
vtype = slash.vtype ;
c2 = slash.c2
} ;
auxBe : VTable =
@@ -412,13 +373,13 @@ resource ResBul = ParamX ** open Prelude in {
s : Tense => Anteriority => Polarity => Order => Str
} ;
mkClSlash : Str -> Agr -> Agr -> VP -> Clause =
\subj,agr_vp,agr_compl,vp -> {
mkClause : Str -> Agr -> VP -> Clause =
\subj,agr,vp -> {
s = \\t,a,p,o =>
let
let
verb : Bool => Str
= \\q => vp.ad ! q ++ vp.s ! t ! a ! p ! agr_vp ! q ! Perf ;
compl = vp.compl ! agr_compl
= \\q => vpTenses vp ! t ! a ! p ! agr ! q ! Perf ;
compl = vp.compl ! agr
in case o of {
Main => subj ++ verb ! False ++ compl ;
Inv => verb ! False ++ compl ++ subj ;
@@ -426,8 +387,83 @@ resource ResBul = ParamX ** open Prelude in {
}
} ;
mkClause : Str -> Agr -> VP -> Clause =
\subj,agr,vp -> mkClSlash subj agr agr vp ;
vpTenses : VP -> Tense => Anteriority => Polarity => Agr => Bool => Aspect => Str =
\verb -> \\t,a,p,agr,q0,asp =>
let clitic = case verb.vtype of {
VNormal => {s=[]; agr=agr} ;
VMedial c => {s=reflClitics ! c; agr=agr} ;
VPhrasal c => {s=personalClitics ! c ! agr.gn ! agr.p; agr={gn=GSg Neut; p=P3}}
} ;
present = verb.s ! asp ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ;
presentImperf = verb.s ! Imperf ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ;
aorist = verb.s ! asp ! (VAorist (numGenNum clitic.agr.gn) clitic.agr.p) ;
perfect = verb.s ! asp ! (VPerfect (aform clitic.agr.gn Indef (RObj Acc))) ;
auxPres = auxBe ! VPres (numGenNum clitic.agr.gn) clitic.agr.p ;
auxAorist = auxBe ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ;
auxCond = auxWould ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ;
apc : Str -> Str = \s ->
case <numGenNum clitic.agr.gn, clitic.agr.p> of {
<Sg, P3> => clitic.s++auxPres++s ;
_ => auxPres++s++clitic.s
} ;
li0 = case <verb.ad.isEmpty,q0> of {<False,True> => "ëè"; _ => []} ;
q = case verb.ad.isEmpty of {True => q0; False => False} ;
li = case q of {True => "ëè"; _ => []} ;
vf1 : Str -> {s1 : Str; s2 : Str} = \s ->
case p of {
Pos => case q of {True => {s1=[]; s2="ëè"++apc []};
False => {s1=apc []; s2=[]}} ;
Neg => {s1="íå"++apc li; s2=[]}
} ;
vf2 : Str -> {s1 : Str; s2 : Str} = \s ->
case p of {
Pos => case q of {True => {s1=[]; s2="ëè"++s};
False => {s1=s; s2=[]}} ;
Neg => case verb.vtype of
{VNormal => {s1="íå"; s2=li} ;
_ => {s1="íå"++s++li; s2=[]}}
} ;
vf3 : Str -> {s1 : Str; s2 : Str} = \s ->
case p of {
Pos => {s1="ùå"++s; s2=li} ;
Neg => {s1="íÿìà"++li++"äà"++s; s2=[]}
} ;
vf4 : Str -> {s1 : Str; s2 : Str} = \s ->
case p of {
Pos => {s1= s++li++clitic.s; s2=[]} ;
Neg => {s1="íå"++s++li++clitic.s; s2=[]}
} ;
verbs : {aux:{s1:Str; s2:Str}; main:Str} =
case <t,a> of {
<Pres,Simul> => {aux=vf2 clitic.s; main=presentImperf} ;
<Pres,Anter> => {aux=vf1 clitic.s; main=perfect} ;
<Past,Simul> => {aux=vf2 clitic.s; main=aorist} ;
<Past,Anter> => {aux=vf4 auxAorist; main=perfect} ;
<Fut, Simul> => {aux=vf3 clitic.s; main=present} ;
<Fut, Anter> => {aux=vf3 (apc []); main=perfect} ;
<Cond,_ > => {aux=vf4 auxCond ; main=perfect}
}
in verb.ad.s ++ li0 ++ verbs.aux.s1 ++ verbs.main ++ verbs.aux.s2 ;
daComplex : VP -> Aspect => Agr => Str =
\vp -> \\asp,agr =>
let clitic = case vp.vtype of {
VNormal => {s=[]; agr=agr} ;
VMedial c => {s=reflClitics ! c; agr=agr} ;
VPhrasal c => {s=personalClitics ! c ! agr.gn ! agr.p; agr={gn=GSg Neut; p=P3}}
}
in vp.ad.s ++ "äà" ++ clitic.s ++ vp.s ! asp ! VPres (numGenNum clitic.agr.gn) clitic.agr.p ++ vp.compl ! agr ;
-- For $Numeral$.

View File

@@ -3,21 +3,32 @@ concrete SentenceBul of Sentence = CatBul ** open Prelude, ResBul in {
flags optimize=all_subs ;
lin
PredVP np vp = mkClause (np.s ! vp.subjRole) np.a vp ;
PredVP np vp = mkClause (np.s ! (case vp.vtype of {
VNormal => RSubj ;
VMedial _ => RSubj ;
VPhrasal c => RObj c})) np.a vp ;
PredSCVP sc vp = mkClause sc.s {gn=GSg Masc; p=P3} vp ;
ImpVP vp = {
s = \\p,gn =>
let agr = {gn = gn ; p = P2} ;
verb = vp.imp ! p ! numGenNum gn ! Perf ;
compl = vp.compl ! agr
in
verb ++ compl
let agr = {gn = gn ; p = P2} ;
verb = vp.s ! Perf ! VImperative (numGenNum gn) ;
compl = vp.compl ! agr ;
clitic = case vp.vtype of {
VNormal => [] ;
VMedial c => reflClitics ! c ;
VPhrasal c => personalClitics ! c ! agr.gn ! agr.p
} ;
in case p of {Pos => vp.ad.s ++ verb ++ clitic ;
Neg => "íå" ++ vp.ad.s ++ clitic ++ verb} ++ compl ;
} ;
SlashVP np slash = {
s = \\agr => (mkClSlash (np.s ! RSubj) np.a agr slash).s ;
s = \\agr => (mkClause (np.s ! RSubj) np.a {s = slash.s ;
ad = slash.ad ;
compl = \\_ => slash.compl1 ! np.a ++ slash.compl2 ! agr ;
vtype = slash.vtype}).s ;
c2 = slash.c2
} ;
@@ -36,7 +47,7 @@ concrete SentenceBul of Sentence = CatBul ** open Prelude, ResBul in {
EmbedS s = {s = "," ++ "֌" ++ s.s} ;
EmbedQS qs = {s = qs.s ! QIndir} ;
EmbedVP vp = {s = vp.ad ! False ++ "äà" ++ vp.s ! Pres ! Simul ! Pos ! {gn=GSg Masc; p=P1} ! False ! Perf} ;
EmbedVP vp = {s = daComplex vp ! Perf ! {gn=GSg Masc; p=P1}} ;
UseCl t a p cl = {
s = t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! Main

View File

@@ -5,25 +5,16 @@ concrete VerbBul of Verb = CatBul ** open Prelude, ResBul, ParadigmsBul in {
lin
UseV = predV ;
SlashV2a v = predV v ** {c2 = v.c2} ;
SlashV2a v = slashV v v.c2 ;
Slash2V3 v np =
insertObj (\\_ => v.c2.s ++ np.s ! RObj v.c2.c) (predV v) ** {c2 = v.c3} ;
insertSlashObj1 (\\_ => v.c2.s ++ np.s ! RObj v.c2.c) (slashV v v.c3) ;
Slash3V3 v np =
insertObj (\\_ => v.c3.s ++ np.s ! RObj v.c3.c) (predV v) ** {c2 = v.c2} ;
insertSlashObj2 (\\_ => v.c3.s ++ np.s ! RObj v.c3.c) (slashV v v.c2) ;
ComplVV vv vp = {
s = \\t,a,p,agr,q,asp =>
let
vv_verb = (predV vv).s ! t ! a ! p ! agr ! q ! asp ;
vp_verb = vp.s ! Pres ! Simul ! Pos ! agr ! False ! Perf ;
in vv_verb ++ vp.ad ! False ++ "äà" ++ vp_verb ;
imp = vp.imp ;
ad = \\_ => [] ;
compl = vp.compl ;
subjRole = vp.subjRole
} ;
ComplVV vv vp =
insertObj (daComplex vp ! Perf) (predV vv) ;
ComplVS v s = insertObj (\\_ => "," ++ "֌" ++ s.s) (predV v) ;
ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
@@ -33,61 +24,44 @@ concrete VerbBul of Verb = CatBul ** open Prelude, ResBul, ParadigmsBul in {
SlashV2A v ap =
insertObj (\\a => ap.s ! aform a.gn Indef (RObj Acc))
(predV v) ** {c2 = v.c2} ; ---- FIXME: agreement with obj.a
insertSlashObj2 (\\a => ap.s ! aform a.gn Indef (RObj Acc)) (slashV v v.c2) ;
-- test: I saw a boy to whom she said that they are here
SlashV2S v s = insertObj (\\_ => "," ++ "֌" ++ s.s) (predV v) ** {c2 = v.c2} ;
SlashV2S v s = insertSlashObj2 (\\_ => "," ++ "֌" ++ s.s) (slashV v v.c2) ;
-- test: I saw a boy whom she asked who is here
SlashV2Q v q = insertObj (\\_ => q.s ! QIndir) (predV v) ** {c2 = v.c2} ;
SlashV2Q v q = insertSlashObj2 (\\_ => q.s ! QIndir) (slashV v v.c2) ;
-- test: I saw a boy whom she begged to walk
SlashV2V vv vp =
insertObj (\\agr => vp.ad ! False ++ "äà" ++ vp.s ! Pres ! Simul ! Pos ! agr ! False ! Perf)
(predV vv)
** {c2 = vv.c2} ;
insertSlashObj2 (daComplex vp ! Perf) (slashV vv vv.c2) ;
-- test: I saw a car whom she wanted to buy
SlashVV vv slash = {
s = \\t,a,p,agr,q,asp =>
let
vv_verb = (predV vv).s ! t ! a ! p ! agr ! q ! asp ;
slash_verb = slash.s ! Pres ! Simul ! Pos ! agr ! False ! Perf ;
in vv_verb ++ slash.ad ! False ++ "äà" ++ slash_verb ;
imp = \\p,n,asp =>
let
vv_verb = (predV vv).imp ! p ! n ! asp ;
slash_verb = slash.s ! Pres ! Simul ! Pos ! {gn = gennum DMasc n; p = P2} ! False ! Perf ;
in vv_verb ++ slash.ad ! False ++ "äà" ++ slash_verb ;
ad = \\_ => [] ;
compl = slash.compl ;
subjRole = (predV vv).subjRole
} ** {c2 = slash.c2} ;
s = vv.s ;
ad = {isEmpty=True; s=[]};
compl1 = daComplex {s=slash.s; ad=slash.ad; compl=slash.compl1; vtype=slash.vtype} ! Perf ;
compl2 = slash.compl2 ;
vtype = vv.vtype ;
c2 = slash.c2
} ;
-- test: I saw a car whom she begged me to buy
SlashV2VNP vv np slash = {
s = \\t,a,p,agr,q,asp =>
let
vv_verb = (predV vv).s ! t ! a ! p ! agr ! q ! asp ;
slash_verb = slash.s ! Pres ! Simul ! Pos ! np.a ! False ! Perf ;
in vv_verb ++ vv.c2.s ++ np.s ! RObj vv.c2.c ++ slash.ad ! False ++ "äà" ++ slash_verb ;
imp = \\p,n,asp =>
let
vv_verb = (predV vv).imp ! p ! n ! asp ;
slash_verb = slash.s ! Pres ! Simul ! Pos ! np.a ! False ! Perf ;
in vv_verb ++ vv.c2.s ++ np.s ! RObj vv.c2.c ++ slash.ad ! False ++ "äà" ++ slash_verb ;
ad = \\_ => [] ;
compl = slash.compl ;
subjRole = (predV vv).subjRole
} ** {c2 = slash.c2} ;
s = vv.s ;
ad = {isEmpty=True; s=[]};
compl1 = \\agr => vv.c2.s ++ np.s ! RObj vv.c2.c ++
daComplex {s=slash.s; ad=slash.ad; compl=slash.compl1; vtype=slash.vtype} ! Perf ! np.a ;
compl2 = slash.compl2 ;
vtype = vv.vtype ;
c2 = slash.c2
} ;
ComplSlash slash np = {
s = slash.s ;
imp = slash.imp ;
ad = slash.ad ;
compl = \\_ => slash.c2.s ++ np.s ! RObj slash.c2.c ++ slash.compl ! np.a ;
subjRole = slash.subjRole
compl = \\a => slash.compl1 ! a ++ slash.c2.s ++ np.s ! RObj slash.c2.c ++ slash.compl2 ! np.a ;
vtype = slash.vtype
} ;
UseComp comp = insertObj comp.s (predV verbBe) ;
@@ -95,22 +69,21 @@ concrete VerbBul of Verb = CatBul ** open Prelude, ResBul, ParadigmsBul in {
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
AdVVP adv vp = {
s = \\t,a,p,agr,q,asp => vp.s ! t ! a ! p ! agr ! False ! asp ;
imp = vp.imp ;
ad = \\q => vp.ad ! q ++ adv.s ++ case q of {True => "ëè"; False => []} ;
s = vp.s ;
ad = {isEmpty=False; s=vp.ad.s ++ adv.s} ;
compl = vp.compl ;
subjRole = vp.subjRole
vtype = vp.vtype
} ;
---- ReflV2 v = predV (reflV (v ** {lock_V=<>}) v.c2.c) ;
---- FIXME: AR cannot do this
---- ReflVP : VPSlash -> VP
ReflVP slash = {
s = slash.s ;
ad = slash.ad ;
compl = \\agr => slash.compl1 ! agr ++ slash.compl2 ! agr ;
vtype = VMedial slash.c2.c ;
} ;
PassV2 v = insertObj (\\a => v.s ! Perf ! VPassive (aform a.gn Indef (RObj Acc))) (predV verbBe) ;
---- UseVS, UseVQ = \vv -> {s = vv.s; c2 = noPrep; vtype = vv.vtype} ; -- no "to"
CompAP ap = {s = \\agr => ap.s ! aform agr.gn Indef (RObj Acc)} ;
CompNP np = {s = \\_ => np.s ! RObj Acc} ;
CompAdv a = {s = \\_ => a.s} ;