Latvian: parameter optimisation, code clean-up and formatting, renaming

This commit is contained in:
normundsg
2013-05-04 04:56:46 +00:00
parent b7ada4d269
commit 5182065168
19 changed files with 575 additions and 584 deletions

View File

@@ -1,10 +1,6 @@
--# -path=.:../abstract:../common:../prelude
concrete CatLav of Cat = CommonX - [CAdv, Voc] **
open
Prelude,
ResLav
in {
concrete CatLav of Cat = CommonX - [CAdv, Voc] ** open Prelude, ResLav in {
flags
coding = utf8 ;
@@ -20,21 +16,21 @@ lincat
-- Sentence
Cl = { s : VerbMood => Polarity => Str } ;
ClSlash = { s : VerbMood => Polarity => Str ; p : ResLav.Prep } ;
Cl = { s : VMood => Polarity => Str } ;
ClSlash = { s : VMood => Polarity => Str ; p : ResLav.Prep } ;
Imp = { s : Polarity => Number => Str } ;
-- Question
QCl = { s : VerbMood => Polarity => Str } ;
QCl = { s : VMood => Polarity => Str } ;
IP = { s : Case => Str ; n : Number } ;
IDet = { s : Gender => Str ; n : Number } ;
IQuant = { s : Gender => Number => Str } ;
-- TODO: IComp = { s : Str ; a : ResLav.Agr } ;
--IComp = { s : Str ; a : ResLav.Agr } ;
-- Relative
-- Relative clause
RCl = { s : VerbMood => Polarity => Agr => Str } ;
RCl = { s : VMood => Polarity => Agr => Str } ;
RP = { s : Gender => Case => Str } ;
-- Verb
@@ -45,19 +41,19 @@ lincat
-- Adjective
AP = { s : Definite => Gender => Number => Case => Str } ;
AP = { s : Definiteness => Gender => Number => Case => Str } ;
-- Noun
CN = { s : Definite => Number => Case => Str ; g : Gender } ;
CN = { s : Definiteness => Number => Case => Str ; g : Gender } ;
NP = { s : Case => Str ; a : ResLav.Agr } ;
Pron = { s : Case => Str ; a : ResLav.Agr ; possessive : Gender => Number => Case => Str } ;
Det = { s : Gender => Case => Str ; n : Number ; d : Definite ; pol : Polarity } ;
Pron = { s : Case => Str ; a : ResLav.Agr ; poss : Gender => Number => Case => Str } ;
Det = { s : Gender => Case => Str ; n : Number ; d : Definiteness ; pol : Polarity } ;
Predet = { s : Gender => Str } ;
Ord = { s : Gender => Case => Str } ;
Num = { s : Gender => Case => Str ; n : Number ; hasCard : Bool } ;
Card = { s : Gender => Case => Str ; n : Number } ;
Quant = { s : Gender => Number => Case => Str ; d : Definite ; pol : Polarity } ;
Quant = { s : Gender => Number => Case => Str ; d : Definiteness ; pol : Polarity } ;
-- Numeral

View File

@@ -20,7 +20,7 @@ lin
a = toAgr (fromAgr ss.a).pers (conjNumber (fromAgr ss.a).num conj.n) (fromAgr ss.a).gend Pos
} ;
ConjAP conj ss = conjunctDistrTable4 Definite Gender Number Case conj ss ;
ConjAP conj ss = conjunctDistrTable4 Definiteness Gender Number Case conj ss ;
ConjRS conj ss = conjunctDistrTable Agr conj ss ;
@@ -33,8 +33,8 @@ lin
BaseNP x y = twoTable Case x y ** { a = conjAgr x.a y.a } ;
ConsNP xs x = consrTable Case comma xs x ** { a = conjAgr xs.a x.a } ;
BaseAP x y = twoTable4 Definite Gender Number Case x y ;
ConsAP xs x = consrTable4 Definite Gender Number Case comma xs x ;
BaseAP x y = twoTable4 Definiteness Gender Number Case x y ;
ConsAP xs x = consrTable4 Definiteness Gender Number Case comma xs x ;
BaseRS x y = twoTable Agr x y ;
ConsRS xs x = consrTable Agr comma xs x ;
@@ -44,7 +44,7 @@ lincat
[S] = { s1, s2 : Str } ;
[Adv] = { s1, s2 : Str } ;
[NP] = { s1, s2 : Case => Str ; a : Agr } ;
[AP] = { s1, s2 : Definite => Gender => Number => Case => Str } ;
[AP] = { s1, s2 : Definiteness => Gender => Number => Case => Str } ;
[RS] = { s1, s2 : Agr => Str } ;
}

View File

@@ -5,15 +5,13 @@ concrete ExtraLav of ExtraLavAbs = CatLav ** open
ParadigmsPronounsLav,
VerbLav,
ResLav,
Coordination,
Prelude
in {
Coordination
in {
flags
coding = utf8 ;
flags coding = utf8 ;
lin
-- NP -> CN -> CN ;
-- NP -> CN -> CN
GenCN np cn = {
s = \\d,n,c => np.s ! Gen ++ cn.s ! d ! n ! c ;
g = cn.g
@@ -42,12 +40,14 @@ lin
have_V3 = mkV3 (mkV "būt") nom_Prep dat_Prep Dat ;
{-empty_Det num def neg = \num,def,neg -> {
{-
empty_Det num def pol = \num,def,pol -> {
s = \\_,_ => [] ;
n = num ;
d = def ;
isNeg = neg
} ;-}
pol = pol
} ;
-}
-- Zemāk esošās f-cijas nav ExtraLavAbs, tās ir abstract/Extra.gf
@@ -58,34 +58,30 @@ lin
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 } ;
-- for VP conjunction
-- VP conjunction:
lincat
VPS = {s : Agr => Str} ;
[VPS] = {s1,s2 : Agr => Str} ;
VPS = { s : Agr => Str } ;
[VPS] = { s1,s2 : Agr => Str } ;
lin
BaseVPS = twoTable Agr ;
ConsVPS = consrTable Agr comma ;
-- NP -> VPS -> S
-- NP = { s : Case => Str ; a : Agr ; isNeg : Bool } ;
PredVPS np vps = {s = np.s ! Nom ++ vps.s ! np.a} ; -- TODO: vps.s ! np.a ! np.isNeg
PredVPS np vps = { s = np.s ! Nom ++ vps.s ! np.a } ;
-- Temp -> Pol -> VP -> VPS
MkVPS temp pol vp = {
s = \\subjAgr =>
-- VP = { v : Verb ; compl : Agr => Str ; agr : ClAgr ; objNeg : Bool } ;
-- Verb = { s : Polarity => VerbForm => Str } ;
-- TODO: other VerbForm-s (moods)
-- TODO: subj-dependent double negation
-- 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
temp.s ++ buildVerb vp.v (Ind temp.a temp.t) pol.p subjAgr (fromAgr subjAgr).pol vp.objNeg ++ vp.compl ! subjAgr
temp.s ++
-- TODO: verb moods other than Ind
buildVerb vp.v (Ind temp.a temp.t) pol.p subjAgr (fromAgr subjAgr).pol vp.objNeg ++
vp.compl ! subjAgr
} ;
-- Conj -> [VPS] -> VPS

View File

@@ -26,7 +26,7 @@ abstract ExtraLavAbs = Extra **
they8fem_Pron : Pron ;
it8fem_Pron : Pron ;
--empty_Det : Number -> Definite -> Bool -> Det ;
--empty_Det : Number -> Definiteness -> Bool -> Det ;
have_V3 : V3 ;
}

View File

@@ -48,7 +48,7 @@ lin
buildVerb v mood pol agr Pos Pos
} ;
-- FIXME: needs restriction so that only VerbMood Indicative _ _ Present is allowed;
-- FIXME: needs restriction so that only VMood Indicative _ _ Present is allowed;
-- can't do that on VP level...
ProgrVP v = v ;
@@ -56,10 +56,10 @@ lin
let agr = AgP1 Pl Masc
in {
s =
vp.v.s ! Pos ! (Indicative P1 Pl Pres) ++ -- Verb
vp.v.s ! Pos ! (VInd P1 Pl Pres) ++ -- Verb
vp.compl ! agr -- Object(s), complements, adverbial modifiers
}
| { s = vp.v.s ! Pos ! (Indicative P1 Pl Fut) ++ vp.compl ! agr } --# notpresent
| { s = vp.v.s ! Pos ! (VInd P1 Pl Fut) ++ vp.compl ! agr } --# notpresent
;
ImpP3 np vp = {

View File

@@ -123,7 +123,7 @@ lin
love_N = mkN "mīlestība" ;
love_V2 = mkV2 (mkV "mīlēt" third_conjugation) acc_Prep ;
man_N = mkN "vīrietis" ;
married_A2 = mkA2 (mkA (mkV "precēties" third_conjugation) IsUsi) with_Prep ;
married_A2 = mkA2 (mkA (mkV "precēties" third_conjugation) Act) with_Prep ;
meat_N = mkN "gaļa" ;
milk_N = mkN "piens" ;
moon_N = mkN "mēness" ;

View File

@@ -98,7 +98,7 @@ lin
} ;
PossPron p = {
s = p.possessive ;
s = p.poss ;
d = Def ;
pol = Pos
} ;
@@ -156,7 +156,7 @@ lin
-- FIXME: vajag šķirot noteikto/nenoteikto galotni..?
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 ! (VPart Pass (fromAgr np.a).gend (fromAgr np.a).num c) ++ np.s ! c ;
a = np.a
} ;

View File

