Latvian: an optimized NP linearization type => fixed the double negation support in VPS

The flag indicating whether a NP has a negated determiner is now encapsulated in the algebraic parameter Agr, removing the extra field in the NP linearization type.
This commit is contained in:
normundsg
2013-05-02 13:17:53 +00:00
parent 0dbddbb9d7
commit 9f5c805ab5
14 changed files with 117 additions and 148 deletions

View File

@@ -50,14 +50,14 @@ lincat
-- Noun -- Noun
CN = { s : Definite => Number => Case => Str ; g : Gender } ; CN = { s : Definite => Number => Case => Str ; g : Gender } ;
NP = { s : Case => Str ; a : ResLav.Agr ; isNeg : Bool } ; NP = { s : Case => Str ; a : ResLav.Agr } ;
Pron = { s : Case => Str ; a : ResLav.Agr ; possessive : Gender => Number => Case => Str } ; Pron = { s : Case => Str ; a : ResLav.Agr ; possessive : Gender => Number => Case => Str } ;
Det = { s : Gender => Case => Str ; n : Number ; d : Definite ; isNeg : Bool } ; Det = { s : Gender => Case => Str ; n : Number ; d : Definite ; pol : Polarity } ;
Predet = { s : Gender => Str } ; Predet = { s : Gender => Str } ;
Ord = { s : Gender => Case => Str } ; Ord = { s : Gender => Case => Str } ;
Num = { s : Gender => Case => Str ; n : Number ; hasCard : Bool } ; Num = { s : Gender => Case => Str ; n : Number ; hasCard : Bool } ;
Card = { s : Gender => Case => Str ; n : Number } ; Card = { s : Gender => Case => Str ; n : Number } ;
Quant = { s : Gender => Number => Case => Str ; d : Definite ; isNeg : Bool } ; Quant = { s : Gender => Number => Case => Str ; d : Definite ; pol : Polarity } ;
-- Numeral -- Numeral

View File

@@ -17,8 +17,7 @@ lin
ConjAdv = conjunctDistrSS ; ConjAdv = conjunctDistrSS ;
ConjNP conj ss = conjunctDistrTable Case conj ss ** { ConjNP conj ss = conjunctDistrTable Case conj ss ** {
a = toAgr (conjNumber (fromAgr ss.a).num conj.n) (fromAgr ss.a).pers (fromAgr ss.a).gend ; a = toAgr (fromAgr ss.a).pers (conjNumber (fromAgr ss.a).num conj.n) (fromAgr ss.a).gend Pos
isNeg = False
} ; } ;
ConjAP conj ss = conjunctDistrTable4 Definite Gender Number Case conj ss ; ConjAP conj ss = conjunctDistrTable4 Definite Gender Number Case conj ss ;

View File

