forked from GitHub/gf-core
Latvian: code refactoring (an intermediate step) and few bugfixes
This commit is contained in:
@@ -18,10 +18,10 @@ lin
|
||||
UseComparA a = { s = \\d,g,n,c => a.s ! (AAdj Compar d g n c) } ;
|
||||
|
||||
ComplA2 a np = {
|
||||
s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) ++ a.p.s ++ np.s ! (a.p.c ! (fromAgr np.a).num)
|
||||
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)
|
||||
} ;
|
||||
|
||||
ReflA2 a = { s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) ++ a.p.s ++ reflPron ! (a.p.c ! n) } ;
|
||||
ReflA2 a = { s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) ++ a.prep.s ++ reflPron ! (a.prep.c ! n) } ;
|
||||
|
||||
AdAP ada ap = { s = \\d,g,n,c => ada.s ++ ap.s ! d ! g ! n ! c } ;
|
||||
|
||||
@@ -32,7 +32,7 @@ lin
|
||||
AdjOrd ord = { s = \\d,g,n,c => ord.s ! g ! c } ;
|
||||
|
||||
--TODO: nominatīvs var ne vienmēr būt, pie CAdv jāliek parametrs par locījumu
|
||||
CAdvAP cadv ap np = { s = \\d,g,n,c => cadv.s ++ ap.s ! d ! g ! n ! c ++ cadv.p ++ np.s ! Nom } ;
|
||||
CAdvAP cadv ap np = { s = \\d,g,n,c => cadv.s ++ ap.s ! d ! g ! n ! c ++ cadv.prep ++ np.s ! Nom } ;
|
||||
|
||||
UseA2 a = { s = \\d,g,n,c => a.s ! (AAdj Posit d g n c) } ;
|
||||
|
||||
|
||||
@@ -13,20 +13,20 @@ lin
|
||||
|
||||
-- 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.d) ++ cadv.p ++ np.s ! Nom } ;
|
||||
ComparAdvAdj cadv a np = { s = cadv.s ++ a.s ! (AAdv cadv.deg) ++ cadv.prep ++ np.s ! Nom } ;
|
||||
|
||||
ComparAdvAdjS cadv a s = { s = cadv.s ++ a.s ! (AAdv cadv.d) ++ cadv.p ++ s.s } ;
|
||||
ComparAdvAdjS cadv a s = { s = cadv.s ++ a.s ! (AAdv cadv.deg) ++ cadv.prep ++ s.s } ;
|
||||
|
||||
-- FIXME: postpozīcijas prievārdi
|
||||
PrepNP prep np = { s = prep.s ++ np.s ! (prep.c ! (fromAgr np.a).num) } ;
|
||||
PrepNP prep np = { s = prep.s ++ np.s ! (prep.c ! (fromAgr np.agr).num) } ;
|
||||
|
||||
AdAdv = cc2 ;
|
||||
|
||||
SubjS = cc2 ;
|
||||
|
||||
AdnCAdv cadv = {
|
||||
s = case cadv.d of {
|
||||
Posit => cadv.s ++ cadv.p ;
|
||||
s = case cadv.deg of {
|
||||
Posit => cadv.s ++ cadv.prep ;
|
||||
_ => NON_EXISTENT
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -1,89 +1,127 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
concrete CatLav of Cat = CommonX - [CAdv, Voc] ** open Prelude, ResLav in {
|
||||
concrete CatLav of Cat = CommonX - [CAdv, Voc] ** open ResLav, Prelude in {
|
||||
|
||||
flags
|
||||
|
||||
coding = utf8 ;
|
||||
optimize = all_subs ;
|
||||
|
||||
lincat
|
||||
|
||||
-- Tensed / Untensed
|
||||
-- Sentences and clauses
|
||||
|
||||
S, QS = { s : Str } ;
|
||||
RS = { s : Agr => Str } ;
|
||||
SSlash = { s : Str ; p : ResLav.Prep } ;
|
||||
|
||||
-- Sentence
|
||||
RS = { s : Agreement => Str } ;
|
||||
|
||||
Cl = { s : VMood => Polarity => Str } ;
|
||||
ClSlash = { s : VMood => Polarity => Str ; p : ResLav.Prep } ;
|
||||
|
||||
ClSlash = { s : VMood => Polarity => Str ; prep : Preposition } ;
|
||||
|
||||
SSlash = { s : Str ; prep : Preposition } ;
|
||||
|
||||
Imp = { s : Polarity => Number => Str } ;
|
||||
|
||||
-- Question
|
||||
-- Questions and interrogatives
|
||||
|
||||
QCl = { s : VMood => Polarity => Str } ;
|
||||
IP = { s : Case => Str ; n : Number } ;
|
||||
IDet = { s : Gender => Str ; n : Number } ;
|
||||
|
||||
IP = { s : Case => Str ; num : Number } ;
|
||||
|
||||
-- TODO: IComp = { s : Str ; agr : Agreement } ;
|
||||
|
||||
IDet = { s : Gender => Str ; num : Number } ;
|
||||
|
||||
IQuant = { s : Gender => Number => Str } ;
|
||||
--IComp = { s : Str ; a : ResLav.Agr } ;
|
||||
|
||||
-- Relative clause
|
||||
-- Relative clauses and pronouns
|
||||
|
||||
RCl = { s : VMood => Polarity => Agreement => Str } ;
|
||||
|
||||
RCl = { s : VMood => Polarity => Agr => Str } ;
|
||||
RP = { s : Gender => Case => Str } ;
|
||||
|
||||
-- Verb
|
||||
-- Verb phrases
|
||||
|
||||
VP = ResLav.VP ;
|
||||
VPSlash = ResLav.VP ** { p : ResLav.Prep } ; -- the object agreement
|
||||
Comp = { s : ResLav.Agr => Str } ;
|
||||
|
||||
-- Adjective
|
||||
VPSlash = ResLav.VPSlash ;
|
||||
|
||||
Comp = { s : Agreement => Str } ;
|
||||
|
||||
-- Adjectival phrases
|
||||
|
||||
AP = { s : Definiteness => Gender => Number => Case => Str } ;
|
||||
|
||||
-- Noun
|
||||
-- Nouns and noun phrases
|
||||
|
||||
CN = { s : Definiteness => Number => Case => Str ; gend : Gender } ;
|
||||
|
||||
NP = { s : Case => Str ; agr : Agreement ; pol : Polarity } ;
|
||||
|
||||
Pron = Pronoun ;
|
||||
|
||||
Det = {
|
||||
s : Gender => Case => Str ;
|
||||
num : Number ;
|
||||
defin : Definiteness ;
|
||||
pol : Polarity
|
||||
} ;
|
||||
|
||||
CN = { s : Definiteness => Number => Case => Str ; g : Gender } ;
|
||||
NP = { s : Case => Str ; a : ResLav.Agr } ;
|
||||
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 } ;
|
||||
|
||||
Quant = {
|
||||
s : Gender => Number => Case => Str ;
|
||||
defin : Definiteness ;
|
||||
pol : Polarity
|
||||
} ;
|
||||
|
||||
Num = { s : Gender => Case => Str ; num : Number ; hasCard : Bool } ;
|
||||
|
||||
Card = { s : Gender => Case => Str ; num : Number } ;
|
||||
|
||||
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 : Definiteness ; pol : Polarity } ;
|
||||
|
||||
-- Numeral
|
||||
-- Numerals
|
||||
|
||||
Numeral = { s : CardOrd => Gender => Case => Str ; n : Number } ;
|
||||
Digits = { s : CardOrd => Str ; n : Number } ;
|
||||
Numeral = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
|
||||
-- Structural
|
||||
Digits = { s : CardOrd => Str ; num : Number } ;
|
||||
|
||||
-- Structural words
|
||||
|
||||
Conj = { s1, s2 : Str ; num : Number } ;
|
||||
|
||||
Conj = { s1, s2 : Str ; n : Number } ;
|
||||
Subj = { s : Str } ;
|
||||
Prep = ResLav.Prep ;
|
||||
|
||||
-- Open lexical classes (lexicon)
|
||||
|
||||
N = { s : Number => Case => Str ; g : Gender } ;
|
||||
N2 = { s : Number => Case => Str ; g : Gender } ** { p : ResLav.Prep ; isPre : Bool } ; -- If isPre then located before the noun
|
||||
N3 = { s : Number => Case => Str ; g : Gender } ** { p1, p2 : ResLav.Prep ; isPre1, isPre2 : Bool } ;
|
||||
PN = { s : Case => Str ; g : Gender ; n : Number } ;
|
||||
Prep = Preposition ;
|
||||
|
||||
A = { s : ResLav.AForm => Str } ;
|
||||
A2 = A ** { p : ResLav.Prep } ;
|
||||
-- Words of open classes
|
||||
|
||||
V, VA = Verb ;
|
||||
VV, VQ = Verb ** { topic : Case } ;
|
||||
VS = Verb ** { subj : Subj ; topic : Case } ;
|
||||
V2A, V2Q, V2V = Verb ** { p : ResLav.Prep } ;
|
||||
V2S = Verb ** { p : ResLav.Prep ; subj : Subj } ;
|
||||
|
||||
V2 = Verb ** { p : ResLav.Prep ; topic : Case } ;
|
||||
V3 = Verb ** { p1, p2 : ResLav.Prep ; topic : Case } ;
|
||||
V, VV, VQ, VA = Verb ;
|
||||
|
||||
V2, V2V, V2Q, V2A = Verb ** { focus : Preposition } ;
|
||||
|
||||
V3 = Verb ** { focus1, focus2 : Preposition } ;
|
||||
|
||||
VS = Verb ** { conj : Subj } ;
|
||||
|
||||
V2S = Verb ** { conj : Subj ; focus : Preposition } ;
|
||||
|
||||
A = Adjective ;
|
||||
|
||||
A2 = Adjective ** { prep : Preposition } ;
|
||||
|
||||
N = Noun ;
|
||||
|
||||
N2 = Noun ** { prep : Preposition ; isPre : Bool } ;
|
||||
|
||||
N3 = Noun ** { prep1, prep2 : Preposition ; isPre1, isPre2 : Bool } ;
|
||||
|
||||
PN = ProperNoun ;
|
||||
|
||||
-- Overriden from CommonX
|
||||
|
||||
CAdv = { s, prep : Str ; deg : Degree } ;
|
||||
|
||||
CAdv = { s, p : Str ; d : Degree } ;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ flags
|
||||
|
||||
lin
|
||||
-- TODO: kāpēc citās valodās (piem., Eng, Bul) kategorijai Num (NumInt) ir lauks isNum (= True)?
|
||||
NumInt n = { s = \\_,_ => n.s ; n = Pl ; hasCard = False } ;
|
||||
NumInt n = { s = \\_,_ => n.s ; num = Pl ; hasCard = False } ;
|
||||
OrdInt n = { s = \\_,_ => n.s ++ "." } ;
|
||||
|
||||
}
|
||||
|
||||
@@ -17,12 +17,13 @@ lin
|
||||
ConjAdv = conjunctDistrSS ;
|
||||
|
||||
ConjNP conj ss = conjunctDistrTable Case conj ss ** {
|
||||
a = toAgr (fromAgr ss.a).pers (conjNumber (fromAgr ss.a).num conj.n) (fromAgr ss.a).gend Pos
|
||||
agr = toAgr (fromAgr ss.agr).pers (conjNumber (fromAgr ss.agr).num conj.num) (fromAgr ss.agr).gend;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
ConjAP conj ss = conjunctDistrTable4 Definiteness Gender Number Case conj ss ;
|
||||
|
||||
ConjRS conj ss = conjunctDistrTable Agr conj ss ;
|
||||
ConjRS conj ss = conjunctDistrTable Agreement conj ss ;
|
||||
|
||||
-- These fun's are generated from the list cat's:
|
||||
BaseS = twoSS ;
|
||||
@@ -30,21 +31,21 @@ lin
|
||||
BaseAdv = twoSS ;
|
||||
ConsAdv = consrSS comma ;
|
||||
|
||||
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 } ;
|
||||
BaseNP x y = twoTable Case x y ** { agr = conjAgr x.agr y.agr } ;
|
||||
ConsNP xs x = consrTable Case comma xs x ** { agr = conjAgr xs.agr x.agr } ;
|
||||
|
||||
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 ;
|
||||
BaseRS x y = twoTable Agreement x y ;
|
||||
ConsRS xs x = consrTable Agreement comma xs x ;
|
||||
|
||||
lincat
|
||||
|
||||
[S] = { s1, s2 : Str } ;
|
||||
[Adv] = { s1, s2 : Str } ;
|
||||
[NP] = { s1, s2 : Case => Str ; a : Agr } ;
|
||||
[NP] = { s1, s2 : Case => Str ; agr : Agreement } ;
|
||||
[AP] = { s1, s2 : Definiteness => Gender => Number => Case => Str } ;
|
||||
[RS] = { s1, s2 : Agr => Str } ;
|
||||
[RS] = { s1, s2 : Agreement => Str } ;
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ lin
|
||||
-- NP -> CN -> CN
|
||||
GenCN np cn = {
|
||||
s = \\d,n,c => np.s ! Gen ++ cn.s ! d ! n ! c ;
|
||||
g = cn.g
|
||||
gend = cn.gend
|
||||
} ;
|
||||
|
||||
aiz_Prep = mkPrep "aiz" Gen Dat ;
|
||||
@@ -38,7 +38,7 @@ lin
|
||||
they8fem_Pron = mkPronoun_They Fem ;
|
||||
it8fem_Pron = mkPronoun_It_Sg Fem ;
|
||||
|
||||
have_V3 = mkV3 (mkV "būt") nom_Prep dat_Prep Dat ;
|
||||
have_V3 = mkV3 (mkV "būt" Dat) nom_Prep dat_Prep ;
|
||||
|
||||
{-
|
||||
empty_Det num def pol = \num,def,pol -> {
|
||||
@@ -54,8 +54,8 @@ lin
|
||||
-- NP -> Quant
|
||||
GenNP np = {
|
||||
s = \\_,_,_ => np.s ! Gen ;
|
||||
d = Def ;
|
||||
pol = (fromAgr np.a).pol
|
||||
defin = Def ;
|
||||
pol = np.pol
|
||||
} ;
|
||||
|
||||
--ICompAP ap = { s = \\g,n => "cik" ++ ap.s ! Indef ! g ! n ! Nom } ;
|
||||
@@ -65,25 +65,28 @@ lin
|
||||
-- VP conjunction:
|
||||
|
||||
lincat
|
||||
VPS = { s : Agr => Str } ;
|
||||
[VPS] = { s1,s2 : Agr => Str } ;
|
||||
VPS = { s : AgrAgr => Str } ;
|
||||
[VPS] = { s1,s2 : AgrAgr => Str } ;
|
||||
|
||||
lin
|
||||
BaseVPS = twoTable Agr ;
|
||||
ConsVPS = consrTable Agr comma ;
|
||||
BaseVPS = twoTable AgrAgr ;
|
||||
ConsVPS = consrTable AgrAgr comma ;
|
||||
|
||||
-- NP -> VPS -> S
|
||||
PredVPS np vps = { s = np.s ! Nom ++ vps.s ! np.a } ;
|
||||
PredVPS np vps = { s = np.s ! Nom ++ vps.s ! { agr = np.agr ; pol = np.pol } } ;
|
||||
|
||||
-- Temp -> Pol -> VP -> VPS
|
||||
MkVPS temp pol vp = {
|
||||
s = \\subjAgr =>
|
||||
s = \\agrAgr =>
|
||||
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
|
||||
buildVerb vp.v (Ind temp.a temp.t) pol.p agrAgr.agr agrAgr.pol vp.agr.focus ++
|
||||
vp.compl ! agrAgr.agr
|
||||
} ;
|
||||
|
||||
-- Conj -> [VPS] -> VPS
|
||||
ConjVPS = conjunctDistrTable Agr ;
|
||||
ConjVPS = conjunctDistrTable AgrAgr ;
|
||||
|
||||
oper AgrAgr : Type = { agr : Agreement ; pol : Polarity } ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,59 +1,49 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
concrete IdiomLav of Idiom = CatLav ** open
|
||||
Prelude,
|
||||
ResLav,
|
||||
VerbLav,
|
||||
ParadigmsVerbsLav
|
||||
ParadigmsLav,
|
||||
ResLav,
|
||||
Prelude
|
||||
in {
|
||||
|
||||
flags
|
||||
|
||||
coding = utf8 ;
|
||||
optimize = all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
ImpersCl vp =
|
||||
let agr = AgP3 Sg Masc Pos
|
||||
let agr = AgrP3 Sg Masc
|
||||
in {
|
||||
s = \\mood,pol =>
|
||||
buildVerb vp.v mood pol agr Pos vp.objNeg ++ -- Verb
|
||||
buildVerb vp.v mood pol agr Pos vp.agr.focus ++ -- Verb
|
||||
vp.compl ! agr -- Object(s), complements, adverbial modifiers
|
||||
} ;
|
||||
|
||||
GenericCl vp =
|
||||
let agr = AgP3 Sg Masc Pos
|
||||
let agr = AgrP3 Sg Masc
|
||||
in {
|
||||
s = \\mood,pol =>
|
||||
buildVerb vp.v mood pol agr Pos vp.objNeg ++
|
||||
buildVerb vp.v mood pol agr Pos vp.agr.focus ++
|
||||
vp.compl ! agr
|
||||
} ;
|
||||
|
||||
ExistNP np =
|
||||
let
|
||||
v = lin V mkVerb_Irreg_Be ;
|
||||
agr = np.a
|
||||
in {
|
||||
s = \\mood,pol =>
|
||||
buildVerb v mood pol agr (fromAgr np.a).pol Pos ++
|
||||
np.s ! Nom
|
||||
} ;
|
||||
ExistNP np = {
|
||||
s = \\mood,pol => buildVerb (mkV "būt") mood pol np.agr np.pol Pos ++ np.s ! Nom
|
||||
} ;
|
||||
|
||||
ExistIP ip =
|
||||
let
|
||||
v = lin V mkVerb_Irreg_Be ;
|
||||
agr = AgP3 ip.n Masc Pos
|
||||
in {
|
||||
s = \\mood,pol =>
|
||||
ip.s ! Nom ++
|
||||
buildVerb v mood pol agr Pos Pos
|
||||
} ;
|
||||
ExistIP ip = {
|
||||
s = \\mood,pol => ip.s ! Nom ++ buildVerb (mkV "būt") mood pol (AgrP3 ip.num Masc) Pos Pos
|
||||
} ;
|
||||
|
||||
-- FIXME: needs restriction so that only VMood Indicative _ _ Present is allowed;
|
||||
-- can't do that on VP level...
|
||||
ProgrVP v = v ;
|
||||
|
||||
ImpPl1 vp =
|
||||
let agr = AgP1 Pl Masc
|
||||
let agr = AgrP1 Pl Masc
|
||||
in {
|
||||
s =
|
||||
vp.v.s ! Pos ! (VInd P1 Pl Pres) ++ -- Verb
|
||||
@@ -63,7 +53,7 @@ lin
|
||||
;
|
||||
|
||||
ImpP3 np vp = {
|
||||
s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a (fromAgr np.a).pol vp.objNeg ++ vp.compl ! np.a ;
|
||||
s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.agr np.pol vp.agr.focus ++ vp.compl ! np.agr ;
|
||||
} ;
|
||||
|
||||
-- FIXME: placeholder
|
||||
|
||||
@@ -14,7 +14,7 @@ flags
|
||||
|
||||
lin
|
||||
airplane_N = mkN "lidmašīna" ;
|
||||
answer_V2S = mkV2S (mkV "atbildēt" third_conjugation) dat_Prep that_Subj ; -- toP = 'answer to [Person]' = 'atbildēt [kam?]'
|
||||
answer_V2S = mkV2S (mkV "atbildēt" third_conjugation) that_Subj dat_Prep ; -- toP = 'answer to [Person]' = 'atbildēt [kam?]'
|
||||
apartment_N = mkN "dzīvoklis" ;
|
||||
apple_N = mkN "ābols" ;
|
||||
art_N = mkN "māksla" ;
|
||||
@@ -115,7 +115,7 @@ lin
|
||||
learn_V2 = mkV2 (mkV "mācīties" third_conjugation) acc_Prep ;
|
||||
leather_N = mkN "āda" ;
|
||||
leave_V2 = mkV2 (mkV "atstāt" "atstāju" "atstāju") acc_Prep ;
|
||||
like_V2 = mkV2 (mkV "patikt" "patīku" "patiku") nom_Prep Dat ;
|
||||
like_V2 = mkV2 (mkV "patikt" "patīku" "patiku" Dat) nom_Prep ;
|
||||
listen_V2 = mkV2 (mkV "klausīties" third_conjugation) acc_Prep ;
|
||||
live_V = mkV "dzīvot" second_conjugation ;
|
||||
long_A = mkA "garš" ;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
resource MorphoLav = ResLav ** {
|
||||
|
||||
flags
|
||||
optimize = all ;
|
||||
flags optimize = all ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,170 +1,229 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
concrete NounLav of Noun = CatLav ** open
|
||||
MorphoLav,
|
||||
ResLav,
|
||||
Prelude
|
||||
in {
|
||||
concrete NounLav of Noun = CatLav ** open ResLav, Prelude in {
|
||||
|
||||
flags
|
||||
|
||||
coding = utf8 ;
|
||||
optimize = all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
UseN n = { s = \\_ => n.s ; g = n.g } ;
|
||||
-- Noun phrases
|
||||
|
||||
UsePN pn = { s = pn.s ; a = AgP3 pn.n pn.g Pos } ;
|
||||
|
||||
UsePron p = { s = p.s ; a = p.a } ;
|
||||
|
||||
PredetNP pred np = {
|
||||
s = \\c => pred.s ! (fromAgr np.a).gend ++ np.s ! c ;
|
||||
a = np.a
|
||||
-- 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
|
||||
} ;
|
||||
|
||||
UseN2 n = { s = \\_ => n.s ; g = n.g } ;
|
||||
|
||||
--UseN3 n = n ;
|
||||
-- PN -> NP
|
||||
-- e.g. 'John'
|
||||
UsePN pn = { s = pn.s ; agr = AgrP3 pn.num pn.gend ; pol = Pos } ;
|
||||
|
||||
ComplN2 f x = {
|
||||
s = \\_,n,c => preOrPost f.isPre (f.p.s ++ x.s ! (f.p.c ! (fromAgr x.a).num)) (f.s ! n ! c) ;
|
||||
g = f.g
|
||||
-- Pron -> NP
|
||||
-- e.g. 'he'
|
||||
UsePron pron = { s = pron.s ; agr = pron.agr ; pol = pron.pol } ;
|
||||
|
||||
-- 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
|
||||
} ;
|
||||
|
||||
ComplN3 f x = {
|
||||
s = \\n,c => preOrPost f.isPre1 (f.p1.s ++ x.s ! (f.p1.c ! (fromAgr x.a).num)) (f.s ! n ! c) ;
|
||||
g = f.g ;
|
||||
p = f.p2 ;
|
||||
isPre = f.isPre2
|
||||
-- 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
|
||||
} ;
|
||||
|
||||
Use2N3 n = { s = n.s ; g = n.g ; p = n.p1 ; isPre = n.isPre1 } ;
|
||||
|
||||
Use3N3 n = { s = n.s ; g = n.g ; p = n.p2 ; isPre = n.isPre2 } ;
|
||||
|
||||
-- NP -> Adv -> NP
|
||||
-- e.g. 'Paris today'
|
||||
AdvNP np adv = {
|
||||
s = \\c => np.s ! c ++ adv.s ;
|
||||
a = np.a
|
||||
agr = np.agr ;
|
||||
pol = np.pol
|
||||
} ;
|
||||
|
||||
-- NP -> RS -> NP
|
||||
-- e.g. 'Paris, which is here'
|
||||
RelNP np rs = {
|
||||
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
|
||||
a = np.a
|
||||
} ;
|
||||
|
||||
DetCN det cn = {
|
||||
s = \\c => det.s ! cn.g ! c ++ cn.s ! det.d ! det.n ! c ;
|
||||
a = AgP3 det.n cn.g det.pol
|
||||
} ;
|
||||
|
||||
DetQuant quant num = {
|
||||
s = \\g,c => quant.s ! g ! num.n ! c ++ num.s ! g ! c ;
|
||||
n = num.n ;
|
||||
d = quant.d ; -- FIXME: ja ir kārtas skaitļa vārds, tad tikai noteiktās formas drīkst būt
|
||||
pol = quant.pol
|
||||
} ;
|
||||
|
||||
DetQuantOrd quant num ord = {
|
||||
s = \\g,c => quant.s ! g ! num.n ! c ++ num.s ! g ! c ++ ord.s ! g ! c ;
|
||||
n = num.n ;
|
||||
d = quant.d ; --FIXME: ja ir kārtas skaitļa vārds, tad tikai noteiktās formas drīkst būt
|
||||
pol = quant.pol
|
||||
s = \\c => np.s ! c ++ "," ++ rs.s ! np.agr ;
|
||||
agr = np.agr ;
|
||||
pol = np.pol
|
||||
} ;
|
||||
|
||||
-- Det -> NP
|
||||
-- e.g. 'these five'
|
||||
DetNP det = {
|
||||
s = \\c => det.s ! Masc ! c ;
|
||||
a = AgP3 det.n Masc det.pol
|
||||
agr = AgrP3 det.num Masc ;
|
||||
pol = det.pol
|
||||
} | {
|
||||
s = \\c => det.s ! Fem ! c ;
|
||||
a = AgP3 det.n Fem det.pol
|
||||
agr = AgrP3 det.num Fem ;
|
||||
pol = det.pol
|
||||
} ;
|
||||
|
||||
AdjCN ap cn = {
|
||||
s = \\d,n,c => ap.s ! d ! cn.g ! n ! c ++ cn.s ! d ! n ! c ;
|
||||
g = cn.g
|
||||
-- Determiners
|
||||
|
||||
-- Quant -> Num -> Det
|
||||
-- e.g. 'these five'
|
||||
DetQuant quant num = {
|
||||
s = \\gend,c => quant.s ! gend ! num.num ! c ++ num.s ! gend ! c ;
|
||||
num = num.num ;
|
||||
defin = quant.defin ; -- FIXME: ja ir kārtas skaitļa vārds, tad tikai noteiktās formas
|
||||
pol = quant.pol
|
||||
} ;
|
||||
|
||||
DefArt = {
|
||||
s = \\_,_,_ => [] ;
|
||||
d = Def ;
|
||||
pol = Pos
|
||||
-- Quant -> Num -> Ord -> Det
|
||||
-- e.g. 'these five best'
|
||||
DetQuantOrd quant num ord = {
|
||||
s = \\gend,c => quant.s ! gend ! num.num ! c ++ num.s ! gend ! c ++ ord.s ! gend ! c ;
|
||||
num = num.num ;
|
||||
defin = quant.defin ; --FIXME: ja ir kārtas skaitļa vārds, tad tikai noteiktās formas
|
||||
pol = quant.pol
|
||||
} ;
|
||||
|
||||
IndefArt = {
|
||||
s = \\_,_,_ => [] ;
|
||||
d = Indef ;
|
||||
pol = Pos
|
||||
-- Num
|
||||
NumSg = { s = \\_,_ => [] ; num = Sg ; hasCard = False } ;
|
||||
|
||||
-- Num
|
||||
NumPl = { s = \\_,_ => [] ; num = Pl ; hasCard = False } ;
|
||||
|
||||
-- Card -> Num
|
||||
NumCard card = card ** { hasCard = True } ;
|
||||
|
||||
-- Digits -> Card
|
||||
-- e.g. '51'
|
||||
NumDigits digits = { s = \\_,_ => digits.s ! NCard ; num = digits.num } ;
|
||||
|
||||
-- Numeral -> Card
|
||||
-- e.g. 'fifty-one'
|
||||
NumNumeral numeral = { s = numeral.s ! NCard ; num = numeral.num } ;
|
||||
|
||||
-- AdN -> Card -> Card
|
||||
-- e.g. 'almost 51'
|
||||
AdNum adn card = {
|
||||
s = \\gend,c => adn.s ++ card.s ! gend ! c ;
|
||||
num = card.num
|
||||
} ;
|
||||
|
||||
PossPron p = {
|
||||
s = p.poss ;
|
||||
d = Def ;
|
||||
pol = Pos
|
||||
} ;
|
||||
-- Digits -> Ord
|
||||
-- e.g. '51st'
|
||||
OrdDigits digits = { s = \\_,_ => digits.s ! NOrd } ;
|
||||
|
||||
MassNP cn = {
|
||||
s = cn.s ! Indef ! Sg ; -- FIXME: a 'šis alus'? der tak gan 'zaļš alus' gan 'zaļais alus'
|
||||
a = AgP3 Sg cn.g Pos
|
||||
} ;
|
||||
|
||||
NumSg = { s = \\_,_ => [] ; n = Sg ; hasCard = False } ;
|
||||
|
||||
NumPl = { s = \\_,_ => [] ; n = Pl ; hasCard = False } ;
|
||||
|
||||
NumCard n = n ** { hasCard = True } ;
|
||||
|
||||
NumDigits n = { s = \\g,c => n.s ! NCard ; n = n.n } ;
|
||||
|
||||
OrdDigits n = { s = \\g,c => n.s ! NOrd } ;
|
||||
|
||||
NumNumeral numeral = { s = numeral.s ! NCard ; n = numeral.n } ;
|
||||
|
||||
-- Numeral -> Ord
|
||||
-- e.g. 'fifty-first'
|
||||
OrdNumeral numeral = { s = numeral.s ! NOrd } ;
|
||||
|
||||
OrdSuperl a = { s = \\g,c => a.s ! (AAdj Superl Def g Sg c) } ;
|
||||
-- A -> Ord
|
||||
-- e.g. 'warmest'
|
||||
OrdSuperl a = { s = \\gend,c => a.s ! (AAdj Superl Def gend Sg c) } ;
|
||||
|
||||
AdNum adn num = {
|
||||
s = \\g,c => adn.s ++ num.s ! g ! c ;
|
||||
n = num.n ;
|
||||
hasCard = num.n
|
||||
-- Quant
|
||||
IndefArt = { s = \\_,_,_ => [] ; defin = Indef ; pol = Pos } ;
|
||||
|
||||
-- Quant
|
||||
DefArt = { s = \\_,_,_ => [] ; defin = Def ; pol = Pos } ;
|
||||
|
||||
-- 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
|
||||
} ;
|
||||
|
||||
AdvCN cn ad = {
|
||||
s = \\d,n,c => cn.s ! d ! n ! c ++ ad.s ;
|
||||
g = cn.g
|
||||
-- Pron -> Quant
|
||||
PossPron pron = { s = pron.poss ; defin = Def ; pol = Pos } ;
|
||||
|
||||
-- Common nouns
|
||||
|
||||
-- N -> CN
|
||||
-- e.g. 'house'
|
||||
UseN n = { s = \\_ => n.s ; gend = n.gend } ;
|
||||
|
||||
-- N2 -> NP -> CN
|
||||
-- e.g. 'mother of the king'
|
||||
ComplN2 n2 np = {
|
||||
s = \\_,num,c => preOrPost n2.isPre (n2.prep.s ++ np.s ! (n2.prep.c ! (fromAgr np.agr).num)) (n2.s ! num ! c) ;
|
||||
gend = n2.gend
|
||||
} ;
|
||||
|
||||
-- 'Pielikums'
|
||||
ApposCN cn np = {
|
||||
s = \\d,n,c => case (fromAgr np.a).num of {
|
||||
n => cn.s ! d ! n ! c ++ np.s ! c ; -- FIXME: comparison not working
|
||||
_ => NON_EXISTENT -- FIXME: pattern never reached
|
||||
} ;
|
||||
g = cn.g
|
||||
-- N3 -> NP -> N2
|
||||
-- e.g. 'distance from this city (to Paris)'
|
||||
ComplN3 n3 np = {
|
||||
s = \\num,c => preOrPost n3.isPre1 (n3.prep1.s ++ np.s ! (n3.prep1.c ! (fromAgr np.agr).num)) (n3.s ! num ! c) ;
|
||||
gend = n3.gend ;
|
||||
prep = n3.prep2 ;
|
||||
isPre = n3.isPre2
|
||||
} ;
|
||||
|
||||
-- N2 -> CN
|
||||
-- e.g. 'mother'
|
||||
UseN2 n2 = { s = \\_ => n2.s ; gend = n2.gend } ;
|
||||
|
||||
-- N3 -> N2
|
||||
-- e.g. 'distance (from this city)'
|
||||
Use2N3 n3 = { s = n3.s ; gend = n3.gend ; prep = n3.prep1 ; isPre = n3.isPre1 } ;
|
||||
|
||||
-- N3 -> N2
|
||||
-- e.g. 'distance (to Paris)'
|
||||
Use3N3 n3 = { s = n3.s ; gend = n3.gend ; prep = n3.prep2 ; isPre = n3.isPre2 } ;
|
||||
|
||||
-- AP -> CN -> CN
|
||||
-- e.g. 'big house'
|
||||
AdjCN ap cn = {
|
||||
s = \\defin,num,c => ap.s ! defin ! cn.gend ! num ! c ++ cn.s ! defin ! num ! c ;
|
||||
gend = cn.gend
|
||||
} ;
|
||||
|
||||
-- CN -> RS -> CN
|
||||
-- e.g. 'house that John bought'
|
||||
RelCN cn rs = {
|
||||
s = \\d,n,c => cn.s ! d ! n ! c ++ "," ++ rs.s ! AgP3 n cn.g Pos ;
|
||||
g = cn.g
|
||||
s = \\defin,num,c => cn.s ! defin ! num ! c ++ "," ++ rs.s ! AgrP3 num cn.gend ;
|
||||
gend = cn.gend
|
||||
} ;
|
||||
|
||||
-- CN -> Adv -> CN
|
||||
-- e.g. 'house on the hill'
|
||||
AdvCN cn adv = {
|
||||
s = \\defin,num,c => cn.s ! defin ! num ! c ++ adv.s ;
|
||||
gend = cn.gend
|
||||
} ;
|
||||
|
||||
-- CN -> SC -> CN
|
||||
-- e.g. 'question where she sleeps'
|
||||
SentCN cn sc = {
|
||||
s = \\d,n,c => cn.s ! d ! n ! c ++ "," ++ sc.s ;
|
||||
g = cn.g
|
||||
s = \\defin,num,c => cn.s ! defin ! num ! c ++ "," ++ sc.s ;
|
||||
gend = cn.gend
|
||||
} ;
|
||||
|
||||
-- FIXME: vajag šķirot noteikto/nenoteikto galotni..?
|
||||
PPartNP np v2 = {
|
||||
s = \\c => v2.s ! Pos ! (VPart Pass (fromAgr np.a).gend (fromAgr np.a).num c) ++ np.s ! c ;
|
||||
a = np.a
|
||||
} ;
|
||||
-- Apposition
|
||||
|
||||
-- TODO: šim vajag -ts -ta divdabjus (+ noteiktās formas tiem)
|
||||
--PPartNP np v2 = {
|
||||
-- s = \\c => np.s ! c ++ v2.s ! VPPart ;
|
||||
-- a = np.a
|
||||
--} ;
|
||||
--SentCN cn sc = { s = \\n,c => cn.s ! n ! c ++ sc.s ; g = cn.g } ;
|
||||
-- CN -> NP -> CN
|
||||
-- e.g. 'city Paris', 'numbers x and y'
|
||||
ApposCN cn np =
|
||||
let num : Number = (fromAgr np.agr).num in {
|
||||
s = \\defin,num,c => cn.s ! defin ! num ! c ++ np.s ! c ;
|
||||
gend = cn.gend
|
||||
} ;
|
||||
|
||||
-- TODO: Possessive and partitive constructs
|
||||
|
||||
-- PossNP : CN -> NP -> CN
|
||||
-- e.g. 'house of Paris', 'house of mine'
|
||||
|
||||
-- PartNP : CN -> NP -> CN
|
||||
-- e.g. 'glass of wine'
|
||||
|
||||
-- CountNP : Det -> NP -> NP
|
||||
-- e.g. 'three of them', 'some of the boys'
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
concrete NumeralLav of Numeral = CatLav ** open
|
||||
ResLav,
|
||||
ParadigmsLav
|
||||
in {
|
||||
concrete NumeralLav of Numeral = CatLav ** open ResLav, ParadigmsLav in {
|
||||
|
||||
flags
|
||||
coding = utf8 ;
|
||||
flags coding = utf8 ;
|
||||
|
||||
lincat
|
||||
|
||||
-- TODO: formas, kas pieprasa ģenitīvu - tūkstotis grāmatu, trīs simti meiteņu
|
||||
Digit = { s : DForm => CardOrd => Gender => Case => Str } ;
|
||||
Sub10 = { s : CardOrd => Gender => Case => Str ; n : Number } ;
|
||||
Sub100 = { s : CardOrd => Gender => Case => Str ; n : Number } ;
|
||||
Sub1000 = { s : CardOrd => Gender => Case => Str ; n : Number } ;
|
||||
Sub1000000 = { s : CardOrd => Gender => Case => Str ; n : Number } ;
|
||||
Sub10 = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
Sub100 = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
Sub1000 = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
Sub1000000 = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
|
||||
lin
|
||||
|
||||
num x = x ;
|
||||
|
||||
n2 = mkNumReg "divi" "otrais" Pl ;
|
||||
@@ -44,55 +42,55 @@ lin
|
||||
n8 = mkNumReg "astoņi" "astotais" Pl ;
|
||||
n9 = mkNumReg "deviņi" "devītais" 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 ! DTen } ** { n = Pl } ;
|
||||
pot01 = { s = viens.s ! DUnit } ** { num = Sg } ;
|
||||
pot0 d = { s = d.s ! DUnit } ** { num = Pl } ;
|
||||
pot110 = { s = viens.s ! DTen } ** { num = Pl } ;
|
||||
pot111 = { s = viens.s ! DTeen } ** { num = Pl } ;
|
||||
pot1to19 d = { s = d.s ! DTeen } ** { num = Pl } ;
|
||||
pot0as1 n = { s = n.s ; num = n.num } ;
|
||||
pot1 d = { s = d.s ! DTen } ** { num = Pl } ;
|
||||
|
||||
pot1plus d e = {
|
||||
s = \\o,g,c => d.s ! DTen ! NCard ! Masc ! Nom ++ e.s ! o ! g ! c ;
|
||||
n = e.n
|
||||
num = e.num
|
||||
} ;
|
||||
|
||||
pot1as2 n = n ;
|
||||
|
||||
-- FIXME: nav īsti labi, kārtas skaitlim ir jābūt 'trīssimtais' utml
|
||||
pot2 d = {
|
||||
s = \\o,g,c => d.s ! NCard ! Masc ! Nom ++ simts ! o ! g ! d.n ! c ;
|
||||
n = Pl
|
||||
s = \\o,g,c => d.s ! NCard ! Masc ! Nom ++ simts ! o ! g ! d.num ! c ;
|
||||
num = Pl
|
||||
} ;
|
||||
|
||||
pot2plus d e = {
|
||||
s = \\o,g,c => d.s ! NCard ! Masc ! Nom ++ simts ! NCard ! Masc ! d.n ! Nom ++ e.s ! o ! g ! c ;
|
||||
n = e.n
|
||||
s = \\o,g,c => d.s ! NCard ! Masc ! Nom ++ simts ! NCard ! Masc ! d.num ! Nom ++ e.s ! o ! g ! c ;
|
||||
num = e.num
|
||||
} ;
|
||||
|
||||
pot2as3 n = n ;
|
||||
|
||||
pot3 d = {
|
||||
s = \\o,g,c => d.s ! NCard ! Masc ! Nom ++ tuukstotis ! o ! g ! d.n ! c ;
|
||||
n = Pl
|
||||
s = \\o,g,c => d.s ! NCard ! Masc ! Nom ++ tuukstotis ! o ! g ! d.num ! c ;
|
||||
num = Pl
|
||||
} ;
|
||||
|
||||
pot3plus d e = {
|
||||
s = \\o,g,c => d.s ! NCard ! Masc ! Nom ++ tuukstotis ! NCard ! Masc ! d.n ! Nom ++ e.s ! o ! g ! c ;
|
||||
n = e.n
|
||||
s = \\o,g,c => d.s ! NCard ! Masc ! Nom ++ tuukstotis ! NCard ! Masc ! d.num ! Nom ++ e.s ! o ! g ! c ;
|
||||
num = e.num
|
||||
} ;
|
||||
|
||||
-- Numerals as sequences of digits:
|
||||
|
||||
lincat
|
||||
Dig = { n : Number ; s : CardOrd => Str } ;
|
||||
Dig = { num : Number ; s : CardOrd => Str } ;
|
||||
|
||||
lin
|
||||
IDig d = d ;
|
||||
|
||||
IIDig d i = {
|
||||
s = \\o => d.s ! NCard ++ i.s ! o ;
|
||||
n = Pl ; -- FIXME: 1 cilvēks, 11 cilvēki, 21 cilvēks, ...
|
||||
num = Pl ; -- FIXME: 1 cilvēks, 11 cilvēki, 21 cilvēks, ...
|
||||
} ;
|
||||
|
||||
D_0 = mkDig "0" ;
|
||||
@@ -111,7 +109,7 @@ oper
|
||||
|
||||
mk2Dig : Str -> Number -> Dig = \c,n -> lin Dig {
|
||||
s = table { NCard => c ; NOrd => c + "." } ;
|
||||
n = n
|
||||
num = n
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
|
||||
resource ParadigmsAdjectivesLav = open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
ResLav,
|
||||
CatLav
|
||||
in {
|
||||
resource ParadigmsAdjectivesLav = open ResLav, CatLav, Predef, Prelude in {
|
||||
|
||||
flags
|
||||
coding = utf8;
|
||||
flags coding = utf8 ;
|
||||
|
||||
oper
|
||||
--Adj : Type = {s : Degree => Definite => Gender => Number => Case => Str} ;
|
||||
Adj : Type = {s : AForm => Str} ;
|
||||
|
||||
-- ADJECTIVES
|
||||
|
||||
@@ -21,7 +13,7 @@ oper
|
||||
-- To keep the code and user interface (parameters) simple, Masc lemmas are expected.
|
||||
|
||||
-- No parameters - default assumptions (type)
|
||||
mkAdjective : Str -> Adj = \lemma ->
|
||||
mkAdjective : Str -> Adjective = \lemma ->
|
||||
case lemma of {
|
||||
s + "ais" => mkAdjective_Rel lemma ;
|
||||
s + ("s"|"š") => mkAdjective_Qual lemma ;
|
||||
@@ -29,7 +21,7 @@ oper
|
||||
} ;
|
||||
|
||||
-- Specified type - no defaults
|
||||
mkAdjectiveByType : Str -> AType -> Adj = \lemma,type ->
|
||||
mkAdjectiveByType : Str -> AType -> Adjective = \lemma,type ->
|
||||
case type of {
|
||||
AQual => mkAdjective_Qual lemma ;
|
||||
ARel => mkAdjective_Rel lemma ;
|
||||
@@ -37,7 +29,7 @@ oper
|
||||
} ;
|
||||
|
||||
-- Indeclinable adjective: theoretically, any #vowel ending
|
||||
mkAdjective_Indecl : Str -> Adj = \lemma -> {
|
||||
mkAdjective_Indecl : Str -> Adjective = \lemma -> {
|
||||
s = table{
|
||||
AAdj Superl Indef _ _ _ => NON_EXISTENT ;
|
||||
AAdj _ _ _ _ _ => lemma ;
|
||||
@@ -46,7 +38,7 @@ oper
|
||||
} ;
|
||||
|
||||
-- Qualitative adjective: -s, -š
|
||||
mkAdjective_Qual : Str -> Adj = \lemma -> {
|
||||
mkAdjective_Qual : Str -> Adjective = \lemma -> {
|
||||
s = table {
|
||||
AAdj Posit d g n c => mkAdjective_Pos lemma d ! g ! n ! c ;
|
||||
AAdj Compar d g n c => mkAdjective_Comp lemma d ! g ! n ! c ;
|
||||
@@ -57,7 +49,7 @@ oper
|
||||
} ;
|
||||
|
||||
-- Relative adjective: -ais (Def only); -s, -š (Indef and Def)
|
||||
mkAdjective_Rel : Str -> Adj = \lemma -> {
|
||||
mkAdjective_Rel : Str -> Adjective = \lemma -> {
|
||||
s = table {
|
||||
AAdj Posit Def g n c => mkAdjective_Pos lemma Def ! g ! n ! c ;
|
||||
AAdj Posit Indef g n c => case lemma of {
|
||||
@@ -74,7 +66,7 @@ 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 -> Voice -> Adj = \v,p -> {
|
||||
mkAdjective_Participle : Verb -> Voice -> Adjective = \v,p -> {
|
||||
s = table {
|
||||
AAdj Posit Indef g n c => v.s ! Pos ! (VPart p g n c) ;
|
||||
_ => NON_EXISTENT
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
resource ParadigmsLav = open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
ResLav,
|
||||
CatLav,
|
||||
ParadigmsNounsLav,
|
||||
ParadigmsPronounsLav,
|
||||
ParadigmsAdjectivesLav,
|
||||
ParadigmsVerbsLav,
|
||||
ParadigmsPronounsLav,
|
||||
ResLav,
|
||||
CatLav
|
||||
Prelude,
|
||||
Predef
|
||||
in {
|
||||
|
||||
flags coding = utf8 ;
|
||||
|
||||
oper
|
||||
|
||||
masculine : Gender = Masc ;
|
||||
feminine : Gender = Fem ;
|
||||
|
||||
@@ -53,12 +54,12 @@ oper
|
||||
} ;
|
||||
|
||||
mkN2 = overload {
|
||||
mkN2 : N -> ResLav.Prep -> N2 = \n,p -> lin N2 n ** { p = p ; isPre = True } ;
|
||||
mkN2 : N -> ResLav.Prep -> Bool -> N2 = \n,p,isPre -> lin N2 n ** { p = p ; isPre = isPre } ;
|
||||
mkN2 : N -> Preposition -> N2 = \n,p -> lin N2 n ** { prep = p ; isPre = True } ;
|
||||
mkN2 : N -> Preposition -> Bool -> N2 = \n,p,pp -> lin N2 n ** { prep = p ; isPre = pp } ;
|
||||
} ;
|
||||
|
||||
mkN3 : N -> ResLav.Prep -> ResLav.Prep -> N3 = \n,p1,p2 ->
|
||||
lin N3 n ** { p1 = p1 ; p2 = p2 ; isPre1 = False ; isPre2 = False } ;
|
||||
mkN3 : N -> Preposition -> Preposition -> N3 = \n,p1,p2 ->
|
||||
lin N3 n ** { prep1 = p1 ; prep2 = p2 ; isPre1 = False ; isPre2 = False } ;
|
||||
|
||||
mkA = overload {
|
||||
mkA : (lemma : Str) -> A = \s -> lin A (mkAdjective s) ;
|
||||
@@ -71,29 +72,35 @@ oper
|
||||
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 ...
|
||||
mkAS : A -> AS =\a -> lin A a ;
|
||||
mkA2S : A -> ResLav.Prep -> A2S =\a,p -> lin A2 (a ** { p = p }) ;
|
||||
mkAV : A -> AV = \a -> lin A a ;
|
||||
mkA2V : A -> ResLav.Prep -> A2V = \a,p -> lin A2 (a ** { p = p }) ;
|
||||
AS, AV = A ;
|
||||
mkAS : A -> AS = \a -> lin A a ;
|
||||
mkAV : A -> AV = \a -> lin A a ;
|
||||
|
||||
mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** { prep = p }) ;
|
||||
|
||||
A2S, A2V = A2 ;
|
||||
mkA2S : A -> Prep -> A2S =\a,p -> lin A2 (a ** { prep = p }) ;
|
||||
mkA2V : A -> Prep -> A2V = \a,p -> lin A2 (a ** { prep = p }) ;
|
||||
|
||||
AS, AV : Type = { s : AForm => Str } ;
|
||||
A2S, A2V : Type = { s : AForm => Str ; p : ResLav.Prep };
|
||||
-- Verbs
|
||||
|
||||
mkV = overload {
|
||||
mkV : (lemma : Str) -> V = \l -> lin V (mkVerb_Irreg l) ;
|
||||
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) ;
|
||||
mkV : Str -> V = \s -> lin V (mkVerb_Irreg s Nom) ;
|
||||
mkV : Str -> Case -> V = \s,c -> lin V (mkVerb_Irreg s c) ;
|
||||
mkV : Str -> Conjugation -> V = \s,c -> lin V (mkVerb s c Nom) ;
|
||||
mkV : Str -> Conjugation -> Case -> V = \s,conj,c -> lin V (mkVerb s conj c) ;
|
||||
mkV : Str -> Str -> Str -> V = \s1,s2,s3 -> lin V (mkVerbC1 s1 s2 s3 Nom) ;
|
||||
mkV : Str -> Str -> Str -> Case -> V = \s1,s2,s3,c -> lin V (mkVerbC1 s1 s2 s3 c) ;
|
||||
} ;
|
||||
|
||||
mkV2 = overload {
|
||||
mkV2 : V -> ResLav.Prep -> V2 = \v,p -> lin V2 v ** { p = p ; topic = Nom } ;
|
||||
mkV2 : V -> ResLav.Prep -> Case -> V2 = \v,p,c -> lin V2 v ** { p = p ; topic = c } ;
|
||||
mkV2 : V -> V2 = \v -> lin V2 v ** { focus = acc_Prep } ;
|
||||
mkV2 : V -> Preposition -> V2 = \v,p -> lin V2 v ** { focus = p } ;
|
||||
} ;
|
||||
|
||||
|
||||
mkVS = overload {
|
||||
mkVS : V -> Subj -> VS = \v,s -> lin VS v ** { subj = s ; topic = Nom } ;
|
||||
mkVS : V -> Subj -> Case -> VS = \v,s,c -> lin VS v ** { subj = s ; topic = c } ;
|
||||
mkVS : V -> Subj -> VS = \v,c -> lin VS v ** { conj = c ; topic = Nom } ;
|
||||
mkVS : V -> Subj -> Case -> VS = \v,c,s -> lin VS v ** { conj = c ; topic = s } ;
|
||||
} ;
|
||||
|
||||
mkVQ = overload {
|
||||
@@ -107,25 +114,25 @@ oper
|
||||
} ;
|
||||
|
||||
mkV3 = overload {
|
||||
mkV3 : V -> ResLav.Prep -> ResLav.Prep -> V3 = \v,p1,p2 ->
|
||||
lin V3 v ** { p1 = p1 ; p2 = p2 ; topic = Nom } ;
|
||||
mkV3 : V -> ResLav.Prep -> ResLav.Prep -> Case -> V3 = \v,p1,p2,c ->
|
||||
lin V3 v ** { p1 = p1 ; p2 = p2 ; topic = c } ;
|
||||
mkV3 : V -> Preposition -> Preposition -> V3 = \v,p1,p2 ->
|
||||
lin V3 v ** { topic = Nom ; focus1 = p1 ; focus2 = p2 } ;
|
||||
mkV3 : V -> Case -> Preposition -> Preposition -> V3 = \v,c,p1,p2 ->
|
||||
lin V3 v ** { topic = c ; focus1 = p1 ; focus2 = p2 } ;
|
||||
} ;
|
||||
|
||||
mkVA : V -> VA = \v -> lin VA v ;
|
||||
|
||||
mkV2S : V -> ResLav.Prep -> Subj -> V2S = \v,p,s -> lin V2S v ** { p = p ; subj = s } ;
|
||||
mkV2A : V -> ResLav.Prep -> V2A = \v,p -> lin V2A v ** { p = p } ;
|
||||
mkV2Q : V -> ResLav.Prep -> V2Q = \v,p -> lin V2Q v ** { p = p } ;
|
||||
mkV2V : V -> ResLav.Prep -> V2V = \v,p -> lin V2V v ** { p = p } ;
|
||||
mkV2S : V -> Subj -> Preposition -> V2S = \v,c,o -> lin V2S v ** { conj = c ; focus = o } ;
|
||||
mkV2A : V -> Preposition -> V2A = \v,o -> lin V2A v ** { focus = o } ;
|
||||
mkV2Q : V -> Preposition -> V2Q = \v,o -> lin V2Q v ** { focus = o } ;
|
||||
mkV2V : V -> Preposition -> V2V = \v,o -> lin V2V v ** { focus = o } ;
|
||||
|
||||
mkCAdv : Str -> Str -> Degree -> CAdv = \s,p,d -> { s = s ; p = p ; d = d ; lock_CAdv = <> } ;
|
||||
mkCAdv : Str -> Str -> Degree -> CAdv = \s,p,d -> lin CAdv { s = s ; prep = p ; deg = d } ;
|
||||
|
||||
mkPrep = overload {
|
||||
mkPrep : Str -> Case -> Case -> ResLav.Prep = \prep,sg,pl ->
|
||||
mkPrep : Str -> Case -> Case -> Preposition = \prep,sg,pl ->
|
||||
lin Prep { s = prep ; c = table { Sg => sg ; Pl => pl } } ;
|
||||
mkPrep : Case -> ResLav.Prep = \c -> lin Prep { s = [] ; c = table { _ => c } } ;
|
||||
mkPrep : Case -> Preposition = \c -> lin Prep { s = [] ; c = table { _ => c } } ;
|
||||
} ;
|
||||
|
||||
-- empty fake prepositions for valences
|
||||
@@ -148,7 +155,7 @@ oper
|
||||
mkConj : Str -> Str -> Number -> Conj = mk2Conj ;
|
||||
} ;
|
||||
|
||||
mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> lin Conj (sd2 x y ** { n = n }) ;
|
||||
mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> lin Conj (sd2 x y ** { num = n }) ;
|
||||
|
||||
viens = mkNumSpec "viens" "pirmais" "vien" "" Sg ;
|
||||
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
resource ParadigmsNounsLav = open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
ResLav,
|
||||
CatLav
|
||||
in {
|
||||
resource ParadigmsNounsLav = open ResLav, CatLav, Prelude, Predef in {
|
||||
|
||||
flags
|
||||
coding = utf8 ;
|
||||
flags coding = utf8 ;
|
||||
|
||||
oper
|
||||
Noun : Type = { s : Number => Case => Str ; g : Gender } ;
|
||||
PNoun : Type = { s : Case => Str ; g : Gender ; n : Number } ;
|
||||
|
||||
masculine : Gender = Masc ;
|
||||
feminine : Gender = Fem ;
|
||||
@@ -21,13 +13,12 @@ oper
|
||||
mkNoun : Str -> Noun = \lemma ->
|
||||
mkNounByPal lemma True ;
|
||||
|
||||
mkProperNoun : Str -> Number -> PNoun = \lemma,number ->
|
||||
let noun = mkNoun lemma
|
||||
in {
|
||||
s = \\c => noun.s ! number ! c ;
|
||||
g = noun.g ;
|
||||
n = number
|
||||
} ;
|
||||
mkProperNoun : Str -> Number -> ProperNoun = \lemma,num ->
|
||||
let n = mkNoun lemma in {
|
||||
s = \\c => n.s ! num ! c ;
|
||||
gend = n.gend ;
|
||||
num = num
|
||||
} ;
|
||||
|
||||
{-
|
||||
mkCardinalNumeral : Str -> CardinalNumeral = \lemma ->
|
||||
@@ -113,7 +104,7 @@ oper
|
||||
-- Expected endings: #vowel
|
||||
mkNoun_D0 : Str -> Gender -> Noun = \lemma,gend -> {
|
||||
s = \\_,_ => lemma ;
|
||||
g = gend
|
||||
gend = gend
|
||||
} ;
|
||||
|
||||
-- Expected endings of a D1 lemma:
|
||||
@@ -143,7 +134,7 @@ oper
|
||||
Voc => stem + "i"
|
||||
}
|
||||
} ;
|
||||
g = Masc
|
||||
gend = Masc
|
||||
} ;
|
||||
|
||||
-- Expected endings of a D2 lemma:
|
||||
@@ -174,7 +165,7 @@ oper
|
||||
Voc => palatalize stem pal + "i"
|
||||
}
|
||||
} ;
|
||||
g = Masc
|
||||
gend = Masc
|
||||
} ;
|
||||
|
||||
-- Expected endings of a D3 lemma:
|
||||
@@ -201,7 +192,7 @@ oper
|
||||
Voc => stem + "i"
|
||||
}
|
||||
} ;
|
||||
g = Masc
|
||||
gend = Masc
|
||||
} ;
|
||||
|
||||
-- Expected endings of a D4 lemma:
|
||||
@@ -228,7 +219,7 @@ oper
|
||||
Voc => stem + "as"
|
||||
}
|
||||
} ;
|
||||
g = gend
|
||||
gend = gend
|
||||
} ;
|
||||
|
||||
-- Expected endings of a D5 lemma:
|
||||
@@ -255,7 +246,7 @@ oper
|
||||
Voc => stem + "es"
|
||||
}
|
||||
} ;
|
||||
g = gend
|
||||
gend = gend
|
||||
} ;
|
||||
|
||||
-- Expected endings of a D6 lemma:
|
||||
@@ -285,7 +276,7 @@ oper
|
||||
Voc => stem + "is"
|
||||
}
|
||||
} ;
|
||||
g = gend
|
||||
gend = gend
|
||||
} ;
|
||||
|
||||
-- Reflexive noun
|
||||
@@ -311,7 +302,7 @@ oper
|
||||
Voc => stem + "šanās"
|
||||
}
|
||||
} ;
|
||||
g = Fem
|
||||
gend = Fem
|
||||
} ;
|
||||
|
||||
-- Exceptions
|
||||
|
||||
@@ -1,31 +1,25 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
resource ParadigmsPronounsLav = open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
ResLav,
|
||||
CatLav
|
||||
in {
|
||||
resource ParadigmsPronounsLav = open ResLav, CatLav, Prelude, Predef in {
|
||||
|
||||
flags
|
||||
coding = utf8 ;
|
||||
flags coding = utf8 ;
|
||||
|
||||
oper
|
||||
|
||||
PronGend : Type = { s : Gender => Number => Case => Str } ;
|
||||
Pron : Type = { s : Case => Str ; a : ResLav.Agr ; poss : Gender => Number => Case => Str } ;
|
||||
|
||||
-- PRONOUNS (incl. 'determiners')
|
||||
-- Pronouns (incl. "determiners")
|
||||
|
||||
mkPronoun_I : Gender -> Pron = \g -> {
|
||||
mkPronoun_I : Gender -> Pronoun = \gend -> {
|
||||
s = table {
|
||||
Nom => "es" ;
|
||||
Gen => "manis" ;
|
||||
Dat => "man" ;
|
||||
Acc => "mani" ;
|
||||
Loc => "manī" ;
|
||||
ResLav.Voc => NON_EXISTENT
|
||||
Voc => NON_EXISTENT
|
||||
} ;
|
||||
a = AgP1 Sg g ;
|
||||
agr = AgrP1 Sg gend ;
|
||||
poss = table {
|
||||
Masc => table {
|
||||
Sg => table {
|
||||
@@ -34,7 +28,7 @@ oper
|
||||
Dat => "manam" ;
|
||||
Acc => "manu" ;
|
||||
Loc => "manā" ;
|
||||
ResLav.Voc => "mans"
|
||||
Voc => "mans"
|
||||
} ;
|
||||
Pl => table {
|
||||
Nom => "mani" ;
|
||||
@@ -42,7 +36,7 @@ oper
|
||||
Dat => "maniem" ;
|
||||
Acc => "manus" ;
|
||||
Loc => "manos" ;
|
||||
ResLav.Voc => "mani"
|
||||
Voc => "mani"
|
||||
}
|
||||
} ;
|
||||
Fem => table {
|
||||
@@ -52,7 +46,7 @@ oper
|
||||
Dat => "manai" ;
|
||||
Acc => "manu" ;
|
||||
Loc => "manā" ;
|
||||
ResLav.Voc => "mana"
|
||||
Voc => "mana"
|
||||
} ;
|
||||
Pl => table {
|
||||
Nom => "manas" ;
|
||||
@@ -60,35 +54,37 @@ oper
|
||||
Dat => "manām" ;
|
||||
Acc => "manas" ;
|
||||
Loc => "manās" ;
|
||||
ResLav.Voc => "manas"
|
||||
Voc => "manas"
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
mkPronoun_We : Gender -> Pron = \g -> {
|
||||
mkPronoun_We : Gender -> Pronoun = \gend -> {
|
||||
s = table {
|
||||
Nom => "mēs" ;
|
||||
Gen => "mūsu" ;
|
||||
Dat => "mums" ;
|
||||
Acc => "mūs" ;
|
||||
Loc => "mūsos" ;
|
||||
ResLav.Voc => NON_EXISTENT
|
||||
Voc => NON_EXISTENT
|
||||
} ;
|
||||
a = AgP1 Pl g ;
|
||||
poss = \\_,_,_ => "mūsu"
|
||||
agr = AgrP1 Pl gend ;
|
||||
poss = \\_,_,_ => "mūsu" ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
mkPronoun_You_Sg : Gender -> Pron = \g -> {
|
||||
mkPronoun_You_Sg : Gender -> Pronoun = \gend -> {
|
||||
s = table {
|
||||
Nom => "tu" ;
|
||||
Gen => "tevis" ;
|
||||
Dat => "tev" ;
|
||||
Acc => "tevi" ;
|
||||
Loc => "tevī" ;
|
||||
ResLav.Voc => "tu"
|
||||
Voc => "tu"
|
||||
} ;
|
||||
a = AgP2 Sg g ;
|
||||
agr = AgrP2 Sg gend ;
|
||||
poss = table {
|
||||
Masc => table {
|
||||
Sg => table {
|
||||
@@ -97,7 +93,7 @@ oper
|
||||
Dat => "tavam" ;
|
||||
Acc => "tavu" ;
|
||||
Loc => "tavā" ;
|
||||
ResLav.Voc => "tavs"
|
||||
Voc => "tavs"
|
||||
};
|
||||
Pl => table {
|
||||
Nom => "tavi" ;
|
||||
@@ -105,7 +101,7 @@ oper
|
||||
Dat => "taviem" ;
|
||||
Acc => "tavus" ;
|
||||
Loc => "tavos" ;
|
||||
ResLav.Voc => "tavi"
|
||||
Voc => "tavi"
|
||||
}
|
||||
} ;
|
||||
Fem => table {
|
||||
@@ -115,7 +111,7 @@ oper
|
||||
Dat => "tavai" ;
|
||||
Acc => "tavu" ;
|
||||
Loc => "tavā" ;
|
||||
ResLav.Voc => "tava"
|
||||
Voc => "tava"
|
||||
};
|
||||
Pl => table {
|
||||
Nom => "tavas" ;
|
||||
@@ -123,48 +119,53 @@ oper
|
||||
Dat => "tavām" ;
|
||||
Acc => "tavas" ;
|
||||
Loc => "tavās" ;
|
||||
ResLav.Voc => "tavas"
|
||||
Voc => "tavas"
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
mkPronoun_You_Pol : Gender -> Pron = \g -> {
|
||||
mkPronoun_You_Pol : Gender -> Pronoun = \gend -> {
|
||||
s = table {
|
||||
Nom => "Jūs" ;
|
||||
Gen => "Jūsu" ;
|
||||
Dat => "Jums" ;
|
||||
Acc => "Jūs" ;
|
||||
Loc => "Jūsos" ;
|
||||
ResLav.Voc => "Jūs"
|
||||
Voc => "Jūs"
|
||||
} ;
|
||||
a = AgP2 Pl g ; -- FIXME: in the case of a predicate nominal: copula=Pl, complement=Sg
|
||||
poss = \\_,_,_ => "Jūsu"
|
||||
agr = AgrP2 Pl gend ; -- FIXME: in the case of a predicate nominal: copula=Pl, complement=Sg
|
||||
poss = \\_,_,_ => "Jūsu" ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
mkPronoun_You_Pl : Gender -> Pron = \g -> {
|
||||
mkPronoun_You_Pl : Gender -> Pronoun = \gend -> {
|
||||
s = table {
|
||||
Nom => "jūs" ;
|
||||
Gen => "jūsu" ;
|
||||
Dat => "jums" ;
|
||||
Acc => "jūs" ;
|
||||
Loc => "jūsos" ;
|
||||
ResLav.Voc => "jūs"
|
||||
Voc => "jūs"
|
||||
} ;
|
||||
a = AgP2 Pl g ;
|
||||
poss = \\_,_,_ => "jūsu"
|
||||
agr = AgrP2 Pl gend ;
|
||||
poss = \\_,_,_ => "jūsu" ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
mkPronoun_They : Gender -> Pron = \g -> {
|
||||
s = \\c => (mkPronoun_Gend "viņš").s ! g ! Pl ! c ;
|
||||
a = AgP3 Pl g Pos ;
|
||||
poss = \\_,_,_ => "viņu"
|
||||
mkPronoun_They : Gender -> Pronoun = \gend -> {
|
||||
s = \\c => (mkPronoun_Gend "viņš").s ! gend ! Pl ! c ;
|
||||
agr = AgrP3 Pl gend ;
|
||||
poss = \\_,_,_ => "viņu" ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
mkPronoun_It_Sg : Gender -> Pron = \g -> {
|
||||
s = \\c => (mkPronoun_ThisThat That).s ! g ! Sg ! c ;
|
||||
a = AgP3 Sg g Pos ;
|
||||
poss = \\_,_,_ => case g of { Masc => "tā" ; Fem => "tās" }
|
||||
mkPronoun_It_Sg : Gender -> Pronoun = \gend -> {
|
||||
s = \\c => (mkPronoun_ThisThat That).s ! gend ! Sg ! c ;
|
||||
agr = AgrP3 Sg gend ;
|
||||
poss = \\_,_,_ => case gend of { Masc => "tā" ; Fem => "tās" } ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
-- Gender=>Number=>Case P3 pronouns
|
||||
@@ -268,7 +269,7 @@ oper
|
||||
} ;
|
||||
|
||||
-- Everything, something, nothing, i.e., all that end with "kas"
|
||||
mkPronoun_Thing : Str -> Polarity -> Pron = \lemma,pol ->
|
||||
mkPronoun_Thing : Str -> Polarity -> Pronoun = \lemma,pol ->
|
||||
let stem : Str = Predef.tk 3 lemma
|
||||
in {
|
||||
s = \\c => table {
|
||||
@@ -279,15 +280,17 @@ oper
|
||||
Loc => case stem of { "kaut" => stem ++ "kur" ; _ => stem + "kur" } ;
|
||||
Voc => NON_EXISTENT
|
||||
} ! c ;
|
||||
a = AgP3 Sg Masc pol ;
|
||||
poss = \\_,_,_ => case stem of { "kaut" => stem ++ "kā" ; _ => stem + "kā" }
|
||||
agr = AgrP3 Sg Masc ;
|
||||
poss = \\_,_,_ => case stem of { "kaut" => stem ++ "kā" ; _ => stem + "kā" } ;
|
||||
pol = pol
|
||||
} ;
|
||||
|
||||
-- Everybody, somebody, nobody
|
||||
mkPronoun_Body : Str -> Polarity -> Pron = \lemma,pol -> {
|
||||
mkPronoun_Body : Str -> Polarity -> Pronoun = \lemma,pol -> {
|
||||
s = \\c => (mkPronoun_Gend lemma).s ! Masc ! Sg ! c ;
|
||||
a = AgP3 Sg Masc pol ;
|
||||
agr = AgrP3 Sg Masc ;
|
||||
poss = \\_,_,_ => (mkPronoun_Gend lemma).s ! Masc ! Sg ! Gen ;
|
||||
pol = pol
|
||||
} ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -1,32 +1,29 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
resource ParadigmsVerbsLav = open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
ResLav,
|
||||
CatLav
|
||||
in {
|
||||
resource ParadigmsVerbsLav = open ResLav, CatLav, Prelude, Predef in {
|
||||
|
||||
flags
|
||||
coding = utf8 ;
|
||||
flags coding = utf8 ;
|
||||
|
||||
oper
|
||||
|
||||
Verb_TMP : Type = {s : VForm => Str} ;
|
||||
|
||||
-- Second and third conjugations
|
||||
mkVerb : Str -> Conjugation -> Verb = \lemma,conj -> {
|
||||
mkVerb : Str -> Conjugation -> Case -> Verb = \lemma,conj,topic -> {
|
||||
s = table {
|
||||
Pos => (mkVerb_Pos lemma conj).s ;
|
||||
Neg => (filter_Neg (mkVerb_Pos ("ne"+lemma) conj)).s
|
||||
}
|
||||
} ;
|
||||
topic = topic
|
||||
} ;
|
||||
|
||||
-- First conjugation
|
||||
mkVerbC1 : Str -> Str -> Str -> Verb = \lemma,lemma2,lemma3 -> {
|
||||
mkVerbC1 : Str -> Str -> Str -> Case -> Verb = \lemma,lemma2,lemma3,topic -> {
|
||||
s = table {
|
||||
Pos => (mkVerbC1_Pos lemma lemma2 lemma3).s ;
|
||||
Neg => (filter_Neg (mkVerbC1_Pos ("ne"+lemma) ("ne"+lemma2) ("ne"+lemma3))).s
|
||||
}
|
||||
} ;
|
||||
topic = topic
|
||||
} ;
|
||||
|
||||
mkVerb_Pos : Str -> Conjugation -> Verb_TMP = \lemma,conj ->
|
||||
@@ -347,18 +344,19 @@ oper
|
||||
}
|
||||
} ;
|
||||
|
||||
mkVerb_Irreg : Str -> Verb = \lemma ->
|
||||
mkVerb_Irreg : Str -> Case -> Verb = \lemma,topic ->
|
||||
case lemma of {
|
||||
"būt" => mkVerb_Irreg_Be ;
|
||||
"iet" => mkVerb_Irreg_Go ;
|
||||
#prefix + "iet" => mkVerb_Irreg_Go_Prefix (Predef.tk 3 lemma) ;
|
||||
"gulēt" => mkVerb_Irreg_Sleep -- FIXME: Should be treated as a regular verb (C3: gulēt, sēdēt etc.)
|
||||
"būt" => mkVerb_Irreg_Be topic ;
|
||||
"iet" => mkVerb_Irreg_Go topic ;
|
||||
#prefix + "iet" => mkVerb_Irreg_Go_Prefix (Predef.tk 3 lemma) topic ;
|
||||
"gulēt" => mkVerb_Irreg_Sleep topic
|
||||
-- FIXME: "gulēt" should be treated as a regular verb (C3: gulēt, sēdēt etc.)
|
||||
-- TODO: add "dot"/Give (+prefix, +refl)
|
||||
-- TODO: multiple prefixes
|
||||
-- TODO: move to IrregLav?
|
||||
} ;
|
||||
|
||||
mkVerb_Irreg_Be : Verb = {
|
||||
mkVerb_Irreg_Be : Case -> Verb = \topic -> {
|
||||
s = table {
|
||||
Pos => table {
|
||||
VInd P1 Sg Pres => "esmu" ;
|
||||
@@ -374,18 +372,18 @@ oper
|
||||
VInd P2 Sg Pres => "neesi" ;
|
||||
VInd P3 _ Pres => "nav" ;
|
||||
|
||||
VDeb => NON_EXISTENT ;
|
||||
|
||||
VDeb => NON_EXISTENT ;
|
||||
VDebRel => NON_EXISTENT ;
|
||||
|
||||
x => (mkVerb_C1 "nebūt" "neesu" "nebiju").s ! x -- the incorrect 'neesu' will be overriden
|
||||
}
|
||||
}
|
||||
} ;
|
||||
topic = topic
|
||||
} ;
|
||||
|
||||
mkVerb_Irreg_Go : Verb = mkVerb_Irreg_Go_Prefix "" ;
|
||||
mkVerb_Irreg_Go : Case -> Verb = \topic -> mkVerb_Irreg_Go_Prefix "" topic ;
|
||||
|
||||
mkVerb_Irreg_Go_Prefix : Str -> Verb = \pref -> {
|
||||
mkVerb_Irreg_Go_Prefix : Str -> Case -> Verb = \pref,topic -> {
|
||||
s = table {
|
||||
Pos => table {
|
||||
VInd P3 _ Pres => pref + "iet" ;
|
||||
@@ -398,10 +396,11 @@ oper
|
||||
VDebRel => NON_EXISTENT ;
|
||||
x => (mkVerb_C1 ("ne" + pref + "iet") ("ne" + pref + "eju") ("ne" + pref + "gāju")).s ! x
|
||||
}
|
||||
}
|
||||
} ;
|
||||
topic = topic
|
||||
} ;
|
||||
|
||||
mkVerb_Irreg_Sleep : Verb = {
|
||||
mkVerb_Irreg_Sleep : Case -> Verb = \topic -> {
|
||||
s = table {
|
||||
Pos => table {
|
||||
VInd P2 Sg Pres => (mkVerb_C3 "gulēt").s ! VInd P2 Sg Pres ;
|
||||
@@ -429,7 +428,8 @@ oper
|
||||
|
||||
x => (mkVerb_C3 "negulēt").s ! x
|
||||
}
|
||||
}
|
||||
} ;
|
||||
topic = topic
|
||||
} ;
|
||||
|
||||
-- Auxiliaries: palatalization rules
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
concrete PhraseLav of Phrase = CatLav ** open
|
||||
ResLav,
|
||||
VerbLav
|
||||
in {
|
||||
concrete PhraseLav of Phrase = CatLav ** open ResLav in {
|
||||
|
||||
flags
|
||||
coding = utf8 ;
|
||||
flags coding = utf8 ;
|
||||
|
||||
lin
|
||||
|
||||
PhrUtt pconj utt voc = { s = pconj.s ++ utt.s ++ voc.s } ;
|
||||
|
||||
UttS s = { s = s.s } ;
|
||||
@@ -22,8 +19,7 @@ lin
|
||||
UttAP ap = { s = ap.s ! Indef ! Masc ! Sg ! Nom } ;
|
||||
UttAdv adv = adv ;
|
||||
|
||||
-- FIXME: neesmu līdz galam drošs vai agreement ir tieši (AgPr Pl)
|
||||
UttVP vp = { s = build_VP vp Pos VInf (AgP3 Pl Masc Pos) } ;
|
||||
UttVP vp = { s = buildVP vp Pos VInf (AgrP3 Pl Masc) } ;
|
||||
|
||||
UttIP ip = { s = ip.s ! Nom } ;
|
||||
UttIAdv iadv = iadv ;
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
|
||||
concrete QuestionLav of Question = CatLav ** open
|
||||
ResLav,
|
||||
VerbLav,
|
||||
Prelude,
|
||||
ParadigmsVerbsLav
|
||||
ParadigmsLav,
|
||||
ResLav,
|
||||
Prelude
|
||||
in {
|
||||
|
||||
flags
|
||||
|
||||
optimize = all_subs ;
|
||||
coding = utf8 ;
|
||||
|
||||
lin
|
||||
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 Pos) Pos vp.objNeg } ;
|
||||
QuestVP ip vp = { s = \\m,p => ip.s ! Nom ++ buildVerb vp.v m p (AgrP3 ip.num Masc) Pos vp.agr.focus } ;
|
||||
|
||||
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.prep.s ++ ip.s ! (slash.prep.c ! ip.num) ++ slash.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 (fromAgr np.a).pol Pos ++ np.s ! Nom } ;
|
||||
QuestIComp icomp np = { s = \\m,p => icomp.s ++ buildVerb (mkV "būt") m p np.agr np.pol Pos ++ np.s ! Nom } ;
|
||||
|
||||
IdetQuant idet num = {
|
||||
s = \\g => idet.s ! g ! num.n ++ num.s ! g ! Nom ;
|
||||
n = num.n
|
||||
s = \\g => idet.s ! g ! num.num ++ num.s ! g ! Nom ;
|
||||
num = num.num
|
||||
} ;
|
||||
|
||||
-- FIXME: quick&dirty - lai kompilētos pret RGL API
|
||||
@@ -34,19 +35,19 @@ lin
|
||||
|
||||
AdvIP ip adv = {
|
||||
s = \\c => ip.s ! c ++ adv.s ;
|
||||
n = ip.n
|
||||
num = ip.num
|
||||
} ;
|
||||
|
||||
PrepIP p ip = { s = p.s ++ ip.s ! (p.c ! ip.n) } ;
|
||||
PrepIP p ip = { s = p.s ++ ip.s ! (p.c ! ip.num) } ;
|
||||
|
||||
IdetCN idet cn = {
|
||||
s = \\c => idet.s ! cn.g ++ cn.s ! Def ! idet.n ! c ;
|
||||
n = idet.n
|
||||
s = \\c => idet.s ! cn.gend ++ cn.s ! Def ! idet.num ! c ;
|
||||
num = idet.num
|
||||
} ;
|
||||
|
||||
IdetIP idet = {
|
||||
s = \\c => (idet.s ! Masc) | (idet.s ! Fem) ;
|
||||
n = idet.n
|
||||
num = idet.num
|
||||
} ;
|
||||
|
||||
CompIAdv a = a ;
|
||||
|
||||
@@ -17,35 +17,39 @@ lin
|
||||
RelVP rp vp = mkRelClause rp vp ;
|
||||
|
||||
oper
|
||||
-- TODO: PassV2 verbs jāsaskaņo ar objektu, nevis subjektu (by8means_Prep: AgP3 Sg Masc)
|
||||
|
||||
-- TODO: PassV2 verbs jāsaskaņo ar objektu, nevis subjektu (by8means_Prep: AgP3 Sg Masc) - done?
|
||||
mkRelClause : RP -> CatLav.VP -> RCl = \rp,vp ->
|
||||
let subj : Case = case vp.voice of {
|
||||
Act => vp.val.subj ;
|
||||
Pass => vp.val.obj
|
||||
} in lin RCl {
|
||||
let subjInTopic : Bool = case <vp.voice, vp.topic> of {
|
||||
<Act, Nom> => True ;
|
||||
<Act, _ > => False ;
|
||||
<Pass, Acc> => False ;
|
||||
<Pass, _ > => True
|
||||
}
|
||||
in lin RCl {
|
||||
s = \\mood,pol,agr =>
|
||||
case mood of { -- Subject
|
||||
case mood of { -- subject
|
||||
Deb _ _ => rp.s ! Masc ! Dat ; --# notpresent
|
||||
_ => rp.s ! Masc ! vp.val.subj
|
||||
_ => rp.s ! Masc ! vp.topic
|
||||
} ++
|
||||
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.val.agr Pos vp.objNeg -- TODO: test me
|
||||
case subjInTopic of { -- verb
|
||||
True => buildVerb vp.v mood pol (AgrP3 (fromAgr agr).num (fromAgr agr).gend) Pos vp.agr.focus ;
|
||||
False => buildVerb vp.v mood pol vp.agr.subj Pos vp.agr.focus
|
||||
} ++
|
||||
vp.compl ! agr -- Object(s), complements, adverbial modifiers
|
||||
vp.compl ! agr -- object(s), complements, adverbial modifiers
|
||||
} ;
|
||||
|
||||
lin
|
||||
-- FIXME: vārdu secība - nevis 'kas mīl viņu' bet 'kas viņu mīl' (?)
|
||||
-- FIXME: Masc varētu nebūt labi
|
||||
RelSlash rp slash = {
|
||||
s = \\m,p,ag => slash.p.s ++ rp.s ! Masc ! (slash.p.c ! Sg) ++ slash.s ! m ! p
|
||||
s = \\m,p,ag => slash.prep.s ++ rp.s ! Masc ! (slash.prep.c ! Sg) ++ slash.s ! m ! p
|
||||
} ;
|
||||
|
||||
-- FIXME: placeholder
|
||||
-- TODO: jātestē, kautkas nav labi ar testpiemēru
|
||||
FunRP p np rp = {
|
||||
s = \\g,c => p.s ++ rp.s ! g ! c ++ np.s ! (p.c ! (fromAgr np.a).num)
|
||||
s = \\g,c => p.s ++ rp.s ! g ! c ++ np.s ! (p.c ! (fromAgr np.agr).num)
|
||||
} ;
|
||||
|
||||
IdRP = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
resource ResLav = ParamX ** open Prelude in {
|
||||
|
||||
@@ -29,7 +29,7 @@ param
|
||||
Voice = Act | Pass ;
|
||||
Conjugation = C2 | C3 ; -- C1 - "irregular" verbs
|
||||
|
||||
-- Verb mood:
|
||||
-- Verb moods:
|
||||
-- Ind - indicative
|
||||
-- Rel - relative (http://www.isocat.org/rest/dc/3836)
|
||||
-- Deb - debitive (http://www.isocat.org/rest/dc/3835)
|
||||
@@ -50,14 +50,11 @@ param
|
||||
| VDebRel -- the relative subtype of debitive
|
||||
| VPart Voice Gender Number Case ;
|
||||
|
||||
-- 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 ;
|
||||
-- Number and Gender has to be agreed in predicative nominal clauses
|
||||
Agreement =
|
||||
AgrP1 Number Gender
|
||||
| AgrP2 Number Gender
|
||||
| AgrP3 Number Gender ;
|
||||
|
||||
-- Other
|
||||
|
||||
@@ -68,38 +65,70 @@ param
|
||||
|
||||
oper
|
||||
|
||||
Verb : Type = { s : Polarity => VForm => Str } ;
|
||||
Noun : Type = { s : Number => Case => Str ; gend : Gender } ;
|
||||
|
||||
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.?
|
||||
ProperNoun : Type = { s : Case => Str ; gend : Gender ; num : Number } ;
|
||||
|
||||
Pronoun : Type = { s : Case => Str ; agr : Agreement ; poss : Gender => Number => Case => Str ; pol : Polarity } ;
|
||||
|
||||
Prep : Type = { s : Str ; c : Number => Case } ;
|
||||
Adjective : Type = { s : AForm => Str } ;
|
||||
|
||||
Preposition : Type = { s : Str ; c : Number => Case } ;
|
||||
-- For simple case-based valences, the preposition is empty ([])
|
||||
-- TODO: position of prepositions (pre or post)
|
||||
-- TODO: position of prepositions (pre or post) ?
|
||||
|
||||
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
|
||||
Verb : Type = { s : Polarity => VForm => Str ; topic : Case } ;
|
||||
|
||||
VPSlash = VP ** { p : Prep } ;
|
||||
-- TODO: p pārklājas ar val.obj un val.agr / vai vp.p = v.p?
|
||||
VP : Type = {
|
||||
v : Verb ;
|
||||
agr : {
|
||||
subj : Agreement ; -- the verb-subject agreement (the subject can be in the focus part of a clause)
|
||||
focus : Polarity -- the verb-focus agreement (for the double negation) -- TODO: jāpārsauc par pol, lai nejūk citur
|
||||
} ;
|
||||
compl : Agreement => Str ; -- the complement-subject agreement
|
||||
voice : Voice ;
|
||||
topic : Case -- the valence of the topic NP (typically, the subject)
|
||||
} ;
|
||||
|
||||
toAgr : Person -> Number -> Gender -> Polarity -> Agr = \pers,num,gend,pol ->
|
||||
VPSlash : Type = VP ** { focus : Preposition } ; -- the valence of the focus NP (typically, the object)
|
||||
|
||||
insertObj : (Agreement => Str) -> VP -> VP = \obj,vp -> {
|
||||
v = vp.v ;
|
||||
agr = vp.agr ;
|
||||
compl = \\agr => vp.compl ! agr ++ obj ! agr ;
|
||||
voice = vp.voice ;
|
||||
topic = vp.topic
|
||||
} ;
|
||||
|
||||
insertObjC : (Agreement => Str) -> VPSlash -> VPSlash = \obj,vp ->
|
||||
insertObj obj vp ** { focus = vp.focus } ;
|
||||
|
||||
insertObjPre : (Agreement => Str) -> VP -> VP = \obj,vp -> {
|
||||
v = vp.v ;
|
||||
agr = vp.agr ;
|
||||
compl = \\agr => obj ! agr ++ vp.compl ! agr ;
|
||||
voice = vp.voice ;
|
||||
topic = vp.topic
|
||||
} ;
|
||||
|
||||
buildVP : VP -> Polarity -> VForm -> Agreement -> Str = \vp,pol,vf,agr ->
|
||||
vp.v.s ! pol ! vf ++ vp.compl ! agr ;
|
||||
|
||||
toAgr : Person -> Number -> Gender -> Agreement = \pers,num,gend ->
|
||||
case pers of {
|
||||
P1 => AgP1 num gend ;
|
||||
P2 => AgP2 num gend ;
|
||||
P3 => AgP3 num gend pol
|
||||
P1 => AgrP1 num gend ;
|
||||
P2 => AgrP2 num gend ;
|
||||
P3 => AgrP3 num gend
|
||||
} ;
|
||||
|
||||
fromAgr : Agr -> { pers : Person ; num : Number ; gend : Gender ; pol : Polarity } = \agr ->
|
||||
fromAgr : Agreement -> { pers : Person ; num : Number ; gend : Gender } = \agr ->
|
||||
case agr of {
|
||||
AgP1 num gend => { pers = P1 ; num = num ; gend = gend ; pol = Pos } ;
|
||||
AgP2 num gend => { pers = P2 ; num = num ; gend = gend ; pol = Pos } ;
|
||||
AgP3 num gend pol => { pers = P3 ; num = num ; gend = gend ; pol = pol }
|
||||
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 : Agr -> Agr -> Agr = \agr1,agr2 ->
|
||||
conjAgr : Agreement -> Agreement -> Agreement = \agr1,agr2 ->
|
||||
let
|
||||
a1 = fromAgr agr1 ;
|
||||
a2 = fromAgr agr2
|
||||
@@ -107,8 +136,7 @@ oper
|
||||
toAgr
|
||||
(conjPerson a1.pers a2.pers) -- FIXME: personu apvienošana ir tricky un ir jāuztaisa korekti
|
||||
(conjNumber a1.num a2.num)
|
||||
(conjGender a1.gend a2.gend)
|
||||
(conjPolarity a1.pol a2.pol) ;
|
||||
(conjGender a1.gend a2.gend) ;
|
||||
|
||||
conjGender : Gender -> Gender -> Gender = \gend1,gend2 ->
|
||||
case gend1 of {
|
||||
@@ -116,20 +144,6 @@ oper
|
||||
_ => Masc
|
||||
} ;
|
||||
|
||||
conjPolarity : Polarity -> Polarity -> Polarity = \pol1,pol2 ->
|
||||
case pol1 of {
|
||||
Neg => Neg ;
|
||||
_ => pol2
|
||||
} ;
|
||||
|
||||
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") ;
|
||||
|
||||
@@ -16,27 +16,30 @@ lin
|
||||
|
||||
PredSCVP sc vp = mkClauseSC sc vp ;
|
||||
|
||||
ImpVP vp = { s = \\pol,n => vp.v.s ! pol ! (VImp n) ++ vp.compl ! (AgP2 n Masc) } ;
|
||||
ImpVP vp = { s = \\pol,num => vp.v.s ! pol ! (VImp num) ++ vp.compl ! (AgrP2 num Masc) } ;
|
||||
|
||||
SlashVP np vp = mkClause np vp ** { p = vp.p } ;
|
||||
SlashVP np vp = mkClause np vp ** { prep = vp.focus } ;
|
||||
|
||||
AdvSlash slash adv = {
|
||||
s = \\m,p => slash.s ! m ! p ++ adv.s ;
|
||||
p = slash.p
|
||||
prep = slash.prep
|
||||
} ;
|
||||
|
||||
SlashPrep cl prep = cl ** { p = prep } ;
|
||||
SlashPrep cl prep = cl ** { prep = prep } ;
|
||||
|
||||
SlashVS np vs sslash =
|
||||
mkClause np (lin VP {
|
||||
-- NP -> VS -> SSlash -> ClSlash
|
||||
-- e.g. '(whom) she says that he loves'
|
||||
SlashVS np vs sslash = mkClause
|
||||
np
|
||||
(lin VP {
|
||||
v = vs ;
|
||||
compl = \\_ => "," ++ vs.subj.s ++ sslash.s ;
|
||||
val = toVal_Reg vs.topic ;
|
||||
objNeg = Pos ;
|
||||
voice = Act
|
||||
}) ** { p = sslash.p } ;
|
||||
agr = { subj = variants {} ; focus = Pos } ;
|
||||
compl = \\_ => "," ++ vs.conj.s ++ sslash.s ;
|
||||
voice = Act ;
|
||||
topic = vs.topic
|
||||
}) ** { prep = sslash.prep } ;
|
||||
|
||||
ComplVS v s = { v = v ; compl = \\_ => "," ++ v.subj.s ++ s.s } ;
|
||||
-- ComplVS v s = { v = v ; compl = \\_ => "," ++ v.subj.s ++ s.s } ;
|
||||
|
||||
-- TODO: nočekot kāpēc te ir tieši 'ka'
|
||||
EmbedS s = { s = "ka" ++ s.s } ;
|
||||
@@ -44,7 +47,7 @@ lin
|
||||
EmbedQS qs = { s = qs.s } ;
|
||||
|
||||
-- FIXME: vai agr ir Pl?
|
||||
EmbedVP vp = { s = build_VP vp Pos VInf (AgP3 Pl Masc Pos) } ;
|
||||
EmbedVP vp = { s = buildVP vp Pos VInf (AgrP3 Pl Masc) } ;
|
||||
|
||||
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 } ;
|
||||
@@ -54,7 +57,7 @@ lin
|
||||
| { s = \\ag => t.s ++ p.s ++ cl.s ! (Rel t.a t.t) ! p.p ! ag } --# notpresent
|
||||
;
|
||||
|
||||
UseSlash t p slash = { s = t.s ++ p.s ++ slash.s ! (Ind t.a t.t) ! p.p ; p = slash.p } ;
|
||||
UseSlash t p slash = { s = t.s ++ p.s ++ slash.s ! (Ind t.a t.t) ! p.p ; prep = slash.prep } ;
|
||||
|
||||
-- FIXME: placeholder
|
||||
AdvS a s = { s = NON_EXISTENT } ;
|
||||
@@ -62,28 +65,27 @@ 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.voice of {
|
||||
Act => vp.val.subj ;
|
||||
Pass => vp.val.obj
|
||||
} in lin Cl {
|
||||
let agr : Agreement = case <vp.voice, vp.topic> of {
|
||||
<Act, Nom> => np.agr ;
|
||||
<Act, _ > => vp.agr.subj ;
|
||||
<Pass, Acc> => vp.agr.subj ;
|
||||
<Pass, _ > => np.agr
|
||||
}
|
||||
in lin Cl {
|
||||
s = \\mood,pol =>
|
||||
case mood of { -- Subject
|
||||
case mood of { -- subject
|
||||
Deb _ _ => np.s ! Dat ; --# notpresent
|
||||
_ => np.s ! vp.val.subj
|
||||
_ => np.s ! vp.topic
|
||||
} ++
|
||||
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.val.agr (fromAgr np.a).pol vp.objNeg -- TESTME
|
||||
} ++
|
||||
vp.compl ! np.a -- Object(s), complements, adverbial modifiers
|
||||
buildVerb vp.v mood pol agr np.pol vp.agr.focus ++ -- verb
|
||||
vp.compl ! np.agr -- object(s), complements, adverbial modifiers
|
||||
} ;
|
||||
|
||||
-- FIXME: quick&dirty - lai kompilētos pret RGL API
|
||||
-- Eng: PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp
|
||||
-- Ar SC nav iespējams neko saskaņot (sk. Cat.gf un Common.gf)
|
||||
mkClauseSC : SC -> CatLav.VP -> Cl = \sc,vp -> lin Cl {
|
||||
s = \\mood,pol => sc.s ++ buildVerb vp.v mood pol (AgP3 Sg Masc Pos) Pos vp.objNeg ++ vp.compl ! (AgP3 Sg Masc Pos)
|
||||
s = \\mood,pol => sc.s ++ buildVerb vp.v mood pol (AgrP3 Sg Masc) Pos vp.agr.focus ++ vp.compl ! (AgrP3 Sg Masc)
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,80 +1,82 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
concrete StructuralLav of Structural = CatLav ** open
|
||||
Prelude,
|
||||
ResLav,
|
||||
ParadigmsLav,
|
||||
ParadigmsPronounsLav,
|
||||
NounLav
|
||||
in {
|
||||
NounLav,
|
||||
Prelude
|
||||
in {
|
||||
|
||||
flags
|
||||
|
||||
optimize = all ;
|
||||
coding = utf8 ;
|
||||
|
||||
lin
|
||||
|
||||
language_title_Utt = ss "latviešu valoda" ;
|
||||
|
||||
yes_Utt = ss "jā" ;
|
||||
no_Utt = ss "nē" ;
|
||||
|
||||
every_Det = {
|
||||
s = (\\g,c => (mkPronoun_Gend "ikviens").s ! g ! Sg ! c) ;
|
||||
n = Sg ;
|
||||
d = Indef ;
|
||||
s = (\\gend,c => (mkPronoun_Gend "ikviens").s ! gend ! Sg ! c) ;
|
||||
num = Sg ;
|
||||
defin = Indef ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
someSg_Det = {
|
||||
s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Sg ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => [])
|
||||
n = Sg ;
|
||||
d = Indef ;
|
||||
s = (\\gend,c => (mkPronoun_Gend "kāds").s ! gend ! Sg ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => [])
|
||||
num = Sg ;
|
||||
defin = Indef ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
somePl_Det = {
|
||||
s = (\\g,c => (mkPronoun_Gend "kāds").s ! g ! Pl ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => [])
|
||||
n = Pl ;
|
||||
d = Indef ;
|
||||
s = (\\gend,c => (mkPronoun_Gend "kāds").s ! gend ! Pl ! c) ; -- TODO: lai atļautu arī tukšo, jāpieliek alternatīva: (\\_,_ => [])
|
||||
num = Pl ;
|
||||
defin = Indef ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
few_Det = {
|
||||
s = (\\g,c => (mkPronoun_Gend "dažs").s ! g ! Pl ! c) ;
|
||||
n = Pl ;
|
||||
d = Indef ;
|
||||
s = (\\gend,c => (mkPronoun_Gend "dažs").s ! gend ! Pl ! c) ;
|
||||
num = Pl ;
|
||||
defin = Indef ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
many_Det = {
|
||||
s = (\\g,c => (mkPronoun_Gend "daudzs").s ! g ! Pl ! c) ; -- 'daudzs' izlocīsies korekti uz daudzskaitļa 'daudzi'; tomēr nesmuki...
|
||||
n = Pl ;
|
||||
d = Indef ;
|
||||
s = (\\gend,c => (mkPronoun_Gend "daudzs").s ! gend ! Pl ! c) ; -- 'daudzs' izlocīsies korekti uz daudzskaitļa 'daudzi'; tomēr nesmuki...
|
||||
num = Pl ;
|
||||
defin = Indef ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
much_Det = {
|
||||
s = (\\g,c => "daudz") ; -- FIXME: piesaista ģenitīvu
|
||||
n = Sg ;
|
||||
d = Indef ;
|
||||
s = (\\gend,c => "daudz") ; -- FIXME: piesaista ģenitīvu
|
||||
num = Sg ;
|
||||
defin = Indef ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
this_Quant = {
|
||||
s = (mkPronoun_ThisThat This).s ;
|
||||
d = Def ;
|
||||
defin = Def ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
that_Quant = {
|
||||
s = (mkPronoun_ThisThat That).s ;
|
||||
d = Def ;
|
||||
defin = Def ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
no_Quant = {
|
||||
s = (mkPronoun_Gend "neviens").s ;
|
||||
d = Indef ;
|
||||
defin = Indef ;
|
||||
pol = Neg
|
||||
} ;
|
||||
|
||||
@@ -96,14 +98,16 @@ lin
|
||||
|
||||
he_Pron = {
|
||||
s = \\c => (mkPronoun_Gend "viņš").s ! Masc ! Sg ! c ;
|
||||
a = AgP3 Sg Masc Pos ;
|
||||
poss = \\_,_,_ => "viņa"
|
||||
agr = AgrP3 Sg Masc ;
|
||||
poss = \\_,_,_ => "viņa" ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
she_Pron = {
|
||||
s = \\c => (mkPronoun_Gend "viņš").s ! Fem ! Sg ! c ;
|
||||
a = AgP3 Sg Fem Pos ;
|
||||
poss = \\_,_,_ => "viņas"
|
||||
agr = AgrP3 Sg Fem ;
|
||||
poss = \\_,_,_ => "viņas" ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
they_Pron = mkPronoun_They Masc ; -- See also: ExtraLav.they8fem_Pron
|
||||
@@ -174,7 +178,7 @@ lin
|
||||
Loc => "kurā" ;
|
||||
ResLav.Voc => NON_EXISTENT
|
||||
} ;
|
||||
n = Sg
|
||||
num = Sg
|
||||
} ;
|
||||
|
||||
whoPl_IP = { -- FIXME: Fem
|
||||
@@ -186,7 +190,7 @@ lin
|
||||
Loc => "kuros" ;
|
||||
ResLav.Voc => NON_EXISTENT
|
||||
} ;
|
||||
n = Pl
|
||||
num = Pl
|
||||
} ;
|
||||
|
||||
whatSg_IP = {
|
||||
@@ -198,7 +202,7 @@ lin
|
||||
Loc => "kur" ;
|
||||
ResLav.Voc => NON_EXISTENT
|
||||
} ;
|
||||
n = Sg
|
||||
num = Sg
|
||||
} ;
|
||||
|
||||
whatPl_IP = {
|
||||
@@ -210,7 +214,7 @@ lin
|
||||
Loc => "kur" ;
|
||||
ResLav.Voc => NON_EXISTENT
|
||||
} ;
|
||||
n = Pl
|
||||
num = Pl
|
||||
} ;
|
||||
|
||||
why_IAdv = ss "kāpēc" ;
|
||||
@@ -228,7 +232,7 @@ lin
|
||||
|
||||
how8many_IDet = {
|
||||
s = table { _ => "cik" } ;
|
||||
n = Pl
|
||||
num = Pl
|
||||
} ;
|
||||
|
||||
when_Subj = ss "kad" ;
|
||||
@@ -254,13 +258,13 @@ lin
|
||||
nobody_NP = UsePron (mkPronoun_Body "neviens" Neg) ;
|
||||
nothing_NP = UsePron (mkPronoun_Thing "nekas" Neg) ;
|
||||
|
||||
have_V2 = mkV2 (mkV "būt") nom_Prep Dat ;
|
||||
--have_V3 = mkV3 (mkV "būt") nom_Prep dat_Prep Dat ;
|
||||
have_V2 = mkV2 (mkV "būt" Dat) nom_Prep ;
|
||||
--have_V3 = mkV3 (mkV "būt") Dat nom_Prep dat_Prep ;
|
||||
|
||||
want_VV = mkVV (mkV "vēlēties" third_conjugation) ;
|
||||
can_VV = mkVV (mkV "varēt" third_conjugation) ;
|
||||
can8know_VV = mkVV (mkV "varēt" third_conjugation) ;
|
||||
must_VV = mkVV (mkV "vajadzēt" third_conjugation) Dat ;
|
||||
must_VV = mkVV (mkV "vajadzēt" third_conjugation Dat) ;
|
||||
|
||||
please_Voc = ss "lūdzu" ;
|
||||
|
||||
@@ -281,13 +285,13 @@ oper
|
||||
{- Netiek izmantoti; to vietā sk. ExtraLav
|
||||
emptyPl_Det = {
|
||||
s : Gender => Case => Str = \\_,_ => [] ;
|
||||
n = Pl ;
|
||||
d = Indef
|
||||
num = Pl ;
|
||||
defin = Indef
|
||||
} ;
|
||||
emptySg_Det = { -- TODO: analoģiski kā emptyPl_Det
|
||||
s : Gender => Case => Str = \\_,_ => [] ;
|
||||
n = Sg ;
|
||||
d = Indef
|
||||
num = Sg ;
|
||||
defin = Indef
|
||||
} ;
|
||||
-}
|
||||
|
||||
|
||||
@@ -10,29 +10,32 @@ flags
|
||||
|
||||
lin
|
||||
|
||||
SymbPN i = {s = \\_ => i.s ; g = Masc ; n = Sg} ;
|
||||
IntPN i = {s = \\_ => i.s ; g = Masc ; n = Pl} ;
|
||||
FloatPN i = {s = \\_ => i.s ; g = Masc ; n = Pl} ;
|
||||
NumPN i = {s = \\_ => i.s ! Masc ! Nom ; g = Masc ; n = Pl} ;
|
||||
SymbPN i = {s = \\_ => i.s ; gend = Masc ; num = Sg} ;
|
||||
IntPN i = {s = \\_ => i.s ; gend = Masc ; num = Pl} ;
|
||||
FloatPN i = {s = \\_ => i.s ; gend = Masc ; num = Pl} ;
|
||||
NumPN i = {s = \\_ => i.s ! Masc ! Nom ; gend = Masc ; num = Pl} ;
|
||||
|
||||
CNIntNP cn i = {
|
||||
s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ;
|
||||
a = AgP3 Sg cn.g Pos
|
||||
agr = AgrP3 Sg cn.gend ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
CNSymbNP det cn xs = {
|
||||
s = \\_ => det.s ! cn.g ! Nom ++ cn.s ! det.d ! det.n ! Nom ++ xs.s ;
|
||||
a = AgP3 det.n cn.g Pos
|
||||
s = \\_ => det.s ! cn.gend ! Nom ++ cn.s ! det.defin ! det.num ! Nom ++ xs.s ;
|
||||
agr = AgrP3 det.num cn.gend ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
CNNumNP cn i = {
|
||||
s = \\_ => cn.s ! Indef ! Sg ! Nom ++ i.s ! Masc ! Nom ;
|
||||
a = AgP3 Sg cn.g Pos
|
||||
agr = AgrP3 Sg cn.gend ;
|
||||
pol = Pos
|
||||
} ;
|
||||
|
||||
SymbS sy = sy ;
|
||||
|
||||
SymbNum sy = { s = \\_,_ => sy.s ; n = Pl } ;
|
||||
SymbNum sy = { s = \\_,_ => sy.s ; num = Pl } ;
|
||||
SymbOrd sy = { s = \\_,_ => sy.s ++ "."} ;
|
||||
|
||||
lincat
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
-- 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 (e.g. 'be' => IrregLav).
|
||||
-- VerbLav is included in many modules because of buildVerb.
|
||||
-- It needs to be reallocated somehow to ResLav.or something similar.
|
||||
-- Not so simple since morphology itself needs ResLav & friends.
|
||||
|
||||
concrete VerbLav of Verb = CatLav ** open
|
||||
StructuralLav,
|
||||
ParadigmsVerbsLav,
|
||||
concrete VerbLav of Verb = CatLav ** open
|
||||
StructuralLav,
|
||||
ParadigmsLav,
|
||||
ResLav,
|
||||
ParamX,
|
||||
Prelude
|
||||
@@ -21,74 +20,80 @@ flags
|
||||
|
||||
lin
|
||||
|
||||
-- Complementization rules
|
||||
|
||||
-- V -> VP
|
||||
-- e.g. 'sleep'
|
||||
UseV v = {
|
||||
v = v ;
|
||||
compl = \\_ => [] ;
|
||||
val = toVal_Reg Nom ;
|
||||
objNeg = Pos ;
|
||||
voice = Act
|
||||
v = v ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\_ => [] ;
|
||||
voice = Act ;
|
||||
topic = v.topic
|
||||
} ;
|
||||
|
||||
-- VV -> VP -> VP
|
||||
-- e.g. 'want to run'
|
||||
ComplVV vv vp = {
|
||||
v = vv ;
|
||||
compl = \\agr => build_VP vp Pos VInf agr ;
|
||||
val = toVal_Reg vv.topic ;
|
||||
objNeg = Pos ;
|
||||
voice = Act
|
||||
v = vv ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\agr => buildVP vp Pos VInf agr ;
|
||||
voice = Act ;
|
||||
topic = vv.topic
|
||||
} ;
|
||||
|
||||
-- VS -> S -> VP
|
||||
-- e.g. 'say that she runs'
|
||||
ComplVS vs s = {
|
||||
v = vs ;
|
||||
compl = \\_ => "," ++ vs.subj.s ++ s.s ;
|
||||
val = toVal_Reg vs.topic ;
|
||||
objNeg = Pos ;
|
||||
voice = Act
|
||||
v = vs ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\_ => "," ++ vs.conj.s ++ s.s ;
|
||||
voice = Act ;
|
||||
topic = vs.topic
|
||||
} ;
|
||||
|
||||
-- VQ -> QS -> VP
|
||||
-- e.g. 'wonder who runs'
|
||||
ComplVQ vq qs = {
|
||||
v = vq ;
|
||||
compl = \\_ => "," ++ qs.s ;
|
||||
val = toVal_Reg vq.topic ;
|
||||
objNeg = Pos ;
|
||||
voice = Act
|
||||
v = vq ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\_ => "," ++ qs.s ;
|
||||
voice = Act ;
|
||||
topic = vq.topic
|
||||
} ;
|
||||
|
||||
-- VA -> AP -> VP
|
||||
-- e.g. '(they) become red'
|
||||
ComplVA va ap = {
|
||||
v = va ;
|
||||
compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ;
|
||||
val = toVal_Reg Nom ;
|
||||
objNeg = Pos ;
|
||||
voice = Act
|
||||
v = va ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ;
|
||||
voice = Act ;
|
||||
topic = va.topic
|
||||
} ;
|
||||
|
||||
-- V2 -> VPSlash
|
||||
-- e.g. 'love (it)'
|
||||
SlashV2a v2 = {
|
||||
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 ;
|
||||
v = v2 ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\_ => [] ;
|
||||
voice = Act ;
|
||||
topic = v2.topic ;
|
||||
focus = v2.focus
|
||||
} ;
|
||||
-- TODO: val other than P3 Sg Masc
|
||||
|
||||
-- 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))
|
||||
(\\_ => v3.focus2.s ++ np.s ! (v3.focus2.c ! (fromAgr np.agr).num))
|
||||
{
|
||||
v = v3 ;
|
||||
compl = \\_ => [] ;
|
||||
val = toVal v3.topic (v3.p1.c ! Sg) np.a ;
|
||||
objNeg = (fromAgr np.a).pol ;
|
||||
voice = Act ;
|
||||
p = v3.p2
|
||||
v = v3 ;
|
||||
agr = { subj = np.agr ; focus = np.pol } ;
|
||||
compl = \\_ => [] ;
|
||||
voice = Act ;
|
||||
topic = v3.topic ;
|
||||
focus = v3.focus1
|
||||
} ;
|
||||
-- FIXME: "vīrietis runā par ābolus ar sievieti" ("a man talks to a woman about apples")
|
||||
-- FIXME: the order of objects (?)
|
||||
@@ -97,194 +102,213 @@ lin
|
||||
-- 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))
|
||||
(\\_ => v3.focus2.s ++ np.s ! (v3.focus2.c ! (fromAgr np.agr).num))
|
||||
{
|
||||
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
|
||||
v = v3 ;
|
||||
agr = { subj = np.agr ; focus = np.pol } ;
|
||||
compl = \\_ => [] ;
|
||||
voice = Act ;
|
||||
topic = v3.topic ;
|
||||
focus = v3.focus1
|
||||
} ;
|
||||
-- TODO: val other than P3 Sg Masc
|
||||
-- TODO: test objNeg
|
||||
|
||||
-- V2V -> VP -> VPSlash
|
||||
-- e.g. 'beg (her) to go'
|
||||
SlashV2V v2v vp = {
|
||||
v = v2v ;
|
||||
compl = \\agr => build_VP vp Pos VInf agr ;
|
||||
val = toVal_Reg Nom ;
|
||||
objNeg = Pos ;
|
||||
voice = Act ;
|
||||
p = v2v.p
|
||||
v = v2v ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\agr => buildVP vp Pos VInf agr ;
|
||||
voice = Act ;
|
||||
topic = v2v.topic ;
|
||||
focus = v2v.focus
|
||||
} ;
|
||||
|
||||
-- V2S -> S -> VPSlash
|
||||
-- e.g. 'answer (to him) that it is good'
|
||||
SlashV2S v2s s = {
|
||||
v = v2s ;
|
||||
compl = \\_ => "," ++ v2s.subj.s ++ s.s ;
|
||||
val = toVal_Reg Nom ;
|
||||
objNeg = Pos ;
|
||||
voice = Act ;
|
||||
p = v2s.p
|
||||
v = v2s ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\_ => "," ++ v2s.conj.s ++ s.s ;
|
||||
voice = Act ;
|
||||
topic = v2s.topic ;
|
||||
focus = v2s.focus
|
||||
} ;
|
||||
|
||||
-- V2Q -> QS -> VPSlash
|
||||
-- e.g. 'ask (him) who came'
|
||||
SlashV2Q v2q qs = {
|
||||
v = v2q ;
|
||||
compl = \\_ => "," ++ qs.s ;
|
||||
val = toVal_Reg Nom ;
|
||||
objNeg = Pos ;
|
||||
voice = Act ;
|
||||
p = v2q.p
|
||||
v = v2q ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\_ => "," ++ qs.s ;
|
||||
voice = Act ;
|
||||
topic = v2q.topic ;
|
||||
focus = v2q.focus
|
||||
} ;
|
||||
|
||||
-- V2A -> AP -> VPSlash
|
||||
-- e.g. 'paint (it) red'
|
||||
SlashV2A v2a ap = {
|
||||
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
|
||||
v = v2a ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\agr => ap.s ! Indef ! (fromAgr agr).gend ! (fromAgr agr).num ! Nom ;
|
||||
voice = Act ;
|
||||
topic = v2a.topic ;
|
||||
focus = v2a.focus
|
||||
} ;
|
||||
|
||||
-- VPSlash -> NP -> VP
|
||||
-- e.g. 'love it'
|
||||
ComplSlash vpslash np =
|
||||
let agr : Agreement = np.agr in {
|
||||
v = vpslash.v ;
|
||||
agr = { subj = agr ; focus = np.pol } ;
|
||||
compl = \\agr => case vpslash.voice of {
|
||||
Act => vpslash.focus.s ++ np.s ! (vpslash.focus.c ! (fromAgr agr).num) ;
|
||||
Pass => case vpslash.focus.c ! (fromAgr agr).num of {
|
||||
Nom => np.s ! (vpslash.focus.c ! Sg) ;
|
||||
_ => vpslash.focus.s ++ np.s ! (vpslash.focus.c ! (fromAgr agr).num)
|
||||
}
|
||||
} ++ vpslash.compl ! agr ;
|
||||
voice = vpslash.voice ;
|
||||
topic = vpslash.topic ;
|
||||
focus = vpslash.focus
|
||||
} ;
|
||||
|
||||
-- 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
|
||||
-- e.g. 'want to buy'
|
||||
SlashVV vv vpslash = {
|
||||
v = vv ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\agr => buildVP vpslash Pos VInf agr ;
|
||||
voice = Act ;
|
||||
topic = vv.topic ;
|
||||
focus = defaultPrep
|
||||
} ;
|
||||
|
||||
-- V2V -> NP -> VPSlash -> VPSlash
|
||||
SlashV2VNP v2v np vp = insertObjC
|
||||
(\\_ => v2v.p.s ++ np.s ! (v2v.p.c ! (fromAgr np.a).num))
|
||||
-- e.g. '-- beg me to buy'
|
||||
SlashV2VNP v2v np vpslash = insertObjC
|
||||
(\\_ => v2v.focus.s ++ np.s ! (v2v.focus.c ! (fromAgr np.agr).num))
|
||||
{
|
||||
v = v2v ;
|
||||
compl = \\agr => build_VP vp Pos VInf agr ;
|
||||
val = toVal_Reg Nom ;
|
||||
objNeg = Pos ;
|
||||
voice = Act ;
|
||||
p = vp.p
|
||||
v = v2v ;
|
||||
agr = { subj = np.agr ; focus = np.pol } ;
|
||||
compl = \\agr => buildVP vpslash Pos VInf agr ;
|
||||
voice = Act ;
|
||||
topic = v2v.topic ;
|
||||
focus = v2v.focus
|
||||
} ;
|
||||
|
||||
-- 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 (?)
|
||||
-- Other ways of forming verb phrases
|
||||
|
||||
-- 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
|
||||
-- VPSlash -> VP
|
||||
-- e.g. 'love himself'
|
||||
ReflVP vpslash = insertObjPre
|
||||
(\\agr => vpslash.focus.s ++ reflPron ! (vpslash.focus.c ! (fromAgr agr).num))
|
||||
vpslash ;
|
||||
|
||||
-- Comp -> VP
|
||||
-- e.g. 'be warm'
|
||||
UseComp comp = {
|
||||
v = mkV "būt" ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\agr => comp.s ! agr ;
|
||||
voice = Act ;
|
||||
topic = Nom
|
||||
} ;
|
||||
|
||||
-- V2 -> VP
|
||||
-- e.g. 'be loved'
|
||||
PassV2 v2 = {
|
||||
v = v2 ;
|
||||
compl = \\_ => [] ;
|
||||
val = toVal (v2.p.c ! Sg) v2.topic (AgP3 Sg Masc Pos) ;
|
||||
objNeg = Pos ;
|
||||
voice = Pass
|
||||
v = v2 ;
|
||||
agr = { subj = defaultAgr ; focus = Pos } ;
|
||||
compl = \\_ => [] ;
|
||||
voice = Pass ;
|
||||
topic = v2.focus.c ! Sg ;
|
||||
focus = mkPrep v2.topic
|
||||
} ;
|
||||
-- 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 -> Adv -> VP
|
||||
-- e.g. 'sleep here'
|
||||
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
|
||||
|
||||
-- AdV -> VP -> VP
|
||||
-- e.g. 'always sleep'
|
||||
AdVVP adv vp = insertObjPre (\\_ => adv.s) vp ;
|
||||
|
||||
-- VPSlash -> VP
|
||||
ReflVP vp = insertObjPre (\\agr => vp.p.s ++ reflPron ! (vp.p.c ! (fromAgr agr).num)) vp ;
|
||||
-- TODO: AdvVPSlash : VPSlash -> Adv -> VPSlash
|
||||
-- e.g. 'use (it) here'
|
||||
|
||||
-- Comp -> VP
|
||||
UseComp comp = {
|
||||
v = lin V mkVerb_Irreg_Be ;
|
||||
compl = \\agr => comp.s ! agr ;
|
||||
val = toVal_Reg Nom ;
|
||||
objNeg = Pos ;
|
||||
voice = Act
|
||||
} ;
|
||||
-- TODO: AdVVPSlash : AdV -> VPSlash -> VPSlash
|
||||
-- e.g. 'always use (it)'
|
||||
|
||||
-- VP -> Prep -> VPSlash
|
||||
-- e.g. 'live in (it)'
|
||||
VPSlashPrep vp prep = vp ** { focus = 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 (?)
|
||||
|
||||
-- Complements to copula
|
||||
|
||||
-- AP -> Comp
|
||||
-- e.g. '(be) small'
|
||||
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 } ;
|
||||
|
||||
-- Adv -> Comp
|
||||
-- e.g. '(be) here'
|
||||
CompAdv a = { s = \\_ => a.s } ;
|
||||
|
||||
-- CN -> Comp
|
||||
-- e.g. '(be) a man/men'
|
||||
CompCN cn = { s = \\agr => cn.s ! Indef ! (fromAgr agr).num ! Nom } ;
|
||||
|
||||
-- TODO: UseCopula : VP
|
||||
-- e.g. 'be'
|
||||
|
||||
oper
|
||||
build_VP : ResLav.VP -> Polarity -> VForm -> Agr -> Str = \vp,pol,vf,agr ->
|
||||
vp.v.s ! pol ! vf ++ vp.compl ! agr ;
|
||||
|
||||
insertObjC : (Agr => Str) -> ResLav.VPSlash -> ResLav.VPSlash = \obj,vp ->
|
||||
insertObj obj vp ** { p = vp.p } ;
|
||||
|
||||
insertObj : (Agr => Str) -> ResLav.VP -> ResLav.VP = \obj,vp -> {
|
||||
v = vp.v ;
|
||||
compl = \\agr => vp.compl ! agr ++ obj ! agr ;
|
||||
val = vp.val ;
|
||||
objNeg = vp.objNeg ;
|
||||
voice = vp.voice
|
||||
} ;
|
||||
|
||||
insertObjPre : (Agr => Str) -> ResLav.VP -> ResLav.VP = \obj,vp -> {
|
||||
v = vp.v ;
|
||||
compl = \\agr => obj ! agr ++ vp.compl ! agr ;
|
||||
val = vp.val ;
|
||||
objNeg = vp.objNeg ;
|
||||
voice = vp.voice
|
||||
} ;
|
||||
defaultAgr : Agreement = AgrP3 Sg Masc ; -- variants {}
|
||||
defaultPrep : Preposition = nom_Prep ;
|
||||
|
||||
-- FIXME: the type of the participle form - depending on what?! (currently fixed)
|
||||
buildVerb : Verb -> VMood -> Polarity -> Agr -> Polarity -> Polarity -> Str =
|
||||
\v,mood,pol,subjAgr,subjNeg,objNeg ->
|
||||
buildVerb : Verb -> VMood -> Polarity -> Agreement -> Polarity -> Polarity -> Str =
|
||||
\v,mood,pol,agr,polTopic,polFocus ->
|
||||
let
|
||||
pol_prim : Polarity = case <subjNeg, objNeg> of {
|
||||
polFinal : Polarity = case <polTopic, polFocus> of {
|
||||
-- double negation, if the topic/focus NP has a negated determiner
|
||||
<Neg, _> => Neg ;
|
||||
<_, Neg> => Neg ;
|
||||
_ => pol
|
||||
} ;
|
||||
agr = fromAgr subjAgr
|
||||
agr = fromAgr agr
|
||||
; --# notpresent
|
||||
part = v.s ! ResLav.Pos ! (VPart Pass agr.gend agr.num Nom) --# notpresent
|
||||
part = v.s ! Pos ! (VPart Pass agr.gend agr.num Nom) --# notpresent
|
||||
in case mood of {
|
||||
Ind Simul tense => v.s ! pol_prim ! (VInd agr.pers agr.num tense)
|
||||
Ind Simul tense => v.s ! polFinal ! (VInd agr.pers agr.num tense)
|
||||
; --# notpresent
|
||||
Ind Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (VInd agr.pers agr.num tense) ++ part ; --# notpresent
|
||||
Ind Anter tense => (mkV "būt").s ! polFinal ! (VInd agr.pers agr.num tense) ++ part ; --# notpresent
|
||||
|
||||
-- FIXME(?): Rel _ Past => ...
|
||||
Rel _ Past => ResLav.NON_EXISTENT ; --# notpresent
|
||||
Rel Simul tense => v.s ! pol_prim ! (VRel tense) ; --# notpresent
|
||||
Rel Anter tense => mkVerb_Irreg_Be.s ! pol_prim ! (VRel tense) ++ part ; --# notpresent
|
||||
Rel _ Past => NON_EXISTENT ; --# notpresent
|
||||
Rel Simul tense => v.s ! polFinal ! (VRel tense) ; --# notpresent
|
||||
Rel Anter tense => (mkV "būt").s ! polFinal ! (VRel tense) ++ part ; --# 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
|
||||
Deb Simul tense => (mkV "būt").s ! polFinal ! (VInd P3 Sg tense) ++ --# notpresent
|
||||
v.s ! Pos ! VDeb ; --# notpresent
|
||||
Deb Anter tense => (mkV "būt").s ! polFinal ! (VInd P3 Sg tense) ++ --# notpresent
|
||||
(mkV "būt").s ! Pos ! (VPart Pass Masc Sg Nom) ++ --# notpresent
|
||||
v.s ! Pos ! VDeb ; --# 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
|
||||
Condit Simul => v.s ! polFinal ! (VInd agr.pers agr.num ParamX.Cond) ; --# notpresent
|
||||
Condit Anter => (mkV "būt").s ! polFinal ! (VInd agr.pers agr.num ParamX.Cond) ++ part --# notpresent
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user