1
0
forked from GitHub/gf-core

A major update to the Latvian resource grammar

The case of the topic part of a clause (~subject) can now depend on the verb, allowing for less frequent agreement.
E.g. "man[Dat] garšo pica[Nom]" ("I like pizza").
The default case for the topic/subject remains the nominative case.
This commit is contained in:
Normunds Gruzitis
2012-08-23 23:05:16 +00:00
parent d6e3d07db1
commit d217f20c60
10 changed files with 185 additions and 139 deletions

View File

@@ -1,46 +1,54 @@
--# -path=.:../abstract:../common:../prelude --# -path=.:../abstract:../common:../prelude
concrete CatLav of Cat = CommonX - [CAdv, Voc] ** open concrete CatLav of Cat = CommonX - [CAdv, Voc] **
ResLav, open
Prelude Prelude,
in { ResLav
in {
flags flags
coding = utf8 ; coding = utf8 ;
optimize = all_subs ; optimize = all_subs ;
lincat lincat
-- Tensed/Untensed
S = { s : Str } ; -- Tensed / Untensed
QS = { s : Str } ;
RS = { s : Agr => Str } ; -- Eng: c : Case -- c for it clefts S, QS = { s : Str } ;
SSlash = { s : Str ; p : Prep } ; RS = { s : Agr => Str } ;
SSlash = { s : Str ; p : ResLav.Prep } ;
-- Sentence -- Sentence
Cl = { s : VerbMood => Polarity => Str } ; Cl = { s : VerbMood => Polarity => Str } ;
ClSlash = { s : VerbMood => Polarity => Str ; p : Prep } ; ClSlash = { s : VerbMood => Polarity => Str ; p : ResLav.Prep } ;
Imp = { s : Polarity => Number => Str } ; Imp = { s : Polarity => Number => Str } ;
-- Question -- Question
QCl = { s : VerbMood => Polarity => Str } ; QCl = { s : VerbMood => Polarity => Str } ;
IP = { s : Case => Str ; n: Number } ; IP = { s : Case => Str ; n: Number } ;
--IComp = { s : Str ; a : ResLav.Agr } ;
IDet = { s : Gender => Str ; n : Number } ; IDet = { s : Gender => Str ; n : Number } ;
IQuant = { s : Gender => Number => Str } ; IQuant = { s : Gender => Number => Str } ;
-- TODO: IComp = { s : Str ; a : ResLav.Agr } ;
-- Relative -- Relative
RCl = { s : VerbMood => Polarity => Agr => Str } ; RCl = { s : VerbMood => Polarity => Agr => Str } ;
RP = { s : Gender => Case => Str } ; RP = { s : Gender => Case => Str } ;
-- Verb -- Verb
VP = ResLav.VP ; VP = ResLav.VP ;
VPSlash = ResLav.VP ** { p : Prep } ; VPSlash = ResLav.VP ** { p : ResLav.Prep } ;
Comp = { s : ResLav.Agr => Str } ; Comp = { s : ResLav.Agr => Str } ;
-- Adjective -- Adjective
AP = { s : Definite => Gender => Number => Case => Str } ; AP = { s : Definite => Gender => Number => Case => Str } ;
-- Noun -- Noun
CN = { s : Definite => Number => Case => Str ; g : Gender } ; CN = { s : Definite => Number => Case => Str ; g : Gender } ;
NP = { s : Case => Str ; a : ResLav.Agr } ; NP = { s : Case => Str ; a : ResLav.Agr } ;
Pron = { s : Case => Str ; a : ResLav.Agr ; possessive : Gender => Number => Case => Str } ; Pron = { s : Case => Str ; a : ResLav.Agr ; possessive : Gender => Number => Case => Str } ;
@@ -52,33 +60,33 @@ lincat
Quant = { s : Gender => Number => Case => Str ; d : Definite } ; Quant = { s : Gender => Number => Case => Str ; d : Definite } ;
-- Numeral -- Numeral
Numeral = { s : CardOrd => Gender => Case => Str ; n : Number } ; Numeral = { s : CardOrd => Gender => Case => Str ; n : Number } ;
Digits = { s : CardOrd => Str ; n : Number } ; Digits = { s : CardOrd => Str ; n : Number } ;
-- Structural -- Structural
Conj = { s1, s2 : Str ; n : Number } ; Conj = { s1, s2 : Str ; n : Number } ;
Subj = { s : Str } ; Subj = { s : Str } ;
Prep = { s : Str ; c : Number => Case } ; Prep = ResLav.Prep ;
-- e.g. 'ar' + Sg-Acc or Pl-Dat; preposition may be empty ([]) for case-based valences
-- TODO: pozīcija (pre/post) nav noteikta -- Open lexical classes (lexicon)
-- Open lexical classes, e.g. Lexicon
N = { s : Number => Case => Str ; g : Gender } ; N = { s : Number => Case => Str ; g : Gender } ;
N2 = { s : Number => Case => Str ; g : Gender } ** { p : Prep ; isPre : Bool } ; N2 = { s : Number => Case => Str ; g : Gender } ** { p : ResLav.Prep ; isPre : Bool } ; -- If isPre then located before the noun
-- case/preposition used; if isPre, then located before the noun N3 = { s : Number => Case => Str ; g : Gender } ** { p1, p2 : ResLav.Prep ; isPre1, isPre2 : Bool } ;
N3 = { s : Number => Case => Str ; g : Gender } ** { p1, p2 : Prep ; isPre1, isPre2 : Bool } ;
PN = { s : Case => Str ; g : Gender ; n : Number } ; PN = { s : Case => Str ; g : Gender ; n : Number } ;
A = { s : AForm => Str } ; A = { s : AForm => Str } ;
A2 = A ** { p : Prep } ; A2 = A ** { p : ResLav.Prep } ;
V, VQ, VA, VV = Verb ; V, VA = Verb ;
VS = Verb ** { subj : Subj } ; VV, VQ = Verb ** { topic : Case } ;
V2, V2A, V2Q, V2V = Verb ** { p : Prep } ; VS = Verb ** { subj : Subj ; topic : Case } ;
V2S = Verb ** { p : Prep ; subj : Subj } ; V2 = Verb ** { p : ResLav.Prep ; topic : Case } ;
V3 = Verb ** { p1, p2 : Prep } ; V2A, V2Q, V2V = Verb ** { p : ResLav.Prep } ;
-- TODO: pieņemam ka viena valence; būtu jānorāda semantika - integrēt ar FrameNet V2S = Verb ** { p : ResLav.Prep ; subj : Subj } ;
V3 = Verb ** { p1, p2 : ResLav.Prep ; topic : Case } ;
CAdv = { s, p : Str ; d : Degree } ; CAdv = { s, p : Str ; d : Degree } ;
} }