@@ -25,14 +25,14 @@ lin
let trijs = mkNumSpec "trijs" "trešais" "trīs" "trīs" Pl
in {
s = \\f,o,g,c => case <f, o, g, c> of {
<unit, NCard, _, Nom> => "trīs" ;
<unit, NCard, _, Dat> => "trim" ;
<unit, NCard, _, Loc> => "trīs" ;
<DUnit, NCard, _, Nom> => "trīs" ;
<DUnit, NCard, _, Dat> => "trim" ;
<DUnit, NCard, _, Loc> => "trīs" ;
_ => trijs.s ! f ! o ! g ! c
}
} | {
s = \\f,o,g,c => case <f, o, g, c> of {
<unit, NCard, _, Nom> => "trīs" ;
<DUnit, NCard, _, Nom> => "trīs" ;
_ => trijs.s ! f ! o ! g ! c
}
} ;
@@ -44,16 +44,16 @@ lin
n8 = mkNumReg "astoņi" "astotais" Pl ;
n9 = mkNumReg "deviņi" "devītais" Pl ;
pot01 = { s = viens.s ! unit } ** { n = Sg } ;
pot0 d = { s = d.s ! unit } ** { n = Pl } ;
pot110 = { s = viens.s ! ten } ** { n = Pl } ;
pot111 = { s = viens.s ! teen } ** { n = Pl } ;
pot1to19 d = { s = d.s ! teen } ** { n = Pl } ;
pot01 = { s = viens.s ! DUnit } ** { n = Sg } ;
pot0 d = { s = d.s ! DUnit } ** { n = Pl } ;
pot110 = { s = viens.s ! DTen } ** { n = Pl } ;
pot111 = { s = viens.s ! DTeen } ** { n = Pl } ;
pot1to19 d = { s = d.s ! DTeen } ** { n = Pl } ;
pot0as1 n = { s = n.s ; n = n.n } ;
pot1 d = { s = d.s ! ten } ** { n = Pl } ;
pot1 d = { s = d.s ! DTen } ** { n = Pl } ;
pot1plus d e = {
s = \\o,g,c => d.s ! ten ! NCard ! Masc ! Nom ++ e.s ! o ! g ! c ;
s = \\o,g,c => d.s ! DTen ! NCard ! Masc ! Nom ++ e.s ! o ! g ! c ;
n = e.n
} ;

View File

