From 120e616a28e98ede61b3eb9bbde06ff27cb0e78f Mon Sep 17 00:00:00 2001 From: normundsg Date: Mon, 16 Dec 2013 19:08:38 +0000 Subject: [PATCH] Latvian: if ~object~ is a Pron and is not modified by a RCl, it is more natural/neutral if it precedes the verb. For this, the lin types of NP and Adv are extended with a boolean field isPron (in addition to the previously introduced isRel field that indicates whether a CN or NP is modified by a RCl). --- lib/src/latvian/AdjectiveLav.gf | 16 +++++- lib/src/latvian/AdverbLav.gf | 30 ++++++++--- lib/src/latvian/CatLav.gf | 74 ++++++++++++------------- lib/src/latvian/ConjunctionLav.gf | 34 +++++++----- lib/src/latvian/GrammarLav.gf | 4 +- lib/src/latvian/NounLav.gf | 90 +++++++++++++++++-------------- lib/src/latvian/ParadigmsLav.gf | 2 +- lib/src/latvian/RelativeLav.gf | 16 +++--- lib/src/latvian/ResLav.gf | 50 ++++++++--------- lib/src/latvian/SentenceLav.gf | 29 +++++++--- lib/src/latvian/SymbolLav.gf | 33 +++++++----- lib/src/latvian/VerbLav.gf | 49 +++++++++++------ 12 files changed, 261 insertions(+), 166 deletions(-) diff --git a/lib/src/latvian/AdjectiveLav.gf b/lib/src/latvian/AdjectiveLav.gf index 9282b6854..74b1e9265 100644 --- a/lib/src/latvian/AdjectiveLav.gf +++ b/lib/src/latvian/AdjectiveLav.gf @@ -17,8 +17,13 @@ lin UseComparA a = { s = \\d,g,n,c => a.s ! (AAdj Compar d g n c) } ; + -- A2 -> NP -> AP + -- e.g. "married to her" ComplA2 a np = { - s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) ++ a.prep.s ++ np.s ! (a.prep.c ! (fromAgr np.agr).num) + s = \\d,g,n,c => case np.isPron of { + False => a.s ! (AAdj Posit d g n c) ++ a.prep.s ++ np.s ! (a.prep.c ! (fromAgr np.agr).num) ; + True => a.prep.s ++ np.s ! (a.prep.c ! (fromAgr np.agr).num) ++ a.s ! (AAdj Posit d g n c) + } } ; ReflA2 a = { s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) ++ a.prep.s ++ reflPron ! (a.prep.c ! n) } ; @@ -36,4 +41,13 @@ lin UseA2 a = { s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) } ; + -- AP -> Adv -> AP + -- e.g. "warm by nature" + AdvAP ap adv = { + s = \\d,g,n,c => case adv.isPron of { + False => ap.s ! d ! g ! n ! c ++ adv.s ; + True => adv.s ++ ap.s ! d ! g ! n ! c + } + } ; + } diff --git a/lib/src/latvian/AdverbLav.gf b/lib/src/latvian/AdverbLav.gf index 3abe330e3..c7f65c8ca 100644 --- a/lib/src/latvian/AdverbLav.gf +++ b/lib/src/latvian/AdverbLav.gf @@ -9,21 +9,37 @@ flags coding = utf8 ; lin - PositAdvAdj a = { s = a.s ! (AAdv Posit) } ; + -- A -> Adv + -- e.g. "warmly" + PositAdvAdj a = {s = a.s ! (AAdv Posit) ; isPron = False} ; + -- Prep -> NP -> Adv + -- e.g. "in the house" + -- FIXME: postpozīcijas prievārdi + PrepNP prep np = {s = prep.s ++ np.s ! (prep.c ! (fromAgr np.agr).num) ; isPron = np.isPron} ; + + -- CAdv -> A -> NP -> Adv + -- e.g. "more warmly than John" -- TODO: vajag arī 'ātrāks par Jāni' un 'ātrāks nekā Jānis' pie more_CAdv -- TODO: vai te tiešām veido 'ātrāk par Jāni'? kurš ir pareizais adverbs? nevis 'ātrāks par Jāni'? - ComparAdvAdj cadv a np = { s = cadv.s ++ a.s ! (AAdv cadv.deg) ++ cadv.prep ++ np.s ! Nom } ; + ComparAdvAdj cadv a np = {s = cadv.s ++ a.s ! (AAdv cadv.deg) ++ cadv.prep ++ np.s ! Nom ; isPron = False} ; - ComparAdvAdjS cadv a s = { s = cadv.s ++ a.s ! (AAdv cadv.deg) ++ cadv.prep ++ s.s } ; + -- CAdv -> A -> S -> Adv + -- e.g. "more warmly than he runs" + ComparAdvAdjS cadv a s = {s = cadv.s ++ a.s ! (AAdv cadv.deg) ++ cadv.prep ++ s.s ; isPron = False} ; - -- FIXME: postpozīcijas prievārdi - PrepNP prep np = { s = prep.s ++ np.s ! (prep.c ! (fromAgr np.agr).num) } ; + -- AdA -> Adv -> Adv + -- e.g. "very quickly" + AdAdv ada adv = {s = ada.s ++ adv.s ; isPron = False} ; - AdAdv = cc2 ; + -- TODO: PositAdAAdj : A -> AdA - SubjS = cc2 ; + -- Subj -> S -> Adv + -- e.g. "when she sleeps" + SubjS subj s = {s = subj.s ++ s.s ; isPron = False} ; + -- CAdv -> AdN + -- e.g. "less (than five)" AdnCAdv cadv = { s = case cadv.deg of { Posit => cadv.s ++ cadv.prep ; diff --git a/lib/src/latvian/CatLav.gf b/lib/src/latvian/CatLav.gf index 17f622432..fda3d86ec 100644 --- a/lib/src/latvian/CatLav.gf +++ b/lib/src/latvian/CatLav.gf @@ -1,6 +1,6 @@ --# -path=.:abstract:common:prelude -concrete CatLav of Cat = CommonX - [CAdv, Voc] ** open ResLav, Prelude in { +concrete CatLav of Cat = CommonX - [Adv, CAdv, Voc] ** open ResLav, Prelude in { flags @@ -11,35 +11,35 @@ lincat -- Sentences and clauses - S, QS = { s : Str } ; + S, QS = {s : Str} ; - RS = { s : Agreement => Str } ; + RS = {s : Agreement => Str} ; - Cl = { s : VMood => Polarity => Str } ; + Cl = {s : VMood => Polarity => Str} ; - ClSlash = { s : VMood => Polarity => Str ; prep : Preposition } ; + ClSlash = {s : VMood => Polarity => Str ; prep : Preposition} ; - SSlash = { s : Str ; prep : Preposition } ; + SSlash = {s : Str ; prep : Preposition} ; - Imp = { s : Polarity => Number => Str } ; + Imp = {s : Polarity => Number => Str} ; -- Questions and interrogatives - QCl = { s : VMood => Polarity => Str } ; + QCl = {s : VMood => Polarity => Str} ; - IP = { s : Case => Str ; num : Number } ; + IP = {s : Case => Str ; num : Number} ; - -- TODO: IComp = { s : Str ; agr : Agreement } ; + -- TODO: IComp = {s : Str ; agr : Agreement} ; - IDet = { s : Gender => Str ; num : Number } ; + IDet = {s : Gender => Str ; num : Number} ; - IQuant = { s : Gender => Number => Str } ; + IQuant = {s : Gender => Number => Str} ; -- Relative clauses and pronouns - RCl = { s : VMood => Polarity => Agreement => Str } ; + RCl = {s : VMood => Polarity => Agreement => Str} ; - RP = { s : Gender => Case => Str } ; + RP = {s : Gender => Case => Str} ; -- Verb phrases @@ -47,43 +47,43 @@ lincat VPSlash = ResLav.VPSlash ; - Comp = { s : Agreement => Str } ; + Comp = {s : Agreement => Str} ; -- Adjectival phrases - AP = { s : Definiteness => Gender => Number => Case => Str } ; + AP = {s : Definiteness => Gender => Number => Case => Str} ; -- Nouns and noun phrases - CN = { s : Definiteness => Number => Case => Str ; gend : Gender ; isRel : Bool } ; + CN = {s : Definiteness => Number => Case => Str ; gend : Gender ; isRel : Bool} ; - NP = { s : Case => Str ; agr : Agreement ; pol : Polarity ; isRel : Bool } ; + NP = {s : Case => Str ; agr : Agreement ; pol : Polarity ; isRel : Bool ; isPron : Bool} ; Pron = Pronoun ; - Det = { s : Gender => Case => Str ; num : Number ; defin : Definiteness ; pol : Polarity } ; + Det = {s : Gender => Case => Str ; num : Number ; defin : Definiteness ; pol : Polarity} ; - Predet = { s : Gender => Str } ; + Predet = {s : Gender => Str} ; - Quant = { s : Gender => Number => Case => Str ; defin : Definiteness ; pol : Polarity } ; + Quant = {s : Gender => Number => Case => Str ; defin : Definiteness ; pol : Polarity} ; - Num = { s : Gender => Case => Str ; num : Number ; hasCard : Bool } ; + Num = {s : Gender => Case => Str ; num : Number ; hasCard : Bool} ; - Card = { s : Gender => Case => Str ; num : Number } ; + Card = {s : Gender => Case => Str ; num : Number} ; - Ord = { s : Gender => Case => Str } ; + Ord = {s : Gender => Case => Str} ; -- Numerals - Numeral = { s : CardOrd => Gender => Case => Str ; num : Number } ; + Numeral = {s : CardOrd => Gender => Case => Str ; num : Number} ; - Digits = { s : CardOrd => Str ; num : Number } ; + Digits = {s : CardOrd => Str ; num : Number} ; -- Structural words - Conj = { s1, s2 : Str ; num : Number } ; + Conj = {s1, s2 : Str ; num : Number} ; - Subj = { s : Str } ; + Subj = {s : Str} ; Prep = Preposition ; @@ -91,28 +91,30 @@ lincat V, VV, VQ, VA = Verb ; - V2, V2V, V2Q, V2A = Verb ** { rightVal : Preposition } ; + V2, V2V, V2Q, V2A = Verb ** {rightVal : Preposition} ; - V3 = Verb ** { rightVal1, rightVal2 : Preposition } ; + V3 = Verb ** {rightVal1, rightVal2 : Preposition} ; - VS = Verb ** { conj : Subj } ; + VS = Verb ** {conj : Subj} ; - V2S = Verb ** { conj : Subj ; rightVal : Preposition } ; + V2S = Verb ** {conj : Subj ; rightVal : Preposition} ; A = Adjective ; - A2 = Adjective ** { prep : Preposition } ; + A2 = Adjective ** {prep : Preposition} ; N = Noun ; - N2 = Noun ** { prep : Preposition ; isPre : Bool } ; + N2 = Noun ** {prep : Preposition ; isPre : Bool} ; - N3 = Noun ** { prep1, prep2 : Preposition ; isPre1, isPre2 : Bool } ; + N3 = Noun ** {prep1, prep2 : Preposition ; isPre1, isPre2 : Bool} ; PN = ProperNoun ; -- Overriden from CommonX - CAdv = { s, prep : Str ; deg : Degree } ; + Adv = {s : Str ; isPron : Bool} ; + + CAdv = {s, prep : Str ; deg : Degree} ; } diff --git a/lib/src/latvian/ConjunctionLav.gf b/lib/src/latvian/ConjunctionLav.gf index 63934f0f4..98ebaf66e 100644 --- a/lib/src/latvian/ConjunctionLav.gf +++ b/lib/src/latvian/ConjunctionLav.gf @@ -14,17 +14,22 @@ lin ConjS = conjunctDistrSS ; - ConjAdv = conjunctDistrSS ; - - ConjNP conj ss = conjunctDistrTable Case conj ss ** { - agr = toAgr (fromAgr ss.agr).pers (conjNumber (fromAgr ss.agr).num conj.num) (fromAgr ss.agr).gend; - pol = Pos ; - isRel = False - } ; + ConjRS conj ss = conjunctDistrTable Agreement conj ss ; ConjAP conj ss = conjunctDistrTable4 Definiteness Gender Number Case conj ss ; - ConjRS conj ss = conjunctDistrTable Agreement conj ss ; + -- Conj -> [NP] -> NP + -- e.g. "she or we" + ConjNP conj ss = conjunctDistrTable Case conj ss ** { + agr = toAgr (fromAgr ss.agr).pers (conjNumber (fromAgr ss.agr).num conj.num) (fromAgr ss.agr).gend; + pol = Pos ; + isRel = False ; + isPron = False + } ; + + -- Conj -> [Adv] -> Adv + -- e.g. "here or there" + ConjAdv or xs = (conjunctDistrSS or xs) ** {isPron = False}; -- These fun's are generated from the list cat's: BaseS = twoSS ; @@ -43,10 +48,13 @@ lin lincat - [S] = { s1, s2 : Str } ; - [Adv] = { s1, s2 : Str } ; - [NP] = { s1, s2 : Case => Str ; agr : Agreement } ; - [AP] = { s1, s2 : Definiteness => Gender => Number => Case => Str } ; - [RS] = { s1, s2 : Agreement => Str } ; + [S] = {s1, s2 : Str} ; + [RS] = {s1, s2 : Agreement => Str} ; + [NP] = {s1, s2 : Case => Str ; agr : Agreement} ; + [AP] = {s1, s2 : Definiteness => Gender => Number => Case => Str} ; + [Adv] = {s1, s2 : Str} ; + -- TODO: [AdV]{2} + -- TODO: [IAdv]{2} + -- TODO: [CN] {2} } diff --git a/lib/src/latvian/GrammarLav.gf b/lib/src/latvian/GrammarLav.gf index 37bc5b494..d28de5f2a 100644 --- a/lib/src/latvian/GrammarLav.gf +++ b/lib/src/latvian/GrammarLav.gf @@ -11,10 +11,10 @@ concrete GrammarLav of Grammar = RelativeLav, ConjunctionLav, PhraseLav, - TextX - [CAdv], + TextX - [Adv,CAdv], StructuralLav, IdiomLav, - TenseX - [CAdv] + TenseX - [Adv,CAdv] ** { flags diff --git a/lib/src/latvian/NounLav.gf b/lib/src/latvian/NounLav.gf index 6e1a190f6..4e37d7222 100644 --- a/lib/src/latvian/NounLav.gf +++ b/lib/src/latvian/NounLav.gf @@ -14,86 +14,96 @@ lin -- Det -> CN -> NP -- e.g. 'the man' DetCN det cn = { - s = \\c => det.s ! cn.gend ! c ++ cn.s ! det.defin ! det.num ! c ; - agr = AgrP3 det.num cn.gend ; - pol = det.pol ; - isRel = cn.isRel + s = \\c => det.s ! cn.gend ! c ++ cn.s ! det.defin ! det.num ! c ; + agr = AgrP3 det.num cn.gend ; + pol = det.pol ; + isRel = cn.isRel ; + isPron = False } ; -- PN -> NP -- e.g. 'John' UsePN pn = { - s = pn.s ; - agr = AgrP3 pn.num pn.gend ; - pol = Pos ; - isRel = False + s = pn.s ; + agr = AgrP3 pn.num pn.gend ; + pol = Pos ; + isRel = False ; + isPron = False } ; -- Pron -> NP -- e.g. 'he' UsePron pron = { - s = pron.s ; - agr = pron.agr ; - pol = pron.pol ; - isRel = False + s = pron.s ; + agr = pron.agr ; + pol = pron.pol ; + isRel = False ; + isPron = True } ; -- Predet -> NP -> NP -- e.g. 'only the man' PredetNP predet np = { - s = \\c => predet.s ! (fromAgr np.agr).gend ++ np.s ! c ; - agr = np.agr ; - pol = np.pol ; - isRel = np.isRel + s = \\c => predet.s ! (fromAgr np.agr).gend ++ np.s ! c ; + agr = np.agr ; + pol = np.pol ; + isRel = np.isRel ; + isPron = False } ; -- NP -> V2 -> NP -- e.g. 'the man seen' PPartNP np v2 = { - s = \\c => v2.s ! Pos ! (VPart Pass (fromAgr np.agr).gend (fromAgr np.agr).num c) ++ np.s ! c ; - agr = np.agr ; - pol = np.pol ; - isRel = np.isRel + s = \\c => v2.s ! Pos ! (VPart Pass (fromAgr np.agr).gend (fromAgr np.agr).num c) ++ np.s ! c ; + agr = np.agr ; + pol = np.pol ; + isRel = np.isRel ; + isPron = False } ; -- NP -> Adv -> NP -- e.g. 'Paris today' AdvNP np adv = { - s = \\c => np.s ! c ++ adv.s ; - agr = np.agr ; - pol = np.pol ; - isRel = False + s = \\c => np.s ! c ++ adv.s ; + agr = np.agr ; + pol = np.pol ; + isRel = False ; + isPron = False } ; -- NP -> RS -> NP -- e.g. 'Paris, which is here' RelNP np rs = { - s = \\c => np.s ! c ++ "," ++ rs.s ! np.agr ; - agr = np.agr ; - pol = np.pol ; - isRel = True + s = \\c => np.s ! c ++ "," ++ rs.s ! np.agr ; + agr = np.agr ; + pol = np.pol ; + isRel = True ; + isPron = False } ; -- CN -> NP MassNP cn = { - s = cn.s ! Indef ! Sg ; -- FIXME: bet 'šis alus'? un 'zaļš alus' vs. 'zaļais alus'? - agr = AgrP3 Sg cn.gend ; - pol = Pos ; - isRel = cn.isRel + s = cn.s ! Indef ! Sg ; -- FIXME: bet 'šis alus'? un 'zaļš alus' vs. 'zaļais alus'? + agr = AgrP3 Sg cn.gend ; + pol = Pos ; + isRel = cn.isRel ; + isPron = False } ; -- Det -> NP -- e.g. 'these five' DetNP det = { - s = \\c => det.s ! Masc ! c ; - agr = AgrP3 det.num Masc ; - pol = det.pol ; - isRel = False + s = \\c => det.s ! Masc ! c ; + agr = AgrP3 det.num Masc ; + pol = det.pol ; + isRel = False ; + isPron = False } | { - s = \\c => det.s ! Fem ! c ; - agr = AgrP3 det.num Fem ; - pol = det.pol ; - isRel = False + s = \\c => det.s ! Fem ! c ; + agr = AgrP3 det.num Fem ; + pol = det.pol ; + isRel = False ; + isPron = False } ; -- Determiners diff --git a/lib/src/latvian/ParadigmsLav.gf b/lib/src/latvian/ParadigmsLav.gf index 37433ba65..c3bb6aea4 100644 --- a/lib/src/latvian/ParadigmsLav.gf +++ b/lib/src/latvian/ParadigmsLav.gf @@ -143,7 +143,7 @@ oper -- Adverbs - mkAdv : Str -> Adv = \x -> lin Adv (ss x) ; + mkAdv : Str -> Adv = \x -> lin Adv {s = x ; isPron = False} ; mkAdV : Str -> AdV = \x -> lin AdV (ss x) ; mkAdA : Str -> AdA = \x -> lin AdA (ss x) ; mkAdN : Str -> AdN = \x -> lin AdN (ss x) ; diff --git a/lib/src/latvian/RelativeLav.gf b/lib/src/latvian/RelativeLav.gf index 3e9981b5e..9190bede1 100644 --- a/lib/src/latvian/RelativeLav.gf +++ b/lib/src/latvian/RelativeLav.gf @@ -28,15 +28,19 @@ oper } in lin RCl { s = \\mood,pol,agr => - case mood of { -- subject + let verb : Str = case subjInTopic of { + True => buildVerb vp.v mood pol (AgrP3 (fromAgr agr).num (fromAgr agr).gend) Pos vp.rightPol ; + False => buildVerb vp.v mood pol vp.rightAgr Pos vp.rightPol + } in + case mood of { -- subject Deb _ _ => rp.s ! Masc ! Dat ; --# notpresent _ => rp.s ! Masc ! vp.leftVal } ++ - case subjInTopic of { -- verb - True => buildVerb vp.v mood pol (AgrP3 (fromAgr agr).num (fromAgr agr).gend) Pos vp.rightPol ; - False => buildVerb vp.v mood pol vp.rightAgr Pos vp.rightPol - } ++ - vp.compl ! agr -- object(s), complements, adverbial modifiers + case vp.objPron of { + False => verb ++ vp.compl ! agr ; + True => (vp.compl ! agr ++ verb) --| (verb ++ vp.compl ! agr) + -- FIXME: the object should be separated from other complements that should remain on the right side + } } ; lin diff --git a/lib/src/latvian/ResLav.gf b/lib/src/latvian/ResLav.gf index 3a817e0bf..fc96defe1 100644 --- a/lib/src/latvian/ResLav.gf +++ b/lib/src/latvian/ResLav.gf @@ -65,17 +65,17 @@ param oper - Noun : Type = { s : Number => Case => Str ; gend : Gender } ; + Noun : Type = {s : Number => Case => Str ; gend : Gender} ; - ProperNoun : Type = { s : Case => Str ; gend : Gender ; num : Number } ; + ProperNoun : Type = {s : Case => Str ; gend : Gender ; num : Number} ; - Pronoun : Type = { s : Case => Str ; agr : Agreement ; poss : Gender => Number => Case => Str ; pol : Polarity } ; + Pronoun : Type = {s : Case => Str ; agr : Agreement ; poss : Gender => Number => Case => Str ; pol : Polarity} ; - Adjective : Type = { s : AForm => Str } ; + Adjective : Type = {s : AForm => Str} ; - Preposition : Type = { s : Str ; c : Number => Case } ; + Preposition : Type = {s : Str ; c : Number => Case} ; - Verb : Type = { s : Polarity => VForm => Str ; leftVal : Case } ; + Verb : Type = {s : Polarity => VForm => Str ; leftVal : Case} ; VP : Type = { v : Verb ; @@ -83,34 +83,36 @@ oper voice : Voice ; leftVal : Case ; -- the left valence (typically, the subject) rightAgr : Agreement ; -- for the potential subject-verb agreement (the subject can be on the right side) - rightPol : Polarity -- for the potential double negation + rightPol : Polarity ; -- for the potential double negation + objPron : Bool -- true, if object is a Pron (for modifying the neutral word order) } ; - VPSlash : Type = VP ** { rightVal : Preposition } ; -- the right valence (typically, the object) + VPSlash : Type = VP ** {rightVal : Preposition} ; -- the right valence (typically, the object) buildVP : VP -> Polarity -> VForm -> Agreement -> Str = \vp,pol,vf,agr -> vp.v.s ! pol ! vf ++ vp.compl ! agr ; - insertObj : (Agreement => Str) -> VP -> VP = \obj,vp -> { + insertObj : (Agreement => Str) -> Bool -> Bool -> VP -> VP = \obj,isPron,isPre,vp -> { v = vp.v ; - compl = \\agr => vp.compl ! agr ++ obj ! agr ; + compl = \\agr => case isPre of { + False => vp.compl ! agr ++ obj ! agr ; + True => obj ! agr ++ vp.compl ! agr + } ; voice = vp.voice ; leftVal = vp.leftVal ; rightAgr = vp.rightAgr ; - rightPol = vp.rightPol + rightPol = vp.rightPol ; + objPron = isPron } ; - insertObjPre : (Agreement => Str) -> VP -> VP = \obj,vp -> { - v = vp.v ; - compl = \\agr => obj ! agr ++ vp.compl ! agr ; - voice = vp.voice ; - leftVal = vp.leftVal ; - rightAgr = vp.rightAgr ; - rightPol = vp.rightPol - } ; + insertObjReg : (Agreement => Str) -> Bool -> VP -> VP = \obj,isPron,vp -> + insertObj obj isPron False vp ; + + insertObjPre : (Agreement => Str) -> VP -> VP = \obj,vp -> + insertObj obj True True vp ; insertObjSlash : (Agreement => Str) -> VPSlash -> VPSlash = \obj,vp -> - insertObj obj vp ** { rightVal = vp.rightVal } ; + insertObj obj vp.objPron False vp ** {rightVal = vp.rightVal} ; getInf : Verb -> Str = \v -> v.s ! Pos ! VInf ; @@ -121,11 +123,11 @@ oper P3 => AgrP3 num gend } ; - fromAgr : Agreement -> { pers : Person ; num : Number ; gend : Gender } = \agr -> + fromAgr : Agreement -> {pers : Person ; num : Number ; gend : Gender} = \agr -> case agr of { - AgrP1 num gend => { pers = P1 ; num = num ; gend = gend } ; - AgrP2 num gend => { pers = P2 ; num = num ; gend = gend } ; - AgrP3 num gend => { pers = P3 ; num = num ; gend = gend } + AgrP1 num gend => {pers = P1 ; num = num ; gend = gend} ; + AgrP2 num gend => {pers = P2 ; num = num ; gend = gend} ; + AgrP3 num gend => {pers = P3 ; num = num ; gend = gend} } ; conjAgr : Agreement -> Agreement -> Agreement = \agr1,agr2 -> diff --git a/lib/src/latvian/SentenceLav.gf b/lib/src/latvian/SentenceLav.gf index e3c0d06b2..8c7c8c576 100644 --- a/lib/src/latvian/SentenceLav.gf +++ b/lib/src/latvian/SentenceLav.gf @@ -32,12 +32,13 @@ lin SlashVS np vs sslash = mkClause np (lin VP { - v = vs ; - compl = \\_ => "," ++ vs.conj.s ++ sslash.s ; - voice = Act ; - leftVal = vs.leftVal ; + v = vs ; + compl = \\_ => "," ++ vs.conj.s ++ sslash.s ; + voice = Act ; + leftVal = vs.leftVal ; rightAgr = AgrP3 Sg Masc ; rightPol = Pos ; + objPron = False }) ** { prep = sslash.prep } ; -- ComplVS v s = { v = v ; compl = \\_ => "," ++ v.subj.s ++ s.s } ; @@ -74,13 +75,25 @@ oper } in lin Cl { s = \\mood,pol => - case mood of { -- subject + case mood of { -- subject Deb _ _ => np.s ! Dat ; --# notpresent _ => np.s ! vp.leftVal } ++ - closeRelCl np.isRel ++ - buildVerb vp.v mood pol agr np.pol vp.rightPol ++ -- verb - vp.compl ! np.agr -- object(s), complements, adverbial modifiers + closeRelCl np.isRel ++ -- comma, if necessary + case vp.objPron of { + False => + buildVerb vp.v mood pol agr np.pol vp.rightPol ++ -- verb + vp.compl ! np.agr ; -- object(s), modifiers and other complements + True => + -- FIXME: the object should be separated from other complements that should remain on the right side + ( + vp.compl ! np.agr ++ -- object(s), modifiers and other complements + buildVerb vp.v mood pol agr np.pol vp.rightPol -- verb + ) --| ( + --buildVerb vp.v mood pol agr np.pol vp.rightPol ++ -- verb + --vp.compl ! np.agr -- object(s), modifiers and other complements + --) + } } ; -- FIXME: quick&dirty - lai kompilētos pret RGL API diff --git a/lib/src/latvian/SymbolLav.gf b/lib/src/latvian/SymbolLav.gf index fd6236e82..c521c8ce5 100644 --- a/lib/src/latvian/SymbolLav.gf +++ b/lib/src/latvian/SymbolLav.gf @@ -15,25 +15,34 @@ lin FloatPN i = {s = \\_ => i.s ; gend = Masc ; num = Pl} ; NumPN i = {s = \\_ => i.s ! Masc ! Nom ; gend = Masc ; num = Pl} ; + -- CN -> Int -> NP + -- e.g. "level 53" (covered by CNNumNP) CNIntNP cn i = { - s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ; - agr = AgrP3 Sg cn.gend ; - pol = Pos ; - isRel = False + s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ; + agr = AgrP3 Sg cn.gend ; + pol = Pos ; + isRel = False ; + isPron = False } ; + -- Det -> CN -> ListSymb -> NP + -- e.g. "(the) (2) numbers x and y" CNSymbNP det cn xs = { - s = \\_ => det.s ! cn.gend ! Nom ++ cn.s ! det.defin ! det.num ! Nom ++ xs.s ; - agr = AgrP3 det.num cn.gend ; - pol = Pos ; - isRel = False + s = \\_ => det.s ! cn.gend ! Nom ++ cn.s ! det.defin ! det.num ! Nom ++ xs.s ; + agr = AgrP3 det.num cn.gend ; + pol = Pos ; + isRel = False ; + isPron = False } ; + -- CN -> Card -> NP + -- e.g. "level five", "level 5" CNNumNP cn i = { - s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ! Masc ! Nom ; - agr = AgrP3 Sg cn.gend ; - pol = Pos ; - isRel = False + s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ! Masc ! Nom ; + agr = AgrP3 Sg cn.gend ; + pol = Pos ; + isRel = False ; + isPron = False } ; SymbS sy = sy ; diff --git a/lib/src/latvian/VerbLav.gf b/lib/src/latvian/VerbLav.gf index a8abcaf6d..f936e78e0 100644 --- a/lib/src/latvian/VerbLav.gf +++ b/lib/src/latvian/VerbLav.gf @@ -30,7 +30,8 @@ lin voice = Act ; leftVal = v.leftVal ; rightAgr = AgrP3 Sg Masc ; - rightPol = Pos + rightPol = Pos ; + objPron = False } ; -- VV -> VP -> VP @@ -41,7 +42,8 @@ lin voice = Act ; leftVal = vv.leftVal ; rightAgr = AgrP3 Sg Masc ; - rightPol = Pos + rightPol = Pos ; + objPron = False } ; -- VS -> S -> VP @@ -52,7 +54,8 @@ lin voice = Act ; leftVal = vs.leftVal ; rightAgr = AgrP3 Sg Masc ; - rightPol = Pos + rightPol = Pos ; + objPron = False } ; -- VQ -> QS -> VP @@ -63,7 +66,8 @@ lin voice = Act ; leftVal = vq.leftVal ; rightAgr = AgrP3 Sg Masc ; - rightPol = Pos + rightPol = Pos ; + objPron = False } ; -- VA -> AP -> VP @@ -74,18 +78,20 @@ lin voice = Act ; leftVal = va.leftVal ; rightAgr = AgrP3 Sg Masc ; - rightPol = Pos + rightPol = Pos ; + objPron = False } ; -- V2 -> VPSlash -- e.g. 'love (it)' SlashV2a v2 = { v = v2 ; - compl = \\_ => [] ; -- will be overriden + compl = \\_ => [] ; -- will be overriden voice = Act ; leftVal = v2.leftVal ; rightAgr = AgrP3 Sg Masc ; -- will be overriden - rightPol = Pos ; -- will be overriden + rightPol = Pos ; -- will be overriden + objPron = False ; -- will be overriden rightVal = v2.rightVal } ; @@ -100,6 +106,7 @@ lin leftVal = v3.leftVal ; rightAgr = np.agr ; rightPol = np.pol ; + objPron = np.isPron ; rightVal = v3.rightVal1 } ; -- FIXME: "vīrietis runā par ābolus ar sievieti" ("a man talks to a woman about apples") @@ -117,6 +124,7 @@ lin leftVal = v3.leftVal ; rightAgr = np.agr ; rightPol = np.pol ; + objPron = np.isPron ; rightVal = v3.rightVal1 } ; @@ -129,6 +137,7 @@ lin leftVal = v2v.leftVal ; rightAgr = AgrP3 Sg Masc ; rightPol = Pos ; + objPron = False ; -- will be overriden rightVal = v2v.rightVal } ; @@ -141,6 +150,7 @@ lin leftVal = v2s.leftVal ; rightAgr = AgrP3 Sg Masc ; rightPol = Pos ; + objPron = False ; -- will be overriden rightVal = v2s.rightVal } ; @@ -153,6 +163,7 @@ lin leftVal = v2q.leftVal ; rightAgr = AgrP3 Sg Masc ; rightPol = Pos ; + objPron = False ; -- will be overriden rightVal = v2q.rightVal } ; @@ -165,6 +176,7 @@ lin leftVal = v2a.leftVal ; rightAgr = AgrP3 Sg Masc ; rightPol = Pos ; + objPron = False ; -- will be overriden rightVal = v2a.rightVal } ; @@ -189,7 +201,8 @@ lin leftVal = vpslash.leftVal ; rightAgr = np.agr ; rightPol = np.pol ; - rightVal = vpslash.rightVal ; + objPron = np.isPron ; + rightVal = vpslash.rightVal } ; -- VV -> VPSlash -> VPSlash @@ -201,6 +214,7 @@ lin leftVal = vv.leftVal ; rightAgr = AgrP3 Sg Masc ; rightPol = Pos ; + objPron = False ; -- will be overriden rightVal = nom_Prep } ; @@ -215,6 +229,7 @@ lin leftVal = v2v.leftVal ; rightAgr = np.agr ; rightPol = np.pol ; + objPron = np.isPron ; rightVal = v2v.rightVal } ; @@ -234,7 +249,8 @@ lin voice = Act ; leftVal = Nom ; rightAgr = AgrP3 Sg Masc ; - rightPol = Pos + rightPol = Pos ; + objPron = False } ; -- V2 -> VP @@ -245,7 +261,8 @@ lin voice = Pass ; leftVal = v2.rightVal.c ! Sg ; rightAgr = AgrP3 Sg Masc ; - rightPol = Pos + rightPol = Pos ; + objPron = False --rightVal = mkPrep v2.leftVal } ; -- TODO: val - should not be overriden in ComplSlash etc.? @@ -254,7 +271,7 @@ lin -- VP -> Adv -> VP -- e.g. 'sleep here' - AdvVP vp adv = insertObj (\\_ => adv.s) vp ; + AdvVP vp adv = insertObjReg (\\_ => adv.s) adv.isPron vp ; -- AdV -> VP -> VP -- e.g. 'always sleep' @@ -268,7 +285,7 @@ lin -- VP -> Prep -> VPSlash -- e.g. 'live in (it)' - VPSlashPrep vp prep = vp ** { rightVal = prep } ; + VPSlashPrep vp prep = vp ** {rightVal = prep} ; -- TODO: šajā brīdī ir jāignorē prep (by8agent_Prep); tas jāaizstāj ar v2.left (?) -- Tad varēs dzēst ārā komentāru pie StructuralLav.by8agent_Prep (?) @@ -276,19 +293,19 @@ lin -- AP -> Comp -- e.g. '(be) small' - CompAP ap = { s = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom } ; + CompAP ap = {s = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom} ; -- NP -> Comp -- e.g. '(be) the man' - CompNP np = { s = \\_ => np.s ! Nom } ; + CompNP np = {s = \\_ => np.s ! Nom} ; -- Adv -> Comp -- e.g. '(be) here' - CompAdv a = { s = \\_ => a.s } ; + CompAdv adv = {s = \\_ => adv.s} ; -- CN -> Comp -- e.g. '(be) a man/men' - CompCN cn = { s = \\agr => cn.s ! Indef ! (fromAgr agr).num ! Nom } ; + CompCN cn = {s = \\agr => cn.s ! Indef ! (fromAgr agr).num ! Nom} ; -- TODO: UseCopula : VP -- e.g. 'be'