@@ -40,6 +40,8 @@ lin
they8fem_Pron = mkPronoun_They Fem ; they8fem_Pron = mkPronoun_They Fem ;
it8fem_Pron = mkPronoun_It_Sg Fem ; it8fem_Pron = mkPronoun_It_Sg Fem ;
have_V3 = mkV3 (mkV "būt") nom_Prep dat_Prep Dat ;
{-empty_Det num def neg = \num,def,neg -> { {-empty_Det num def neg = \num,def,neg -> {
s = \\_,_ => [] ; s = \\_,_ => [] ;
n = num ; n = num ;
@@ -49,18 +51,17 @@ lin
-- Zemāk esošās f-cijas nav ExtraLavAbs, tās ir abstract/Extra.gf -- Zemāk esošās f-cijas nav ExtraLavAbs, tās ir abstract/Extra.gf
-- NP -> Quant
GenNP np = { GenNP np = {
s = \\_,_,_ => np.s ! Gen ; s = \\_,_,_ => np.s ! Gen ;
d = Def ; d = Def ;
isNeg = np.isNeg pol = (fromAgr np.a).pol
} ; } ;
--ICompAP ap = {s = \\g,n => "cik" ++ ap.s ! Indef ! g ! n ! Nom } ; --ICompAP ap = {s = \\g,n => "cik" ++ ap.s ! Indef ! g ! n ! Nom } ;
IAdvAdv adv = {s = "cik" ++ adv.s} ; IAdvAdv adv = {s = "cik" ++ adv.s} ;
have_V3 = mkV3 (mkV "būt") nom_Prep dat_Prep Dat ;
-- for VP conjunction -- for VP conjunction
lincat lincat
@@ -84,7 +85,7 @@ lin
-- TODO: subj-dependent double negation -- TODO: subj-dependent double negation
-- TODO: subj/obj isNeg jāpārceļ uz Agr (?) -- TODO: subj/obj isNeg jāpārceļ uz Agr (?)
--let verb = vp.v.s ! pol.p ! Indicative (fromAgr agr).pers (fromAgr agr).num temp.t in --let verb = vp.v.s ! pol.p ! Indicative (fromAgr agr).pers (fromAgr agr).num temp.t in
temp.s ++ buildVerb vp.v (Ind temp.a temp.t) pol.p subjAgr False vp.objNeg ++ vp.compl ! subjAgr temp.s ++ buildVerb vp.v (Ind temp.a temp.t) pol.p subjAgr (fromAgr subjAgr).pol vp.objNeg ++ vp.compl ! subjAgr
} ; } ;
-- Conj -> [VPS] -> VPS -- Conj -> [VPS] -> VPS

View File

@@ -13,18 +13,18 @@ flags
lin lin
ImpersCl vp = ImpersCl vp =
let agr = AgP3 Sg Masc let agr = AgP3 Sg Masc Pos
in { in {
s = \\mood,pol => s = \\mood,pol =>
buildVerb vp.v mood pol agr False vp.objNeg ++ -- Verb buildVerb vp.v mood pol agr Pos vp.objNeg ++ -- Verb
vp.compl ! agr -- Object(s), complements, adverbial modifiers vp.compl ! agr -- Object(s), complements, adverbial modifiers
} ; } ;
GenericCl vp = GenericCl vp =
let agr = AgP3 Sg Masc let agr = AgP3 Sg Masc Pos
in { in {
s = \\mood,pol => s = \\mood,pol =>
buildVerb vp.v mood pol agr False vp.objNeg ++ buildVerb vp.v mood pol agr Pos vp.objNeg ++
vp.compl ! agr vp.compl ! agr
} ; } ;
@@ -34,18 +34,18 @@ lin
agr = np.a agr = np.a
in { in {
s = \\mood,pol => s = \\mood,pol =>
buildVerb v mood pol agr np.isNeg False ++ buildVerb v mood pol agr (fromAgr np.a).pol Pos ++
np.s ! Nom np.s ! Nom
} ; } ;
ExistIP ip = ExistIP ip =
let let
v = lin V mkVerb_Irreg_Be ; v = lin V mkVerb_Irreg_Be ;
agr = AgP3 ip.n Masc agr = AgP3 ip.n Masc Pos
in { in {
s = \\mood,pol => s = \\mood,pol =>
ip.s ! Nom ++ ip.s ! Nom ++
buildVerb v mood pol agr False False buildVerb v mood pol agr Pos Pos
} ; } ;
-- FIXME: needs restriction so that only VerbMood Indicative _ _ Present is allowed; -- FIXME: needs restriction so that only VerbMood Indicative _ _ Present is allowed;
@@ -63,7 +63,7 @@ lin
; ;
ImpP3 np vp = { ImpP3 np vp = {
s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a np.isNeg vp.objNeg ++ vp.compl ! np.a ; s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a (fromAgr np.a).pol vp.objNeg ++ vp.compl ! np.a ;
} ; } ;
-- FIXME: placeholder -- FIXME: placeholder

View File

@@ -14,14 +14,13 @@ lin
UseN n = { s = \\_ => n.s ; g = n.g } ; UseN n = { s = \\_ => n.s ; g = n.g } ;
UsePN pn = { s = pn.s ; a = agrgP3 pn.n pn.g ; isNeg = False } ; UsePN pn = { s = pn.s ; a = AgP3 pn.n pn.g Pos } ;
UsePron p = { s = p.s ; a = p.a ; isNeg = False } ; UsePron p = { s = p.s ; a = p.a } ;
PredetNP pred np = { PredetNP pred np = {
s = \\c => pred.s ! (fromAgr np.a).gend ++ np.s ! c ; s = \\c => pred.s ! (fromAgr np.a).gend ++ np.s ! c ;
a = np.a ; a = np.a
isNeg = False
} ; } ;
UseN2 n = { s = \\_ => n.s ; g = n.g } ; UseN2 n = { s = \\_ => n.s ; g = n.g } ;
@@ -46,44 +45,39 @@ lin
AdvNP np adv = { AdvNP np adv = {
s = \\c => np.s ! c ++ adv.s ; s = \\c => np.s ! c ++ adv.s ;
a = np.a ; a = np.a
isNeg = np.isNeg
} ; } ;
RelNP np rs = { RelNP np rs = {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
a = np.a ; a = np.a
isNeg = np.isNeg
} ; } ;
DetCN det cn = { DetCN det cn = {
s = \\c => det.s ! cn.g ! c ++ cn.s ! det.d ! det.n ! c ; s = \\c => det.s ! cn.g ! c ++ cn.s ! det.d ! det.n ! c ;
a = AgP3 det.n cn.g ; a = AgP3 det.n cn.g det.pol
isNeg = det.isNeg
} ; } ;
DetQuant quant num = { DetQuant quant num = {
s = \\g,c => quant.s ! g ! num.n ! c ++ num.s ! g ! c ; s = \\g,c => quant.s ! g ! num.n ! c ++ num.s ! g ! c ;
n = num.n ; n = num.n ;
d = quant.d ; -- FIXME: ja ir kārtas skaitļa vārds, tad tikai noteiktās formas drīkst būt d = quant.d ; -- FIXME: ja ir kārtas skaitļa vārds, tad tikai noteiktās formas drīkst būt
isNeg = quant.isNeg pol = quant.pol
} ; } ;
DetQuantOrd quant num ord = { DetQuantOrd quant num ord = {
s = \\g,c => quant.s ! g ! num.n ! c ++ num.s ! g ! c ++ ord.s ! g ! c ; s = \\g,c => quant.s ! g ! num.n ! c ++ num.s ! g ! c ++ ord.s ! g ! c ;
n = num.n ; n = num.n ;
d = quant.d ; --FIXME: ja ir kārtas skaitļa vārds, tad tikai noteiktās formas drīkst būt d = quant.d ; --FIXME: ja ir kārtas skaitļa vārds, tad tikai noteiktās formas drīkst būt
isNeg = quant.isNeg pol = quant.pol
} ; } ;
DetNP det = { DetNP det = {
s = \\c => det.s ! Masc ! c ; s = \\c => det.s ! Masc ! c ;
a = AgP3 det.n Masc ; a = AgP3 det.n Masc det.pol
isNeg = det.isNeg
} | { } | {
s = \\c => det.s ! Fem ! c ; s = \\c => det.s ! Fem ! c ;
a = AgP3 det.n Fem ; a = AgP3 det.n Fem det.pol
isNeg = det.isNeg
} ; } ;
AdjCN ap cn = { AdjCN ap cn = {
@@ -94,25 +88,24 @@ lin
DefArt = { DefArt = {
s = \\_,_,_ => [] ; s = \\_,_,_ => [] ;
d = Def ; d = Def ;
isNeg = False pol = Pos
} ; } ;
IndefArt = { IndefArt = {
s = \\_,_,_ => [] ; s = \\_,_,_ => [] ;
d = Indef ; d = Indef ;
isNeg = False pol = Pos
} ; } ;
PossPron p = { PossPron p = {
s = p.possessive ; s = p.possessive ;
d = Def ; d = Def ;
isNeg = False pol = Pos
} ; } ;
MassNP cn = { MassNP cn = {
s = cn.s ! Indef ! Sg ; -- FIXME: a 'šis alus'? der tak gan 'zaļš alus' gan 'zaļais alus' s = cn.s ! Indef ! Sg ; -- FIXME: a 'šis alus'? der tak gan 'zaļš alus' gan 'zaļais alus'
a = AgP3 Sg cn.g ; a = AgP3 Sg cn.g Pos
isNeg = False
} ; } ;
NumSg = { s = \\_,_ => [] ; n = Sg ; hasCard = False } ; NumSg = { s = \\_,_ => [] ; n = Sg ; hasCard = False } ;
@@ -152,7 +145,7 @@ lin
} ; } ;
RelCN cn rs = { RelCN cn rs = {
s = \\d, n,c => cn.s ! d ! n ! c ++ "," ++ rs.s ! AgP3 n cn.g ; s = \\d,n,c => cn.s ! d ! n ! c ++ "," ++ rs.s ! AgP3 n cn.g Pos ;
g = cn.g g = cn.g
} ; } ;
@@ -164,8 +157,7 @@ lin
-- FIXME: vajag šķirot noteikto/nenoteikto galotni..? -- FIXME: vajag šķirot noteikto/nenoteikto galotni..?
PPartNP np v2 = { PPartNP np v2 = {
s = \\c => v2.s ! Pos ! (Participle TsTa (fromAgr np.a).gend (fromAgr np.a).num 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 ; a = np.a
isNeg = np.isNeg
} ; } ;
-- TODO: šim vajag -ts -ta divdabjus (+ noteiktās formas tiem) -- TODO: šim vajag -ts -ta divdabjus (+ noteiktās formas tiem)

View File

@@ -157,13 +157,13 @@ oper
mkPronoun_They : Gender -> Pron = \g -> { mkPronoun_They : Gender -> Pron = \g -> {
s = \\c => (mkPronoun_Gend "viņš").s ! g ! Pl ! c ; s = \\c => (mkPronoun_Gend "viņš").s ! g ! Pl ! c ;
a = AgP3 Pl g ; a = AgP3 Pl g Pos ;
possessive = \\_,_,_ => "viņu" possessive = \\_,_,_ => "viņu"
} ; } ;
mkPronoun_It_Sg : Gender -> Pron = \g -> { mkPronoun_It_Sg : Gender -> Pron = \g -> {
s = \\c => (mkPronoun_ThisThat That).s ! g ! Sg ! c ; s = \\c => (mkPronoun_ThisThat That).s ! g ! Sg ! c ;
a = AgP3 Sg g ; a = AgP3 Sg g Pos ;
possessive = \\_,_,_ => case g of { Masc => "tā" ; Fem => "tās" } possessive = \\_,_,_ => case g of { Masc => "tā" ; Fem => "tās" }
} ; } ;
@@ -268,8 +268,7 @@ oper
} ; } ;
-- Everything, something, nothing, i.e., all that end with "kas" -- Everything, something, nothing, i.e., all that end with "kas"
-- Quick & dirty mkPronoun_Thing : Str -> Polarity -> Pron = \lemma,pol ->
mkPronoun_Thing : Str -> Pron = \lemma ->
let stem : Str = Predef.tk 3 lemma let stem : Str = Predef.tk 3 lemma
in { in {
s = \\c => table { s = \\c => table {
@@ -280,13 +279,14 @@ oper
Loc => case stem of { "kaut" => stem ++ "kur" ; _ => stem + "kur" } ; Loc => case stem of { "kaut" => stem ++ "kur" ; _ => stem + "kur" } ;
Voc => NON_EXISTENT Voc => NON_EXISTENT
} ! c ; } ! c ;
a = AgP3 Sg Masc ; a = AgP3 Sg Masc pol ;
possessive = \\_,_,_ => case stem of { "kaut" => stem ++ "kā" ; _ => stem + "kā" } possessive = \\_,_,_ => case stem of { "kaut" => stem ++ "kā" ; _ => stem + "kā" }
} ; } ;
mkPronoun_Body : Str -> Pron = \lemma -> { -- Everybody, somebody, nobody
mkPronoun_Body : Str -> Polarity -> Pron = \lemma,pol -> {
s = \\c => (mkPronoun_Gend lemma).s ! Masc ! Sg ! c ; s = \\c => (mkPronoun_Gend lemma).s ! Masc ! Sg ! c ;
a = AgP3 Sg Masc ; a = AgP3 Sg Masc pol ;
possessive = \\_,_,_ => (mkPronoun_Gend lemma).s ! Masc ! Sg ! Gen ; possessive = \\_,_,_ => (mkPronoun_Gend lemma).s ! Masc ! Sg ! Gen ;
} ; } ;

View File

@@ -23,7 +23,7 @@ lin
UttAdv adv = adv ; UttAdv adv = adv ;
-- FIXME: neesmu līdz galam drošs vai agreement ir tieši (AgPr Pl) -- FIXME: neesmu līdz galam drošs vai agreement ir tieši (AgPr Pl)
UttVP vp = { s = build_VP vp Pos Infinitive (AgP3 Pl Masc) } ; UttVP vp = { s = build_VP vp Pos Infinitive (AgP3 Pl Masc Pos) } ;
UttIP ip = { s = ip.s ! Nom } ; UttIP ip = { s = ip.s ! Nom } ;
UttIAdv iadv = iadv ; UttIAdv iadv = iadv ;

View File

@@ -14,13 +14,13 @@ flags
lin lin
QuestCl cl = { s = \\m,p => "vai" ++ cl.s ! m ! p } ; QuestCl cl = { s = \\m,p => "vai" ++ cl.s ! m ! p } ;
QuestVP ip vp = { s = \\m,p => ip.s ! Nom ++ buildVerb vp.v m p (AgP3 ip.n Masc) False vp.objNeg } ; QuestVP ip vp = { s = \\m,p => ip.s ! Nom ++ buildVerb vp.v m p (AgP3 ip.n Masc Pos) Pos vp.objNeg } ;
QuestSlash ip slash = { s = \\m,p => slash.p.s ++ ip.s ! (slash.p.c ! ip.n) ++ slash.s ! m ! p } ; QuestSlash ip slash = { s = \\m,p => slash.p.s ++ ip.s ! (slash.p.c ! ip.n) ++ slash.s ! m ! p } ;
QuestIAdv iadv cl = { s = \\m,p => iadv.s ++ cl.s ! m ! p } ; QuestIAdv iadv cl = { s = \\m,p => iadv.s ++ cl.s ! m ! p } ;
QuestIComp icomp np = { s = \\m,p => icomp.s ++ buildVerb mkVerb_Irreg_Be m p np.a np.isNeg False ++ np.s ! Nom } ; QuestIComp icomp np = { s = \\m,p => icomp.s ++ buildVerb mkVerb_Irreg_Be m p np.a (fromAgr np.a).pol Pos ++ np.s ! Nom } ;
IdetQuant idet num = { IdetQuant idet num = {
s = \\g => idet.s ! g ! num.n ++ num.s ! g ! Nom ; s = \\g => idet.s ! g ! num.n ++ num.s ! g ! Nom ;

View File

@@ -29,8 +29,8 @@ oper
_ => rp.s ! Masc ! vp.agr.c_topic _ => rp.s ! Masc ! vp.agr.c_topic
} ++ } ++
case subj of { -- Verb 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? Nom => buildVerb vp.v mood pol (AgP3 (fromAgr agr).num (fromAgr agr).gend Pos) Pos 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 _ => buildVerb vp.v mood pol vp.agr.agr Pos vp.objNeg -- TODO: test me
} ++ } ++
vp.compl ! agr -- Object(s), complements, adverbial modifiers vp.compl ! agr -- Object(s), complements, adverbial modifiers
} ; } ;