View File

@@ -22,6 +22,8 @@ lin
they8fem_Pron = mkPronoun_They Fem ; they8fem_Pron = mkPronoun_They Fem ;
it8fem_Pron = mkPronoun_It_Sg Fem ; it8fem_Pron = mkPronoun_It_Sg Fem ;
-- FIXME: zemāk esošās f-cijas nav ExtraLavAbs - kāpēc tās ir te?!
GenNP np = {s = \\_,_,_ => np.s ! Gen ; d = Def} ; GenNP np = {s = \\_,_,_ => np.s ! Gen ; d = Def} ;
--ICompAP ap = {s = \\g,n => "cik" ++ ap.s ! Indef ! g ! n ! Nom } ; --ICompAP ap = {s = \\g,n => "cik" ++ ap.s ! Indef ! g ! n ! Nom } ;

View File

@@ -13,39 +13,39 @@ flags
lin lin
ImpersCl vp = ImpersCl vp =
let a = AgP3 Sg Masc let agr = AgP3 Sg Masc
in { in {
s = \\mood,pol => s = \\mood,pol =>
buildVerb vp.v mood pol a ++ -- Verb buildVerb vp.v mood pol agr ++ -- Verb
vp.s2 ! a -- Object(s), complements, adverbial modifiers vp.focus ! agr -- Object(s), complements, adverbial modifiers
} ; } ;
GenericCl vp = GenericCl vp =
let a = AgP3 Sg Masc let agr = AgP3 Sg Masc
in { in {
s = \\mood,pol => s = \\mood,pol =>
buildVerb vp.v mood pol a ++ buildVerb vp.v mood pol agr ++
vp.s2 ! a vp.focus ! agr
} ; } ;
ExistNP np = ExistNP np =
let let
v = lin V mkVerb_Irreg_Be ; v = lin V mkVerb_Irreg_Be ;
a = np.a agr = np.a
in { in {
s = \\mood,pol => s = \\mood,pol =>
buildVerb v mood pol a ++ buildVerb v mood pol agr ++
np.s ! Nom np.s ! Nom
} ; } ;
ExistIP ip = ExistIP ip =
let let
v = lin V mkVerb_Irreg_Be ; v = lin V mkVerb_Irreg_Be ;
a = AgP3 ip.n Masc agr = AgP3 ip.n Masc
in { in {
s = \\mood,pol => s = \\mood,pol =>
ip.s ! Nom ++ ip.s ! Nom ++
buildVerb v mood pol a buildVerb v mood pol agr
} ; } ;
-- FIXME: needs restriction so that only VerbMood Indicative _ _ Present is allowed; -- FIXME: needs restriction so that only VerbMood Indicative _ _ Present is allowed;
@@ -53,17 +53,17 @@ lin
ProgrVP v = v ; ProgrVP v = v ;
ImpPl1 vp = ImpPl1 vp =
let a = AgP1 Pl Masc let agr = AgP1 Pl Masc
in { in {
s = s =
vp.v.s ! Pos ! (Indicative P1 Pl Pres) ++ -- Verb vp.v.s ! Pos ! (Indicative P1 Pl Pres) ++ -- Verb
vp.s2 ! a -- Object(s), complements, adverbial modifiers vp.focus ! agr -- Object(s), complements, adverbial modifiers
} }
| { s = vp.v.s ! Pos ! (Indicative P1 Pl Fut) ++ vp.s2 ! a } --# notpresent | { s = vp.v.s ! Pos ! (Indicative P1 Pl Fut) ++ vp.focus ! agr } --# notpresent
; ;
ImpP3 np vp = { ImpP3 np vp = {
s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a ++ vp.s2 ! np.a ; s = "lai" ++ np.s ! Nom ++ buildVerb vp.v (Ind Simul Pres) Pos np.a ++ vp.focus ! np.a ;
} ; } ;
-- FIXME: placeholder -- FIXME: placeholder

