From 6f4befae687487b5dff50c53e4a4cdde0722a276 Mon Sep 17 00:00:00 2001 From: normundsg Date: Wed, 1 May 2013 03:33:58 +0000 Subject: [PATCH] Latvian: finally handles PassV2 clauses in a more or less adequate way Extends the previously introduced support for specifying the verb valence (verb-dependent subject and object cases), involving functions up to PredVP and RelVP. In Latvian, the passive voice is not used if the agent (subject) is known; to preserve the information structure (i.e. the word order), a clause like 'A is by B' is linearized in the active voice ('A B') where A has the object case (e.g. Acc), and B - the subject case (e.g. Nom). Thus, the verb valence patterns are swapped on-the-fly. This is still a rather quick & dirty implementation: parameters and linearization types have to be optimized (VerbLav), the use of PassV2 in AdvVP is problematic as it doesn't apply VPSlashPrep / ComplSlash, etc. --- lib/src/latvian/AdjectiveLav.gf | 2 +- lib/src/latvian/AdverbLav.gf | 4 +- lib/src/latvian/ConjunctionLav.gf | 2 +- lib/src/latvian/ExtraLav.gf | 2 +- lib/src/latvian/ExtraLavAbs.gf | 2 +- lib/src/latvian/LexiconLav.gf | 10 +-- lib/src/latvian/NounLav.gf | 10 +-- lib/src/latvian/RelativeLav.gf | 30 ++++++-- lib/src/latvian/ResLav.gf | 72 ++++++++++++------- lib/src/latvian/SentenceLav.gf | 58 +++++++++++----- lib/src/latvian/StructuralLav.gf | 81 ++++++++++----------- lib/src/latvian/VerbLav.gf | 112 ++++++++++++++++++------------ 12 files changed, 234 insertions(+), 151 deletions(-) diff --git a/lib/src/latvian/AdjectiveLav.gf b/lib/src/latvian/AdjectiveLav.gf index 466268c01..0dd786296 100644 --- a/lib/src/latvian/AdjectiveLav.gf +++ b/lib/src/latvian/AdjectiveLav.gf @@ -18,7 +18,7 @@ lin UseComparA a = { s = \\d,g,n,c => a.s ! (AAdj Compar d g n c) } ; ComplA2 a np = { - s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) ++ a.p.s ++ np.s ! (a.p.c ! (fromAgr np.a).n) + s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) ++ a.p.s ++ np.s ! (a.p.c ! (fromAgr np.a).num) } ; ReflA2 a = { s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) ++ a.p.s ++ reflPron ! (a.p.c ! n) } ; diff --git a/lib/src/latvian/AdverbLav.gf b/lib/src/latvian/AdverbLav.gf index 583d89443..164862013 100644 --- a/lib/src/latvian/AdverbLav.gf +++ b/lib/src/latvian/AdverbLav.gf @@ -18,7 +18,7 @@ lin ComparAdvAdjS cadv a s = { s = cadv.s ++ a.s ! (AAdv cadv.d) ++ cadv.p ++ s.s } ; -- FIXME: postpozīcijas prievārdi - PrepNP prep np = { s = prep.s ++ np.s ! (prep.c ! (fromAgr np.a).n) } ; + PrepNP prep np = { s = prep.s ++ np.s ! (prep.c ! (fromAgr np.a).num) } ; AdAdv = cc2 ; @@ -27,7 +27,7 @@ lin AdnCAdv cadv = { s = case cadv.d of { Posit => cadv.s ++ cadv.p ; - _ => NON_EXISTENT + _ => NON_EXISTENT } } ; diff --git a/lib/src/latvian/ConjunctionLav.gf b/lib/src/latvian/ConjunctionLav.gf index cde5488cc..c63be9361 100644 --- a/lib/src/latvian/ConjunctionLav.gf +++ b/lib/src/latvian/ConjunctionLav.gf @@ -17,7 +17,7 @@ lin ConjAdv = conjunctDistrSS ; ConjNP conj ss = conjunctDistrTable Case conj ss ** { - a = toAgr (conjNumber (fromAgr ss.a).n conj.n) (fromAgr ss.a).p (fromAgr ss.a).g ; + a = toAgr (conjNumber (fromAgr ss.a).num conj.n) (fromAgr ss.a).pers (fromAgr ss.a).gend ; isNeg = False } ; diff --git a/lib/src/latvian/ExtraLav.gf b/lib/src/latvian/ExtraLav.gf index 36d1a4570..885d3eeea 100644 --- a/lib/src/latvian/ExtraLav.gf +++ b/lib/src/latvian/ExtraLav.gf @@ -17,7 +17,7 @@ lin kopsh_Prep = mkPrep "kopš" Gen Dat ; liidz_Prep = mkPrep "līdz" Dat Dat ; pa_Prep = mkPrep "pa" Acc Dat ; - par_Prep = mkPrep "par" Acc Dat ; + --par_Prep = mkPrep "par" Acc Dat ; paar_Prep = mkPrep "pār" Acc Dat ; pie_Prep = mkPrep "pie" Gen Dat ; pret_Prep = mkPrep "pret" Acc Dat ; diff --git a/lib/src/latvian/ExtraLavAbs.gf b/lib/src/latvian/ExtraLavAbs.gf index 84992440c..34ef447df 100644 --- a/lib/src/latvian/ExtraLavAbs.gf +++ b/lib/src/latvian/ExtraLavAbs.gf @@ -8,7 +8,7 @@ abstract ExtraLavAbs = Extra ** open ResLav, Prelude in { kopsh_Prep : Prep ; liidz_Prep : Prep ; pa_Prep : Prep ; - par_Prep : Prep ; + --par_Prep : Prep ; paar_Prep : Prep ; pie_Prep : Prep ; pret_Prep : Prep ; diff --git a/lib/src/latvian/LexiconLav.gf b/lib/src/latvian/LexiconLav.gf index 8a513c8e5..bc381dec7 100644 --- a/lib/src/latvian/LexiconLav.gf +++ b/lib/src/latvian/LexiconLav.gf @@ -1,9 +1,9 @@ ---# -path=.:../abstract:../common:../prelude +--# -path=.:abstract:common:prelude concrete LexiconLav of Lexicon = CatLav ** open ParadigmsLav, StructuralLav, - ExtraLav, + --(E = ExtraLav), ResLav, Prelude in { @@ -190,7 +190,7 @@ lin switch8off_V2 = mkV2 (mkV "izslēgt" "izslēdzu" "izslēdzu") acc_Prep ; switch8on_V2 = mkV2 (mkV "ieslēgt" "ieslēdzu" "ieslēdzu") acc_Prep ; table_N = mkN "galds" ; - talk_V3 = mkV3 (mkV "runāt" second_conjugation) to_Prep par_Prep ; -- ar ko, par ko + talk_V3 = mkV3 (mkV "runāt" second_conjugation) with_Prep par_Prep ; -- ar ko, par ko teacher_N = mkN "skolotājs" ; teach_V2 = mkV2 (mkV "mācīt" third_conjugation) acc_Prep ; television_N = mkN "televīzija" ; @@ -372,6 +372,8 @@ lin today_Adv = mkAdv "šodien" ; uncertain_A = mkA "nepārliecināts" ; ---oper par_Prep = mkPrep "par" Acc Dat ; + -- TODO: kāpēc neizdodas ar ExtraLav? + -- Eng arī dara šitā: + oper par_Prep = mkPrep "par" Acc Dat ; } diff --git a/lib/src/latvian/NounLav.gf b/lib/src/latvian/NounLav.gf index 414da93a0..9ba65e7f5 100644 --- a/lib/src/latvian/NounLav.gf +++ b/lib/src/latvian/NounLav.gf @@ -19,7 +19,7 @@ lin UsePron p = { s = p.s ; a = p.a ; isNeg = False } ; PredetNP pred np = { - s = \\c => pred.s ! (fromAgr np.a).g ++ np.s ! c ; + s = \\c => pred.s ! (fromAgr np.a).gend ++ np.s ! c ; a = np.a ; isNeg = False } ; @@ -29,12 +29,12 @@ lin --UseN3 n = n ; ComplN2 f x = { - s = \\_,n,c => preOrPost f.isPre (f.p.s ++ x.s ! (f.p.c ! (fromAgr x.a).n)) (f.s ! n ! c) ; + s = \\_,n,c => preOrPost f.isPre (f.p.s ++ x.s ! (f.p.c ! (fromAgr x.a).num)) (f.s ! n ! c) ; g = f.g } ; ComplN3 f x = { - s = \\n,c => preOrPost f.isPre1 (f.p1.s ++ x.s ! (f.p1.c ! (fromAgr x.a).n)) (f.s ! n ! c) ; + s = \\n,c => preOrPost f.isPre1 (f.p1.s ++ x.s ! (f.p1.c ! (fromAgr x.a).num)) (f.s ! n ! c) ; g = f.g ; p = f.p2 ; isPre = f.isPre2 @@ -144,7 +144,7 @@ lin -- 'Pielikums' ApposCN cn np = { - s = \\d,n,c => case (fromAgr np.a).n of { + s = \\d,n,c => case (fromAgr np.a).num of { n => cn.s ! d ! n ! c ++ np.s ! c ; -- FIXME: comparison not working _ => NON_EXISTENT -- FIXME: pattern never reached } ; @@ -163,7 +163,7 @@ lin -- FIXME: vajag šķirot noteikto/nenoteikto galotni..? PPartNP np v2 = { - s = \\c => v2.s ! Pos ! (Participle TsTa (fromAgr np.a).g (fromAgr np.a).n c) ++ np.s ! c ; + s = \\c => v2.s ! Pos ! (Participle TsTa (fromAgr np.a).gend (fromAgr np.a).num c) ++ np.s ! c ; a = np.a ; isNeg = np.isNeg } ; diff --git a/lib/src/latvian/RelativeLav.gf b/lib/src/latvian/RelativeLav.gf index a39cee870..e753d55aa 100644 --- a/lib/src/latvian/RelativeLav.gf +++ b/lib/src/latvian/RelativeLav.gf @@ -13,13 +13,29 @@ flags lin RelCl cl = { s = \\m,p,_ => "ka" ++ cl.s ! m ! p } ; - RelVP rp vp = { - s = \\m,p,ag => - rp.s ! Masc ! Nom ++ - buildVerb vp.v m p (toAgr (fromAgr ag).n P3 (fromAgr ag).g) False vp.objNeg ++ - vp.compl ! ag - } ; + -- RP -> VP -> RCl + RelVP rp vp = mkRelClause rp vp ; +oper + -- TODO: PassV2 verbs jāsaskaņo ar objektu, nevis subjektu (by8means_Prep: AgP3 Sg Masc) + mkRelClause : RP -> CatLav.VP -> RCl = \rp,vp -> + let subj : Case = case vp.agr.voice of { + Act => vp.agr.c_topic ; + Pass => vp.agr.c_focus + } in lin RCl { + s = \\mood,pol,agr => + case mood of { -- Subject + Deb _ _ => rp.s ! Masc ! Dat ; --# notpresent + _ => rp.s ! Masc ! vp.agr.c_topic + } ++ + case subj of { -- Verb + Nom => buildVerb vp.v mood pol (toAgr (fromAgr agr).num P3 (fromAgr agr).gend) False vp.objNeg ; -- TODO: kāpēc P3 nevis agr, kāds tas ir? + _ => buildVerb vp.v mood pol vp.agr.agr False vp.objNeg -- TODO: test me + } ++ + vp.compl ! agr -- Object(s), complements, adverbial modifiers + } ; + +lin -- FIXME: vārdu secība - nevis 'kas mīl viņu' bet 'kas viņu mīl' (?) -- FIXME: Masc varētu nebūt labi RelSlash rp slash = { @@ -29,7 +45,7 @@ lin -- FIXME: placeholder -- TODO: jātestē, kautkas nav labi ar testpiemēru FunRP p np rp = { - s = \\g,c => p.s ++ rp.s ! g ! c ++ np.s ! (p.c ! (fromAgr np.a).n) + s = \\g,c => p.s ++ rp.s ! g ! c ++ np.s ! (p.c ! (fromAgr np.a).num) } ; IdRP = { diff --git a/lib/src/latvian/ResLav.gf b/lib/src/latvian/ResLav.gf index a92005569..4f200b66a 100644 --- a/lib/src/latvian/ResLav.gf +++ b/lib/src/latvian/ResLav.gf @@ -20,7 +20,8 @@ param AForm = AAdj Degree Definite Gender Number Case | AAdv Degree ; -- Participles - PartType = IsUsi | TsTa ; + PartType = IsUsi | TsTa ; -- TODO: šo jāmet ārā - pārklājas ar Voice, kas attiecas ne tikai uz divdabjiem + Voice = Act | Pass ; -- Verbs -- Ind = Indicative @@ -54,7 +55,9 @@ param Agr = AgP1 Number Gender | AgP2 Number Gender | AgP3 Number Gender ; -- Clause agreement - ClAgr = Topic Case | TopicFocus Case Agr ; + -- TODO: jāpāriet uz vienotu TopicFocus (=> ieraksta tips) + --ClAgr = Topic Case Voice | TopicFocus Case Case Agr Voice ; + --ClAgr = NomAcc Agr Voice | DatNom Agr Voice | DatGen Agr Voice ; ThisOrThat = This | That ; CardOrd = NCard | NOrd ; @@ -74,6 +77,9 @@ oper Verb : Type = { s : Polarity => VerbForm => Str } ; + -- TODO: voice ir jāliek pa tiešo zem VP (?) + ClAgr : Type = { c_topic : Case ; c_focus : Case ; agr : Agr ; voice : Voice } ; + -- TODO: topic un focus jāapvieno vienā (jaunā) agr parametrā (?), jo -- ne vienmēr ir abi un ne visas kombinācijas ir vajadzīgas -- @@ -83,7 +89,7 @@ oper -- topic: typically - subject -- focus: typically - objects, complements, adverbial modifiers - VPSlash = VP ** { p : Prep } ; + VPSlash = VP ** { p : Prep } ; -- TODO: p pārklājas ar agr -- principā rekur ir objekts kuram jau kaut kas ir bet ir vēl viena brīva valence... Prep : Type = { s : Str ; c : Number => Case } ; @@ -93,36 +99,54 @@ oper --Valence : Type = { p : Prep ; c : Number => Case } ; -- e.g. 'ar' + Sg-Acc or Pl-Dat; Preposition may be skipped for simple case-baced valences - toAgr : Number -> Person -> Gender -> Agr = \n,p,g -> - case p of { - P1 => AgP1 n g ; - P2 => AgP2 n g ; - P3 => AgP3 n g + toAgr : Number -> Person -> Gender -> Agr = \num,pers,gend -> + case pers of { + P1 => AgP1 num gend ; + P2 => AgP2 num gend ; + P3 => AgP3 num gend } ; - fromAgr : Agr -> { n : Number ; p : Person ; g : Gender } = \a -> - case a of { - AgP1 n g => { n = n ; p = P1 ; g = g } ; - AgP2 n g => { n = n ; p = P2 ; g = g } ; - AgP3 n g => { n = n ; p = P3 ; g = g } + toClAgr : Case -> Case -> Agr -> Voice -> ClAgr = \c_topic,c_focus,agr,voice -> { + c_topic = c_topic ; + c_focus = c_focus ; + agr = agr ; + voice = voice + } ; + + -- TODO: quick & dirty + toClAgr_Reg : Case -> ClAgr = \c_topic -> toClAgr c_topic Nom (AgP3 Sg Masc) Act ; + + fromAgr : Agr -> { num : Number ; pers : Person ; gend : Gender } = \agr -> + case agr of { + AgP1 num gend => { num = num ; pers = P1 ; gend = gend } ; + AgP2 num gend => { num = num ; pers = P2 ; gend = gend } ; + AgP3 num gend => { num = num ; pers = P3 ; gend = gend } } ; - conjAgr : Agr -> Agr -> Agr = \a0,b0 -> + {- + fromClAgr : ClAgr -> { c_topic : Case ; c_focus : Case ; voice : Voice } = \agr -> + case agr of { + Topic c_topic voice => { c_topic = c_topic ; c_focus = Acc ; voice = voice } ; + TopicFocus c_topic c_focus _ voice => { c_topic = c_topic ; c_focus = c_focus ; voice = voice } + } ; + -} + + conjAgr : Agr -> Agr -> Agr = \agr1,agr2 -> let - a = fromAgr a0 ; - b = fromAgr b0 + a1 = fromAgr agr1 ; + a2 = fromAgr agr2 in toAgr - (conjNumber a.n b.n) - (conjPerson a.p b.p) -- FIXME: personu apvienošana ir tricky un ir jāuztaisa korekti - (conjGender a.g b.g) ; + (conjNumber a1.num a2.num) + (conjPerson a1.pers a2.pers) -- FIXME: personu apvienošana ir tricky un ir jāuztaisa korekti + (conjGender a1.gend a2.gend) ; - conjGender : Gender -> Gender -> Gender = \a,b -> - case a of { - Fem => b ; - _ => Masc + conjGender : Gender -> Gender -> Gender = \gend1,gend2 -> + case gend1 of { + Fem => gend2 ; + _ => Masc } ; - agrgP3 : Number -> Gender -> Agr = \n,g -> toAgr n P3 g ; + agrgP3 : Number -> Gender -> Agr = \num,gend -> toAgr num P3 gend ; } diff --git a/lib/src/latvian/SentenceLav.gf b/lib/src/latvian/SentenceLav.gf index dfa975538..699665fa9 100644 --- a/lib/src/latvian/SentenceLav.gf +++ b/lib/src/latvian/SentenceLav.gf @@ -11,6 +11,7 @@ flags coding = utf8 ; lin + -- NP -> VP -> Cl PredVP np vp = mkClause np vp ; PredSCVP sc vp = mkClauseSC sc vp ; @@ -30,7 +31,7 @@ lin mkClause np (lin VP { v = vs ; compl = \\_ => "," ++ vs.subj.s ++ sslash.s ; - agr = Topic vs.topic ; + agr = toClAgr_Reg vs.topic ; objNeg = False }) ** { p = sslash.p } ; @@ -58,24 +59,43 @@ lin AdvS a s = { s = NON_EXISTENT } ; oper - - mkClause : NP -> CatLav.VP -> Cl = \np,vp -> lin Cl { - s = \\mood,pol => - case mood of { -- Subject - Deb _ _ => np.s ! Dat ; --# notpresent - _ => case vp.agr of { - Topic c => np.s ! c ; - TopicFocus c _ => np.s ! c - } - } ++ - case vp.agr of { -- Verb - Topic Nom => buildVerb vp.v mood pol np.a np.isNeg vp.objNeg ; - Topic _ => buildVerb vp.v mood pol (AgP3 Sg Masc) np.isNeg vp.objNeg ; -- TODO: test me - TopicFocus Nom _ => buildVerb vp.v mood pol np.a np.isNeg vp.objNeg ; - TopicFocus _ agr => buildVerb vp.v mood pol agr np.isNeg vp.objNeg - } ++ - vp.compl ! np.a -- Object(s), complements, adverbial modifiers - } ; + -- TODO: PassV2 verbs jāsaskaņo ar objektu, nevis subjektu (by8means_Prep: AgP3 Sg Masc) + mkClause : NP -> CatLav.VP -> Cl = \np,vp -> + let subj : Case = case vp.agr.voice of { + Act => vp.agr.c_topic ; + Pass => vp.agr.c_focus + } in lin Cl { + s = \\mood,pol => + case mood of { -- Subject + Deb _ _ => np.s ! Dat ; --# notpresent + _ => np.s ! vp.agr.c_topic + {- + _ => case vp.agr.voice of { + Act => np.s ! vp.agr.c_topic ; + Pass => np.s ! vp.agr.c_focus + } + -} + {- + _ => case vp.agr of { + Topic c _ => np.s ! c ; + TopicFocus c _ _ _ => np.s ! c + } + -} + } ++ + case subj of { -- Verb + Nom => buildVerb vp.v mood pol np.a np.isNeg vp.objNeg ; + _ => buildVerb vp.v mood pol vp.agr.agr np.isNeg vp.objNeg -- TODO: test me + } ++ + {- + case vp.agr of { -- Verb + Topic Nom _ => buildVerb vp.v mood pol np.a np.isNeg vp.objNeg ; + Topic _ _ => buildVerb vp.v mood pol (AgP3 Sg Masc) np.isNeg vp.objNeg ; -- TODO: test me + TopicFocus Nom _ _ _ => buildVerb vp.v mood pol np.a np.isNeg vp.objNeg ; + TopicFocus _ _ agr _ => buildVerb vp.v mood pol agr np.isNeg vp.objNeg + } ++ + -} + 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 diff --git a/lib/src/latvian/StructuralLav.gf b/lib/src/latvian/StructuralLav.gf index 09c1f1d8f..96afcc041 100644 --- a/lib/src/latvian/StructuralLav.gf +++ b/lib/src/latvian/StructuralLav.gf @@ -15,6 +15,9 @@ flags lin language_title_Utt = ss "latviešu valoda" ; + yes_Utt = ss "jā" ; + no_Utt = ss "nē" ; + every_Det = { s = (\\g,c => (mkPronoun_Gend "ikviens").s ! g ! Sg ! c) ; n = Sg ; @@ -23,14 +26,14 @@ lin } ; someSg_Det = { - s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Sg ! c) ; -- lai atļautu arī tukšo, jāliek (\\_,_ => []) | klāt + s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Sg ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => []) n = Sg ; d = Indef ; isNeg = False } ; somePl_Det = { - s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Pl ! c) ; -- lai atļautu arī tukšo, jāliek (\\_,_ => []) | klāt + s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Pl ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => []) n = Pl ; d = Indef ; isNeg = False @@ -44,14 +47,14 @@ lin } ; many_Det = { - s = (\\g,c => (mkPronoun_Gend "daudzs").s ! g ! Pl ! c) ; -- 'daudzs' izlocīsies korekti uz daudzskaitļa 'daudzi' + s = (\\g,c => (mkPronoun_Gend "daudzs").s ! g ! Pl ! c) ; -- 'daudzs' izlocīsies korekti uz daudzskaitļa 'daudzi'; tomēr nesmuki... n = Pl ; d = Indef ; isNeg = False } ; much_Det = { - s = (\\g,c => "daudz") ; -- FIXME - ņem saistību ar ģenitīvu; kā to realizēt? + s = (\\g,c => "daudz") ; -- FIXME: piesaista ģenitīvu n = Sg ; d = Indef ; isNeg = False @@ -107,42 +110,36 @@ lin it_Pron = mkPronoun_It_Sg Masc ; -- See also: ExtraLav.it8fem_Pron - -- manuprāt prievārdi tomēr ir valodas-specifiski un nebūtu tieši 1-pret-1 jātulko + -- Pronouns; their translation is very ambiguos... + above_Prep = mkPrep "virs" Gen Dat ; after_Prep = mkPrep "pēc" Gen Dat ; before_Prep = mkPrep "pirms" Gen Dat ; behind_Prep = mkPrep "aiz" Gen Dat ; -- taču "aiz" nav viennozīmīgi "behind" between_Prep = mkPrep "starp" Acc Dat ; + during_Prep = mkPrep Loc ; for_Prep = mkPrep "priekš" Gen Dat ; from_Prep = mkPrep "no" Gen Dat ; - on_Prep = mkPrep "uz" Gen Dat ; - with_Prep = mkPrep "ar" Acc Dat ; -- ar sievu, ar sievām in_Prep = mkPrep Loc ; - to_Prep = mkPrep "uz" Acc Dat ; -- See also: ExtraLav.liidz_Prep, pie_Prep - possess_Prep = mkPrep Gen ; -- FIXME: vajadzētu vārdu secību otrādi - pirms paskaidrojamā vārda likt - under_Prep = mkPrep "zem" Gen Dat ; - without_Prep = mkPrep "bez" Gen Dat ; - by8agent_Prep = nom_Prep ; -- TODO: should get rid of this Prep; taču tas parādās Eng2Abs kokos... -- FIXME: nom_Prep vs. dat_Prep/accPrep - by8means_Prep = mkPrep "ar" Acc Dat ; - during_Prep = mkPrep Loc ; in8front_Prep = mkPrep "priekšā" Dat Dat ; - part_Prep = mkPrep Gen ; --FIXME - vajadzētu vārdu secību otrādi - pirms paskaidrojamā vārda likt + on_Prep = mkPrep "uz" Gen Dat ; through_Prep = mkPrep "caur" Acc Dat ; - except_Prep = mkPrep "izņemot" Acc Acc ; - + to_Prep = mkPrep "uz" Acc Dat ; -- See also: ExtraLav.liidz_Prep, pie_Prep + under_Prep = mkPrep "zem" Gen Dat ; + with_Prep = mkPrep "ar" Acc Dat ; + without_Prep = mkPrep "bez" Gen Dat ; + + by8agent_Prep = nom_Prep ; -- TODO: nom_Prep (default) vs. dat_Prep + by8means_Prep = mkPrep "ar" Acc Dat ; + except_Prep = mkPrep "izņemot" Acc Acc ; -- Acc - by default? + part_Prep = mkPrep Gen ; --FIXME - vajadzētu vārdu secību otrādi - pirms paskaidrojamā vārda likt + possess_Prep = mkPrep Gen ; -- FIXME: vajadzētu vārdu secību otrādi - pirms paskaidrojamā vārda likt + very_AdA = mkAdA "ļoti" ; almost_AdA = mkAdA "gandrīz" ; so_AdA = mkAdA "tik" ; too_AdA = mkAdA "pārāk" ; - and_Conj = mkConj "un" ; - or_Conj = mkConj "vai" Sg ; - if_then_Conj = mkConj "ja" "tad" ; - - but_PConj = ss "bet" ; - otherwise_PConj = ss "citādi" ; - therefore_PConj = ss "tāpēc" ; - more_CAdv = (mkCAdv [] "nekā" Compar) | (mkCAdv "vairāk" "nekā" Posit) ; less_CAdv = mkCAdv "mazāk" "nekā" Posit ; as_CAdv = mkCAdv "tikpat" "kā" Posit ; @@ -157,10 +154,16 @@ lin somewhere_Adv = mkAdv "kaut kur" ; quite_Adv = mkAdv "diezgan" ; - both7and_DConj = mkConj "gan" ("," ++ "gan"); --FIXME - komati nav tā kā vajag - either7or_DConj = mkConj ("vai" ++ "nu") ("," ++ "vai") Sg ; --FIXME - komati nav tā kā vajag + and_Conj = mkConj "un" ; + or_Conj = mkConj "vai" Sg ; + if_then_Conj = mkConj "ja" "tad" ; - want_VV = mkVV (mkV "vēlēties" third_conjugation) ; + but_PConj = ss "bet" ; + otherwise_PConj = ss "citādi" ; + therefore_PConj = ss "tāpēc" ; + + both7and_DConj = mkConj "gan" ("," ++ "gan"); -- FIXME: komati nav tā kā vajag + either7or_DConj = mkConj ("vai" ++ "nu") ("," ++ "vai") Sg ; -- FIXME: komati nav tā kā vajag whoSg_IP = { -- FIXME: Fem s = table { @@ -223,6 +226,11 @@ lin } } ; + how8many_IDet = { + s = table { _ => "cik" } ; + n = Pl + } ; + when_Subj = ss "kad" ; although_Subj = ss "kaut arī" ; because_Subj = ss "jo" ; @@ -230,24 +238,15 @@ lin that_Subj = ss "ka" ; all_Predet = { s = table { Masc => "visi" ; Fem => "visas" } } ; - only_Predet = { s = table { _ => "tikai"} } ; most_Predet = { s = table { _ => "vairums"} } ; - yes_Utt = ss "jā" ; - please_Voc = ss "lūdzu" ; - almost_AdN = mkAdN "gandrīz" ; at_least_AdN = mkAdN "vismaz" ; at_most_AdN = mkAdN "ne vairāk kā" ; always_AdV = mkAdV "vienmēr" ; - how8many_IDet = { - s = table { _ => "cik" } ; - n = Pl - } ; - somebody_NP = UsePron (mkPronoun_Body "kāds") ; something_NP = UsePron (mkPronoun_Thing "kaut kas") ; everybody_NP = UsePron (mkPronoun_Body "ikviens") ; @@ -258,9 +257,13 @@ lin 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) ; + want_VV = mkVV (mkV "vēlēties" third_conjugation) ; + can_VV = mkVV (mkV "varēt" third_conjugation) ; + can8know_VV = mkVV (mkV "varēt" third_conjugation) ; must_VV = mkVV (mkV "vajadzēt" third_conjugation) Dat ; + please_Voc = ss "lūdzu" ; + oper reflPron : Case => Str = table { @@ -288,6 +291,4 @@ oper } ; -} - no_Utt = ss "nē" ; - } diff --git a/lib/src/latvian/VerbLav.gf b/lib/src/latvian/VerbLav.gf index 7925061a0..062632f80 100644 --- a/lib/src/latvian/VerbLav.gf +++ b/lib/src/latvian/VerbLav.gf @@ -24,88 +24,105 @@ lin UseV v = { v = v ; compl = \\_ => [] ; - agr = Topic Nom ; + agr = toClAgr_Reg Nom ; objNeg = False } ; ComplVV vv vp = { v = vv ; compl = \\agr => build_VP vp Pos Infinitive agr ; - agr = Topic vv.topic ; + agr = toClAgr_Reg vv.topic ; objNeg = False } ; ComplVS vs s = { v = vs ; compl = \\_ => "," ++ vs.subj.s ++ s.s ; - agr = Topic vs.topic ; + agr = toClAgr_Reg vs.topic ; objNeg = False } ; ComplVQ vq qs = { v = vq ; compl = \\_ => "," ++ qs.s ; - agr = Topic vq.topic ; + agr = toClAgr_Reg vq.topic ; objNeg = False } ; ComplVA va ap = { v = va ; - compl = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom ; - agr = Topic Nom ; + compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ; + agr = toClAgr_Reg Nom ; objNeg = False } ; - -- SlashV2a : V2 -> VPSlash ; -- love (it) + -- V2 -> VPSlash -- The (direct) object is added by ComplSlash SlashV2a v2 = { v = v2 ; compl = \\_ => [] ; p = v2.p ; - agr = TopicFocus v2.topic (AgP3 Sg Masc) ; -- overriden in ComplSlash + agr = toClAgr v2.topic (v2.p.c ! Sg) (AgP3 Sg Masc) Act ; -- overriden in ComplSlash objNeg = False -- overriden in ComplSlash } ; - -- VPSlash = { v : Verb ; compl : Agr => Str ; agr : ClAgr ; objNeg : Bool ; p : ResLav.Prep } - -- Agr = AgP1 Number Gender | AgP2 Number Gender | AgP3 Number Gender - ComplSlash vpslash np = + -- VPSlash -> NP -> VP + ComplSlash vp np = let agr : Agr = np.a in insertObjPre_Spec - (\\agr => vpslash.p.s ++ np.s ! (vpslash.p.c ! (fromAgr agr).n)) - vpslash + {- + (\\agr => case (fromClAgr vp.agr).voice of { + Act => vp.p.s ++ np.s ! (vp.p.c ! (fromAgr agr).num) ; + Pass => np.s ! (fromClAgr vp.agr).c_topic + }) + -} + (\\agr => case vp.agr.voice of { + Act => vp.p.s ++ np.s ! (vp.p.c ! (fromAgr agr).num) ; + Pass => case vp.p.c ! (fromAgr agr).num of { + --Nom => np.s ! vp.agr.c_topic ; + Nom => np.s ! vp.agr.c_focus ; + _ => vp.p.s ++ np.s ! (vp.p.c ! (fromAgr agr).num) + } + }) + vp np ; oper insertObjPre_Spec : (Agr => Str) -> ResLav.VP -> NP -> ResLav.VP = \obj,vp,obj_np -> { v = vp.v ; compl = \\agr => obj ! agr ++ vp.compl ! agr ; - agr = case vp.agr of { - TopicFocus topic _ => TopicFocus topic obj_np.a ; - _ => Topic Nom + agr = vp.agr ; + {- + agr = case vp.agr.voice of { + Topic c_topic voice => Topic c_topic voice ; + TopicFocus c_topic c_focus _ voice => TopicFocus c_topic c_focus obj_np.a voice + -- _ => Topic Nom -- kāpēc ne 'Topic topic_case'? -- TODO: remove } ; + -} objNeg = obj_np.isNeg } ; lin - -- Slash2V3 : V3 -> NP -> VPSlash ; -- give it (to her) + -- V3 -> NP -> VPSlash ; -- give it (to her) + -- FIXME: "vīrietis runā par ābolus ar sievieti" ("a man talks to a woman about apples") Slash2V3 v3 np = insertObjC - (\\_ => v3.p1.s ++ np.s ! (v3.p1.c ! (fromAgr np.a).n)) + (\\_ => v3.p1.s ++ np.s ! (v3.p1.c ! (fromAgr np.a).num)) { v = v3 ; compl = \\_ => [] ; p = v3.p2 ; - agr = TopicFocus v3.topic np.a ; -- TESTME: P1, P2 (in the focus) + agr = toClAgr v3.topic (v3.p1.c ! Sg) np.a Act ; -- TESTME: P1, P2 (in the focus) objNeg = np.isNeg -- TESTME } ; - -- Slash3V3 : V3 -> NP -> VPSlash ; -- give (it) to her + -- V3 -> NP -> VPSlash ; -- give (it) to her Slash3V3 v3 np = insertObjC - (\\_ => v3.p2.s ++ np.s ! (v3.p2.c ! (fromAgr np.a).n)) + (\\_ => v3.p2.s ++ np.s ! (v3.p2.c ! (fromAgr np.a).num)) { 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) + agr = toClAgr v3.topic (v3.p2.c ! Sg) (AgP3 Sg Masc) Act ; -- FIXME: works only if the focus is P3 (Sg/Pl); TODO: P1, P2 (Sg, Pl) objNeg = np.isNeg -- TESTME } ; @@ -113,7 +130,7 @@ lin v = v2v ; compl = \\agr => build_VP vp Pos Infinitive agr ; p = v2v.p ; - agr = Topic Nom ; + agr = toClAgr_Reg Nom ; objNeg = False } ; @@ -121,7 +138,7 @@ lin v = v2s ; compl = \\_ => "," ++ v2s.subj.s ++ s.s ; p = v2s.p ; - agr = Topic Nom ; + agr = toClAgr_Reg Nom ; objNeg = False } ; @@ -129,15 +146,15 @@ lin v = v2q ; compl = \\_ => "," ++ qs.s ; p = v2q.p ; - agr = Topic Nom ; + agr = toClAgr_Reg Nom ; objNeg = False } ; SlashV2A v2a ap = { v = v2a ; - compl = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom ; + compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ; p = v2a.p ; - agr = Topic Nom ; + agr = toClAgr_Reg Nom ; objNeg = False } ; @@ -145,39 +162,42 @@ lin v = vv ; compl = \\agr => build_VP vpslash Pos Infinitive agr ; p = vpslash.p ; - agr = Topic vv.topic ; + agr = toClAgr_Reg vv.topic ; objNeg = False } ; SlashV2VNP v2v np vpslash = insertObjC - (\\_ => v2v.p.s ++ np.s ! (v2v.p.c ! (fromAgr np.a).n)) + (\\_ => v2v.p.s ++ np.s ! (v2v.p.c ! (fromAgr np.a).num)) { v = v2v ; compl = \\agr => build_VP vpslash Pos Infinitive agr ; p = vpslash.p ; - agr = Topic Nom ; + agr = toClAgr_Reg Nom ; objNeg = False } ; ReflVP vpslash = insertObjPre - (\\agr => vpslash.p.s ++ reflPron ! (vpslash.p.c ! (fromAgr agr).n)) + (\\agr => vpslash.p.s ++ reflPron ! (vpslash.p.c ! (fromAgr agr).num)) vpslash ; UseComp comp = { v = lin V mkVerb_Irreg_Be ; compl = \\agr => comp.s ! agr ; - agr = Topic Nom ; + agr = toClAgr_Reg Nom ; objNeg = False } ; - -- TODO: vai VP nevajag papildlauku isPass? + -- V2 -> VP + -- TODO: vai VP nevajag papildlauku isPass? Izskatās, ka vajag - jau/tikai ComplSlash (objekta locījumam) PassV2 v2 = { - v = v2 ; - compl = \\_ => [] ; - agr = Topic v2.topic ; - objNeg = False -- FIXME: inherit from the object + v = v2 ; + compl = \\_ => [] ; + --agr = toClAgr v2.topic (v2.p.c ! Sg) (AgP3 Sg Masc) Pass ; -- FIXME(?): should not be overriden in ComplSlash; P3 restriction - never used? + agr = toClAgr (v2.p.c ! Sg) v2.topic (AgP3 Sg Masc) Pass ; -- FIXME(?): should not be overriden in ComplSlash; P3 restriction - never used? + objNeg = False -- overriden in ComplSlash } ; + -- VP -> Prep -> VPSlash -- TODO: šajā brīdī ir jāignorē prep (by8agent_Prep); tas jāaizstāj ar v2.topic -- Tad varēs dzēst ārā komentāru pie StructuralLav.by8agent_Prep VPSlashPrep vp prep = vp ** {p = prep} ; @@ -186,13 +206,13 @@ lin AdVVP adv vp = insertObjPre (\\_ => adv.s) vp ; - CompAP ap = { s = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom } ; + CompAP ap = { s = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom } ; CompNP np = { s = \\_ => np.s ! Nom } ; CompAdv a = { s = \\_ => a.s } ; - CompCN cn = { s = \\agr => cn.s ! Indef ! (fromAgr agr).n ! Nom } ; + CompCN cn = { s = \\agr => cn.s ! Indef ! (fromAgr agr).num ! Nom } ; oper build_VP : ResLav.VP -> Polarity -> VerbForm -> Agr -> Str = \vp,pol,vf,agr -> @@ -220,20 +240,20 @@ oper -- FIXME: the type of the participle form - depending on what?! (currently fixed) buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Bool -> Bool -> Str = - \v,mood,pol,agr,subjNeg,objNeg -> + \v,mood,pol,subjAgr,subjNeg,objNeg -> let pol_prim : Polarity = case of { => Neg ; <_, True> => Neg ; _ => pol } ; - agr = fromAgr agr + agr = fromAgr subjAgr ; --# notpresent - part = v.s ! ResLav.Pos ! (Participle TsTa agr.g agr.n Nom) --# notpresent + part = v.s ! ResLav.Pos ! (Participle TsTa agr.gend agr.num Nom) --# notpresent in case mood of { - Ind Simul tense => v.s ! pol_prim ! (Indicative agr.p agr.n tense) + Ind Simul tense => v.s ! pol_prim ! (Indicative agr.pers agr.num tense) ; --# notpresent - Ind Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (Indicative agr.p agr.n tense) ++ part ; --# notpresent + Ind Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (Indicative agr.pers agr.num tense) ++ part ; --# notpresent -- FIXME(?): Rel _ Past => ... Rel _ Past => ResLav.NON_EXISTENT ; --# notpresent @@ -246,7 +266,7 @@ oper mkVerb_Irreg_Be.s ! ResLav.Pos ! (Participle TsTa Masc Sg Nom) ++ --# notpresent v.s ! ResLav.Pos ! Debitive ; --# notpresent - Condit Simul => v.s ! pol_prim ! (Indicative agr.p agr.n ParamX.Cond) ; --# notpresent - Condit Anter => mkVerb_Irreg_Be.s ! pol_prim ! (Indicative agr.p agr.n ParamX.Cond) ++ part --# notpresent + Condit Simul => v.s ! pol_prim ! (Indicative agr.pers agr.num ParamX.Cond) ; --# notpresent + Condit Anter => mkVerb_Irreg_Be.s ! pol_prim ! (Indicative agr.pers agr.num ParamX.Cond) ++ part --# notpresent } ; }