View File

@@ -52,7 +52,8 @@ param
-- Verb agreement -- Verb agreement
-- Number depends on the person -- Number depends on the person
-- Gender has to be taken into accunt because of predicative nominals and participles -- Gender has to be taken into accunt because of predicative nominals and participles
Agr = AgP1 Number Gender | AgP2 Number Gender | AgP3 Number Gender ; -- Polarity may depend on the subject/object NP (double negation, if subject/object has a negated determiner)
Agr = AgP1 Number Gender | AgP2 Number Gender | AgP3 Number Gender Polarity ;
-- Clause agreement -- Clause agreement
-- TODO: jāpāriet uz vienotu TopicFocus (=> ieraksta tips) -- TODO: jāpāriet uz vienotu TopicFocus (=> ieraksta tips)
@@ -84,7 +85,7 @@ oper
-- ne vienmēr ir abi un ne visas kombinācijas ir vajadzīgas -- 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 -- 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 ; objNeg : Bool } ; VP = { v : Verb ; compl : Agr => Str ; agr : ClAgr ; objNeg : Polarity } ;
-- compl: objects, complements, adverbial modifiers -- compl: objects, complements, adverbial modifiers
-- topic: typically - subject -- topic: typically - subject
-- focus: typically - objects, complements, adverbial modifiers -- focus: typically - objects, complements, adverbial modifiers
@@ -99,11 +100,11 @@ oper
--Valence : Type = { p : Prep ; c : Number => Case } ; --Valence : Type = { p : Prep ; c : Number => Case } ;
-- e.g. 'ar' + Sg-Acc or Pl-Dat; Preposition may be skipped for simple case-baced valences -- e.g. 'ar' + Sg-Acc or Pl-Dat; Preposition may be skipped for simple case-baced valences
toAgr : Number -> Person -> Gender -> Agr = \num,pers,gend -> toAgr : Person -> Number -> Gender -> Polarity -> Agr = \pers,num,gend,pol ->
case pers of { case pers of {
P1 => AgP1 num gend ; P1 => AgP1 num gend ;
P2 => AgP2 num gend ; P2 => AgP2 num gend ;
P3 => AgP3 num gend P3 => AgP3 num gend pol
} ; } ;
toClAgr : Case -> Case -> Agr -> Voice -> ClAgr = \c_topic,c_focus,agr,voice -> { toClAgr : Case -> Case -> Agr -> Voice -> ClAgr = \c_topic,c_focus,agr,voice -> {
@@ -113,33 +114,25 @@ oper
voice = voice voice = voice
} ; } ;
-- TODO: quick & dirty toClAgr_Reg : Case -> ClAgr = \c_topic -> toClAgr c_topic Nom (AgP3 Sg Masc Pos) Act ;
toClAgr_Reg : Case -> ClAgr = \c_topic -> toClAgr c_topic Nom (AgP3 Sg Masc) Act ;
fromAgr : Agr -> { num : Number ; pers : Person ; gend : Gender } = \agr -> fromAgr : Agr -> { pers : Person ; num : Number ; gend : Gender ; pol : Polarity } = \agr ->
case agr of { case agr of {
AgP1 num gend => { num = num ; pers = P1 ; gend = gend } ; AgP1 num gend => { pers = P1 ; num = num ; gend = gend ; pol = Pos } ;
AgP2 num gend => { num = num ; pers = P2 ; gend = gend } ; AgP2 num gend => { pers = P2 ; num = num ; gend = gend ; pol = Pos } ;
AgP3 num gend => { num = num ; pers = P3 ; gend = gend } AgP3 num gend pol => { pers = P3 ; num = num ; gend = gend ; pol = pol }
} ; } ;
{-
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 -> conjAgr : Agr -> Agr -> Agr = \agr1,agr2 ->
let let
a1 = fromAgr agr1 ; a1 = fromAgr agr1 ;
a2 = fromAgr agr2 a2 = fromAgr agr2
in in
toAgr toAgr
(conjNumber a1.num a2.num)
(conjPerson a1.pers a2.pers) -- FIXME: personu apvienošana ir tricky un ir jāuztaisa korekti (conjPerson a1.pers a2.pers) -- FIXME: personu apvienošana ir tricky un ir jāuztaisa korekti
(conjGender a1.gend a2.gend) ; (conjNumber a1.num a2.num)
(conjGender a1.gend a2.gend)
(conjPolarity a1.pol a2.pol) ;
conjGender : Gender -> Gender -> Gender = \gend1,gend2 -> conjGender : Gender -> Gender -> Gender = \gend1,gend2 ->
case gend1 of { case gend1 of {
@@ -147,6 +140,12 @@ oper
_ => Masc _ => Masc
} ; } ;
agrgP3 : Number -> Gender -> Agr = \num,gend -> toAgr num P3 gend ; conjPolarity : Polarity -> Polarity -> Polarity = \pol1,pol2 ->
case pol1 of {
Neg => Neg ;
_ => pol2
} ;
--agrP3 : Number -> Gender -> Polarity -> Agr = \num,gend,pol -> toAgr P3 num gend pol ;
} }