View File

@@ -312,7 +312,7 @@ lin
year_N = mkN "gads" ; year_N = mkN "gads" ;
blow_V = mkV "pūst" "pūšu" "pūtu" ; blow_V = mkV "pūst" "pūšu" "pūtu" ;
breathe_V = mkV2 (mkV "elpot" second_conjugation) acc_Prep ; breathe_V = mkV "elpot" second_conjugation ;
burn_V = mkV "degt" "degu" "degu" ; burn_V = mkV "degt" "degu" "degu" ;
dig_V = mkV "rakt" "roku" "raku" ; dig_V = mkV "rakt" "roku" "raku" ;
fall_V = mkV "krist" "krītu" "kritu" ; fall_V = mkV "krist" "krītu" "kritu" ;

View File

@@ -15,13 +15,8 @@ flags
coding = utf8 ; coding = utf8 ;
oper oper
Number : Type ; singular : Number = Sg ;
singular : Number ; plural : Number = Pl ;
plural : Number ;
Number = ResLav.Number ;
singular = Sg ;
plural = Pl ;
second_conjugation : VerbConj = C2 ; second_conjugation : VerbConj = C2 ;
third_conjugation : VerbConj = C3 ; third_conjugation : VerbConj = C3 ;
@@ -53,11 +48,11 @@ oper
} ; } ;
mkN2 = overload { mkN2 = overload {
mkN2 : N -> Prep -> N2 = \n,p -> lin N2 n ** { p = p ; isPre = False } ; mkN2 : N -> ResLav.Prep -> N2 = \n,p -> lin N2 n ** { p = p ; isPre = False } ;
mkN2 : N -> Prep -> Bool -> N2 = \n,p,isPre -> lin N2 n ** { p = p ; isPre = isPre } ; mkN2 : N -> ResLav.Prep -> Bool -> N2 = \n,p,isPre -> lin N2 n ** { p = p ; isPre = isPre } ;
} ; } ;
mkN3 : N -> Prep -> Prep -> N3 = \n,p1,p2 -> mkN3 : N -> ResLav.Prep -> ResLav.Prep -> N3 = \n,p1,p2 ->
lin N3 n ** { p1 = p1 ; p2 = p2 ; isPre1 = False ; isPre2 = False } ; lin N3 n ** { p1 = p1 ; p2 = p2 ; isPre1 = False ; isPre2 = False } ;
mkA = overload { mkA = overload {
@@ -66,14 +61,14 @@ oper
mkA : (v : Verb) -> A = \v -> lin A (mkAdjective_Participle v) ; mkA : (v : Verb) -> A = \v -> lin A (mkAdjective_Participle v) ;
} ; } ;
mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** { p = p }) ; -- precējies ar ... mkA2 : A -> ResLav.Prep -> A2 = \a,p -> lin A2 (a ** { p = p }) ; -- precējies ar ...
mkAS : A -> AS =\a -> lin A a ; mkAS : A -> AS =\a -> lin A a ;
mkA2S : A -> Prep -> A2S =\a,p -> lin A2 (a ** { p = p }) ; mkA2S : A -> ResLav.Prep -> A2S =\a,p -> lin A2 (a ** { p = p }) ;
mkAV : A -> AV = \a -> lin A a ; mkAV : A -> AV = \a -> lin A a ;
mkA2V : A -> Prep -> A2V = \a,p -> lin A2 (a ** { p = p }) ; mkA2V : A -> ResLav.Prep -> A2V = \a,p -> lin A2 (a ** { p = p }) ;
AS, AV : Type = { s : AForm => Str } ; AS, AV : Type = { s : AForm => Str } ;
A2S, A2V : Type = { s : AForm => Str ; p : Prep }; A2S, A2V : Type = { s : AForm => Str ; p : ResLav.Prep };
mkV = overload { mkV = overload {
mkV : (lemma : Str) -> V = \l -> lin V (mkVerb_Irreg l) ; mkV : (lemma : Str) -> V = \l -> lin V (mkVerb_Irreg l) ;
@@ -81,23 +76,46 @@ oper
mkV : (lemma : Str) -> Str -> Str -> V = \l1,l2,l3 -> lin V (mkVerbC1 l1 l2 l3) ; mkV : (lemma : Str) -> Str -> Str -> V = \l1,l2,l3 -> lin V (mkVerbC1 l1 l2 l3) ;
} ; } ;
mkV2 : V -> Prep -> V2 = \v,p -> lin V2 v ** { p = p } ; mkV2 = overload {
mkVS : V -> Subj -> VS = \v,s -> lin VS v ** { subj = s } ; mkV2 : V -> ResLav.Prep -> V2 = \v,p -> lin V2 v ** { p = p ; topic = Nom } ;
mkV2S : V -> Prep -> Subj -> V2S = \v,p,s -> lin V2S v ** { p = p ; subj = s } ; mkV2 : V -> ResLav.Prep -> Case -> V2 = \v,p,c -> lin V2 v ** { p = p ; topic = c } ;
mkVA : V -> VA = \v -> lin VA v ; } ;
mkV2A : V -> Prep -> V2A = \v,p -> lin V2A v ** { p = p } ;
mkVQ : V -> VQ = \v -> lin VQ v ; mkVS = overload {
mkV2Q : V -> Prep -> V2Q = \v,p -> lin V2Q v ** { p = p } ; mkVS : V -> Subj -> VS = \v,s -> lin VS v ** { subj = s ; topic = Nom } ;
mkVV : V -> VV = \v -> lin VV v ; mkVS : V -> Subj -> Case -> VS = \v,s,c -> lin VS v ** { subj = s ; topic = c } ;
mkV2V : V -> Prep -> V2V = \v,p -> lin V2V v ** { p = p } ; } ;
mkV3 : V -> Prep -> Prep -> V3 = \v,p1,p2 -> lin V3 v ** { p1 = p1 ; p2 = p2 } ;
mkVQ = overload {
mkVQ : V -> VQ = \v -> lin VQ v ** { topic = Nom } ;
mkVQ : V -> Case -> VQ = \v,c -> lin VQ v ** { topic = c } ;
} ;
mkVV = overload {
mkVV : V -> VV = \v -> lin VV v ** { topic = Nom } ;
mkVV : V -> Case -> VV = \v,c -> lin VV v ** { topic = c } ;
} ;
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 } ;
} ;
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 } ;
mkCAdv : Str -> Str -> Degree -> CAdv = \s,p,d -> { s = s ; p = p ; d = d ; lock_CAdv = <> } ; mkCAdv : Str -> Str -> Degree -> CAdv = \s,p,d -> { s = s ; p = p ; d = d ; lock_CAdv = <> } ;
mkPrep = overload { mkPrep = overload {
mkPrep : Str -> Case -> Case -> Prep = \prep,sg,pl -> mkPrep : Str -> Case -> Case -> ResLav.Prep = \prep,sg,pl ->
lin Prep { s = prep ; c = table { Sg => sg ; Pl => pl } } ; lin Prep { s = prep ; c = table { Sg => sg ; Pl => pl } } ;
mkPrep : Case -> Prep = \c -> lin Prep { s = [] ; c = table { _ => c } } ; mkPrep : Case -> ResLav.Prep = \c -> lin Prep { s = [] ; c = table { _ => c } } ;
} ; } ;
-- empty fake prepositions for valences -- empty fake prepositions for valences