@@ -29,11 +29,11 @@ oper
} ;
-- Specified type - no defaults
mkAdjectiveByType : Str -> AdjType -> Adj = \lemma,type ->
mkAdjectiveByType : Str -> AType -> Adj = \lemma,type ->
case type of {
AdjQual => mkAdjective_Qual lemma ;
AdjRel => mkAdjective_Rel lemma ;
AdjIndecl => mkAdjective_Indecl lemma
AQual => mkAdjective_Qual lemma ;
ARel => mkAdjective_Rel lemma ;
AIndecl => mkAdjective_Indecl lemma
} ;
-- Indeclinable adjective: theoretically, any #vowel ending
@@ -74,16 +74,16 @@ oper
-- TODO: Jāpieliek parametrs Tense: present = ziedošs, izsalkstošs; past = ziedējis, izsalcis.
-- Vai arī jāpadod Str "-is"/"-ošs" un pa tiešo jāizsauc mkParticiple, bet
-- kā šis mkA(Str) atšķirsies no citiem mkA(Str)?
mkAdjective_Participle : Verb -> PartType -> Adj = \v,p -> {
mkAdjective_Participle : Verb -> Voice -> Adj = \v,p -> {
s = table {
AAdj Posit Indef g n c => v.s ! Pos ! (Participle p g n c) ;
AAdj Posit Indef g n c => v.s ! Pos ! (VPart p g n c) ;
_ => NON_EXISTENT
}
};
-- Positive degree: -s, -š (Indef and Def); -ais (Def only)
-- TODO: atsaukties uz lietvārdu locīšanas tabulām?
mkAdjective_Pos : Str -> Definite -> Gender => Number => Case => Str = \lemma,defin ->
mkAdjective_Pos : Str -> Definiteness -> Gender => Number => Case => Str = \lemma,defin ->
let stem : Str = case lemma of {
s + "ais" => s ;
_ => Predef.tk 1 lemma
@@ -168,7 +168,7 @@ oper
} ;
-- Comparative degree: Qual only
mkAdjective_Comp : Str -> Definite -> Gender => Number => Case => Str = \lemma,defin ->
mkAdjective_Comp : Str -> Definiteness -> Gender => Number => Case => Str = \lemma,defin ->
let stem : Str = Predef.tk 1 lemma
in case defin of {
Indef => table {

View File

@@ -9,20 +9,16 @@ resource ParadigmsLav = open
ParadigmsPronounsLav,
ResLav,
CatLav
in {
in {
flags
coding = utf8 ;
flags coding = utf8 ;
oper
singular : Number = Sg ;
plural : Number = Pl ;
masculine : Gender = Masc ;
feminine : Gender = Fem ;
second_conjugation : VerbConj = C2 ;
third_conjugation : VerbConj = C3 ;
singular : Number = Sg ;
plural : Number = Pl ;
nominative : Case = Nom ;
genitive : Case = Gen ;
@@ -30,21 +26,24 @@ oper
accusative : Case = Acc ;
locative : Case = Loc ;
active_voice : PartType = IsUsi ;
passive_voice : PartType = TsTa ;
second_conjugation : Conjugation = C2 ;
third_conjugation : Conjugation = C3 ;
active_voice : Voice = Act ;
passive_voice : Voice = Pass ;
mkN = overload {
mkN : (lemma : Str) -> N = \l -> lin N (mkNoun l) ;
mkN : (lemma : Str) -> Bool -> N = \l,p -> lin N (mkNounByPal l p) ;
mkN : (lemma : Str) -> Gender -> N = \l,g -> lin N (mkNounByGend l g) ;
mkN : (lemma : Str) -> NounDecl -> N = \l,d -> lin N (mkNounByDecl l d) ;
mkN : (lemma : Str) -> Declension -> N = \l,d -> lin N (mkNounByDecl l d) ;
mkN : (lemma : Str) -> Gender -> Bool -> N = \l,g,p -> lin N (mkNounByGendPal l g p) ;
mkN : (lemma : Str) -> NounDecl -> Bool -> N = \l,d,p -> lin N (mkNounByDeclPal l d p) ;
mkN : (lemma : Str) -> Gender -> NounDecl -> N = \l,g,d -> lin N (mkNounByGendDecl l g d) ;
mkN : (lemma : Str) -> Declension -> Bool -> N = \l,d,p -> lin N (mkNounByDeclPal l d p) ;
mkN : (lemma : Str) -> Gender -> Declension -> N = \l,g,d -> lin N (mkNounByGendDecl l g d) ;
mkN : (lemma : Str) -> Gender -> NounDecl -> Bool -> N = \l,g,d,p ->
mkN : (lemma : Str) -> Gender -> Declension -> Bool -> N = \l,g,d,p ->
lin N (mkNounByGendDeclPal l g d p) ;
} ;
@@ -63,13 +62,13 @@ oper
mkA = overload {
mkA : (lemma : Str) -> A = \s -> lin A (mkAdjective s) ;
mkA : (lemma : Str) -> AdjType -> A = \s,t -> lin A (mkAdjectiveByType s t) ;
-- TODO: nav forši, ka jānorāda PartType, bet kā lai aptiet?
-- TODO: drīzāk jānorāda Str (divdabja forma) + PartType - pārējais iekšēji (auto)
mkA : (lemma : Str) -> AType -> A = \s,t -> lin A (mkAdjectiveByType s t) ;
-- TODO: nav forši, ka jānorāda Voice, bet kā lai aptiet?
-- TODO: drīzāk jānorāda Str (divdabja forma) + Voice - pārējais iekšēji (auto)
-- Turklāt Adj f-cijā iespējams būtu ok, ja pa tiešo izsauktu mkAdjective?!
-- Tomēr diez vai: IsUsi...
-- mkA2 gadījumā: vai PartType var noteikt pēc obj_Prep? Diez vai...
mkA : (v : Verb) -> PartType -> A = \v,p -> lin A (mkAdjective_Participle v p) ;
-- mkA2 gadījumā: vai Voice var noteikt pēc obj_Prep? Diez vai...
mkA : (v : Verb) -> Voice -> A = \v,p -> lin A (mkAdjective_Participle v p) ;
} ;
mkA2 : A -> ResLav.Prep -> A2 = \a,p -> lin A2 (a ** { p = p }) ; -- precējies ar ...
@@ -83,7 +82,7 @@ oper
mkV = overload {
mkV : (lemma : Str) -> V = \l -> lin V (mkVerb_Irreg l) ;
mkV : (lemma : Str) -> VerbConj -> V = \l,c -> lin V (mkVerb l c) ;
mkV : (lemma : Str) -> Conjugation -> V = \l,c -> lin V (mkVerb l c) ;
mkV : (lemma : Str) -> Str -> Str -> V = \l1,l2,l3 -> lin V (mkVerbC1 l1 l2 l3) ;
} ;
@@ -162,11 +161,11 @@ oper
masc = mkNoun_D1 pieci ;
fem = mkNoun_D4 pieci Fem ;
ord = mkAdjective_Pos piektais Def ;
padsmit = mkAdjective_Pos (stem_teen+"padsmitais") Def ;
desmit = mkAdjective_Pos (stem_ten+"desmitais") Def ;
padsmit = mkAdjective_Pos (stem_teen + "padsmitais") Def ;
desmit = mkAdjective_Pos (stem_ten + "desmitais") Def ;
in {
s = table {
unit => table {
DUnit => table {
NCard => table {
Masc => table { c => masc.s ! n ! c } ;
Fem => table { c => fem.s ! n ! c }
@@ -176,11 +175,11 @@ oper
g => table { c => ord ! g ! Sg ! c }
}
} ;
teen => table {
DTeen => table {
NCard => table { g => table { c => stem_teen + "padsmit" } } ;
NOrd => table { g => table { c => padsmit ! g ! Sg ! c } }
} ;
ten => table {
DTen => table {
NCard => table { g => table { c => stem_ten + "desmit" } } ;
NOrd => table { g => table { c => desmit ! g ! Sg ! c } }
}

View File

@@ -11,8 +11,8 @@ flags
coding = utf8 ;
oper
Noun : Type = { s : Number => Case => Str ; g : Gender } ;
ProperNoun : Type = { s : Case => Str ; g : Gender ; n : Number } ;
Noun : Type = { s : Number => Case => Str ; g : Gender } ;
PNoun : Type = { s : Case => Str ; g : Gender ; n : Number } ;
masculine : Gender = Masc ;
feminine : Gender = Fem ;
@@ -21,7 +21,7 @@ oper
mkNoun : Str -> Noun = \lemma ->
mkNounByPal lemma True ;
mkProperNoun : Str -> Number -> ProperNoun = \lemma,number ->
mkProperNoun : Str -> Number -> PNoun = \lemma,number ->
let noun = mkNoun lemma
in {
s = \\c => noun.s ! number ! c ;
@@ -61,7 +61,7 @@ oper
-- Specified gender and palatalization; default declension
mkNounByGendPal : Str -> Gender -> Bool -> Noun = \lemma,gend,pal ->
let decl : NounDecl = case lemma of {
let decl : Declension = case lemma of {
#exception_D2_1 + "s" => D2 ;
#exception_D2_1_pal + "i" => D2 ;
#exception_D2_2 + "s" => D2 ;
@@ -82,22 +82,22 @@ oper
in mkNounByGendDeclPal lemma gend decl pal ;
-- Specified declension; default gender and palatalization
mkNounByDecl : Str -> NounDecl -> Noun = \lemma,decl ->
mkNounByDecl : Str -> Declension -> Noun = \lemma,decl ->
mkNounByDeclPal lemma decl True ;
-- Specified declension and palatalization; default gender
mkNounByDeclPal : Str -> NounDecl -> Bool -> Noun = \lemma,decl,pal ->
mkNounByDeclPal : Str -> Declension -> Bool -> Noun = \lemma,decl,pal ->
case decl of {
D0|D1|D2|D3 => mkNounByGendDeclPal lemma Masc decl pal ;
D4|D5|D6|DR => mkNounByGendDeclPal lemma Fem decl pal
} ;
-- Specified gender and declension; default palatalization
mkNounByGendDecl : Str -> Gender -> NounDecl -> Noun = \lemma,gend,decl ->
mkNounByGendDecl : Str -> Gender -> Declension -> Noun = \lemma,gend,decl ->
mkNounByGendDeclPal lemma gend decl True ;
-- Specified gender, declension and palatalization - no defaults
mkNounByGendDeclPal : Str -> Gender -> NounDecl -> Bool -> Noun = \lemma,gend,decl,pal ->
mkNounByGendDeclPal : Str -> Gender -> Declension -> Bool -> Noun = \lemma,gend,decl,pal ->
case decl of {
D0 => mkNoun_D0 lemma gend ;
D1 => mkNoun_D1 lemma ;

View File

@@ -12,7 +12,7 @@ flags
oper
PronGend : Type = { s : Gender => Number => Case => Str } ;
Pron : Type = { s : Case => Str ; a : ResLav.Agr ; possessive : Gender => Number => Case => Str } ;
Pron : Type = { s : Case => Str ; a : ResLav.Agr ; poss : Gender => Number => Case => Str } ;
-- PRONOUNS (incl. 'determiners')
@@ -26,7 +26,7 @@ oper
ResLav.Voc => NON_EXISTENT
} ;
a = AgP1 Sg g ;
possessive = table {
poss = table {
Masc => table {
Sg => table {
Nom => "mans" ;
@@ -76,7 +76,7 @@ oper
ResLav.Voc => NON_EXISTENT
} ;
a = AgP1 Pl g ;
possessive = \\_,_,_ => "mūsu"
poss = \\_,_,_ => "mūsu"
} ;
mkPronoun_You_Sg : Gender -> Pron = \g -> {
@@ -89,7 +89,7 @@ oper
ResLav.Voc => "tu"
} ;
a = AgP2 Sg g ;
possessive = table {
poss = table {
Masc => table {
Sg => table {
Nom => "tavs" ;
@@ -139,7 +139,7 @@ oper
ResLav.Voc => "Jūs"
} ;
a = AgP2 Pl g ; -- FIXME: in the case of a predicate nominal: copula=Pl, complement=Sg
possessive = \\_,_,_ => "Jūsu"
poss = \\_,_,_ => "Jūsu"
} ;
mkPronoun_You_Pl : Gender -> Pron = \g -> {
@@ -152,19 +152,19 @@ oper
ResLav.Voc => "jūs"
} ;
a = AgP2 Pl g ;
possessive = \\_,_,_ => "jūsu"
poss = \\_,_,_ => "jūsu"
} ;
mkPronoun_They : Gender -> Pron = \g -> {
s = \\c => (mkPronoun_Gend "viņš").s ! g ! Pl ! c ;
a = AgP3 Pl g Pos ;
possessive = \\_,_,_ => "viņu"
poss = \\_,_,_ => "viņu"
} ;
mkPronoun_It_Sg : Gender -> Pron = \g -> {
s = \\c => (mkPronoun_ThisThat That).s ! g ! Sg ! c ;
a = AgP3 Sg g Pos ;
possessive = \\_,_,_ => case g of { Masc => "tā" ; Fem => "tās" }
poss = \\_,_,_ => case g of { Masc => "tā" ; Fem => "tās" }
} ;
-- Gender=>Number=>Case P3 pronouns
@@ -280,14 +280,14 @@ oper
Voc => NON_EXISTENT
} ! c ;
a = AgP3 Sg Masc pol ;
possessive = \\_,_,_ => case stem of { "kaut" => stem ++ "kā" ; _ => stem + "kā" }
poss = \\_,_,_ => case stem of { "kaut" => stem ++ "kā" ; _ => stem + "kā" }
} ;
-- Everybody, somebody, nobody
mkPronoun_Body : Str -> Polarity -> Pron = \lemma,pol -> {
s = \\c => (mkPronoun_Gend lemma).s ! Masc ! Sg ! c ;
a = AgP3 Sg Masc pol ;
possessive = \\_,_,_ => (mkPronoun_Gend lemma).s ! Masc ! Sg ! Gen ;
poss = \\_,_,_ => (mkPronoun_Gend lemma).s ! Masc ! Sg ! Gen ;
} ;
} ;

View File

@@ -11,10 +11,10 @@ flags
coding = utf8 ;
oper
Verb_TMP : Type = {s : VerbForm => Str} ;
Verb_TMP : Type = {s : VForm => Str} ;
-- Second and third conjugations
mkVerb : Str -> VerbConj -> Verb = \lemma,conj -> {
mkVerb : Str -> Conjugation -> Verb = \lemma,conj -> {
s = table {
Pos => (mkVerb_Pos lemma conj).s ;
Neg => (filter_Neg (mkVerb_Pos ("ne"+lemma) conj)).s
@@ -29,7 +29,7 @@ oper
}
} ;
mkVerb_Pos : Str -> VerbConj -> Verb_TMP = \lemma,conj ->
mkVerb_Pos : Str -> Conjugation -> Verb_TMP = \lemma,conj ->
case lemma of {
-- TODO: "ir" =>
s + ("t") => mkRegVerb lemma conj ;
@@ -43,13 +43,13 @@ oper
s + ("ties") => mkVerb_C1_Refl lemma lemma2 lemma3
} ;
mkRegVerb : Str -> VerbConj -> Verb_TMP = \lemma,conj ->
mkRegVerb : Str -> Conjugation -> Verb_TMP = \lemma,conj ->
case conj of {
C2 => mkVerb_C2 lemma ;
C3 => mkVerb_C3 lemma
} ;
mkReflVerb : Str -> VerbConj -> Verb_TMP = \lemma,conj ->
mkReflVerb : Str -> Conjugation -> Verb_TMP = \lemma,conj ->
case conj of {
C2 => mkVerb_C2_Refl lemma ;
C3 => mkVerb_C3_Refl lemma
@@ -57,17 +57,17 @@ oper
filter_Neg : Verb_TMP -> Verb_TMP = \full -> {
s = table {
Debitive => NON_EXISTENT ;
DebitiveRelative => NON_EXISTENT ;
VDeb => NON_EXISTENT ;
VDebRel => NON_EXISTENT ;
x => full.s ! x
}
} ;
-- First conjugation
-- Ref. to lexicon.xml (revision 719): 15th paradigm
-- lemma1: Infinitive
-- lemma2: Indicative P1 Sg Pres
-- lemma3: Indicative P1 Sg Past
-- lemma1: VInf
-- lemma2: VInd P1 Sg Pres
-- lemma3: VInd P1 Sg Past
mkVerb_C1 : Str -> Str -> Str -> Verb_TMP = \lemma1,lemma2,lemma3 ->
let
stem1 : Str = Predef.tk 1 lemma1 ;
@@ -75,147 +75,141 @@ oper
stem3 : Str = Predef.tk 1 lemma3
in {
s = table {
Infinitive => lemma1 ; -- stem1 + "t"
VInf => lemma1 ; -- stem1 + "t"
Indicative P1 Sg Pres => lemma2 ; -- stem2 + "u"
Indicative P1 Sg Fut => pal_C1_1 stem3 stem1 + "šu" ;
Indicative P1 Sg Past => lemma3 ; -- stem3 + "u"
Indicative P1 Pl Pres => stem2 + "am" ;
Indicative P1 Pl Fut => pal_C1_1 stem3 stem1 + "sim" ;
Indicative P1 Pl Past => stem3 + "ām" ;
VInd P1 Sg Pres => lemma2 ; -- stem2 + "u"
VInd P1 Sg Fut => pal_C1_1 stem3 stem1 + "šu" ;
VInd P1 Sg Past => lemma3 ; -- stem3 + "u"
VInd P1 Pl Pres => stem2 + "am" ;
VInd P1 Pl Fut => pal_C1_1 stem3 stem1 + "sim" ;
VInd P1 Pl Past => stem3 + "ām" ;
Indicative P2 Sg Pres => pal_C1_4 stem2 ;
Indicative P2 Sg Fut => pal_C1_1 stem3 stem1 + "si" ;
Indicative P2 Sg Past => stem3 + "i" ;
Indicative P2 Pl Pres => stem2 + "at" ;
--Indicative P2 Pl Fut => pal_C1_1 stem3 stem1 + ("siet"|"sit") ;
Indicative P2 Pl Fut => pal_C1_1 stem3 stem1 + "siet" ;
Indicative P2 Pl Past => stem3 + "āt" ;
VInd P2 Sg Pres => pal_C1_4 stem2 ;
VInd P2 Sg Fut => pal_C1_1 stem3 stem1 + "si" ;
VInd P2 Sg Past => stem3 + "i" ;
VInd P2 Pl Pres => stem2 + "at" ;
VInd P2 Pl Fut => pal_C1_1 stem3 stem1 + "siet" ; -- ("siet"|"sit")
VInd P2 Pl Past => stem3 + "āt" ;
Indicative P3 _ Pres => stem2 ;
Indicative P3 _ Fut => pal_C1_1 stem3 stem1 + "s" ;
Indicative P3 _ Past => stem3 + "a" ;
VInd P3 _ Pres => stem2 ;
VInd P3 _ Fut => pal_C1_1 stem3 stem1 + "s" ;
VInd P3 _ Past => stem3 + "a" ;
Indicative _ _ Cond => stem1 + "tu" ;
VInd _ _ Cond => stem1 + "tu" ;
Relative Pres => stem2 + "ot" ;
Relative Fut => pal_C1_1 stem3 stem1 + "šot" ;
Relative Past => NON_EXISTENT ;
Relative Cond => NON_EXISTENT ;
VRel Pres => stem2 + "ot" ;
VRel Fut => pal_C1_1 stem3 stem1 + "šot" ;
VRel Past => NON_EXISTENT ;
VRel Cond => NON_EXISTENT ;
Debitive => "jā" + stem2 ;
VDeb => "jā" + stem2 ;
VDebRel => "jā" + stem2 + "ot" ;
DebitiveRelative => "jā" + stem2 + "ot" ;
VImp Sg => pal_C1_4 stem2 ;
VImp Pl => pal_C1_4 stem2 + "iet" ;
Imperative Sg => pal_C1_4 stem2 ;
Imperative Pl => pal_C1_4 stem2 + "iet" ;
Participle IsUsi g n c => mkParticiple_IsUsi g n c (pal_C1_3 stem3) ;
Participle TsTa g n c => mkParticiple_TsTa g n c stem1
VPart Act g n c => mkParticiple_IsUsi g n c (pal_C1_3 stem3) ;
VPart Pass g n c => mkParticiple_TsTa g n c stem1
}
} ;
-- Second conjugation
-- Ref. to lexicon.xml (revision 719): 16th paradigm
-- lemma: Infinitive
-- lemma: VInf
mkVerb_C2 : Str -> Verb_TMP = \lemma ->
let
stem : Str = Predef.tk 1 lemma
in {
s = table {
Infinitive => lemma ; -- stem + "t"
VInf => lemma ; -- stem + "t"
Indicative P1 Sg Pres => stem + "ju" ;
Indicative P1 Sg Fut => stem + "šu" ;
Indicative P1 Sg Past => stem + "ju" ;
Indicative P1 Pl Pres => stem + "jam" ;
Indicative P1 Pl Fut => stem + "sim" ;
Indicative P1 Pl Past => stem + "jām" ;
VInd P1 Sg Pres => stem + "ju" ;
VInd P1 Sg Fut => stem + "šu" ;
VInd P1 Sg Past => stem + "ju" ;
VInd P1 Pl Pres => stem + "jam" ;
VInd P1 Pl Fut => stem + "sim" ;
VInd P1 Pl Past => stem + "jām" ;
Indicative P2 Sg Pres => stem ;
Indicative P2 Sg Fut => stem + "si" ;
Indicative P2 Sg Past => stem + "ji" ;
Indicative P2 Pl Pres => stem + "jat" ;
--Indicative P2 Pl Fut => stem + ("siet"|"sit") ;
Indicative P2 Pl Fut => stem + "siet" ;
Indicative P2 Pl Past => stem + "jāt" ;
VInd P2 Sg Pres => stem ;
VInd P2 Sg Fut => stem + "si" ;
VInd P2 Sg Past => stem + "ji" ;
VInd P2 Pl Pres => stem + "jat" ;
VInd P2 Pl Fut => stem + "siet" ; -- ("siet"|"sit")
VInd P2 Pl Past => stem + "t" ;
Indicative P3 _ Pres => stem ;
Indicative P3 _ Fut => stem + "s" ;
Indicative P3 _ Past => stem + "ja" ;
VInd P3 _ Pres => stem ;
VInd P3 _ Fut => stem + "s" ;
VInd P3 _ Past => stem + "ja" ;
Indicative _ _ Cond => stem + "tu" ;
VInd _ _ Cond => stem + "tu" ;
Relative Pres => stem + "jot" ;
Relative Fut => stem + "šot" ;
Relative Past => NON_EXISTENT ;
Relative Cond => NON_EXISTENT ;
VRel Pres => stem + "jot" ;
VRel Fut => stem + "šot" ;
VRel Past => NON_EXISTENT ;
VRel Cond => NON_EXISTENT ;
Debitive => "jā" + stem ;
VDeb => "jā" + stem ;
VDebRel => "jā" + stem + "jot" ;
DebitiveRelative => "jā" + stem + "jot" ;
VImp Sg => stem ;
VImp Pl => stem + "jiet" ;
Imperative Sg => stem ;
Imperative Pl => stem + "jiet" ;
Participle IsUsi g n c => mkParticiple_IsUsi g n c (stem + "j") ;
Participle TsTa g n c => mkParticiple_TsTa g n c stem
VPart Act g n c => mkParticiple_IsUsi g n c (stem + "j") ;
VPart Pass g n c => mkParticiple_TsTa g n c stem
}
} ;
-- Third conjugation
-- Ref. to lexicon.xml (revision 719): 17th paradigm
-- lemma: Infinitive
-- lemma: VInf
mkVerb_C3 : Str -> Verb_TMP = \lemma ->
let
stem : Str = Predef.tk 1 lemma
in {
s = table {
Infinitive => lemma ; -- stem + "t"
VInf => lemma ; -- stem + "t"
Indicative P1 Sg Pres => pal_C3_1 stem + "u" ;
Indicative P1 Sg Fut => stem + "šu" ;
Indicative P1 Sg Past => stem + "ju" ;
Indicative P1 Pl Pres => pal_C3_1 stem + pal_C3_2 stem "am" ;
Indicative P1 Pl Fut => stem + "sim" ;
Indicative P1 Pl Past => stem + "jām" ;
VInd P1 Sg Pres => pal_C3_1 stem + "u" ;
VInd P1 Sg Fut => stem + "šu" ;
VInd P1 Sg Past => stem + "ju" ;
VInd P1 Pl Pres => pal_C3_1 stem + pal_C3_2 stem "am" ;
VInd P1 Pl Fut => stem + "sim" ;
VInd P1 Pl Past => stem + "jām" ;
Indicative P2 Sg Pres => pal_C3_1 stem + "i" ;
Indicative P2 Sg Fut => stem + "si" ;
Indicative P2 Sg Past => stem + "ji" ;
Indicative P2 Pl Pres => pal_C3_1 stem + pal_C3_2 stem "at" ;
--Indicative P2 Pl Fut => stem + ("siet"|"sit") ;
Indicative P2 Pl Fut => stem + "siet" ;
Indicative P2 Pl Past => stem + "jāt" ;
VInd P2 Sg Pres => pal_C3_1 stem + "i" ;
VInd P2 Sg Fut => stem + "si" ;
VInd P2 Sg Past => stem + "ji" ;
VInd P2 Pl Pres => pal_C3_1 stem + pal_C3_2 stem "at" ;
VInd P2 Pl Fut => stem + "siet" ; -- ("siet"|"sit")
VInd P2 Pl Past => stem + "t" ;
Indicative P3 _ Pres => pal_C3_5 stem ;
Indicative P3 _ Fut => stem + "s" ;
Indicative P3 _ Past => stem + "ja" ;
VInd P3 _ Pres => pal_C3_5 stem ;
VInd P3 _ Fut => stem + "s" ;
VInd P3 _ Past => stem + "ja" ;
Indicative _ _ Cond => stem + "tu" ;
VInd _ _ Cond => stem + "tu" ;
Relative Pres => pal_C3_1 stem + "ot" ;
Relative Fut => stem + "šot" ;
Relative Past => NON_EXISTENT ;
Relative Cond => NON_EXISTENT ;
VRel Pres => pal_C3_1 stem + "ot" ;
VRel Fut => stem + "šot" ;
VRel Past => NON_EXISTENT ;
VRel Cond => NON_EXISTENT ;
Debitive => pal_C3_3 stem ;
VDeb => pal_C3_3 stem ;
VDebRel => pal_C3_3 stem + "ot" ;
DebitiveRelative => pal_C3_3 stem + "ot" ;
VImp Sg => pal_C3_1 stem + "i" ;
VImp Pl => pal_C3_1 stem + "iet" ;
Imperative Sg => pal_C3_1 stem + "i" ;
Imperative Pl => pal_C3_1 stem + "iet" ;
Participle IsUsi g n c => mkParticiple_IsUsi g n c (stem + "j") ;
Participle TsTa g n c => mkParticiple_TsTa g n c stem
VPart Act g n c => mkParticiple_IsUsi g n c (stem + "j") ;
VPart Pass g n c => mkParticiple_TsTa g n c stem
}
} ;
-- First conjugation: reflexive
-- Ref. to lexicon.xml (revision 719): 18th paradigm
-- lemma1: Infinitive
-- lemma2: Indicative P1 Sg Pres
-- lemma3: Indicative P1 Sg Past
-- lemma1: VInf
-- lemma2: VInd P1 Sg Pres
-- lemma3: VInd P1 Sg Past
mkVerb_C1_Refl : Str -> Str -> Str -> Verb_TMP = \lemma1,lemma2,lemma3 ->
let
stem1 : Str = Predef.tk 4 lemma1 ;
@@ -223,139 +217,133 @@ oper
stem3 : Str = Predef.tk 2 lemma3
in {
s = table {
Infinitive => lemma1 ; -- stem + "ties"
VInf => lemma1 ; -- stem + "ties"
Indicative P1 Sg Pres => lemma2 ; -- stem2 + "os"
Indicative P1 Sg Fut => pal_C1_1 stem3 stem1 + "šos" ;
Indicative P1 Sg Past => lemma3 ; -- stem3 + "os"
Indicative P1 Pl Pres => stem2 + "amies" ;
Indicative P1 Pl Fut => pal_C1_1 stem3 stem1 + "simies" ;
Indicative P1 Pl Past => stem3 + "āmies" ;
VInd P1 Sg Pres => lemma2 ; -- stem2 + "os"
VInd P1 Sg Fut => pal_C1_1 stem3 stem1 + "šos" ;
VInd P1 Sg Past => lemma3 ; -- stem3 + "os"
VInd P1 Pl Pres => stem2 + "amies" ;
VInd P1 Pl Fut => pal_C1_1 stem3 stem1 + "simies" ;
VInd P1 Pl Past => stem3 + "āmies" ;
Indicative P2 Sg Pres => pal_C1_2 stem3 stem2 + "ies" ;
Indicative P2 Sg Fut => pal_C1_1 stem3 stem1 + "sies" ;
Indicative P2 Sg Past => stem3 + "ies" ;
Indicative P2 Pl Pres => stem2 + "aties" ;
--Indicative P2 Pl Fut => pal_C1_1 stem3 stem1 + ("sieties"|"sities") ;
Indicative P2 Pl Fut => pal_C1_1 stem3 stem1 + "sieties" ;
Indicative P2 Pl Past => stem3 + "āties" ;
VInd P2 Sg Pres => pal_C1_2 stem3 stem2 + "ies" ;
VInd P2 Sg Fut => pal_C1_1 stem3 stem1 + "sies" ;
VInd P2 Sg Past => stem3 + "ies" ;
VInd P2 Pl Pres => stem2 + "aties" ;
VInd P2 Pl Fut => pal_C1_1 stem3 stem1 + "sieties" ; -- ("sieties"|"sities")
VInd P2 Pl Past => stem3 + "āties" ;
Indicative P3 _ Pres => stem2 + "as" ;
Indicative P3 _ Fut => pal_C1_1 stem3 stem1 + "sies" ;
Indicative P3 _ Past => stem3 + "ās" ;
VInd P3 _ Pres => stem2 + "as" ;
VInd P3 _ Fut => pal_C1_1 stem3 stem1 + "sies" ;
VInd P3 _ Past => stem3 + "ās" ;
Indicative _ _ Cond => stem1 + "tos" ;
VInd _ _ Cond => stem1 + "tos" ;
Relative Pres => stem2 + "oties" ;
Relative Fut => pal_C1_1 stem3 stem1 + "šoties" ;
Relative Past => NON_EXISTENT ;
Relative Cond => NON_EXISTENT ;
VRel Pres => stem2 + "oties" ;
VRel Fut => pal_C1_1 stem3 stem1 + "šoties" ;
VRel Past => NON_EXISTENT ;
VRel Cond => NON_EXISTENT ;
Debitive => "jā" + stem2 + "as" ;
VDeb => "jā" + stem2 + "as" ;
VDebRel => "jā" + stem2 + "oties" ;
DebitiveRelative => "jā" + stem2 + "oties" ;
VImp Sg => pal_C1_2 stem3 stem2 + "ies" ;
VImp Pl => pal_C1_2 stem3 stem2 + "ieties" ;
Imperative Sg => pal_C1_2 stem3 stem2 + "ies" ;
Imperative Pl => pal_C1_2 stem3 stem2 + "ieties" ;
Participle IsUsi g n c => mkParticiple_IesUsies g n c (pal_C1_3 stem3) ;
Participle TsTa g n c => mkParticiple_TsTa g n c stem1
VPart Act g n c => mkParticiple_IesUsies g n c (pal_C1_3 stem3) ;
VPart Pass g n c => mkParticiple_TsTa g n c stem1
}
} ;
-- Second conjugation: reflexive
-- Ref. to lexicon.xml (revision 719): 19th paradigm
-- lemma: Infinitive
-- lemma: VInf
mkVerb_C2_Refl : Str -> Verb_TMP = \lemma ->
let
stem : Str = Predef.tk 4 lemma
in {
s = table {
Infinitive => lemma ; -- stem + "ties"
VInf => lemma ; -- stem + "ties"
Indicative P1 Sg Pres => stem + "jos" ;
Indicative P1 Sg Fut => stem + "šos" ;
Indicative P1 Sg Past => stem + "jos" ;
Indicative P1 Pl Pres => stem + "jamies" ;
Indicative P1 Pl Fut => stem + "simies" ;
Indicative P1 Pl Past => stem + "jāmies" ;
VInd P1 Sg Pres => stem + "jos" ;
VInd P1 Sg Fut => stem + "šos" ;
VInd P1 Sg Past => stem + "jos" ;
VInd P1 Pl Pres => stem + "jamies" ;
VInd P1 Pl Fut => stem + "simies" ;
VInd P1 Pl Past => stem + "jāmies" ;
Indicative P2 Sg Pres => stem + "jies" ;
Indicative P2 Sg Fut => stem + "sies" ;
Indicative P2 Sg Past => stem + "jies" ;
Indicative P2 Pl Pres => stem + "jaties" ;
--Indicative P2 Pl Fut => stem + ("sieties"|"sities") ;
Indicative P2 Pl Fut => stem + "sieties" ;
Indicative P2 Pl Past => stem + "jāties" ;
VInd P2 Sg Pres => stem + "jies" ;
VInd P2 Sg Fut => stem + "sies" ;
VInd P2 Sg Past => stem + "jies" ;
VInd P2 Pl Pres => stem + "jaties" ;
VInd P2 Pl Fut => stem + "sieties" ; -- ("sieties"|"sities")
VInd P2 Pl Past => stem + "ties" ;
Indicative P3 _ Pres => stem + "jas" ;
Indicative P3 _ Fut => stem + "sies" ;
Indicative P3 _ Past => stem + "jās" ;
VInd P3 _ Pres => stem + "jas" ;
VInd P3 _ Fut => stem + "sies" ;
VInd P3 _ Past => stem + "jās" ;
Indicative _ _ Cond => stem + "tos" ;
VInd _ _ Cond => stem + "tos" ;
Relative Pres => stem + "joties" ;
Relative Fut => stem + "šoties" ;
Relative Past => NON_EXISTENT ;
Relative Cond => NON_EXISTENT ;
VRel Pres => stem + "joties" ;
VRel Fut => stem + "šoties" ;
VRel Past => NON_EXISTENT ;
VRel Cond => NON_EXISTENT ;
Debitive => "jā" + stem + "jas" ;
VDeb => "jā" + stem + "jas" ;
VDebRel => "jā" + stem + "joties" ;
DebitiveRelative => "jā" + stem + "joties" ;
VImp Sg => stem + "jies" ;
VImp Pl => stem + "jieties" ;
Imperative Sg => stem + "jies" ;
Imperative Pl => stem + "jieties" ;
Participle IsUsi g n c => mkParticiple_IesUsies g n c (stem + "j") ;
Participle TsTa g n c => mkParticiple_TsTa g n c stem
VPart Act g n c => mkParticiple_IesUsies g n c (stem + "j") ;
VPart Pass g n c => mkParticiple_TsTa g n c stem
}
} ;
-- Third conjugation: reflexive
-- Ref. to lexicon.xml (revision 719): 20th paradigm
-- lemma: Infinitive
-- lemma: VInf
mkVerb_C3_Refl : Str -> Verb_TMP = \lemma ->
let
stem : Str = Predef.tk 4 lemma
in {
s = table {
Infinitive => lemma ; -- stem + "ties"
VInf => lemma ; -- stem + "ties"
Indicative P1 Sg Pres => pal_C3_1 stem + "os" ;
Indicative P1 Sg Fut => stem + "šos" ;
Indicative P1 Sg Past => stem + "jos" ;
Indicative P1 Pl Pres => pal_C3_4 stem + "mies" ;
Indicative P1 Pl Fut => stem + "simies" ;
Indicative P1 Pl Past => stem + "jāmies" ;
VInd P1 Sg Pres => pal_C3_1 stem + "os" ;
VInd P1 Sg Fut => stem + "šos" ;
VInd P1 Sg Past => stem + "jos" ;
VInd P1 Pl Pres => pal_C3_4 stem + "mies" ;
VInd P1 Pl Fut => stem + "simies" ;
VInd P1 Pl Past => stem + "jāmies" ;
Indicative P2 Sg Pres => pal_C3_1 stem + "ies" ;
Indicative P2 Sg Fut => stem + "sies" ;
Indicative P2 Sg Past => stem + "jies" ;
Indicative P2 Pl Pres => pal_C3_4 stem + "ties" ;
--Indicative P2 Pl Fut => stem + ("sieties"|"sities") ;
Indicative P2 Pl Fut => stem + "sieties" ;
Indicative P2 Pl Past => stem + "jāties" ;
VInd P2 Sg Pres => pal_C3_1 stem + "ies" ;
VInd P2 Sg Fut => stem + "sies" ;
VInd P2 Sg Past => stem + "jies" ;
VInd P2 Pl Pres => pal_C3_4 stem + "ties" ;
VInd P2 Pl Fut => stem + "sieties" ; -- ("sieties"|"sities")
VInd P2 Pl Past => stem + "ties" ;
Indicative P3 _ Pres => pal_C3_4 stem + "s" ;
Indicative P3 _ Fut => stem + "sies" ;
Indicative P3 _ Past => stem + "jās" ;
VInd P3 _ Pres => pal_C3_4 stem + "s" ;
VInd P3 _ Fut => stem + "sies" ;
VInd P3 _ Past => stem + "jās" ;
Indicative _ _ Cond => stem + "tos" ;
VInd _ _ Cond => stem + "tos" ;
Relative Pres => pal_C3_1 stem + "oties" ;
Relative Fut => stem + "šoties" ;
Relative Past => NON_EXISTENT ;
Relative Cond => NON_EXISTENT ;
VRel Pres => pal_C3_1 stem + "oties" ;
VRel Fut => stem + "šoties" ;
VRel Past => NON_EXISTENT ;
VRel Cond => NON_EXISTENT ;
Debitive => pal_C3_6 stem + "s" ;
VDeb => pal_C3_6 stem + "s" ;
VDebRel => pal_C3_6 stem + "oties" ;
DebitiveRelative => pal_C3_6 stem + "oties" ;
VImp Sg => pal_C3_1 stem + "ies" ;
VImp Pl => pal_C3_1 stem + "ieties" ;
Imperative Sg => pal_C3_1 stem + "ies" ;
Imperative Pl => pal_C3_1 stem + "ieties" ;
Participle IsUsi g n c => mkParticiple_IesUsies g n c (stem + "j") ;
Participle TsTa g n c => mkParticiple_TsTa g n c stem
VPart Act g n c => mkParticiple_IesUsies g n c (stem + "j") ;
VPart Pass g n c => mkParticiple_TsTa g n c stem
}
} ;
@@ -373,22 +361,22 @@ oper
mkVerb_Irreg_Be : Verb = {
s = table {
Pos => table {
Indicative P1 Sg Pres => "esmu" ;
Indicative P2 Sg Pres => "esi" ;
Indicative P3 _ Pres => "ir" ;
VInd P1 Sg Pres => "esmu" ;
VInd P2 Sg Pres => "esi" ;
VInd P3 _ Pres => "ir" ;
Debitive => "jābūt" ;
VDeb => "jābūt" ;
x => (mkVerb_C1 "būt" "esu" "biju").s ! x -- the incorrect 'esu' will be overriden
} ;
Neg => table {
Indicative P1 Sg Pres => "neesmu" ;
Indicative P2 Sg Pres => "neesi" ;
Indicative P3 _ Pres => "nav" ;
VInd P1 Sg Pres => "neesmu" ;
VInd P2 Sg Pres => "neesi" ;
VInd P3 _ Pres => "nav" ;
Debitive => NON_EXISTENT ;
VDeb => NON_EXISTENT ;
DebitiveRelative => NON_EXISTENT ;
VDebRel => NON_EXISTENT ;
x => (mkVerb_C1 "nebūt" "neesu" "nebiju").s ! x -- the incorrect 'neesu' will be overriden
}
@@ -400,14 +388,14 @@ oper
mkVerb_Irreg_Go_Prefix : Str -> Verb = \pref -> {
s = table {
Pos => table {
Indicative P3 _ Pres => pref + "iet" ;
Debitive => "jā" + pref + "iet" ;
VInd P3 _ Pres => pref + "iet" ;
VDeb => "jā" + pref + "iet" ;
x => (mkVerb_C1 (pref + "iet") (pref + "eju") (pref + "gāju")).s ! x
} ;
Neg => table {
Indicative P3 _ Pres => "ne" + pref + "iet" ;
Debitive => NON_EXISTENT ;
DebitiveRelative => NON_EXISTENT ;
VInd P3 _ Pres => "ne" + pref + "iet" ;
VDeb => NON_EXISTENT ;
VDebRel => NON_EXISTENT ;
x => (mkVerb_C1 ("ne" + pref + "iet") ("ne" + pref + "eju") ("ne" + pref + "gāju")).s ! x
}
}
@@ -416,28 +404,28 @@ oper
mkVerb_Irreg_Sleep : Verb = {
s = table {
Pos => table {
Indicative P2 Sg Pres => (mkVerb_C3 "gulēt").s ! Indicative P2 Sg Pres ;
Indicative p n Pres => (mkVerb_C3 "guļēt").s ! Indicative p n Pres ;
VInd P2 Sg Pres => (mkVerb_C3 "gulēt").s ! VInd P2 Sg Pres ;
VInd p n Pres => (mkVerb_C3 "guļēt").s ! VInd p n Pres ;
-- FIXME: Here and there, the incorrect 'guļēt' contains intentional palatalization
Relative Pres => (mkVerb_C3 "guļēt").s ! Relative Pres ;
VRel Pres => (mkVerb_C3 "guļēt").s ! VRel Pres ;
Debitive => (mkVerb_C3 "guļēt").s ! Debitive ;
VDeb => (mkVerb_C3 "guļēt").s ! VDeb ;
DebitiveRelative => (mkVerb_C3 "guļēt").s ! DebitiveRelative ;
VDebRel => (mkVerb_C3 "guļēt").s ! VDebRel ;
x => (mkVerb_C3 "gulēt").s ! x
} ;
Neg => table {
Indicative P2 Sg Pres => (mkVerb_C3 "negulēt").s ! Indicative P2 Sg Pres ;
Indicative p n Pres => (mkVerb_C3 "neguļēt").s ! Indicative p n Pres ;
VInd P2 Sg Pres => (mkVerb_C3 "negulēt").s ! VInd P2 Sg Pres ;
VInd p n Pres => (mkVerb_C3 "neguļēt").s ! VInd p n Pres ;
Relative Pres => (mkVerb_C3 "neguļēt").s ! Relative Pres ;
VRel Pres => (mkVerb_C3 "neguļēt").s ! VRel Pres ;
Debitive => NON_EXISTENT ;
VDeb => NON_EXISTENT ;
DebitiveRelative => NON_EXISTENT ;
VDebRel => NON_EXISTENT ;
x => (mkVerb_C3 "negulēt").s ! x
}
@@ -447,8 +435,8 @@ oper
-- Auxiliaries: palatalization rules
-- Ref. to the Java implementation: mija6
-- stem3: Indicative P1 Sg Past
-- stem1: Infinitive
-- stem3: VInd P1 Sg Past
-- stem1: VInf
pal_C1_1 : Str -> Str -> Str = \stem3,stem1 ->
case stem1 of {
s + "s" => case stem3 of {
@@ -462,8 +450,8 @@ oper
} ;
-- Ref. to the Java implementation: mija7
-- stem3: Indicative P1 Sg Past
-- stem2: Indicative P1 Sg Pres
-- stem3: VInd P1 Sg Past
-- stem2: VInd P1 Sg Pres
pal_C1_2 : Str -> Str -> Str = \stem3,stem2 ->
case stem2 of {
s + "š" => case stem3 of {
@@ -486,7 +474,7 @@ oper
} ;
-- Ref. to the Java implementation: mija11
-- stem3: Indicative P1 Sg Past
-- stem3: VInd P1 Sg Past
pal_C1_3 : Str -> Str = \stem3 ->
case stem3 of {
s + "c" => s + "k" ;
@@ -495,7 +483,7 @@ oper
} ;
-- Ref. to the Java implementation: mija14
-- stem: Indicative P1 Sg Pres | Indicative P1 Sg Past
-- stem: VInd P1 Sg Pres | VInd P1 Sg Past
pal_C1_4 : Str -> Str = \stem ->
case stem of {
s + "k" => s + "c" ;

View File

@@ -23,7 +23,7 @@ lin
UttAdv adv = adv ;
-- 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 Pos) } ;
UttVP vp = { s = build_VP vp Pos VInf (AgP3 Pl Masc Pos) } ;
UttIP ip = { s = ip.s ! Nom } ;
UttIAdv iadv = iadv ;

View File

@@ -19,18 +19,18 @@ lin
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
let subj : Case = case vp.voice of {
Act => vp.val.subj ;
Pass => vp.val.obj
} in lin RCl {
s = \\mood,pol,agr =>
case mood of { -- Subject
Deb _ _ => rp.s ! Masc ! Dat ; --# notpresent
_ => rp.s ! Masc ! vp.agr.c_topic
_ => rp.s ! Masc ! vp.val.subj
} ++
case subj of { -- Verb
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 Pos vp.objNeg -- TODO: test me
_ => buildVerb vp.v mood pol vp.val.agr Pos vp.objNeg -- TODO: test me
} ++
vp.compl ! agr -- Object(s), complements, adverbial modifiers
} ;

View File

@@ -3,102 +3,87 @@
resource ResLav = ParamX ** open Prelude in {
flags
optimize = all ;
coding = utf8 ;
param
-- Nouns
Case = Nom | Gen | Dat | Acc | Loc | Voc ;
Gender = Masc | Fem ;
NounDecl = D0 | D1 | D2 | D3 | D4 | D5 | D6 | DR ;
Declension = D0 | D1 | D2 | D3 | D4 | D5 | D6 | DR ;
-- Adjectives
Definite = Indef | Def ;
AdjType = AdjQual | AdjRel | AdjIndecl ;
-- TODO: pārveidot uz šādu formu lai ir arī apstākļa vārdi kas atvasināti no īpašības vārdiem
AForm = AAdj Degree Definite Gender Number Case | AAdv Degree ;
Definiteness = Indef | Def ;
AType = AQual | ARel | AIndecl ;
-- Participles
PartType = IsUsi | TsTa ; -- TODO: šo jāmet ārā - pārklājas ar Voice, kas attiecas ne tikai uz divdabjiem
Voice = Act | Pass ;
AForm =
AAdj Degree Definiteness Gender Number Case
| AAdv Degree ;
-- Verbs
-- Ind = Indicative
-- Rel = Relative (Latvian specific: http://www.isocat.org/rest/dc/3836)
-- Deb = Debitive (Latvian specific: http://www.isocat.org/rest/dc/3835)
-- Condit = Conditional
-- DebitiveRelative = the relative subtype of debitive
VerbForm =
Infinitive
| Indicative Person Number Tense
| Relative Tense
| Debitive
| Imperative Number
| DebitiveRelative
| Participle PartType Gender Number Case
;
-- TODO: divdabim noteiktā forma un arī pārākā / vispārākā pakāpe
VerbMood =
Ind Anteriority Tense
| Rel Anteriority Tense --# notpresent
| Deb Anteriority Tense --# notpresent
| Condit Anteriority --# notpresent
;
Voice = Act | Pass ;
Conjugation = C2 | C3 ; -- C1 - "irregular" verbs
VerbConj = C2 | C3 ;
-- Verb mood:
-- Ind - indicative
-- Rel - relative (http://www.isocat.org/rest/dc/3836)
-- Deb - debitive (http://www.isocat.org/rest/dc/3835)
-- Condit - conditional
VMood =
Ind Anteriority Tense
| Rel Anteriority Tense --# notpresent
| Deb Anteriority Tense --# notpresent
| Condit Anteriority --# notpresent
;
-- Verb agreement
-- Number depends on the person
-- Gender has to be taken into accunt because of predicative nominals and participles
-- 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 ;
VForm =
VInf
| VInd Person Number Tense
| VRel Tense
| VDeb
| VImp Number
| VDebRel -- the relative subtype of debitive
| VPart Voice Gender Number Case ;
-- Clause agreement
-- 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 ;
-- Verb agreement:
-- Number depends on Subject.Person
-- Subject.Gender has to be agreed in predicative nominal clauses, and in participle forms
-- Polarity - double negation, if the subject/object NP has a negated determiner
Agr =
AgP1 Number Gender
| AgP2 Number Gender
| AgP3 Number Gender Polarity ;
-- Other
ThisOrThat = This | That ;
CardOrd = NCard | NOrd ;
DForm = unit | teen | ten ;
DForm = DUnit | DTeen | DTen ;
oper
vowel : pattern Str = #("a"|"ā"|"e"|"ē"|"i"|"ī"|"o"|"u"|"ū") ;
simpleCons : pattern Str = #("c"|"d"|"l"|"n"|"s"|"t"|"z") ;
labialCons : pattern Str = #("b"|"m"|"p"|"v") ;
sonantCons : pattern Str = #("l"|"m"|"n"|"r"|"ļ"|"ņ") ;
doubleCons : pattern Str = #("ll"|"ln"|"nn"|"sl"|"sn"|"st"|"zl"|"zn") ;
Verb : Type = { s : Polarity => VForm => Str } ;
prefix : pattern Str = #("aiz"|"ap"|"at"|"ie"|"iz"|"no"|"pa"|"pār"|"pie"|"sa"|"uz") ;
NON_EXISTENT : Str = "NON_EXISTENT" ;
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
--
-- 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 : Polarity } ;
-- compl: objects, complements, adverbial modifiers
-- topic: typically - subject
-- focus: typically - objects, complements, adverbial modifiers
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...
Valence : Type = { subj : Case ; obj : Case ; agr : Agr } ;
-- TODO: jāpāriet uz vienotu TopicFocus parametru
-- TODO: ieraksta tips (c:CaseCase, p:Prep; kam ir agr?) vai algebr. param.?
Prep : Type = { s : Str ; c : Number => Case } ;
-- In the case of case-based valences, the preposition is empty ([])
-- For simple 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
VP = { v : Verb ; compl : Agr => Str ; val : Valence ; objNeg : Polarity ; voice : Voice } ;
-- compl: objects, complements, adverbial modifiers
-- TODO: lai varētu spēlēties ar vārdu secību, compl vēlāk būs jāskalda pa daļām
VPSlash = VP ** { p : Prep } ;
-- TODO: p pārklājas ar val.obj un val.agr / vai vp.p = v.p?
toAgr : Person -> Number -> Gender -> Polarity -> Agr = \pers,num,gend,pol ->
case pers of {
@@ -107,15 +92,6 @@ oper
P3 => AgP3 num gend pol
} ;
toClAgr : Case -> Case -> Agr -> Voice -> ClAgr = \c_topic,c_focus,agr,voice -> {
c_topic = c_topic ;
c_focus = c_focus ;
agr = agr ;
voice = voice
} ;
toClAgr_Reg : Case -> ClAgr = \c_topic -> toClAgr c_topic Nom (AgP3 Sg Masc Pos) Act ;
fromAgr : Agr -> { pers : Person ; num : Number ; gend : Gender ; pol : Polarity } = \agr ->
case agr of {
AgP1 num gend => { pers = P1 ; num = num ; gend = gend ; pol = Pos } ;
@@ -146,6 +122,23 @@ oper
_ => pol2
} ;
--agrP3 : Number -> Gender -> Polarity -> Agr = \num,gend,pol -> toAgr P3 num gend pol ;
toVal : Case -> Case -> Agr -> Valence = \subj,obj,agr -> {
subj = subj ;
obj = obj ;
agr = agr
} ;
toVal_Reg : Case -> Valence = \subj -> toVal subj Nom (AgP3 Sg Masc Pos) ;
vowel : pattern Str = #("a"|"ā"|"e"|"ē"|"i"|"ī"|"o"|"u"|"ū") ;
simpleCons : pattern Str = #("c"|"d"|"l"|"n"|"s"|"t"|"z") ;
labialCons : pattern Str = #("b"|"m"|"p"|"v") ;
sonantCons : pattern Str = #("l"|"m"|"n"|"r"|"ļ"|"ņ") ;
doubleCons : pattern Str = #("ll"|"ln"|"nn"|"sl"|"sn"|"st"|"zl"|"zn") ;
prefix : pattern Str = #("aiz"|"ap"|"at"|"ie"|"iz"|"no"|"pa"|"pār"|"pie"|"sa"|"uz") ;
NON_EXISTENT : Str = "NON_EXISTENT" ;
}

View File

@@ -16,7 +16,7 @@ lin
PredSCVP sc vp = mkClauseSC sc vp ;
ImpVP vp = { s = \\pol,n => vp.v.s ! pol ! (Imperative n) ++ vp.compl ! (AgP2 n Masc) } ;
ImpVP vp = { s = \\pol,n => vp.v.s ! pol ! (VImp n) ++ vp.compl ! (AgP2 n Masc) } ;
SlashVP np vp = mkClause np vp ** { p = vp.p } ;
@@ -31,8 +31,9 @@ lin
mkClause np (lin VP {
v = vs ;
compl = \\_ => "," ++ vs.subj.s ++ sslash.s ;
agr = toClAgr_Reg vs.topic ;
objNeg = Pos
val = toVal_Reg vs.topic ;
objNeg = Pos ;
voice = Act
}) ** { p = sslash.p } ;
ComplVS v s = { v = v ; compl = \\_ => "," ++ v.subj.s ++ s.s } ;
@@ -43,7 +44,7 @@ lin
EmbedQS qs = { s = qs.s } ;
-- FIXME: vai agr ir Pl?
EmbedVP vp = { s = build_VP vp Pos Infinitive (AgP3 Pl Masc Pos) } ;
EmbedVP vp = { s = build_VP vp Pos VInf (AgP3 Pl Masc Pos) } ;
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 } ;
@@ -61,19 +62,19 @@ lin
oper
-- 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
let subj : Case = case vp.voice of {
Act => vp.val.subj ;
Pass => vp.val.obj
} in lin Cl {
s = \\mood,pol =>
case mood of { -- Subject
Deb _ _ => np.s ! Dat ; --# notpresent
_ => np.s ! vp.agr.c_topic
_ => np.s ! vp.val.subj
} ++
case subj of { -- Verb
-- TODO: vai np.a un np.a.pol argumentus nevar apvienot?
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
_ => buildVerb vp.v mood pol vp.val.agr (fromAgr np.a).pol vp.objNeg -- TESTME
} ++
vp.compl ! np.a -- Object(s), complements, adverbial modifiers
} ;

View File

@@ -97,13 +97,13 @@ lin
he_Pron = {
s = \\c => (mkPronoun_Gend "viņš").s ! Masc ! Sg ! c ;
a = AgP3 Sg Masc Pos ;
possessive = \\_,_,_ => "viņa"
poss = \\_,_,_ => "viņa"
} ;
she_Pron = {
s = \\c => (mkPronoun_Gend "viņš").s ! Fem ! Sg ! c ;
a = AgP3 Sg Fem Pos ;
possessive = \\_,_,_ => "viņas"
poss = \\_,_,_ => "viņas"
} ;
they_Pron = mkPronoun_They Masc ; -- See also: ExtraLav.they8fem_Pron

View File

@@ -1,15 +1,15 @@
--# -path=.:../abstract:../common:../prelude
-- FIXME: module relations.
-- TODO: module relations.
-- VerbLav is included in many places because of buildVerb (SentenceLav, QuestionLav, RelativeLav, IdiomLav),
-- and includes ParadigmsVerbsLav because of mkVerb_Irreg_Be -
-- they need to be reallocated somehow to ResLav or something similar ('be' - IrregLav).
-- and includes ParadigmsVerbsLav because of mkVerb_Irreg_Be.
-- They need to be reallocated somehow to ResLav.or something similar (e.g. 'be' => IrregLav).
-- Not so simple since morphology itself needs ResLav & friends.
concrete VerbLav of Verb = CatLav ** open
StructuralLav,
ParadigmsVerbsLav,
ResLav, -- TODO: get rid of ResLav - include parameters (Pos etc.) in ParadigmsVerbsLav
ResLav,
ParamX,
Prelude
in {
@@ -21,225 +21,243 @@ flags
lin
-- V -> VP
UseV v = {
v = v ;
compl = \\_ => [] ;
agr = toClAgr_Reg Nom ;
objNeg = Pos
v = v ;
compl = \\_ => [] ;
val = toVal_Reg Nom ;
objNeg = Pos ;
voice = Act
} ;
-- VV -> VP -> VP
ComplVV vv vp = {
v = vv ;
compl = \\agr => build_VP vp Pos Infinitive agr ;
agr = toClAgr_Reg vv.topic ;
objNeg = Pos
v = vv ;
compl = \\agr => build_VP vp Pos VInf agr ;
val = toVal_Reg vv.topic ;
objNeg = Pos ;
voice = Act
} ;
-- VS -> S -> VP
ComplVS vs s = {
v = vs ;
compl = \\_ => "," ++ vs.subj.s ++ s.s ;
agr = toClAgr_Reg vs.topic ;
objNeg = Pos
v = vs ;
compl = \\_ => "," ++ vs.subj.s ++ s.s ;
val = toVal_Reg vs.topic ;
objNeg = Pos ;
voice = Act
} ;
-- VQ -> QS -> VP
ComplVQ vq qs = {
v = vq ;
compl = \\_ => "," ++ qs.s ;
agr = toClAgr_Reg vq.topic ;
objNeg = Pos
v = vq ;
compl = \\_ => "," ++ qs.s ;
val = toVal_Reg vq.topic ;
objNeg = Pos ;
voice = Act
} ;
-- VA -> AP -> VP
ComplVA va ap = {
v = va ;
compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ;
agr = toClAgr_Reg Nom ;
objNeg = Pos
v = va ;
compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ;
val = toVal_Reg Nom ;
objNeg = Pos ;
voice = Act
} ;
-- V2 -> VPSlash
-- The (direct) object is added by ComplSlash
-- e.g. 'love (it)'
SlashV2a v2 = {
v = v2 ;
compl = \\_ => [] ;
p = v2.p ;
agr = toClAgr v2.topic (v2.p.c ! Sg) (AgP3 Sg Masc Pos) Act ; -- overriden in ComplSlash
objNeg = Pos -- overriden in ComplSlash
v = v2 ;
compl = \\_ => [] ; -- overriden in ComplSlash
val = toVal v2.topic (v2.p.c ! Sg) (AgP3 Sg Masc Pos) ;
objNeg = Pos ; -- overriden in ComplSlash
voice = Act ;
p = v2.p ;
} ;
-- TODO: val other than P3 Sg Masc
-- VPSlash -> NP -> VP
ComplSlash vp np =
let agr : Agr = np.a
in insertObjPre_Spec
{-
(\\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 = 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 = (fromAgr obj_np.a).pol
} ;
lin
-- V3 -> NP -> VPSlash ; -- give it (to her)
-- FIXME: "vīrietis runā par ābolus ar sievieti" ("a man talks to a woman about apples")
-- V3 -> NP -> VPSlash
-- e.g. 'give it (to her)'
Slash2V3 v3 np = insertObjC
(\\_ => v3.p1.s ++ np.s ! (v3.p1.c ! (fromAgr np.a).num))
{
v = v3 ;
compl = \\_ => [] ;
p = v3.p2 ;
agr = toClAgr v3.topic (v3.p1.c ! Sg) np.a Act ; -- TESTME: P1, P2 (in the focus)
objNeg = (fromAgr np.a).pol -- TESTME
v = v3 ;
compl = \\_ => [] ;
val = toVal v3.topic (v3.p1.c ! Sg) np.a ;
objNeg = (fromAgr np.a).pol ;
voice = Act ;
p = v3.p2
} ;
-- FIXME: "vīrietis runā par ābolus ar sievieti" ("a man talks to a woman about apples")
-- FIXME: the order of objects (?)
-- TODO: test val (P1 un P2) un objNeg
-- V3 -> NP -> VPSlash ; -- give (it) to her
-- V3 -> NP -> VPSlash
-- e.g. 'give (it) to her'
Slash3V3 v3 np = insertObjC
(\\_ => v3.p2.s ++ np.s ! (v3.p2.c ! (fromAgr np.a).num))
{
v = v3 ;
compl = \\_ => [] ;
p = v3.p1 ;
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 = (fromAgr np.a).pol -- TESTME
v = v3 ;
compl = \\_ => [] ;
val = toVal v3.topic (v3.p2.c ! Sg) (AgP3 Sg Masc Pos) ;
objNeg = (fromAgr np.a).pol ;
voice = Act ;
p = v3.p1
} ;
-- TODO: val other than P3 Sg Masc
-- TODO: test objNeg
-- V2V -> VP -> VPSlash
SlashV2V v2v vp = {
v = v2v ;
compl = \\agr => build_VP vp Pos Infinitive agr ;
p = v2v.p ;
agr = toClAgr_Reg Nom ;
objNeg = Pos
v = v2v ;
compl = \\agr => build_VP vp Pos VInf agr ;
val = toVal_Reg Nom ;
objNeg = Pos ;
voice = Act ;
p = v2v.p
} ;
-- V2S -> S -> VPSlash
SlashV2S v2s s = {
v = v2s ;
compl = \\_ => "," ++ v2s.subj.s ++ s.s ;
p = v2s.p ;
agr = toClAgr_Reg Nom ;
objNeg = Pos
v = v2s ;
compl = \\_ => "," ++ v2s.subj.s ++ s.s ;
val = toVal_Reg Nom ;
objNeg = Pos ;
voice = Act ;
p = v2s.p
} ;
-- V2Q -> QS -> VPSlash
SlashV2Q v2q qs = {
v = v2q ;
compl = \\_ => "," ++ qs.s ;
p = v2q.p ;
agr = toClAgr_Reg Nom ;
objNeg = Pos
v = v2q ;
compl = \\_ => "," ++ qs.s ;
val = toVal_Reg Nom ;
objNeg = Pos ;
voice = Act ;
p = v2q.p
} ;
-- V2A -> AP -> VPSlash
SlashV2A v2a ap = {
v = v2a ;
compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ;
p = v2a.p ;
agr = toClAgr_Reg Nom ;
objNeg = Pos
v = v2a ;
compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ;
val = toVal_Reg Nom ;
objNeg = Pos ;
voice = Act ;
p = v2a.p
} ;
SlashVV vv vpslash = {
v = vv ;
compl = \\agr => build_VP vpslash Pos Infinitive agr ;
p = vpslash.p ;
agr = toClAgr_Reg vv.topic ;
objNeg = Pos
-- VV -> VPSlash -> VPSlash
SlashVV vv vp = {
v = vv ;
compl = \\agr => build_VP vp Pos VInf agr ;
val = toVal_Reg vv.topic ;
objNeg = Pos ;
voice = Act ;
p = vp.p
} ;
SlashV2VNP v2v np vpslash = insertObjC
-- V2V -> NP -> VPSlash -> VPSlash
SlashV2VNP v2v np vp = insertObjC
(\\_ => 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 = toClAgr_Reg Nom ;
objNeg = Pos
v = v2v ;
compl = \\agr => build_VP vp Pos VInf agr ;
val = toVal_Reg Nom ;
objNeg = Pos ;
voice = Act ;
p = vp.p
} ;
ReflVP vpslash = insertObjPre
(\\agr => vpslash.p.s ++ reflPron ! (vpslash.p.c ! (fromAgr agr).num))
vpslash ;
-- VP -> Prep -> VPSlash
VPSlashPrep vp prep = vp ** {p = prep} ;
-- 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 (?)
UseComp comp = {
v = lin V mkVerb_Irreg_Be ;
compl = \\agr => comp.s ! agr ;
agr = toClAgr_Reg Nom ;
objNeg = Pos
-- VPSlash -> NP -> VP
ComplSlash vp np = let agr : Agr = np.a in {
v = vp.v ;
compl = \\agr => case vp.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.val.obj ;
_ => vp.p.s ++ np.s ! (vp.p.c ! (fromAgr agr).num)
}
} ++ vp.compl ! agr ;
val = vp.val ;
objNeg = (fromAgr np.a).pol ;
voice = vp.voice
} ;
-- V2 -> VP
-- TODO: vai VP nevajag papildlauku isPass? Izskatās, ka vajag - jau/tikai ComplSlash (objekta locījumam)
PassV2 v2 = {
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 Pos) Pass ; -- FIXME(?): should not be overriden in ComplSlash; P3 restriction - never used?
objNeg = Pos -- overriden in ComplSlash
val = toVal (v2.p.c ! Sg) v2.topic (AgP3 Sg Masc Pos) ;
objNeg = Pos ;
voice = Pass
} ;
-- TODO: val - should not be overriden in ComplSlash etc.?
-- TODO: val - P3 Sg Masc restriction - never used?
-- TODO: notestēt objNeg (kur tas tiek pārrakstīts - ComplSlash, AdvVP u.c.?)
-- 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} ;
-- VP -> Adv -> VP
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
-- AdV -> VP -> VP
AdVVP adv vp = insertObjPre (\\_ => adv.s) vp ;
-- VPSlash -> VP
ReflVP vp = insertObjPre (\\agr => vp.p.s ++ reflPron ! (vp.p.c ! (fromAgr agr).num)) vp ;
-- Comp -> VP
UseComp comp = {
v = lin V mkVerb_Irreg_Be ;
compl = \\agr => comp.s ! agr ;
val = toVal_Reg Nom ;
objNeg = Pos ;
voice = Act
} ;
-- AP -> Comp
CompAP ap = { s = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom } ;
-- NP -> Comp
CompNP np = { s = \\_ => np.s ! Nom } ;
-- Adv -> Comp
CompAdv a = { s = \\_ => a.s } ;
-- CN -> Comp
CompCN cn = { s = \\agr => cn.s ! Indef ! (fromAgr agr).num ! Nom } ;
oper
build_VP : ResLav.VP -> Polarity -> VerbForm -> Agr -> Str = \vp,pol,vf,agr ->
build_VP : ResLav.VP -> Polarity -> VForm -> Agr -> Str = \vp,pol,vf,agr ->
vp.v.s ! pol ! vf ++ vp.compl ! agr ;
-- VPSlash = { v : Verb ; topic : Case ; compl : Agr => Str ; p : Prep }
insertObjC : (Agr => Str) -> ResLav.VPSlash -> ResLav.VPSlash = \obj,vp ->
insertObj obj vp ** { p = vp.p } ;
-- VP = { v : Verb ; topic : Case ; compl : Agr => Str }
insertObj : (Agr => Str) -> ResLav.VP -> ResLav.VP = \obj,vp -> {
v = vp.v ;
compl = \\agr => vp.compl ! agr ++ obj ! agr ;
agr = vp.agr ;
objNeg = vp.objNeg
val = vp.val ;
objNeg = vp.objNeg ;
voice = vp.voice
} ;
-- VP = { v : Verb ; topic : Case ; compl : Agr => Str }
insertObjPre : (Agr => Str) -> ResLav.VP -> ResLav.VP = \obj,vp -> {
v = vp.v ;
compl = \\agr => obj ! agr ++ vp.compl ! agr ;
agr = vp.agr ;
objNeg = vp.objNeg
val = vp.val ;
objNeg = vp.objNeg ;
voice = vp.voice
} ;
-- FIXME: the type of the participle form - depending on what?! (currently fixed)
buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Polarity -> Polarity -> Str =
buildVerb : Verb -> VMood -> Polarity -> Agr -> Polarity -> Polarity -> Str =
\v,mood,pol,subjAgr,subjNeg,objNeg ->
let
pol_prim : Polarity = case <subjNeg, objNeg> of {
@@ -249,24 +267,24 @@ oper
} ;
agr = fromAgr subjAgr
; --# notpresent
part = v.s ! ResLav.Pos ! (Participle TsTa agr.gend agr.num Nom) --# notpresent
part = v.s ! ResLav.Pos ! (VPart Pass agr.gend agr.num Nom) --# notpresent
in case mood of {
Ind Simul tense => v.s ! pol_prim ! (Indicative agr.pers agr.num tense)
Ind Simul tense => v.s ! pol_prim ! (VInd agr.pers agr.num tense)
; --# notpresent
Ind Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (Indicative agr.pers agr.num tense) ++ part ; --# notpresent
Ind Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (VInd agr.pers agr.num tense) ++ part ; --# notpresent
-- FIXME(?): Rel _ Past => ...
Rel _ Past => ResLav.NON_EXISTENT ; --# notpresent
Rel Simul tense => v.s ! pol_prim ! (Relative tense) ; --# notpresent
Rel Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (Relative tense) ++ part ; --# notpresent
Rel Simul tense => v.s ! pol_prim ! (VRel tense) ; --# notpresent
Rel Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (VRel tense) ++ part ; --# notpresent
Deb Simul tense => mkVerb_Irreg_Be.s ! pol_prim ! (Indicative P3 Sg tense) ++ --# notpresent
v.s ! ResLav.Pos ! Debitive ; --# notpresent
Deb Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (Indicative P3 Sg tense) ++ --# notpresent
mkVerb_Irreg_Be.s ! ResLav.Pos ! (Participle TsTa Masc Sg Nom) ++ --# notpresent
v.s ! ResLav.Pos ! Debitive ; --# notpresent
Deb Simul tense => mkVerb_Irreg_Be.s ! pol_prim ! (VInd P3 Sg tense) ++ --# notpresent
v.s ! ResLav.Pos ! VDeb ; --# notpresent
Deb Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (VInd P3 Sg tense) ++ --# notpresent
mkVerb_Irreg_Be.s ! ResLav.Pos ! (VPart Pass Masc Sg Nom) ++ --# notpresent
v.s ! ResLav.Pos ! VDeb ; --# 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
Condit Simul => v.s ! pol_prim ! (VInd agr.pers agr.num ParamX.Cond) ; --# notpresent
Condit Anter => mkVerb_Irreg_Be.s ! pol_prim ! (VInd agr.pers agr.num ParamX.Cond) ++ part --# notpresent
} ;
}