View File

@@ -32,7 +32,7 @@ lin
v = vs ; v = vs ;
compl = \\_ => "," ++ vs.subj.s ++ sslash.s ; compl = \\_ => "," ++ vs.subj.s ++ sslash.s ;
agr = toClAgr_Reg vs.topic ; agr = toClAgr_Reg vs.topic ;
objNeg = False objNeg = Pos
}) ** { p = sslash.p } ; }) ** { p = sslash.p } ;
ComplVS v s = { v = v ; compl = \\_ => "," ++ v.subj.s ++ s.s } ; ComplVS v s = { v = v ; compl = \\_ => "," ++ v.subj.s ++ s.s } ;
@@ -42,8 +42,8 @@ lin
EmbedQS qs = { s = qs.s } ; EmbedQS qs = { s = qs.s } ;
-- FIXME: neesmu līdz galam drošs vai agreement ir tieši (AgPr Pl) -- FIXME: vai agr ir Pl?
EmbedVP vp = { s = build_VP vp Pos Infinitive (AgP3 Pl Masc) } ; EmbedVP vp = { s = build_VP vp Pos Infinitive (AgP3 Pl Masc Pos) } ;
UseCl t p cl = { s = t.s ++ p.s ++ cl.s ! (Ind t.a t.t) ! p.p } ; UseCl t p cl = { s = t.s ++ p.s ++ cl.s ! (Ind t.a t.t) ! p.p } ;
UseQCl t p cl = { s = t.s ++ p.s ++ cl.s ! (Ind t.a t.t) ! p.p } ; UseQCl t p cl = { s = t.s ++ p.s ++ cl.s ! (Ind t.a t.t) ! p.p } ;
@@ -69,31 +69,12 @@ oper
case mood of { -- Subject case mood of { -- Subject
Deb _ _ => np.s ! Dat ; --# notpresent Deb _ _ => np.s ! Dat ; --# notpresent
_ => np.s ! vp.agr.c_topic _ => 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 case subj of { -- Verb
Nom => buildVerb vp.v mood pol np.a np.isNeg vp.objNeg ; -- TODO: vai np.a un np.a.pol argumentus nevar apvienot?
_ => buildVerb vp.v mood pol vp.agr.agr np.isNeg vp.objNeg -- TODO: test me Nom => buildVerb vp.v mood pol np.a (fromAgr np.a).pol vp.objNeg ;
_ => buildVerb vp.v mood pol vp.agr.agr (fromAgr np.a).pol vp.objNeg -- TESTME
} ++ } ++
{-
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 vp.compl ! np.a -- Object(s), complements, adverbial modifiers
} ; } ;
@@ -101,7 +82,7 @@ oper
-- Eng: PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp -- Eng: PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp
-- Ar SC nav iespējams neko saskaņot (sk. Cat.gf un Common.gf) -- Ar SC nav iespējams neko saskaņot (sk. Cat.gf un Common.gf)
mkClauseSC : SC -> CatLav.VP -> Cl = \sc,vp -> lin Cl { mkClauseSC : SC -> CatLav.VP -> Cl = \sc,vp -> lin Cl {
s = \\mood,pol => sc.s ++ buildVerb vp.v mood pol (AgP3 Sg Masc) False vp.objNeg ++ vp.compl ! (AgP3 Sg Masc) s = \\mood,pol => sc.s ++ buildVerb vp.v mood pol (AgP3 Sg Masc Pos) Pos vp.objNeg ++ vp.compl ! (AgP3 Sg Masc Pos)
} ; } ;
} }

