mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-13 23:09:31 -06:00
Latvian RG: improved support for verb-dependent clauses (word order & agreement)
This commit is contained in:
@@ -40,7 +40,7 @@ lincat
|
||||
-- Verb
|
||||
|
||||
VP = ResLav.VP ;
|
||||
VPSlash = ResLav.VP ** { p : ResLav.Prep } ;
|
||||
VPSlash = ResLav.VP ** { p : ResLav.Prep } ; -- TODO: kāpēc jāglabā prep?
|
||||
Comp = { s : ResLav.Agr => Str } ;
|
||||
|
||||
-- Adjective
|
||||
@@ -83,9 +83,10 @@ lincat
|
||||
V, VA = Verb ;
|
||||
VV, VQ = Verb ** { topic : Case } ;
|
||||
VS = Verb ** { subj : Subj ; topic : Case } ;
|
||||
V2 = Verb ** { p : ResLav.Prep ; topic : Case } ;
|
||||
V2A, V2Q, V2V = Verb ** { p : ResLav.Prep } ;
|
||||
V2S = Verb ** { p : ResLav.Prep ; subj : Subj } ;
|
||||
|
||||
V2 = Verb ** { p : ResLav.Prep ; topic : Case } ;
|
||||
V3 = Verb ** { p1, p2 : ResLav.Prep ; topic : Case } ;
|
||||
|
||||
CAdv = { s, p : Str ; d : Degree } ;
|
||||
|
||||
@@ -17,7 +17,7 @@ lin
|
||||
in {
|
||||
s = \\mood,pol =>
|
||||
buildVerb vp.v mood pol agr ++ -- Verb
|
||||
vp.focus ! agr -- Object(s), complements, adverbial modifiers
|
||||
vp.compl ! agr -- Object(s), complements, adverbial modifiers
|
||||
} ;
|
||||
|
||||
GenericCl vp =
|
||||
@@ -25,7 +25,7 @@ lin
|
||||
in {
|
||||
s = \\mood,pol =>
|
||||
buildVerb vp.v mood pol agr ++
|
||||
vp.focus ! agr
|
||||
vp.compl ! agr
|
||||
} ;
|
||||
|
||||
ExistNP np =
|
||||
@@ -57,13 +57,13 @@ lin
|
||||
in {
|
||||
s =
|
||||
vp.v.s ! Pos ! (Indicative P1 Pl Pres) ++ -- Verb
|
||||
vp.focus ! agr -- Object(s), complements, adverbial modifiers
|
||||
vp.compl ! agr -- Object(s), complements, adverbial modifiers
|
||||
}
|
||||
| { s = vp.v.s ! Pos ! (Indicative P1 Pl Fut) ++ vp.focus ! agr } --# notpresent
|
||||
| { s = vp.v.s ! Pos ! (Indicative P1 Pl Fut) ++ vp.compl ! agr } --# notpresent
|
||||
;
|
||||
|
||||
ImpP3 np vp = {
|
||||
s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a ++ vp.focus ! np.a ;
|
||||
s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a ++ vp.compl ! np.a ;
|
||||
} ;
|
||||
|
||||
-- FIXME: placeholder
|
||||
|
||||
@@ -16,7 +16,7 @@ lin
|
||||
s = \\m,p,ag =>
|
||||
rp.s ! Masc ! Nom ++
|
||||
buildVerb vp.v m p (toAgr (fromAgr ag).n P3 (fromAgr ag).g) ++
|
||||
vp.focus ! ag
|
||||
vp.compl ! ag
|
||||
} ;
|
||||
|
||||
-- FIXME: vārdu secība - nevis 'kas mīl viņu' bet 'kas viņu mīl' (?)
|
||||
|
||||
@@ -45,10 +45,14 @@ param
|
||||
|
||||
VerbConj = C2 | C3 ;
|
||||
|
||||
-- TODO: Kāpēc Gender ir tikai P3? Lokāmo divdabju dēļ?
|
||||
-- Dzimte jāsaskaņo vienmēr - nominālo izteicēju dēļ...
|
||||
-- Verb agreement
|
||||
-- Number depends on the person
|
||||
-- Gender has to be taken into accunt because of predicative nominals and participles
|
||||
Agr = AgP1 Number Gender | AgP2 Number Gender | AgP3 Number Gender ;
|
||||
|
||||
-- Clause agreement
|
||||
ClAgr = Topic Case | TopicFocus Case Agr ;
|
||||
|
||||
ThisOrThat = This | That ;
|
||||
CardOrd = NCard | NOrd ;
|
||||
DForm = unit | teen | ten ;
|
||||
@@ -67,7 +71,12 @@ oper
|
||||
|
||||
Verb : Type = { s : Polarity => VerbForm => Str } ;
|
||||
|
||||
VP = { v : Verb ; topic : Case ; focus : Agr => Str } ;
|
||||
-- TODO: topic un focus jāapvieno vienā (jaunā) agr parametrā (?), jo
|
||||
-- ne vienmēr ir abi un ne visas kombinācijas ir vajadzīgas
|
||||
--
|
||||
-- TODO: lai varētu spēlēties ar vārdu secību, compl vēlāk būs jāskalda pa daļām
|
||||
VP = { v : Verb ; compl : Agr => Str ; agr : ClAgr } ;
|
||||
-- compl: objects, complements, adverbial modifiers
|
||||
-- topic: typically - subject
|
||||
-- focus: typically - objects, complements, adverbial modifiers
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ lin
|
||||
|
||||
PredSCVP sc vp = mkClauseSC sc vp ;
|
||||
|
||||
ImpVP vp = { s = \\pol,n => vp.v.s ! pol ! (Imperative n) ++ vp.focus ! (AgP2 n Masc) } ;
|
||||
ImpVP vp = { s = \\pol,n => vp.v.s ! pol ! (Imperative n) ++ vp.compl ! (AgP2 n Masc) } ;
|
||||
|
||||
SlashVP np vp = mkClause np vp ** { p = vp.p } ;
|
||||
|
||||
@@ -28,11 +28,11 @@ lin
|
||||
SlashVS np vs sslash =
|
||||
mkClause np (lin VP {
|
||||
v = vs ;
|
||||
topic = vs.topic ;
|
||||
focus = \\_ => "," ++ vs.subj.s ++ sslash.s
|
||||
compl = \\_ => "," ++ vs.subj.s ++ sslash.s ;
|
||||
agr = Topic vs.topic ;
|
||||
}) ** { p = sslash.p } ;
|
||||
|
||||
ComplVS v s = { v = v ; focus = \\_ => "," ++ v.subj.s ++ s.s } ;
|
||||
ComplVS v s = { v = v ; compl = \\_ => "," ++ v.subj.s ++ s.s } ;
|
||||
|
||||
-- TODO: nočekot kāpēc te ir tieši 'ka'
|
||||
EmbedS s = { s = "ka" ++ s.s } ;
|
||||
@@ -60,17 +60,25 @@ oper
|
||||
s = \\mood,pol =>
|
||||
case mood of { -- Subject
|
||||
Deb _ _ => np.s ! Dat ; --# notpresent
|
||||
_ => np.s ! vp.topic
|
||||
_ => case vp.agr of {
|
||||
Topic c => np.s ! c ;
|
||||
TopicFocus c _ => np.s ! c
|
||||
}
|
||||
} ++
|
||||
buildVerb vp.v mood pol np.a ++ -- Verb
|
||||
vp.focus ! np.a -- Object(s), complements, adverbial modifiers
|
||||
case vp.agr of { -- Verb
|
||||
Topic Nom => buildVerb vp.v mood pol np.a ;
|
||||
Topic _ => buildVerb vp.v mood pol (AgP3 Sg Masc) ; -- TODO: test me
|
||||
TopicFocus Nom _ => buildVerb vp.v mood pol np.a ;
|
||||
TopicFocus _ agr => buildVerb vp.v mood pol agr
|
||||
} ++
|
||||
vp.compl ! np.a -- Object(s), complements, adverbial modifiers
|
||||
} ;
|
||||
|
||||
-- FIXME: quick&dirty - lai kompilētos pret RGL API
|
||||
-- Eng: PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp
|
||||
-- Ar SC nav iespējams neko saskaņot (sk. Cat.gf un Common.gf)
|
||||
mkClauseSC : SC -> CatLav.VP -> Cl = \sc,vp -> lin Cl {
|
||||
s = \\mood,pol => sc.s ++ buildVerb vp.v mood pol (AgP3 Sg Masc) ++ vp.focus ! (AgP3 Sg Masc)
|
||||
s = \\mood,pol => sc.s ++ buildVerb vp.v mood pol (AgP3 Sg Masc) ++ vp.compl ! (AgP3 Sg Masc)
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ lin
|
||||
both7and_DConj = mkConj "gan" ("," ++ "gan"); --FIXME - komati nav tā kā vajag
|
||||
either7or_DConj = mkConj ("vai" ++ "nu") ("," ++ "vai") Sg ; --FIXME - komati nav tā kā vajag
|
||||
|
||||
want_VV = mkVV (mkV "gribēt" third_conjugation) ;
|
||||
want_VV = mkVV (mkV "vēlēties" third_conjugation) ;
|
||||
|
||||
whoSg_IP = {
|
||||
s = table {
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
Reference in New Issue
Block a user