View File

@@ -14,7 +14,9 @@ lin
RelVP rp vp = { RelVP rp vp = {
s = \\m,p,ag => s = \\m,p,ag =>
rp.s ! Masc ! Nom ++ buildVerb vp.v m p (toAgr (fromAgr ag).n P3 (fromAgr ag).g) ++ vp.s2 ! ag rp.s ! Masc ! Nom ++
buildVerb vp.v m p (toAgr (fromAgr ag).n P3 (fromAgr ag).g) ++
vp.focus ! ag
} ; } ;
-- FIXME: vārdu secība - nevis 'kas mīl viņu' bet 'kas viņu mīl' (?) -- FIXME: vārdu secība - nevis 'kas mīl viņu' bet 'kas viņu mīl' (?)

View File

@@ -67,12 +67,16 @@ oper
Verb : Type = { s : Polarity => VerbForm => Str } ; Verb : Type = { s : Polarity => VerbForm => Str } ;
VP = { v : Verb ; s2 : Agr => Str } ; -- s2 = object(s), complements, adverbial modifiers VP = { v : Verb ; topic : Case ; focus : Agr => Str } ;
-- topic: typically - subject
-- focus: typically - objects, complements, adverbial modifiers
VPSlash = VP ** { p : prep } ; VPSlash = VP ** { p : Prep } ;
-- principā rekur ir objekts kuram jau kaut kas ir bet ir vēl viena brīva valence... -- principā rekur ir objekts kuram jau kaut kas ir bet ir vēl viena brīva valence...
prep = { s : Str ; c : Number => Case } ; Prep : Type = { s : Str ; c : Number => Case } ;
-- In the case of case-based valences, the preposition is empty ([])
-- TODO: position of prepositions (pre or post)
--Valence : Type = { p : Prep ; c : Number => Case } ; --Valence : Type = { p : Prep ; c : Number => Case } ;
-- e.g. 'ar' + Sg-Acc or Pl-Dat; Preposition may be skipped for simple case-baced valences -- e.g. 'ar' + Sg-Acc or Pl-Dat; Preposition may be skipped for simple case-baced valences