View File

@@ -22,60 +22,60 @@ lin
s = (\\g,c => (mkPronoun_Gend "ikviens").s ! g ! Sg ! c) ; s = (\\g,c => (mkPronoun_Gend "ikviens").s ! g ! Sg ! c) ;
n = Sg ; n = Sg ;
d = Indef ; d = Indef ;
isNeg = False pol = Pos
} ; } ;
someSg_Det = { someSg_Det = {
s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Sg ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => []) s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Sg ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => [])
n = Sg ; n = Sg ;
d = Indef ; d = Indef ;
isNeg = False pol = Pos
} ; } ;
somePl_Det = { somePl_Det = {
s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Pl ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => []) s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Pl ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => [])
n = Pl ; n = Pl ;
d = Indef ; d = Indef ;
isNeg = False pol = Pos
} ; } ;
few_Det = { few_Det = {
s = (\\g,c => (mkPronoun_Gend "dažs").s ! g ! Pl ! c) ; s = (\\g,c => (mkPronoun_Gend "dažs").s ! g ! Pl ! c) ;
n = Pl ; n = Pl ;
d = Indef ; d = Indef ;
isNeg = False pol = Pos
} ; } ;
many_Det = { many_Det = {
s = (\\g,c => (mkPronoun_Gend "daudzs").s ! g ! Pl ! c) ; -- 'daudzs' izlocīsies korekti uz daudzskaitļa 'daudzi'; tomēr nesmuki... s = (\\g,c => (mkPronoun_Gend "daudzs").s ! g ! Pl ! c) ; -- 'daudzs' izlocīsies korekti uz daudzskaitļa 'daudzi'; tomēr nesmuki...
n = Pl ; n = Pl ;
d = Indef ; d = Indef ;
isNeg = False pol = Pos
} ; } ;
much_Det = { much_Det = {
s = (\\g,c => "daudz") ; -- FIXME: piesaista ģenitīvu s = (\\g,c => "daudz") ; -- FIXME: piesaista ģenitīvu
n = Sg ; n = Sg ;
d = Indef ; d = Indef ;
isNeg = False pol = Pos
} ; } ;
this_Quant = { this_Quant = {
s = (mkPronoun_ThisThat This).s ; s = (mkPronoun_ThisThat This).s ;
d = Def ; d = Def ;
isNeg = False pol = Pos
} ; } ;
that_Quant = { that_Quant = {
s = (mkPronoun_ThisThat That).s ; s = (mkPronoun_ThisThat That).s ;
d = Def ; d = Def ;
isNeg = False pol = Pos
} ; } ;
no_Quant = { no_Quant = {
s = (mkPronoun_Gend "neviens").s ; s = (mkPronoun_Gend "neviens").s ;
d = Indef ; d = Indef ;
isNeg = True pol = Neg
} ; } ;
-- P1 -- P1
@@ -96,13 +96,13 @@ lin
he_Pron = { he_Pron = {
s = \\c => (mkPronoun_Gend "viņš").s ! Masc ! Sg ! c ; s = \\c => (mkPronoun_Gend "viņš").s ! Masc ! Sg ! c ;
a = AgP3 Sg Masc ; a = AgP3 Sg Masc Pos ;
possessive = \\_,_,_ => "viņa" possessive = \\_,_,_ => "viņa"
} ; } ;
she_Pron = { she_Pron = {
s = \\c => (mkPronoun_Gend "viņš").s ! Fem ! Sg ! c ; s = \\c => (mkPronoun_Gend "viņš").s ! Fem ! Sg ! c ;
a = AgP3 Sg Fem ; a = AgP3 Sg Fem Pos ;
possessive = \\_,_,_ => "viņas" possessive = \\_,_,_ => "viņas"
} ; } ;
@@ -247,15 +247,15 @@ lin
always_AdV = mkAdV "vienmēr" ; always_AdV = mkAdV "vienmēr" ;
somebody_NP = UsePron (mkPronoun_Body "kāds") ; somebody_NP = UsePron (mkPronoun_Body "kāds" Pos) ;
something_NP = UsePron (mkPronoun_Thing "kaut kas") ; something_NP = UsePron (mkPronoun_Thing "kaut kas" Pos) ;
everybody_NP = UsePron (mkPronoun_Body "ikviens") ; everybody_NP = UsePron (mkPronoun_Body "ikviens" Pos) ;
everything_NP = UsePron (mkPronoun_Thing "jebkas") ; everything_NP = UsePron (mkPronoun_Thing "jebkas" Pos) ;
nobody_NP = UsePron (mkPronoun_Body "neviens") ; nobody_NP = UsePron (mkPronoun_Body "neviens" Neg) ;
nothing_NP = UsePron (mkPronoun_Thing "nekas") ; nothing_NP = UsePron (mkPronoun_Thing "nekas" Neg) ;
have_V2 = mkV2 (mkV "būt") nom_Prep Dat ; have_V2 = mkV2 (mkV "būt") nom_Prep Dat ;
have_V3 = mkV3 (mkV "būt") nom_Prep dat_Prep Dat ; --have_V3 = mkV3 (mkV "būt") nom_Prep dat_Prep Dat ;
want_VV = mkVV (mkV "vēlēties" third_conjugation) ; want_VV = mkVV (mkV "vēlēties" third_conjugation) ;
can_VV = mkVV (mkV "varēt" third_conjugation) ; can_VV = mkVV (mkV "varēt" third_conjugation) ;

