Latvian RG: improved support for verb-dependent clauses (word order & agreement)

This commit is contained in:
Normunds Gruzitis
2012-09-17 13:41:31 +00:00
parent 507dc623a9
commit a93a6f4fc6
7 changed files with 154 additions and 50 deletions

View File

@@ -7,88 +7,174 @@
-- Not so simple since morphology itself needs ResLav & friends.
concrete VerbLav of Verb = CatLav **
open
ParadigmsVerbsLav,
ParamX,
ResLav,
StructuralLav
in {
open StructuralLav, ParadigmsVerbsLav, ResLav, ParamX in {
flags
optimize = all_subs ;
coding = utf8 ;
lin
UseV v = { v = v ; topic = Nom ; focus = \\_ => [] } ;
ComplVV vv vp = { v = vv ; topic = vv.topic ; focus = \\agr => build_VP vp Pos Infinitive agr } ;
ComplVS vs s = { v = vs ; topic = vs.topic ; focus = \\_ => "," ++ vs.subj.s ++ s.s } ;
ComplVQ vq qs = { v = vq ; topic = vq.topic ; focus = \\_ => "," ++ qs.s } ;
ComplVA va ap = { v = va ; topic = Nom ; focus = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom } ;
UseV v = {
v = v ;
compl = \\_ => [] ;
agr = Topic Nom
} ;
SlashV2a v2 = { v = v2 ; topic = v2.topic ; focus = \\_ => [] ; p = v2.p } ;
ComplVV vv vp = {
v = vv ;
compl = \\agr => build_VP vp Pos Infinitive agr ;
agr = Topic vv.topic
} ;
ComplVS vs s = {
v = vs ;
compl = \\_ => "," ++ vs.subj.s ++ s.s ;
agr = Topic vs.topic
} ;
ComplVQ vq qs = {
v = vq ;
compl = \\_ => "," ++ qs.s ;
agr = Topic vq.topic
} ;
ComplVA va ap = {
v = va ;
compl = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom ;
agr = Topic Nom
} ;
-- SlashV2a : V2 -> VPSlash ; -- love (it)
-- Where the (direct) object comes from?!
SlashV2a v2 = {
v = v2 ;
compl = \\_ => [] ;
p = v2.p ;
agr = TopicFocus v2.topic (AgP3 Sg Masc) -- FIXME: works only if the focus is P3 (Sg/Pl); TODO: P1, P2 (Sg, Pl)
} ;
-- Slash2V3 : V3 -> NP -> VPSlash ; -- give it (to her)
-- Where the indirect object comes from?!
Slash2V3 v3 np = insertObjC
(\\_ => v3.p1.s ++ np.s ! (v3.p1.c ! (fromAgr np.a).n))
{ v = v3 ; topic = Nom ; focus = \\_ => [] ; p = v3.p2 } ;
{
v = v3 ;
compl = \\_ => [] ;
p = v3.p2 ;
agr = TopicFocus v3.topic np.a -- TESTME: P1, P2 (in the focus)
} ;
-- Slash3V3 : V3 -> NP -> VPSlash ; -- give (it) to her
-- Where the direct object comes from?!
Slash3V3 v3 np = insertObjC
(\\_ => v3.p2.s ++ np.s ! (v3.p2.c ! (fromAgr np.a).n))
{ v = v3 ; topic = Nom ; focus = \\_ => [] ; p = v3.p1 } ;
{
v = v3 ;
compl = \\_ => [] ;
p = v3.p1 ;
agr = TopicFocus v3.topic (AgP3 Sg Masc) -- FIXME: works only if the focus is P3 (Sg/Pl); TODO: P1, P2 (Sg, Pl)
} ;
SlashV2V v2v vp = { v = v2v ; topic = Nom ; focus = \\agr => build_VP vp Pos Infinitive agr ; p = v2v.p } ;
SlashV2S v2s s = { v = v2s ; topic = Nom ; focus = \\_ => "," ++ v2s.subj.s ++ s.s ; p = v2s.p } ;
SlashV2Q v2q qs = { v = v2q ; topic = Nom ; focus = \\_ => "," ++ qs.s ; p = v2q.p } ;
SlashV2A v2a ap = { v = v2a ; topic = Nom ; focus = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom ; p = v2a.p } ;
SlashV2V v2v vp = {
v = v2v ;
compl = \\agr => build_VP vp Pos Infinitive agr ;
p = v2v.p ;
agr = Topic Nom
} ;
SlashV2S v2s s = {
v = v2s ;
compl = \\_ => "," ++ v2s.subj.s ++ s.s ;
p = v2s.p ;
agr = Topic Nom
} ;
SlashV2Q v2q qs = {
v = v2q ;
compl = \\_ => "," ++ qs.s ;
p = v2q.p ;
agr = Topic Nom
} ;
SlashV2A v2a ap = {
v = v2a ;
compl = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom ;
p = v2a.p ;
agr = Topic Nom
} ;
ComplSlash vpslash np = insertObjPre
(\\_ => vpslash.p.s ++ np.s ! (vpslash.p.c ! (fromAgr np.a).n))
vpslash ;
SlashVV vv vpslash = { v = vv ; topic = vv.topic ; focus = \\agr => build_VP vpslash Pos Infinitive agr ; p = vpslash.p } ;
SlashVV vv vpslash = {
v = vv ;
compl = \\agr => build_VP vpslash Pos Infinitive agr ;
p = vpslash.p ;
agr = Topic vv.topic
} ;
SlashV2VNP v2v np vpslash = insertObjC
(\\_ => v2v.p.s ++ np.s ! (v2v.p.c ! (fromAgr np.a).n))
{ v = v2v ; topic = Nom ; focus = \\agr => build_VP vpslash Pos Infinitive agr ; p = vpslash.p } ;
{
v = v2v ;
compl = \\agr => build_VP vpslash Pos Infinitive agr ;
p = vpslash.p ;
agr = Topic Nom
} ;
ReflVP vpslash = insertObjPre
(\\agr => vpslash.p.s ++ reflPron ! (vpslash.p.c ! (fromAgr agr).n))
vpslash ;
UseComp comp = { v = lin V mkVerb_Irreg_Be ; topic = Nom ; focus = \\agr => comp.s ! agr } ;
UseComp comp = {
v = lin V mkVerb_Irreg_Be ;
compl = \\agr => comp.s ! agr ;
agr = Topic Nom
} ;
PassV2 v2 = { v = v2 ; topic = v2.topic ; focus = \\_ => NON_EXISTENT } ; -- FIXME: placeholder
PassV2 v2 = {
v = v2 ;
compl = \\_ => NON_EXISTENT ; -- FIXME: placeholder
agr = Topic v2.topic -- TODO: test me
} ;
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
AdVVP adv vp = insertObjPre (\\_ => adv.s) vp ;
CompAP ap = { s = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom } ;
CompNP np = { s = \\_ => np.s ! Nom } ;
CompAdv a = { s = \\_ => a.s } ;
CompCN cn = { s = \\agr => cn.s ! Indef ! (fromAgr agr).n ! Nom } ;
oper
build_VP : ResLav.VP -> Polarity -> VerbForm -> Agr -> Str = \vp,pol,vf,agr ->
vp.v.s ! pol ! vf ++ vp.focus ! agr ;
vp.v.s ! pol ! vf ++ vp.compl ! agr ;
-- VPSlash = { v : Verb ; topic : Case ; focus : Agr => Str ; p : Prep }
-- VPSlash = { v : Verb ; topic : Case ; compl : Agr => Str ; p : Prep }
insertObjC : (Agr => Str) -> ResLav.VPSlash -> ResLav.VPSlash = \obj,vp ->
insertObj obj vp ** { p = vp.p } ;
-- VP = { v : Verb ; topic : Case ; focus : Agr => Str }
-- VP = { v : Verb ; topic : Case ; compl : Agr => Str }
insertObj : (Agr => Str) -> ResLav.VP -> ResLav.VP = \obj,vp -> {
v = vp.v ;
topic = vp.topic ;
focus = \\agr => vp.focus ! agr ++ obj ! agr
compl = \\agr => vp.compl ! agr ++ obj ! agr ;
agr = vp.agr
} ;
-- VP = { v : Verb ; topic : Case ; focus : Agr => Str }
-- VP = { v : Verb ; topic : Case ; compl : Agr => Str }
-- TODO: šo jāmet ārā un jāpieliek insertObj parametrs isPre
-- Bet kas šis vispār ir par gadījumu?!
insertObjPre : (Agr => Str) -> ResLav.VP -> ResLav.VP = \obj,vp -> {
v = vp.v ;
topic = vp.topic ;
focus = \\agr => obj ! agr ++ vp.focus ! agr
compl = \\agr => obj ! agr ++ vp.compl ! agr ;
agr = vp.agr
} ;
buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Str = \v,mood,pol,ag ->