View File

@@ -14,7 +14,7 @@ lin
PredSCVP sc vp = mkClauseSC sc vp ; PredSCVP sc vp = mkClauseSC sc vp ;
ImpVP vp = { s = \\pol,n => vp.v.s ! pol ! (Imperative n) ++ vp.s2 ! (AgP2 n Masc) } ; ImpVP vp = { s = \\pol,n => vp.v.s ! pol ! (Imperative n) ++ vp.focus ! (AgP2 n Masc) } ;
SlashVP np vp = mkClause np vp ** { p = vp.p } ; SlashVP np vp = mkClause np vp ** { p = vp.p } ;
@@ -25,10 +25,14 @@ lin
SlashPrep cl prep = cl ** { p = prep } ; SlashPrep cl prep = cl ** { p = prep } ;
SlashVS np vs slash = SlashVS np vs sslash =
mkClause np (lin VP { v = vs ; s2 = \\_ => "," ++ vs.subj.s ++ slash.s }) ** { p = slash.p } ; mkClause np (lin VP {
v = vs ;
topic = vs.topic ;
focus = \\_ => "," ++ vs.subj.s ++ sslash.s
}) ** { p = sslash.p } ;
ComplVS v s = { v = v ; s2 = \\_ => "," ++ v.subj.s ++ s.s } ; ComplVS v s = { v = v ; focus = \\_ => "," ++ v.subj.s ++ s.s } ;
-- TODO: nočekot kāpēc te ir tieši 'ka' -- TODO: nočekot kāpēc te ir tieši 'ka'
EmbedS s = { s = "ka" ++ s.s } ; EmbedS s = { s = "ka" ++ s.s } ;
@@ -55,19 +59,18 @@ oper
mkClause : NP -> CatLav.VP -> Cl = \np,vp -> lin Cl { mkClause : NP -> CatLav.VP -> Cl = \np,vp -> lin Cl {
s = \\mood,pol => s = \\mood,pol =>
case mood of { -- Subject case mood of { -- Subject
-- FIXME: jāčeko valences, reizēm arī īstenības izteiksmē - 'man patīk kaut kas'
Deb _ _ => np.s ! Dat ; --# notpresent Deb _ _ => np.s ! Dat ; --# notpresent
_ => np.s ! Nom _ => np.s ! vp.topic
} ++ } ++
buildVerb vp.v mood pol np.a ++ -- Verb buildVerb vp.v mood pol np.a ++ -- Verb
vp.s2 ! np.a -- Object(s), complements, adverbial modifiers vp.focus ! np.a -- Object(s), complements, adverbial modifiers
} ; } ;
-- FIXME: quick&dirty - lai kompilētos pret RGL API -- FIXME: quick&dirty - lai kompilētos pret RGL API
-- Eng: PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp -- Eng: PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp
-- Ar SC nav iespējams neko saskaņot (sk. Cat.gf un Common.gf) -- Ar SC nav iespējams neko saskaņot (sk. Cat.gf un Common.gf)
mkClauseSC : SC -> CatLav.VP -> Cl = \sc,vp -> lin Cl { mkClauseSC : SC -> CatLav.VP -> Cl = \sc,vp -> lin Cl {
s = \\mood,pol => sc.s ++ buildVerb vp.v mood pol (AgP3 Sg Masc) ++ vp.s2 ! (AgP3 Sg Masc) s = \\mood,pol => sc.s ++ buildVerb vp.v mood pol (AgP3 Sg Masc) ++ vp.focus ! (AgP3 Sg Masc)
} ; } ;
} }