View File

@@ -17,20 +17,17 @@ lin
CNIntNP cn i = { CNIntNP cn i = {
s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ; s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ;
a = agrgP3 Sg cn.g ; a = AgP3 Sg cn.g Pos
isNeg = False
} ; } ;
CNSymbNP det cn xs = { CNSymbNP det cn xs = {
s = \\_ => det.s ! cn.g ! Nom ++ cn.s ! det.d ! det.n ! Nom ++ xs.s ; s = \\_ => det.s ! cn.g ! Nom ++ cn.s ! det.d ! det.n ! Nom ++ xs.s ;
a = agrgP3 det.n cn.g ; a = AgP3 det.n cn.g Pos
isNeg = False
} ; } ;
CNNumNP cn i = { CNNumNP cn i = {
s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ! Masc ! Nom ; s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ! Masc ! Nom ;
a = agrgP3 Sg cn.g ; a = AgP3 Sg cn.g Pos
isNeg = False
} ; } ;
SymbS sy = sy ; SymbS sy = sy ;

View File

@@ -25,35 +25,35 @@ lin
v = v ; v = v ;
compl = \\_ => [] ; compl = \\_ => [] ;
agr = toClAgr_Reg Nom ; agr = toClAgr_Reg Nom ;
objNeg = False objNeg = Pos
} ; } ;
ComplVV vv vp = { ComplVV vv vp = {
v = vv ; v = vv ;
compl = \\agr => build_VP vp Pos Infinitive agr ; compl = \\agr => build_VP vp Pos Infinitive agr ;
agr = toClAgr_Reg vv.topic ; agr = toClAgr_Reg vv.topic ;
objNeg = False objNeg = Pos
} ; } ;
ComplVS vs s = { ComplVS vs s = {
v = vs ; v = vs ;
compl = \\_ => "," ++ vs.subj.s ++ s.s ; compl = \\_ => "," ++ vs.subj.s ++ s.s ;
agr = toClAgr_Reg vs.topic ; agr = toClAgr_Reg vs.topic ;
objNeg = False objNeg = Pos
} ; } ;
ComplVQ vq qs = { ComplVQ vq qs = {
v = vq ; v = vq ;
compl = \\_ => "," ++ qs.s ; compl = \\_ => "," ++ qs.s ;
agr = toClAgr_Reg vq.topic ; agr = toClAgr_Reg vq.topic ;
objNeg = False objNeg = Pos
} ; } ;
ComplVA va ap = { ComplVA va ap = {
v = va ; v = va ;
compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ; compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ;
agr = toClAgr_Reg Nom ; agr = toClAgr_Reg Nom ;
objNeg = False objNeg = Pos
} ; } ;
-- V2 -> VPSlash -- V2 -> VPSlash
@@ -62,8 +62,8 @@ lin
v = v2 ; v = v2 ;
compl = \\_ => [] ; compl = \\_ => [] ;
p = v2.p ; p = v2.p ;
agr = toClAgr v2.topic (v2.p.c ! Sg) (AgP3 Sg Masc) Act ; -- overriden in ComplSlash agr = toClAgr v2.topic (v2.p.c ! Sg) (AgP3 Sg Masc Pos) Act ; -- overriden in ComplSlash
objNeg = False -- overriden in ComplSlash objNeg = Pos -- overriden in ComplSlash
} ; } ;
-- VPSlash -> NP -> VP -- VPSlash -> NP -> VP
@@ -99,7 +99,7 @@ oper
-- _ => Topic Nom -- kāpēc ne 'Topic topic_case'? -- TODO: remove -- _ => Topic Nom -- kāpēc ne 'Topic topic_case'? -- TODO: remove
} ; } ;
-} -}
objNeg = obj_np.isNeg objNeg = (fromAgr obj_np.a).pol
} ; } ;
lin lin
@@ -112,7 +112,7 @@ lin
compl = \\_ => [] ; compl = \\_ => [] ;
p = v3.p2 ; p = v3.p2 ;
agr = toClAgr v3.topic (v3.p1.c ! Sg) np.a Act ; -- 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 objNeg = (fromAgr np.a).pol -- TESTME
} ; } ;
-- V3 -> NP -> VPSlash ; -- give (it) to her -- V3 -> NP -> VPSlash ; -- give (it) to her
@@ -122,8 +122,8 @@ lin
v = v3 ; v = v3 ;
compl = \\_ => [] ; compl = \\_ => [] ;
p = v3.p1 ; p = v3.p1 ;
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) agr = toClAgr v3.topic (v3.p2.c ! Sg) (AgP3 Sg Masc Pos) Act ; -- FIXME: works only if the focus is P3 (Sg/Pl); TODO: P1, P2 (Sg, Pl)
objNeg = np.isNeg -- TESTME objNeg = (fromAgr np.a).pol -- TESTME
} ; } ;
SlashV2V v2v vp = { SlashV2V v2v vp = {
@@ -131,7 +131,7 @@ lin
compl = \\agr => build_VP vp Pos Infinitive agr ; compl = \\agr => build_VP vp Pos Infinitive agr ;
p = v2v.p ; p = v2v.p ;
agr = toClAgr_Reg Nom ; agr = toClAgr_Reg Nom ;
objNeg = False objNeg = Pos
} ; } ;
SlashV2S v2s s = { SlashV2S v2s s = {
@@ -139,7 +139,7 @@ lin
compl = \\_ => "," ++ v2s.subj.s ++ s.s ; compl = \\_ => "," ++ v2s.subj.s ++ s.s ;
p = v2s.p ; p = v2s.p ;
agr = toClAgr_Reg Nom ; agr = toClAgr_Reg Nom ;
objNeg = False objNeg = Pos
} ; } ;
SlashV2Q v2q qs = { SlashV2Q v2q qs = {
@@ -147,7 +147,7 @@ lin
compl = \\_ => "," ++ qs.s ; compl = \\_ => "," ++ qs.s ;
p = v2q.p ; p = v2q.p ;
agr = toClAgr_Reg Nom ; agr = toClAgr_Reg Nom ;
objNeg = False objNeg = Pos
} ; } ;
SlashV2A v2a ap = { SlashV2A v2a ap = {
@@ -155,7 +155,7 @@ lin
compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ; compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ;
p = v2a.p ; p = v2a.p ;
agr = toClAgr_Reg Nom ; agr = toClAgr_Reg Nom ;
objNeg = False objNeg = Pos
} ; } ;
SlashVV vv vpslash = { SlashVV vv vpslash = {
@@ -163,7 +163,7 @@ lin
compl = \\agr => build_VP vpslash Pos Infinitive agr ; compl = \\agr => build_VP vpslash Pos Infinitive agr ;
p = vpslash.p ; p = vpslash.p ;
agr = toClAgr_Reg vv.topic ; agr = toClAgr_Reg vv.topic ;
objNeg = False objNeg = Pos
} ; } ;
SlashV2VNP v2v np vpslash = insertObjC SlashV2VNP v2v np vpslash = insertObjC
@@ -173,7 +173,7 @@ lin
compl = \\agr => build_VP vpslash Pos Infinitive agr ; compl = \\agr => build_VP vpslash Pos Infinitive agr ;
p = vpslash.p ; p = vpslash.p ;
agr = toClAgr_Reg Nom ; agr = toClAgr_Reg Nom ;
objNeg = False objNeg = Pos
} ; } ;
ReflVP vpslash = insertObjPre ReflVP vpslash = insertObjPre
@@ -184,7 +184,7 @@ lin
v = lin V mkVerb_Irreg_Be ; v = lin V mkVerb_Irreg_Be ;
compl = \\agr => comp.s ! agr ; compl = \\agr => comp.s ! agr ;
agr = toClAgr_Reg Nom ; agr = toClAgr_Reg Nom ;
objNeg = False objNeg = Pos
} ; } ;
-- V2 -> VP -- V2 -> VP
@@ -193,8 +193,8 @@ lin
v = v2 ; v = v2 ;
compl = \\_ => [] ; 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.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? agr = toClAgr (v2.p.c ! Sg) v2.topic (AgP3 Sg Masc Pos) Pass ; -- FIXME(?): should not be overriden in ComplSlash; P3 restriction - never used?
objNeg = False -- overriden in ComplSlash objNeg = Pos -- overriden in ComplSlash
} ; } ;
-- VP -> Prep -> VPSlash -- VP -> Prep -> VPSlash
@@ -239,12 +239,12 @@ oper
} ; } ;
-- FIXME: the type of the participle form - depending on what?! (currently fixed) -- FIXME: the type of the participle form - depending on what?! (currently fixed)
buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Bool -> Bool -> Str = buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Polarity -> Polarity -> Str =
\v,mood,pol,subjAgr,subjNeg,objNeg -> \v,mood,pol,subjAgr,subjNeg,objNeg ->
let let
pol_prim : Polarity = case <subjNeg, objNeg> of { pol_prim : Polarity = case <subjNeg, objNeg> of {
<True, _> => Neg ; <Neg, _> => Neg ;
<_, True> => Neg ; <_, Neg> => Neg ;
_ => pol _ => pol
} ; } ;
agr = fromAgr subjAgr agr = fromAgr subjAgr