From d217f20c60fd563ac9eeb2f2ea7ecaff3106301d Mon Sep 17 00:00:00 2001 From: Normunds Gruzitis Date: Thu, 23 Aug 2012 23:05:16 +0000 Subject: [PATCH] A major update to the Latvian resource grammar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The case of the topic part of a clause (~subject) can now depend on the verb, allowing for less frequent agreement. E.g. "man[Dat] garšo pica[Nom]" ("I like pizza"). The default case for the topic/subject remains the nominative case. --- lib/src/latvian/CatLav.gf | 62 +++++++++------- lib/src/latvian/ExtraLav.gf | 2 + lib/src/latvian/IdiomLav.gf | 28 ++++---- lib/src/latvian/LexiconLav.gf | 2 +- lib/src/latvian/ParadigmsLav.gf | 70 +++++++++++------- lib/src/latvian/RelativeLav.gf | 4 +- lib/src/latvian/ResLav.gf | 10 ++- lib/src/latvian/SentenceLav.gf | 19 ++--- lib/src/latvian/StructuralLav.gf | 8 ++- lib/src/latvian/VerbLav.gf | 119 ++++++++++++++++--------------- 10 files changed, 185 insertions(+), 139 deletions(-) diff --git a/lib/src/latvian/CatLav.gf b/lib/src/latvian/CatLav.gf index 0c87558c4..247d900dc 100644 --- a/lib/src/latvian/CatLav.gf +++ b/lib/src/latvian/CatLav.gf @@ -1,46 +1,54 @@ --# -path=.:../abstract:../common:../prelude -concrete CatLav of Cat = CommonX - [CAdv, Voc] ** open - ResLav, - Prelude - in { +concrete CatLav of Cat = CommonX - [CAdv, Voc] ** +open + Prelude, + ResLav +in { flags coding = utf8 ; optimize = all_subs ; lincat - -- Tensed/Untensed - S = { s : Str } ; - QS = { s : Str } ; - RS = { s : Agr => Str } ; -- Eng: c : Case -- c for it clefts - SSlash = { s : Str ; p : Prep } ; + + -- Tensed / Untensed + + S, QS = { s : Str } ; + RS = { s : Agr => Str } ; + SSlash = { s : Str ; p : ResLav.Prep } ; -- Sentence + Cl = { s : VerbMood => Polarity => Str } ; - ClSlash = { s : VerbMood => Polarity => Str ; p : Prep } ; + ClSlash = { s : VerbMood => Polarity => Str ; p : ResLav.Prep } ; Imp = { s : Polarity => Number => Str } ; -- Question + QCl = { s : VerbMood => Polarity => Str } ; IP = { s : Case => Str ; n: Number } ; - --IComp = { s : Str ; a : ResLav.Agr } ; IDet = { s : Gender => Str ; n : Number } ; IQuant = { s : Gender => Number => Str } ; + -- TODO: IComp = { s : Str ; a : ResLav.Agr } ; -- Relative + RCl = { s : VerbMood => Polarity => Agr => Str } ; RP = { s : Gender => Case => Str } ; -- Verb + VP = ResLav.VP ; - VPSlash = ResLav.VP ** { p : Prep } ; + VPSlash = ResLav.VP ** { p : ResLav.Prep } ; Comp = { s : ResLav.Agr => Str } ; -- Adjective + AP = { s : Definite => Gender => Number => Case => Str } ; -- Noun + CN = { s : Definite => Number => Case => Str ; g : Gender } ; NP = { s : Case => Str ; a : ResLav.Agr } ; Pron = { s : Case => Str ; a : ResLav.Agr ; possessive : Gender => Number => Case => Str } ; @@ -52,33 +60,33 @@ lincat Quant = { s : Gender => Number => Case => Str ; d : Definite } ; -- Numeral + Numeral = { s : CardOrd => Gender => Case => Str ; n : Number } ; Digits = { s : CardOrd => Str ; n : Number } ; -- Structural + Conj = { s1, s2 : Str ; n : Number } ; Subj = { s : Str } ; - Prep = { s : Str ; c : Number => Case } ; - -- e.g. 'ar' + Sg-Acc or Pl-Dat; preposition may be empty ([]) for case-based valences - -- TODO: pozīcija (pre/post) nav noteikta + Prep = ResLav.Prep ; + + -- Open lexical classes (lexicon) - -- Open lexical classes, e.g. Lexicon N = { s : Number => Case => Str ; g : Gender } ; - N2 = { s : Number => Case => Str ; g : Gender } ** { p : Prep ; isPre : Bool } ; - -- case/preposition used; if isPre, then located before the noun - N3 = { s : Number => Case => Str ; g : Gender } ** { p1, p2 : Prep ; isPre1, isPre2 : Bool } ; + N2 = { s : Number => Case => Str ; g : Gender } ** { p : ResLav.Prep ; isPre : Bool } ; -- If isPre then located before the noun + N3 = { s : Number => Case => Str ; g : Gender } ** { p1, p2 : ResLav.Prep ; isPre1, isPre2 : Bool } ; PN = { s : Case => Str ; g : Gender ; n : Number } ; A = { s : AForm => Str } ; - A2 = A ** { p : Prep } ; + A2 = A ** { p : ResLav.Prep } ; - V, VQ, VA, VV = Verb ; - VS = Verb ** { subj : Subj } ; - V2, V2A, V2Q, V2V = Verb ** { p : Prep } ; - V2S = Verb ** { p : Prep ; subj : Subj } ; - V3 = Verb ** { p1, p2 : Prep } ; - -- TODO: pieņemam ka viena valence; būtu jānorāda semantika - integrēt ar FrameNet + 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 } ; + V3 = Verb ** { p1, p2 : ResLav.Prep ; topic : Case } ; CAdv = { s, p : Str ; d : Degree } ; - } diff --git a/lib/src/latvian/ExtraLav.gf b/lib/src/latvian/ExtraLav.gf index c04230933..d42887a8e 100644 --- a/lib/src/latvian/ExtraLav.gf +++ b/lib/src/latvian/ExtraLav.gf @@ -22,6 +22,8 @@ lin they8fem_Pron = mkPronoun_They Fem ; it8fem_Pron = mkPronoun_It_Sg Fem ; + -- FIXME: zemāk esošās f-cijas nav ExtraLavAbs - kāpēc tās ir te?! + GenNP np = {s = \\_,_,_ => np.s ! Gen ; d = Def} ; --ICompAP ap = {s = \\g,n => "cik" ++ ap.s ! Indef ! g ! n ! Nom } ; diff --git a/lib/src/latvian/IdiomLav.gf b/lib/src/latvian/IdiomLav.gf index f32182b45..5145275e0 100644 --- a/lib/src/latvian/IdiomLav.gf +++ b/lib/src/latvian/IdiomLav.gf @@ -13,39 +13,39 @@ flags lin ImpersCl vp = - let a = AgP3 Sg Masc + let agr = AgP3 Sg Masc in { s = \\mood,pol => - buildVerb vp.v mood pol a ++ -- Verb - vp.s2 ! a -- Object(s), complements, adverbial modifiers + buildVerb vp.v mood pol agr ++ -- Verb + vp.focus ! agr -- Object(s), complements, adverbial modifiers } ; GenericCl vp = - let a = AgP3 Sg Masc + let agr = AgP3 Sg Masc in { s = \\mood,pol => - buildVerb vp.v mood pol a ++ - vp.s2 ! a + buildVerb vp.v mood pol agr ++ + vp.focus ! agr } ; ExistNP np = let v = lin V mkVerb_Irreg_Be ; - a = np.a + agr = np.a in { s = \\mood,pol => - buildVerb v mood pol a ++ + buildVerb v mood pol agr ++ np.s ! Nom } ; ExistIP ip = let v = lin V mkVerb_Irreg_Be ; - a = AgP3 ip.n Masc + agr = AgP3 ip.n Masc in { s = \\mood,pol => ip.s ! Nom ++ - buildVerb v mood pol a + buildVerb v mood pol agr } ; -- FIXME: needs restriction so that only VerbMood Indicative _ _ Present is allowed; @@ -53,17 +53,17 @@ lin ProgrVP v = v ; ImpPl1 vp = - let a = AgP1 Pl Masc + let agr = AgP1 Pl Masc in { s = vp.v.s ! Pos ! (Indicative P1 Pl Pres) ++ -- Verb - vp.s2 ! a -- Object(s), complements, adverbial modifiers + vp.focus ! agr -- Object(s), complements, adverbial modifiers } - | { s = vp.v.s ! Pos ! (Indicative P1 Pl Fut) ++ vp.s2 ! a } --# notpresent + | { s = vp.v.s ! Pos ! (Indicative P1 Pl Fut) ++ vp.focus ! agr } --# notpresent ; ImpP3 np vp = { - s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a ++ vp.s2 ! np.a ; + s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a ++ vp.focus ! np.a ; } ; -- FIXME: placeholder diff --git a/lib/src/latvian/LexiconLav.gf b/lib/src/latvian/LexiconLav.gf index 829da7081..8d7ca6854 100644 --- a/lib/src/latvian/LexiconLav.gf +++ b/lib/src/latvian/LexiconLav.gf @@ -312,7 +312,7 @@ lin year_N = mkN "gads" ; blow_V = mkV "pūst" "pūšu" "pūtu" ; - breathe_V = mkV2 (mkV "elpot" second_conjugation) acc_Prep ; + breathe_V = mkV "elpot" second_conjugation ; burn_V = mkV "degt" "degu" "degu" ; dig_V = mkV "rakt" "roku" "raku" ; fall_V = mkV "krist" "krītu" "kritu" ; diff --git a/lib/src/latvian/ParadigmsLav.gf b/lib/src/latvian/ParadigmsLav.gf index 17067a61d..2c8f0d22c 100644 --- a/lib/src/latvian/ParadigmsLav.gf +++ b/lib/src/latvian/ParadigmsLav.gf @@ -15,13 +15,8 @@ flags coding = utf8 ; oper - Number : Type ; - singular : Number ; - plural : Number ; - - Number = ResLav.Number ; - singular = Sg ; - plural = Pl ; + singular : Number = Sg ; + plural : Number = Pl ; second_conjugation : VerbConj = C2 ; third_conjugation : VerbConj = C3 ; @@ -53,11 +48,11 @@ oper } ; mkN2 = overload { - mkN2 : N -> Prep -> N2 = \n,p -> lin N2 n ** { p = p ; isPre = False } ; - mkN2 : N -> Prep -> Bool -> N2 = \n,p,isPre -> lin N2 n ** { p = p ; isPre = isPre } ; + mkN2 : N -> ResLav.Prep -> N2 = \n,p -> lin N2 n ** { p = p ; isPre = False } ; + mkN2 : N -> ResLav.Prep -> Bool -> N2 = \n,p,isPre -> lin N2 n ** { p = p ; isPre = isPre } ; } ; - mkN3 : N -> Prep -> Prep -> N3 = \n,p1,p2 -> + mkN3 : N -> ResLav.Prep -> ResLav.Prep -> N3 = \n,p1,p2 -> lin N3 n ** { p1 = p1 ; p2 = p2 ; isPre1 = False ; isPre2 = False } ; mkA = overload { @@ -66,14 +61,14 @@ oper mkA : (v : Verb) -> A = \v -> lin A (mkAdjective_Participle v) ; } ; - mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** { p = p }) ; -- precējies ar ... + mkA2 : A -> ResLav.Prep -> A2 = \a,p -> lin A2 (a ** { p = p }) ; -- precējies ar ... mkAS : A -> AS =\a -> lin A a ; - mkA2S : A -> Prep -> A2S =\a,p -> lin A2 (a ** { p = p }) ; + mkA2S : A -> ResLav.Prep -> A2S =\a,p -> lin A2 (a ** { p = p }) ; mkAV : A -> AV = \a -> lin A a ; - mkA2V : A -> Prep -> A2V = \a,p -> lin A2 (a ** { p = p }) ; + mkA2V : A -> ResLav.Prep -> A2V = \a,p -> lin A2 (a ** { p = p }) ; AS, AV : Type = { s : AForm => Str } ; - A2S, A2V : Type = { s : AForm => Str ; p : Prep }; + A2S, A2V : Type = { s : AForm => Str ; p : ResLav.Prep }; mkV = overload { mkV : (lemma : Str) -> V = \l -> lin V (mkVerb_Irreg l) ; @@ -81,23 +76,46 @@ oper mkV : (lemma : Str) -> Str -> Str -> V = \l1,l2,l3 -> lin V (mkVerbC1 l1 l2 l3) ; } ; - mkV2 : V -> Prep -> V2 = \v,p -> lin V2 v ** { p = p } ; - mkVS : V -> Subj -> VS = \v,s -> lin VS v ** { subj = s } ; - mkV2S : V -> Prep -> Subj -> V2S = \v,p,s -> lin V2S v ** { p = p ; subj = s } ; - mkVA : V -> VA = \v -> lin VA v ; - mkV2A : V -> Prep -> V2A = \v,p -> lin V2A v ** { p = p } ; - mkVQ : V -> VQ = \v -> lin VQ v ; - mkV2Q : V -> Prep -> V2Q = \v,p -> lin V2Q v ** { p = p } ; - mkVV : V -> VV = \v -> lin VV v ; - mkV2V : V -> Prep -> V2V = \v,p -> lin V2V v ** { p = p } ; - mkV3 : V -> Prep -> Prep -> V3 = \v,p1,p2 -> lin V3 v ** { p1 = p1 ; p2 = p2 } ; + mkV2 = overload { + mkV2 : V -> ResLav.Prep -> V2 = \v,p -> lin V2 v ** { p = p ; topic = Nom } ; + mkV2 : V -> ResLav.Prep -> Case -> V2 = \v,p,c -> lin V2 v ** { p = p ; topic = c } ; + } ; + + mkVS = overload { + mkVS : V -> Subj -> VS = \v,s -> lin VS v ** { subj = s ; topic = Nom } ; + mkVS : V -> Subj -> Case -> VS = \v,s,c -> lin VS v ** { subj = s ; topic = c } ; + } ; + + mkVQ = overload { + mkVQ : V -> VQ = \v -> lin VQ v ** { topic = Nom } ; + mkVQ : V -> Case -> VQ = \v,c -> lin VQ v ** { topic = c } ; + } ; + + mkVV = overload { + mkVV : V -> VV = \v -> lin VV v ** { topic = Nom } ; + mkVV : V -> Case -> VV = \v,c -> lin VV v ** { topic = c } ; + } ; + + mkV3 = overload { + mkV3 : V -> ResLav.Prep -> ResLav.Prep -> V3 = \v,p1,p2 -> + lin V3 v ** { p1 = p1 ; p2 = p2 ; topic = Nom } ; + mkV3 : V -> ResLav.Prep -> ResLav.Prep -> Case -> V3 = \v,p1,p2,c -> + lin V3 v ** { p1 = p1 ; p2 = p2 ; topic = c } ; + } ; + + mkVA : V -> VA = \v -> lin VA v ; + + mkV2S : V -> ResLav.Prep -> Subj -> V2S = \v,p,s -> lin V2S v ** { p = p ; subj = s } ; + mkV2A : V -> ResLav.Prep -> V2A = \v,p -> lin V2A v ** { p = p } ; + mkV2Q : V -> ResLav.Prep -> V2Q = \v,p -> lin V2Q v ** { p = p } ; + mkV2V : V -> ResLav.Prep -> V2V = \v,p -> lin V2V v ** { p = p } ; mkCAdv : Str -> Str -> Degree -> CAdv = \s,p,d -> { s = s ; p = p ; d = d ; lock_CAdv = <> } ; mkPrep = overload { - mkPrep : Str -> Case -> Case -> Prep = \prep,sg,pl -> + mkPrep : Str -> Case -> Case -> ResLav.Prep = \prep,sg,pl -> lin Prep { s = prep ; c = table { Sg => sg ; Pl => pl } } ; - mkPrep : Case -> Prep = \c -> lin Prep { s = [] ; c = table { _ => c } } ; + mkPrep : Case -> ResLav.Prep = \c -> lin Prep { s = [] ; c = table { _ => c } } ; } ; -- empty fake prepositions for valences diff --git a/lib/src/latvian/RelativeLav.gf b/lib/src/latvian/RelativeLav.gf index d789d9c70..d4b6cdd28 100644 --- a/lib/src/latvian/RelativeLav.gf +++ b/lib/src/latvian/RelativeLav.gf @@ -14,7 +14,9 @@ lin RelVP rp vp = { s = \\m,p,ag => - rp.s ! Masc ! Nom ++ buildVerb vp.v m p (toAgr (fromAgr ag).n P3 (fromAgr ag).g) ++ vp.s2 ! ag + rp.s ! Masc ! Nom ++ + buildVerb vp.v m p (toAgr (fromAgr ag).n P3 (fromAgr ag).g) ++ + vp.focus ! ag } ; -- FIXME: vārdu secība - nevis 'kas mīl viņu' bet 'kas viņu mīl' (?) diff --git a/lib/src/latvian/ResLav.gf b/lib/src/latvian/ResLav.gf index 7066d42ec..078a0e1c1 100644 --- a/lib/src/latvian/ResLav.gf +++ b/lib/src/latvian/ResLav.gf @@ -67,12 +67,16 @@ oper Verb : Type = { s : Polarity => VerbForm => Str } ; - VP = { v : Verb ; s2 : Agr => Str } ; -- s2 = object(s), complements, adverbial modifiers + VP = { v : Verb ; topic : Case ; focus : Agr => Str } ; + -- topic: typically - subject + -- focus: typically - objects, complements, adverbial modifiers - VPSlash = VP ** { p : prep } ; + VPSlash = VP ** { p : Prep } ; -- principā rekur ir objekts kuram jau kaut kas ir bet ir vēl viena brīva valence... - prep = { s : Str ; c : Number => Case } ; + Prep : Type = { s : Str ; c : Number => Case } ; + -- In the case of case-based valences, the preposition is empty ([]) + -- TODO: position of prepositions (pre or post) --Valence : Type = { p : Prep ; c : Number => Case } ; -- e.g. 'ar' + Sg-Acc or Pl-Dat; Preposition may be skipped for simple case-baced valences diff --git a/lib/src/latvian/SentenceLav.gf b/lib/src/latvian/SentenceLav.gf index ec228e71a..8da432507 100644 --- a/lib/src/latvian/SentenceLav.gf +++ b/lib/src/latvian/SentenceLav.gf @@ -14,7 +14,7 @@ lin PredSCVP sc vp = mkClauseSC sc vp ; - ImpVP vp = { s = \\pol,n => vp.v.s ! pol ! (Imperative n) ++ vp.s2 ! (AgP2 n Masc) } ; + ImpVP vp = { s = \\pol,n => vp.v.s ! pol ! (Imperative n) ++ vp.focus ! (AgP2 n Masc) } ; SlashVP np vp = mkClause np vp ** { p = vp.p } ; @@ -25,10 +25,14 @@ lin SlashPrep cl prep = cl ** { p = prep } ; - SlashVS np vs slash = - mkClause np (lin VP { v = vs ; s2 = \\_ => "," ++ vs.subj.s ++ slash.s }) ** { p = slash.p } ; + SlashVS np vs sslash = + mkClause np (lin VP { + v = vs ; + topic = vs.topic ; + focus = \\_ => "," ++ vs.subj.s ++ sslash.s + }) ** { p = sslash.p } ; - ComplVS v s = { v = v ; s2 = \\_ => "," ++ v.subj.s ++ s.s } ; + ComplVS v s = { v = v ; focus = \\_ => "," ++ v.subj.s ++ s.s } ; -- TODO: nočekot kāpēc te ir tieši 'ka' EmbedS s = { s = "ka" ++ s.s } ; @@ -55,19 +59,18 @@ oper mkClause : NP -> CatLav.VP -> Cl = \np,vp -> lin Cl { s = \\mood,pol => case mood of { -- Subject - -- FIXME: jāčeko valences, reizēm arī īstenības izteiksmē - 'man patīk kaut kas' Deb _ _ => np.s ! Dat ; --# notpresent - _ => np.s ! Nom + _ => np.s ! vp.topic } ++ buildVerb vp.v mood pol np.a ++ -- Verb - vp.s2 ! np.a -- Object(s), complements, adverbial modifiers + vp.focus ! 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.s2 ! (AgP3 Sg Masc) + s = \\mood,pol => sc.s ++ buildVerb vp.v mood pol (AgP3 Sg Masc) ++ vp.focus ! (AgP3 Sg Masc) } ; } diff --git a/lib/src/latvian/StructuralLav.gf b/lib/src/latvian/StructuralLav.gf index 19ff991a4..a082216d9 100644 --- a/lib/src/latvian/StructuralLav.gf +++ b/lib/src/latvian/StructuralLav.gf @@ -245,9 +245,11 @@ lin somebody_NP = DetCN emptySg_Det (UseN (mkN "kāds")); something_NP = DetCN emptySg_Det (UseN (mkN "kaut kas")); - have_V2 = mkV2 (mkV "būt") nom_Prep ; - can8know_VV, can_VV = mkV "varēt" third_conjugation ; - must_VV = mkV "vajadzēt" third_conjugation ; + have_V2 = mkV2 (mkV "būt") nom_Prep Dat ; + have_V3 = mkV3 (mkV "būt") nom_Prep dat_Prep Dat ; + + can8know_VV, can_VV = mkVV (mkV "varēt" third_conjugation) ; + must_VV = mkVV (mkV "vajadzēt" third_conjugation) Dat ; oper reflPron : Case => Str = table { diff --git a/lib/src/latvian/VerbLav.gf b/lib/src/latvian/VerbLav.gf index 65b6b7da3..2922d6371 100644 --- a/lib/src/latvian/VerbLav.gf +++ b/lib/src/latvian/VerbLav.gf @@ -1,77 +1,95 @@ --# -path=.:../abstract:../common:../prelude --- FIXME: module relations. VerbLav is included in many places because of buildVerb, +-- FIXME: module relations. +-- VerbLav is included in many places because of buildVerb, -- and includes ParadigmsVerbsLav because of mkVerb_Irreg_Be - -- they need to be reallocated somehow to ResLav or something similar. -- Not so simple since morphology itself needs ResLav & friends. -concrete VerbLav of Verb = CatLav ** open +concrete VerbLav of Verb = CatLav ** +open + ParadigmsVerbsLav, ParamX, ResLav, - ParadigmsVerbsLav, StructuralLav - in { +in { flags - optimize = all_subs ; - coding = utf8 ; + optimize = all_subs ; + coding = utf8 ; lin - -- TODO: rewrite šo uz valencēm, lai ir semantiskās saites - UseV v = { v = v ; s2 = \\_ => [] } ; + UseV v = { v = v ; topic = Nom ; focus = \\_ => [] } ; - ComplVV v vp = { v = v ; s2 = \\agr => build_VP vp Pos Infinitive agr } ; - ComplVS v s = { v = v ; s2 = \\_ => "," ++ v.subj.s ++ s.s } ; - ComplVQ v q = { v = v ; s2 = \\_ => "," ++ q.s } ; - ComplVA v ap = { v = v ; s2 = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom } ; + 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 } ; - SlashV2a v = { v = v ; s2 = \\_ => [] ; p = v.p } ; + SlashV2a v2 = { v = v2 ; topic = v2.topic ; focus = \\_ => [] ; p = v2.p } ; - Slash2V3 v np = - insertObjc (\\_ => v.p1.s ++ np.s ! (v.p1.c ! (fromAgr np.a).n)) - { v = v ; s2 = \\_ => [] ; p = v.p2 } ; + Slash2V3 v3 np = insertObjC + (\\_ => v3.p1.s ++ np.s ! (v3.p1.c ! (fromAgr np.a).n)) + { v = v3 ; topic = Nom ; focus = \\_ => [] ; p = v3.p2 } ; - Slash3V3 v np = - insertObjc (\\_ => v.p2.s ++ np.s ! (v.p2.c ! (fromAgr np.a).n)) - { v = v ; s2 = \\_ => [] ; p = v.p1 } ; + Slash3V3 v3 np = insertObjC + (\\_ => v3.p2.s ++ np.s ! (v3.p2.c ! (fromAgr np.a).n)) + { v = v3 ; topic = Nom ; focus = \\_ => [] ; p = v3.p1 } ; - SlashV2V v vp = { v = v ; s2 = \\agr => build_VP vp Pos Infinitive agr ; p = v.p } ; - SlashV2S v s = { v = v ; s2 = \\_ => "," ++ v.subj.s ++ s.s ; p = v.p } ; - SlashV2Q v q = { v = v ; s2 = \\_ => "," ++ q.s ; p = v.p } ; - SlashV2A v ap = { v = v ; s2 = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom ; p = v.p } ; + 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 } ; - ComplSlash vp np = insertObjPre (\\_ => vp.p.s ++ np.s ! (vp.p.c ! (fromAgr np.a).n)) vp ; + 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 } ; + + 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 } ; + + 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 } ; + + PassV2 v2 = { v = v2 ; topic = v2.topic ; focus = \\_ => NON_EXISTENT } ; -- FIXME: placeholder + + 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 } ; - ReflVP vp = insertObjPre (\\a => vp.p.s ++ reflPron ! (vp.p.c ! (fromAgr a).n)) vp ; - - UseComp comp = { v = lin V mkVerb_Irreg_Be ; s2 = \\agr => comp.s ! agr } ; - - AdvVP vp adv = insertObj (\\_ => adv.s) vp ; - AdVVP adv vp = insertObjPre (\\_ => adv.s) vp ; - oper - build_VP : ResLav.VP -> Polarity -> VerbForm -> Agr -> Str = \vp,p,vf,agr -> - vp.v.s ! p ! vf ++ vp.s2 ! agr ; + build_VP : ResLav.VP -> Polarity -> VerbForm -> Agr -> Str = \vp,pol,vf,agr -> + vp.v.s ! pol ! vf ++ vp.focus ! agr ; - insertObj : (Agr => Str) -> { v : Verb ; s2 : Agr => Str } -> { v : Verb ; s2 : Agr => Str } = - \obj,vp -> { - v = vp.v ; - s2 = \\a => vp.s2 ! a ++ obj ! a - } ; + -- VPSlash = { v : Verb ; topic : Case ; focus : Agr => Str ; p : Prep } + insertObjC : (Agr => Str) -> ResLav.VPSlash -> ResLav.VPSlash = \obj,vp -> + insertObj obj vp ** { p = vp.p } ; - insertObjPre : (Agr => Str) -> { v : Verb ; s2 : Agr => Str } -> { v : Verb ; s2 : Agr => Str } = - \obj,vp -> { - v = vp.v ; - s2 = \\a => obj ! a ++ vp.s2 ! a - } ; + -- VP = { v : Verb ; topic : Case ; focus : Agr => Str } + insertObj : (Agr => Str) -> ResLav.VP -> ResLav.VP = \obj,vp -> { + v = vp.v ; + topic = vp.topic ; + focus = \\agr => vp.focus ! agr ++ obj ! agr + } ; - insertObjc : (Agr => Str) -> { v : Verb ; s2 : Agr => Str ; p : Prep } -> { v : Verb ; s2 : Agr => Str ; p : Prep } = - \obj,vp -> insertObj obj vp ** { p = vp.p } ; + -- VP = { v : Verb ; topic : Case ; focus : 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 + } ; buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Str = \v,mood,pol,ag -> let @@ -97,15 +115,4 @@ oper Condit Simul => v.s ! pol ! (Indicative ag.p ag.n ParamX.Cond) ; --# notpresent Condit Anter => mkVerb_Irreg_Be.s ! pol ! (Indicative ag.p ag.n ParamX.Cond) ++ part --# notpresent } ; - --- TODO: nav testēts -lin - SlashVV vv vp = { v = vv ; s2 = \\agr => build_VP vp Pos Infinitive agr ; p = vp.p } ; - SlashV2VNP vv np vp = - insertObjc (\\_ => vv.p.s ++ np.s ! (vv.p.c ! (fromAgr np.a).n)) - { v = vv ; s2 = \\agr => build_VP vp Pos Infinitive agr ; p = vp.p } ; - - -- FIXME: placeholder - PassV2 v = { v = v ; s2 = \\_ => NON_EXISTENT } ; - }