View File

@@ -245,9 +245,11 @@ lin
somebody_NP = DetCN emptySg_Det (UseN (mkN "kāds")); somebody_NP = DetCN emptySg_Det (UseN (mkN "kāds"));
something_NP = DetCN emptySg_Det (UseN (mkN "kaut kas")); something_NP = DetCN emptySg_Det (UseN (mkN "kaut kas"));
have_V2 = mkV2 (mkV "būt") nom_Prep ; have_V2 = mkV2 (mkV "būt") nom_Prep Dat ;
can8know_VV, can_VV = mkV "varēt" third_conjugation ; have_V3 = mkV3 (mkV "būt") nom_Prep dat_Prep Dat ;
must_VV = mkV "vajadzēt" third_conjugation ;
can8know_VV, can_VV = mkVV (mkV "varēt" third_conjugation) ;
must_VV = mkVV (mkV "vajadzēt" third_conjugation) Dat ;
oper oper
reflPron : Case => Str = table { reflPron : Case => Str = table {

View File

@@ -1,77 +1,95 @@
--# -path=.:../abstract:../common:../prelude --# -path=.:../abstract:../common:../prelude
-- FIXME: module relations. VerbLav is included in many places because of buildVerb, -- FIXME: module relations.
-- VerbLav is included in many places because of buildVerb,
-- and includes ParadigmsVerbsLav because of mkVerb_Irreg_Be - -- and includes ParadigmsVerbsLav because of mkVerb_Irreg_Be -
-- they need to be reallocated somehow to ResLav or something similar. -- they need to be reallocated somehow to ResLav or something similar.
-- Not so simple since morphology itself needs ResLav & friends. -- Not so simple since morphology itself needs ResLav & friends.
concrete VerbLav of Verb = CatLav ** open concrete VerbLav of Verb = CatLav **
open
ParadigmsVerbsLav,
ParamX, ParamX,
ResLav, ResLav,
ParadigmsVerbsLav,
StructuralLav StructuralLav
in { in {
flags flags
optimize = all_subs ; optimize = all_subs ;
coding = utf8 ; coding = utf8 ;
lin lin
-- TODO: rewrite šo uz valencēm, lai ir semantiskās saites UseV v = { v = v ; topic = Nom ; focus = \\_ => [] } ;
UseV v = { v = v ; s2 = \\_ => [] } ;
ComplVV v vp = { v = v ; s2 = \\agr => build_VP vp Pos Infinitive agr } ; ComplVV vv vp = { v = vv ; topic = vv.topic ; focus = \\agr => build_VP vp Pos Infinitive agr } ;
ComplVS v s = { v = v ; s2 = \\_ => "," ++ v.subj.s ++ s.s } ; ComplVS vs s = { v = vs ; topic = vs.topic ; focus = \\_ => "," ++ vs.subj.s ++ s.s } ;
ComplVQ v q = { v = v ; s2 = \\_ => "," ++ q.s } ; ComplVQ vq qs = { v = vq ; topic = vq.topic ; focus = \\_ => "," ++ qs.s } ;
ComplVA v ap = { v = v ; s2 = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom } ; ComplVA va ap = { v = va ; topic = Nom ; focus = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom } ;
SlashV2a v = { v = v ; s2 = \\_ => [] ; p = v.p } ; SlashV2a v2 = { v = v2 ; topic = v2.topic ; focus = \\_ => [] ; p = v2.p } ;
Slash2V3 v np = Slash2V3 v3 np = insertObjC
insertObjc (\\_ => v.p1.s ++ np.s ! (v.p1.c ! (fromAgr np.a).n)) (\\_ => v3.p1.s ++ np.s ! (v3.p1.c ! (fromAgr np.a).n))
{ v = v ; s2 = \\_ => [] ; p = v.p2 } ; { v = v3 ; topic = Nom ; focus = \\_ => [] ; p = v3.p2 } ;
Slash3V3 v np = Slash3V3 v3 np = insertObjC
insertObjc (\\_ => v.p2.s ++ np.s ! (v.p2.c ! (fromAgr np.a).n)) (\\_ => v3.p2.s ++ np.s ! (v3.p2.c ! (fromAgr np.a).n))
{ v = v ; s2 = \\_ => [] ; p = v.p1 } ; { v = v3 ; topic = Nom ; focus = \\_ => [] ; p = v3.p1 } ;
SlashV2V v vp = { v = v ; s2 = \\agr => build_VP vp Pos Infinitive agr ; p = v.p } ; SlashV2V v2v vp = { v = v2v ; topic = Nom ; focus = \\agr => build_VP vp Pos Infinitive agr ; p = v2v.p } ;
SlashV2S v s = { v = v ; s2 = \\_ => "," ++ v.subj.s ++ s.s ; p = v.p } ; SlashV2S v2s s = { v = v2s ; topic = Nom ; focus = \\_ => "," ++ v2s.subj.s ++ s.s ; p = v2s.p } ;
SlashV2Q v q = { v = v ; s2 = \\_ => "," ++ q.s ; p = v.p } ; SlashV2Q v2q qs = { v = v2q ; topic = Nom ; focus = \\_ => "," ++ qs.s ; p = v2q.p } ;
SlashV2A v ap = { v = v ; s2 = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom ; p = v.p } ; SlashV2A v2a ap = { v = v2a ; topic = Nom ; focus = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom ; p = v2a.p } ;
ComplSlash vp np = insertObjPre (\\_ => vp.p.s ++ np.s ! (vp.p.c ! (fromAgr np.a).n)) vp ; ComplSlash vpslash np = insertObjPre
(\\_ => vpslash.p.s ++ np.s ! (vpslash.p.c ! (fromAgr np.a).n))
vpslash ;
SlashVV vv vpslash = { v = vv ; topic = vv.topic ; focus = \\agr => build_VP vpslash Pos Infinitive agr ; p = vpslash.p } ;
SlashV2VNP v2v np vpslash = insertObjC
(\\_ => v2v.p.s ++ np.s ! (v2v.p.c ! (fromAgr np.a).n))
{ v = v2v ; topic = Nom ; focus = \\agr => build_VP vpslash Pos Infinitive agr ; p = vpslash.p } ;
ReflVP vpslash = insertObjPre
(\\agr => vpslash.p.s ++ reflPron ! (vpslash.p.c ! (fromAgr agr).n))
vpslash ;
UseComp comp = { v = lin V mkVerb_Irreg_Be ; topic = Nom ; focus = \\agr => comp.s ! agr } ;
PassV2 v2 = { v = v2 ; topic = v2.topic ; focus = \\_ => NON_EXISTENT } ; -- FIXME: placeholder
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
AdVVP adv vp = insertObjPre (\\_ => adv.s) vp ;
CompAP ap = { s = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom } ; CompAP ap = { s = \\agr => ap.s ! Indef ! (fromAgr agr).g ! (fromAgr agr).n ! Nom } ;
CompNP np = { s = \\_ => np.s ! Nom } ; CompNP np = { s = \\_ => np.s ! Nom } ;
CompAdv a = { s = \\_ => a.s } ; CompAdv a = { s = \\_ => a.s } ;
CompCN cn = { s = \\agr => cn.s ! Indef ! (fromAgr agr).n ! Nom } ; CompCN cn = { s = \\agr => cn.s ! Indef ! (fromAgr agr).n ! Nom } ;
ReflVP vp = insertObjPre (\\a => vp.p.s ++ reflPron ! (vp.p.c ! (fromAgr a).n)) vp ;
UseComp comp = { v = lin V mkVerb_Irreg_Be ; s2 = \\agr => comp.s ! agr } ;
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
AdVVP adv vp = insertObjPre (\\_ => adv.s) vp ;
oper oper
build_VP : ResLav.VP -> Polarity -> VerbForm -> Agr -> Str = \vp,p,vf,agr -> build_VP : ResLav.VP -> Polarity -> VerbForm -> Agr -> Str = \vp,pol,vf,agr ->
vp.v.s ! p ! vf ++ vp.s2 ! agr ; vp.v.s ! pol ! vf ++ vp.focus ! agr ;
insertObj : (Agr => Str) -> { v : Verb ; s2 : Agr => Str } -> { v : Verb ; s2 : Agr => Str } = -- VPSlash = { v : Verb ; topic : Case ; focus : Agr => Str ; p : Prep }
\obj,vp -> { insertObjC : (Agr => Str) -> ResLav.VPSlash -> ResLav.VPSlash = \obj,vp ->
v = vp.v ; insertObj obj vp ** { p = vp.p } ;
s2 = \\a => vp.s2 ! a ++ obj ! a
} ;
insertObjPre : (Agr => Str) -> { v : Verb ; s2 : Agr => Str } -> { v : Verb ; s2 : Agr => Str } = -- VP = { v : Verb ; topic : Case ; focus : Agr => Str }
\obj,vp -> { insertObj : (Agr => Str) -> ResLav.VP -> ResLav.VP = \obj,vp -> {
v = vp.v ; v = vp.v ;
s2 = \\a => obj ! a ++ vp.s2 ! a topic = vp.topic ;
} ; focus = \\agr => vp.focus ! agr ++ obj ! agr
} ;
insertObjc : (Agr => Str) -> { v : Verb ; s2 : Agr => Str ; p : Prep } -> { v : Verb ; s2 : Agr => Str ; p : Prep } = -- VP = { v : Verb ; topic : Case ; focus : Agr => Str }
\obj,vp -> insertObj obj vp ** { p = vp.p } ; -- TODO: šo jāmet ārā un jāpieliek insertObj parametrs isPre
-- Bet kas šis vispār ir par gadījumu?!
insertObjPre : (Agr => Str) -> ResLav.VP -> ResLav.VP = \obj,vp -> {
v = vp.v ;
topic = vp.topic ;
focus = \\agr => obj ! agr ++ vp.focus ! agr
} ;
buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Str = \v,mood,pol,ag -> buildVerb : Verb -> VerbMood -> Polarity -> Agr -> Str = \v,mood,pol,ag ->
let let
@@ -97,15 +115,4 @@ oper
Condit Simul => v.s ! pol ! (Indicative ag.p ag.n ParamX.Cond) ; --# notpresent Condit Simul => v.s ! pol ! (Indicative ag.p ag.n ParamX.Cond) ; --# notpresent
Condit Anter => mkVerb_Irreg_Be.s ! pol ! (Indicative ag.p ag.n ParamX.Cond) ++ part --# notpresent Condit Anter => mkVerb_Irreg_Be.s ! pol ! (Indicative ag.p ag.n ParamX.Cond) ++ part --# notpresent
} ; } ;
-- TODO: nav testēts
lin
SlashVV vv vp = { v = vv ; s2 = \\agr => build_VP vp Pos Infinitive agr ; p = vp.p } ;
SlashV2VNP vv np vp =
insertObjc (\\_ => vv.p.s ++ np.s ! (vv.p.c ! (fromAgr np.a).n))
{ v = vv ; s2 = \\agr => build_VP vp Pos Infinitive agr ; p = vp.p } ;
-- FIXME: placeholder
PassV2 v = { v = v ; s2 = \\_ => NON_EXISTENT } ;
} }