Merge pull request #394 from inariksit/estonian-extend

Improvements in Estonian
This commit is contained in:
Inari Listenmaa
2022-04-28 10:13:12 +02:00
committed by GitHub
30 changed files with 1584 additions and 1251 deletions

View File

@@ -11,14 +11,14 @@ concrete AdjectiveEst of Adjective = CatEst ** open ResEst, Prelude in {
} ;
ComparA a np = {
s = \\isMod,af => case isMod of {
True => np.s ! NPCase Elat ++ a.s ! Compar ! AN af ; -- minust suurem
_ => a.s ! Compar ! AN af ++ "kui" ++ np.s ! NPCase Nom -- suurem kui mina
True => linNP (NPCase Elat) np ++ a.s ! Compar ! AN af ; -- minust suurem
_ => a.s ! Compar ! AN af ++ "kui" ++ linNP (NPCase Nom) np -- suurem kui mina
} ;
infl = Regular ; --a.infl
} ;
CAdvAP ad ap np = {
s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ np.s ! NPCase Nom ;
s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ linNP (NPCase Nom) np ;
infl = ap.infl
} ;
UseComparA a = {

View File

@@ -5,13 +5,13 @@ concrete AdverbEst of Adverb = CatEst ** open ResEst, Prelude in {
lin
PositAdvAdj a = {s = a.s ! Posit ! AAdv} ;
ComparAdvAdj cadv a np = {
s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ np.s ! NPCase Nom
s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ linNP (NPCase Nom) np
} ;
ComparAdvAdjS cadv a s = {
s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ s.s
} ;
PrepNP prep np = {s = preOrPost prep.isPre prep.s (np.s ! prep.c)} ;
PrepNP prep np = {s = appCompl True Pos prep np} ;
AdAdv = cc2 ;

View File

@@ -20,7 +20,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in {
-- Question
QCl = {s : ResEst.Tense => Anteriority => Polarity => Str} ;
IP = {s : NPForm => Str ; n : Number} ;
IP = ResEst.IPhrase ;
IComp = {s : Agr => Str} ;
IDet = {s : Case => Str ; n : Number ; isNum : Bool} ;
IQuant = {s : Number => Case => Str} ;
@@ -28,7 +28,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in {
-- Relative
RCl = {s : ResEst.Tense => Anteriority => Polarity => Agr => Str ; c : NPForm} ;
RP = {s : Number => NPForm => Str ; a : RAgr} ;
RP = ResEst.RelPron ;
-- Verb
@@ -43,20 +43,15 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in {
-- The $Infl$ in infl tells whether the adjective inflects as a
-- modifier: e.g. "väsinud mehele" vs. "mees muutus väsinuks".
AP = {s : Bool => NForm => Str ; infl : Infl} ;
AP = ResEst.APhrase ;
-- Noun
CN = {s : NForm => Str} ;
CN = ResEst.CNoun ;
Pron = {s : NPForm => Str ; a : Agr} ;
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool} ;
Det = {
s : Case => Str ; -- minun kolme
sp : Case => Str ; -- se (substantival form)
n : Number ; -- Pl (agreement feature for verb)
isNum : Bool ; -- True (a numeral is present)
isDef : Bool -- True (verb agrees in Pl, Nom is not Part) --I: actually, can we get rid of this?
} ;
NP = ResEst.NPhrase ;
DAP, Det = ResEst.Determiner ;
---- QuantSg, QuantPl = {s : Case => Str ; isDef : Bool} ;
Ord = {s : NForm => Str} ;
Predet = {s : Number => NPForm => Str} ;
@@ -74,26 +69,37 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in {
Conj = {s1,s2 : Str ; n : Number} ;
----b DConj = {s1,s2 : Str ; n : Number} ;
Subj = {s : Str} ;
Prep = Compl ;
Prep = ResEst.Compl ;
-- Open lexical classes, e.g. Lexicon
V, VS, VQ = Verb1 ; -- = {s : VForm => Str ; sc : Case} ;
V2, VA, V2Q, V2S = Verb1 ** {c2 : Compl} ;
V2A = Verb1 ** {c2, c3 : Compl} ;
VV = Verb1 ** {vi : InfForm} ; ---- infinitive form
V2V = Verb1 ** {c2 : Compl ; vi : InfForm} ; ---- infinitive form
V3 = Verb1 ** {c2, c3 : Compl} ;
V, VS, VQ = ResEst.Verb1 ; -- = {s : VForm => Str ; sc : Case} ;
V2, VA, V2Q, V2S = ResEst.Verb2 ;
V2A, V3 = ResEst.Verb3 ;
VV = ResEst.Verb1 ** {vi : InfForms} ;
V2V = ResEst.Verb2 ** {vi : InfForms} ;
A = Adjective ** {infl : Infl} ;
A2 = A ** {c2 : Compl} ;
A = ResEst.Adjective ** {infl : Infl} ;
A2 = ResEst.Adjective ** {infl : Infl ; c2 : Compl} ;
N = Noun ;
N2 = Noun ** {c2 : Compl ; isPre : Bool ; lock_N2 : {}} ;
N3 = Noun ** {c2,c3 : Compl ; isPre,isPre2 : Bool ; lock_N3 : {}} ;
N = ResEst.Noun ;
N2 = ResEst.Noun ** {
postmod : Str ; -- postmod, because N2 can come from N3+complement via ComplN3
c2 : Compl ;
isPre : Bool} ;
N3 = ResEst.Noun ** { -- no postmod, because N3 can only come from lexical funs
c2,c3 : Compl ;
isPre,isPre2 : Bool
} ;
PN = {s : Case => Str} ;
oper Verb1 = Verb ** { sc : NPForm} ; --what is this for? --subject case, i.e. "ma näen kassi"/"mul on kass"
linref
VP = \vp -> linV vp.v ;
NP = linNP (NPCase Nom) ;
CN = linCN (NCase Sg Nom) ;
V,VS,VQ = linV ;
V2,VA,V2S,V2Q = linV2 ;
}

View File

@@ -9,11 +9,12 @@ concrete ConjunctionEst of Conjunction =
ConjAdv = conjunctDistrSS ;
ConjCN = conjunctDistrTable NForm ;
ConjCN conj ss = conjunctDistrTable NForm conj ss ** ss ;
ConjNP conj ss = conjunctDistrTable NPForm conj ss ** {
a = conjAgr (Ag conj.n P3) ss.a ; -- P3 is the maximum
isPron = False
isPron = False ;
postmod = ss.postmod
} ;
ConjAP conj ss = conjunctDistrTableAdj conj ss ;
@@ -28,20 +29,20 @@ concrete ConjunctionEst of Conjunction =
ConsS = consrSS comma ;
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseCN = twoTable NForm ;
ConsCN = consrTable NForm comma ;
BaseNP x y = twoTable NPForm x y ** {a = conjAgr x.a y.a} ;
ConsNP xs x = consrTable NPForm comma xs x ** {a = conjAgr xs.a x.a} ;
BaseCN x y = twoTable NForm (mergeCN x) y ** {postmod = y.postmod} ;
ConsCN x xs = consrTable NForm comma (mergeCN x) xs ** xs ;
BaseNP x y = twoTable NPForm (mergeNP x) y ** {a = conjAgr x.a y.a ; postmod = y.postmod} ;
ConsNP x xs = consrTable NPForm comma (mergeNP x) xs ** {a = conjAgr xs.a x.a ; postmod = xs.postmod} ;
BaseAP x y = twoTableAdj x y ;
ConsAP xs x = consrTableAdj comma x xs ;
ConsAP x xs = consrTableAdj comma x xs ;
BaseRS x y = twoTable Agr x y ** {c = y.c} ;
ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
ConsRS x xs = consrTable Agr comma x xs ** {c = xs.c} ;
lincat
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[CN] = {s1,s2 : NForm => Str} ;
[NP] = {s1,s2 : NPForm => Str ; a : Agr} ;
[CN] = {s1,s2 : NForm => Str ; postmod : Str} ;
[NP] = {s1,s2 : NPForm => Str ; a : Agr ; postmod : Str} ;
[AP] = {s1,s2 : {s : Bool => NForm => Str ; infl : Infl }} ;
[RS] = {s1,s2 : Agr => Str ; c : NPForm} ;
@@ -53,7 +54,7 @@ concrete ConjunctionEst of Conjunction =
s2 = y
} ;
consrTableAdj : Str -> [AP] -> {s : Bool => NForm => Str ; infl : Infl} -> [AP] = \c,xs,x ->
consrTableAdj : Str -> APhrase -> [AP] -> [AP] = \c,x,xs ->
let
ap1 = xs.s1 ;
ap2 = xs.s2
@@ -74,7 +75,6 @@ concrete ConjunctionEst of Conjunction =
} ;
infl = Regular } ;
s2 = x ;
lock_ListAP = <>
} ;
@@ -102,4 +102,7 @@ concrete ConjunctionEst of Conjunction =
infl = Regular
} ;
-- for CN and NP with discontinuous fields, put all stuff in s field
mergeNP : NPhrase -> NPhrase = \np -> np ** {s = \\c => linNP c np} ;
mergeCN : CNoun -> CNoun = \cn -> cn ** {s = \\nf => linCN nf cn} ;
}

View File

@@ -23,11 +23,17 @@ lincat
oper
heading : N -> Str = \n -> (nounHeading n).s ;
caseplus2nf : N -> ResEst.Number -> CasePlus -> Str = \noun,num,cas ->
noun.s ! NCase num cas.c ++ cas.suf ;
caseplus2af : (AForm => Str) -> ResEst.Number -> CasePlus -> Str = \adj,num,cas ->
adj ! AN (NCase num cas.c) ++ cas.suf ;
lin
InflectionN, InflectionN2, InflectionN3 = \noun -> {
t = "s" ;
s1 = heading1 (heading noun_Category) ;
s2 = inflNoun (\nf -> noun.s ! nf)
s2 = inflNoun (caseplus2nf noun)
} ;
InflectionA, InflectionA2 = \adj ->
@@ -37,11 +43,11 @@ lin
in
{ t = "a" ;
s1 = heading1 (heading adjective_Category) ;
s2 = inflNoun (\nf -> posit ! AN nf) ++
s2 = inflNoun (caseplus2af posit) ++
heading2 (heading comparative_Parameter) ++
inflNoun (\nf -> compar ! AN nf) ++
inflNoun (caseplus2af compar) ++
heading2 (heading superlative_Parameter) ++
inflNoun (\nf -> superl ! AN nf)
inflNoun (caseplus2af superl)
} ;
InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> {
@@ -142,6 +148,8 @@ oper
--verb = sverb2verbSep verb0 ;
vfin : ResEst.VForm -> Str = \f ->
verb.s ! f ;
vinf : ResEst.InfForms -> Str = \if ->
applyInfFormsV if verb.s ;
nounNounHeading : Parameter -> Parameter -> Str = \n1,n2 ->
(S.mkUtt (G.PossNP (S.mkCN n1) (S.mkNP n2))).s ;
@@ -218,15 +226,16 @@ oper
heading3 (heading infinitive_Parameter) ++
frameTable (
tr (intagAttr "th" "rowspan=2" "da" ++
th (heading nominative_Parameter) ++ td (vfin (Inf InfDa))) ++
tr (th (heading inessive_Parameter) ++ td (vfin (Inf InfDes))) ++
th (heading nominative_Parameter) ++ td (vinf InfDa)) ++
tr (th (heading inessive_Parameter) ++ td (vinf InfDes)) ++
tr (intagAttr "th" "rowspan=5" "ma" ++
th (heading illative_Parameter) ++ td (vfin (Inf InfMa))) ++
tr (th (heading inessive_Parameter) ++ td (vfin (Inf InfMas))) ++
tr (th (heading elative_Parameter) ++ td (vfin (Inf InfMast))) ++
tr (th (heading abessive_Parameter) ++ td (vfin (Inf InfMata))) ++
tr (th (heading translative_Parameter) ++ td (vfin (Inf InfMaks)))
tr (intagAttr "th" "rowspan=6" "ma" ++
th (heading illative_Parameter) ++ td (vinf InfMa)) ++
tr (th (heading inessive_Parameter) ++ td (vinf InfMas)) ++
tr (th (heading elative_Parameter) ++ td (vinf InfMast)) ++
tr (th (heading abessive_Parameter) ++ td (vinf InfMata)) ++
tr (th (heading abessive_Parameter) ++ td (vinf InfMaks)) ++
tr (th (heading translative_Parameter) ++ td (vinf InfMine))
) ++
heading3 (heading participle_Parameter) ++
@@ -245,24 +254,24 @@ oper
td (vfin (PastPart Pass )))
) ; --}
inflNoun : (NForm -> Str) -> Str = \nouns ->
inflNoun : (Number -> CasePlus -> Str) -> Str = \nouns ->
frameTable (
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++
tr (th (heading nominative_Parameter) ++ td (nouns (NCase Sg Nom)) ++ td (nouns (NCase Pl Nom))) ++
tr (th (heading genitive_Parameter) ++ td (nouns (NCase Sg Gen)) ++ td (nouns (NCase Pl Gen))) ++
tr (th (heading partitive_Parameter) ++ td (nouns (NCase Sg Part)) ++ td (nouns (NCase Pl Part))) ++
tr (th (heading translative_Parameter) ++ td (nouns (NCase Sg Transl)) ++ td (nouns (NCase Pl Transl))) ++
tr (th (heading essive_Parameter) ++ td (nouns (NCase Sg Ess)) ++ td (nouns (NCase Pl Ess))) ++
tr (th (heading inessive_Parameter) ++ td (nouns (NCase Sg Iness)) ++ td (nouns (NCase Pl Iness))) ++
tr (th (heading elative_Parameter) ++ td (nouns (NCase Sg Elat)) ++ td (nouns (NCase Pl Elat))) ++
tr (th (heading illative_Parameter) ++ td (nouns (NCase Sg Illat)) ++ td (nouns (NCase Pl Illat))) ++
tr (th (heading adessive_Parameter) ++ td (nouns (NCase Sg Adess)) ++ td (nouns (NCase Pl Adess))) ++
tr (th (heading ablative_Parameter) ++ td (nouns (NCase Sg Ablat)) ++ td (nouns (NCase Pl Ablat))) ++
tr (th (heading allative_Parameter) ++ td (nouns (NCase Sg Allat)) ++ td (nouns (NCase Pl Allat))) ++
tr (th (heading abessive_Parameter) ++ td (nouns (NCase Sg Abess)) ++ td (nouns (NCase Pl Abess))) ++
tr (th (heading comitative_Parameter) ++ td (nouns (NCase Sg Comit)) ++ td (nouns (NCase Pl Comit))) ++
tr (th (heading instructive_Parameter) ++ td (nouns (NCase Sg Termin)) ++ td (nouns (NCase Pl Termin))
)) ;
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++
tr (th (heading nominative_Parameter) ++ td (nouns Sg Nominative) ++ td (nouns Pl Nominative)) ++
tr (th (heading genitive_Parameter) ++ td (nouns Sg Genitive) ++ td (nouns Pl Genitive)) ++
tr (th (heading partitive_Parameter) ++ td (nouns Sg Partitive) ++ td (nouns Pl Partitive)) ++
tr (th (heading translative_Parameter) ++ td (nouns Sg Translative) ++ td (nouns Pl Translative)) ++
tr (th (heading essive_Parameter) ++ td (nouns Sg Essive) ++ td (nouns Pl Essive)) ++
tr (th (heading inessive_Parameter) ++ td (nouns Sg Inessive) ++ td (nouns Pl Inessive)) ++
tr (th (heading elative_Parameter) ++ td (nouns Sg Elative) ++ td (nouns Pl Elative)) ++
tr (th (heading illative_Parameter) ++ td (nouns Sg Illative) ++ td (nouns Pl Illative)) ++
tr (th (heading adessive_Parameter) ++ td (nouns Sg Adessive) ++ td (nouns Pl Adessive)) ++
tr (th (heading ablative_Parameter) ++ td (nouns Sg Ablative) ++ td (nouns Pl Ablative)) ++
tr (th (heading allative_Parameter) ++ td (nouns Sg Allative) ++ td (nouns Pl Allative)) ++
tr (th (heading abessive_Parameter) ++ td (nouns Sg Abessive) ++ td (nouns Pl Abessive)) ++
tr (th (heading comitative_Parameter) ++ td (nouns Sg Comitative) ++ td (nouns Pl Comitative)) ++
tr (th (heading instructive_Parameter) ++ td (nouns Sg Terminative) ++ td (nouns Pl Terminative))
) ;
lin
NoDefinition t = {s=t.s};

View File

@@ -3,19 +3,29 @@
concrete ExtendEst of Extend =
CatEst ** ExtendFunctor -
[
VPS, ListVPS, VPI, ListVPI, VPS2, ListVPS2, VPI2, ListVPI2, RNP, RNPList,
AdAdV, AdjAsCN, AdjAsNP, ApposNP,
BaseVPS, ConsVPS, BaseVPI, ConsVPI, BaseVPS2, ConsVPS2, BaseVPI2, ConsVPI2,
MkVPS, ConjVPS, PredVPS, MkVPI, ConjVPI, ComplVPIVV,
MkVPS2, ConjVPS2, ComplVPS2, MkVPI2, ConjVPI2, ComplVPI2,
Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, ByVP, CompBareCN,
CompIQuant, CompQS, CompS, CompVP, ComplBareVS, ComplGenVV, ComplSlashPartLast, ComplVPSVV, CompoundAP,
CompoundN, ConjRNP, ConjVPS, ConsVPS, Cons_nr_RNP, Cons_rr_RNP, DetNPFem, EmbedPresPart,
ExistsNP, FocusAP, FocusAdV, FocusAdv, FocusObj, FrontExtPredVP, GenIP, GenModIP, GenModNP, GenNP, GenRP,
GerundAdv, GerundCN, GerundNP, IAdvAdv, ICompAP, InOrderToVP, InvFrontExtPredVP, MkVPS, NominalizeVPSlashNP,
PassAgentVPSlash, PassVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, PredVPS, PredVPSVV, PredetRNP, PrepCN,
PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V,
UncontractedNeg, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, MkVPS2
-- Extensions of VP
VPS, ListVPS, VPI, ListVPI, VPS2, ListVPS2, VPI2, ListVPI2,
MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, QuestVPS, SQuestVPS, RelVPS,
MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
MkVPS2, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, ReflVPS2,
MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2,
-- Reflexives
RNP, RNPList, Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, ConjRNP, Cons_nr_RNP, Cons_rr_RNP, PredetRNP, ReflRNP, ReflPoss, ReflPron,
-- Rest in alphabetical order
AdAdV, AdjAsCN, AdjAsNP, ApposNP, AdvIsNP, A2VPSlash, ByVP,
CardCNCard, CompBareCN, CompIQuant, CompQS, CompS, CompVP,
ComplBareVS, ComplGenVV, ComplSlashPartLast, ComplVPSVV, CompoundAP, CompoundN,
EmbedPresPart, EmbedSSlash, EmptyRelSlash, ExistsNP, ExistCN, ExistMassCN, ExistPluralCN,
FocusAP, FocusAdV, FocusAdv, FocusObj, FrontComplDirectVQ, FrontComplDirectVS,
GenIP, GenModIP, GenModNP, GenNP, GenRP, GerundAdv, GerundCN, GerundNP,
IAdvAdv, ICompAP, InOrderToVP, N2VPSlash, NominalizeVPSlashNP,
PassAgentVPSlash, PassVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj,
PredAPVP, PredIAdvVP, PredVPSVV, PresPartAP, PrepCN, ProDrop, ProgrVPSlash, PurposeVP,
SlashBareV2S, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP
]
with
(Grammar = GrammarEst) **
@@ -24,6 +34,7 @@ concrete ExtendEst of Extend =
GrammarEst,
ResEst,
(R=ResEst),
(X=ExtraEst),
IdiomEst,
Coordination,
Prelude,
@@ -31,257 +42,382 @@ concrete ExtendEst of Extend =
LexiconEst,
ParadigmsEst in {
---------------------------------
-- VPS, VPI, VPS2 + list versions
lincat
VPS = X.VPS ;
[VPS] = X.ListVPS ;
VPI = X.VPI ;
[VPI] = X.ListVPI ;
VPS2 = X.VPS ** {c2 : Compl} ;
[VPS2] = X.ListVPS ** {c2 : Compl} ;
VPI2 = X.VPI ** {c2 : Compl} ;
[VPI2] = X.ListVPI ** {c2 : Compl} ;
lin
-- : NP -> Quant ; -- this man's
GenNP np = {
s,sp = \\_,_ => np.s ! NPCase Gen ;
MkVPS = X.MkVPS ;
BaseVPS = X.BaseVPS ;
ConsVPS = X.ConsVPS ;
ConjVPS = X.ConjVPS ;
PredVPS = X.PredVPS ;
-- QuestVPS
-- SQuestVPS
-- RelVPS
MkVPI = X.MkVPI ;
BaseVPI = X.BaseVPI ;
ConsVPI = X.ConsVPI ;
ConjVPI = X.ConjVPI ;
ComplVPIVV = X.ComplVPIVV ;
MkVPS2 t p vps = MkVPS t p vps ** {c2 = vps.c2} ;
-- BaseVPS2, ConsVPS2, ConjVPS2,
ComplVPS2 v np = lin VPS (v ** {
-- TODO: param to record whether it's pos or neg, so we get right form of np
s = \\agr => v.s ! agr ++ appCompl True Pos v.c2 np ;
}) ;
-- ReflVPS2 v rnp =
-- MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2,
---------------------------------
-- RNP + all related funs
lincat
RNP = {s : Agr => NPForm => Str} ;
RNPList = {s1,s2 : Agr => NPForm => Str} ;
oper
rnp2np : Agr -> RNP -> NPhrase = \agr,rnp -> emptyNP ** {
a = agr ;
s = rnp.s ! agr ;
isPron = False ; -- ??
} ;
lin
-- : VPSlash -> RNP -> VP ; -- support my family and myself
ReflRNP vps rnp = insertObj (\\b,p,a => appCompl True Pos vps.c2 (rnp2np a rnp)) vps ;
-- : RNP
ReflPron = {s = \\agr,npf => (reflPron agr).s ! npf} ;
-- : Num -> CN -> RNP ; -- my car(s)
ReflPoss num cn = {
s = \\a,npf => possPron ! a ++ num.s ! Sg ! Nom ++
case npf of {
NPCase c => cn.s ! NCase num.n c ;
NPAcc => cn.s ! NCase num.n Gen } ;
} ;
PredetRNP predet rnp = {
s = \\a,c => case a of {
Ag n p => predet.s ! n ! c ++ rnp.s ! a ! c ;
AgPol => predet.s ! Pl ! c ++ rnp.s ! a ! c }
} ;
ConjRNP conj rpns = conjunctDistrTable2 Agr NPForm conj rpns ;
Base_rr_RNP x y = twoTable2 Agr NPForm x y ;
Base_nr_RNP x y = twoTable2 Agr NPForm {s = \\a => x.s} y ;
Base_rn_RNP x y = twoTable2 Agr NPForm x {s = \\a => y.s} ;
Cons_rr_RNP x xs = consrTable2 Agr NPForm comma x xs ;
Cons_nr_RNP x xs = consrTable2 Agr NPForm comma {s = \\a => x.s} xs ;
{-
-- : Pron -> Num -> CN -> RNP -> NP ; -- his abandonment of his wife and children
PossPronRNP pron num cn rnp =
-- : NP -> Prep -> RNP -> RNP ; -- a dispute with his wife
AdvRAP adv rp =
-- : VP -> Prep -> RNP -> VP ; -- lectured about her travels
AdvRNP adv rp =
-- : AP -> Prep -> RNP -> AP ; -- adamant in his refusal
AdvRVP adv rp =
-}
oper
possPron : Agr => Str = table {
Ag Sg P1 => "minu" ;
Ag Sg P2 => "sinu" ;
Ag Sg P3 => "tema" ;
Ag Pl P1 => "meie" ;
Ag Pl P2 => "teie" ;
Ag Pl P3 => "nende" ;
AgPol => "teie"
} ;
---------------------------------
-- A - B
lin
AdAdV ad adv = AdAdv ad adv ;
-- : AP -> CN ; -- a green one ; en grön (Swe)
AdjAsCN ap = emptyCN ** {s = ap.s ! True} ; -- True = attributive ; False = predicative
-- : AP -> NP
AdjAsNP ap = MassNP (AdjAsCN ap) ;
-- : NP -> NP -> NP
ApposNP np1 np2 = np2 ** {
s = \\nf => np1.s ! nf ++ np2.s ! nf ; -- comma or not?
} ;
-- : Adv -> NP -> Cl ; -- here is the tree / here are the trees
AdvIsNP adv np = mkClause (\_ -> adv.s) (agrP3 Sg) (UseComp (CompNP np)) ;
-- : A2 -> VPSlash
A2VPSlash a2 = UseComp (CompAP (UseA2 a2)) ** {c2 = a2.c2} ;
-- : VP -> Adv ;
ByVP = GerundAdv ;
---------------------------------
-- C
lin
-- : VS -> S -> VP ;
ComplBareVS v s = insertExtrapos s.s (predV v) ;
-- : N -> N -> N ; -- control system / controls system / control-system
CompoundN noun cn = cn ** {
s = \\nf => noun.s ! NCase Sg Gen ++ BIND ++ cn.s ! nf
} ;
-- : N -> A -> AP ; -- language independent / language-independent
CompoundAP n a = PositA (a ** {s = \\d,af => n.s ! NCase Sg Nom ++ BIND ++ a.s ! d ! af}) ;
-- : VS -> Utt -> VP ; -- say: "today"
ComplDirectVS vs utt = insertExtrapos (BIND ++ ":" ++ utt.s) (predV vs) ;
-- : VQ -> Utt -> VP ; -- ask: "when"
ComplDirectVQ vq utt = insertExtrapos (BIND ++ ":" ++ utt.s) (predV vq) ;
-- : S -> Comp ; -- (the fact is) that she sleeps
CompS s = {s = \\_ => "et" ++ s.s} ;
-- : QS -> Comp ; -- (the question is) who sleeps
CompQS qs = {s = \\_ => qs.s } ;
-- : Ant -> Pol -> VP -> Comp ; -- (she is) to go
CompVP ant pol vp = {s = \\a => infVPAnt ant.a (NPCase Nom) pol.p a vp InfDa } ;
-- ComplGenVV v a p vp = insertObj (\\agr => a.s ++ p.s ++ infVP v.typ vp a.a p.p agr)
-- (predVV v) ;
-- ComplSlashPartLast vps np = {} ; --- AR 7/3/2013
---------------------------------
-- E - F
lin
-- : VP -> SC ; -- looking at Mary (is fun) / filmide vaatamine (on tore) / ___ga abielus olemine,
EmbedPresPart vp = {s = infVP (NPCase Gen) Pos (agrP3 Sg) vp InfMine } ;
EmbedSSlash s = {s = s.s ++ s.c2.s} ;
-- : ClSlash -> RCl ; -- he lives in
EmptyRelSlash cls = {
s = \\t,a,p,_ => cls.s ! t ! a ! p ++ cls.c2.s ;
c = NPCase Nom
} ;
-- : CN -> Cl ; -- there is a car / there is no car ; there is beer / there is no beer ; there are
-- TODO: these all use the literal "exist" verb. Does Estonian have a construction for "there is"?
ExistCN, ExistMassCN = \cn -> ExistsNP (MassNP cn) ;
ExistPluralCN cn = ExistsNP (DetCN (DetQuant IndefArt NumPl) cn) ;
-- : NP -> Cl ; -- there exists a number / there exist numbers
ExistsNP = IdiomEst.ExistNP ;
-- : AP -> NP -> Utt ; -- green was the tree
FocusAP ap np =
let pred : VP = UseComp (CompNP np) ;
subj : NP = AdjAsNP ap ;
cl : Cl = PredVP subj pred ;
in UttS (UseCl (TTAnt TPres ASimul) PPos cl) ; -- use AdvIsNP for similar construction but that returns a Cl instead
-- : Ad[vV] -> S -> Utt -- today I will sleep
FocusAdV, FocusAdv = \adv,s -> cc2 adv s ;
-- : NP -> SSlash -> Utt ; -- her I love
FocusObj np sslash = {s = appCompl True Pos sslash.c2 np ++ sslash.s} ;
-- : NP -> VS -> Utt -> Cl ; -- "I am here", she said
FrontComplDirectVS np vs utt =
let cl : Cl = PredVP np (UseV vs) ;
in cl ** {s = \\t,a,p,o => utt.s ++ bindComma ++ cl.s ! t ! a ! p ! o} ;
-- : NP -> VQ -> Utt -> Cl ; -- "where", she asked
FrontComplDirectVQ np vq utt =
let cl : Cl = PredVP np (UseV vq) ;
in cl ** {s = \\t,a,p,o => utt.s ++ bindComma ++ cl.s ! t ! a ! p ! o} ;
---------------------------------
-- G
lin
-- : NP -> Quant ; -- this man's
GenNP np = {
s,sp = \\_,_ => linNP (NPCase Gen) np ;
isNum = False ;
isDef = True ;
isNeg = False
} ;
} ;
-- : IP -> IQuant ; -- whose
GenIP ip = { s = \\_,_ => ip.s ! NPCase Gen } ;
-- : IP -> IQuant ; -- whose
GenIP ip = {s = \\_,_ => linIP (NPCase Gen) ip} ;
-- : Num -> CN -> RP ; -- whose car
GenRP num cn = {
s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ;
a = RNoAg
} ;
-- : Num -> CN -> RP ; -- whose car
GenRP num cn = {
s = \\n,c => let k = npform2case num.n c
in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ;
a = RNoAg
} ;
-- In case the first two are not available, the following applications should in any case be.
-- : Num -> NP -> CN -> NP ; -- this man's car(s)
GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ;
-- : Num -> NP -> CN -> NP ; -- this man's car(s)
GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ;
-- : Num -> IP -> CN -> IP ; -- whose car(s)
GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ;
-- : Num -> IP -> CN -> IP ; -- whose car(s)
GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ;
{-
-- : VP -> Adv
GerundAdv vp = {s = infVPdefault vp InfDes} ;
-- : VP -> CN -- publishing of the document (can get a determiner)
GerundCN vp = emptyCN ** {s = \\nf => infVPdefault vp InfMine} ;
-- : VP -> NP -- publishing the document (by nature definite)
GerundNP vp = MassNP (GerundCN vp) ;
lincat
VPS = {s : Agr => Str} ;
[VPS] = {s1,s2 : Agr => Str} ;
VPI = {s : VVType => Agr => Str} ;
[VPI] = {s1,s2 : VVType => Agr => Str} ;
---------------------------------
-- I - N
lin
BaseVPS = twoTable Agr ;
ConsVPS = consrTable Agr comma ;
BaseVPI = twoTable2 VVType Agr ;
ConsVPI = consrTable2 VVType Agr comma ;
-- : AP -> IComp ; -- "how old"
ICompAP ap = icompAP "kui" ap ;
MkVPS t p vp = mkVPS (lin Temp t) (lin Pol p) (lin VP vp) ;
ConjVPS c xs = conjunctDistrTable Agr c xs ;
PredVPS np vps = {s = np.s ! npNom ++ vps.s ! np.a} ;
-- : Adv -> IAdv ; -- "how often"
IAdvAdv adv = { s = "kui" ++ adv.s } ;
-- : VP -> Adv -- et raamatut paremini näha
InOrderToVP vp = {s = "et" ++ infVPdefault vp InfDa} ;
-- : N2 -> VPSlash
N2VPSlash n2 = UseComp (CompCN (UseN2 n2)) ** {c2 = n2.c2} ;
-- : VPSlash -> NP -> NP ; publishing of the document
-- NominalizeVPSlashNP vpslash np = {} ;
MkVPI vp = mkVPI (lin VP vp) ;
ConjVPI c xs = conjunctDistrTable2 VVType Agr c xs ;
ComplVPIVV vv vpi = insertObj (\\a => vpi.s ! vv.typ ! a) (predVV vv) ;
-------- two-place verb conjunction
lincat
VPS2 = {s : Agr => Str ; c2 : Str} ;
[VPS2] = {s1,s2 : Agr => Str ; c2 : Str} ;
VPI2 = {s : VVType => Agr => Str ; c2 : Str} ;
[VPI2] = {s1,s2 : VVType => Agr => Str ; c2 : Str} ;
---------------------------------
-- P
lin
MkVPS2 t p vpsl = mkVPS (lin Temp t) (lin Pol p) (lin VP vpsl) ** {c2 = vpsl.c2} ;
MkVPI2 vpsl = mkVPI (lin VP vpsl) ** {c2 = vpsl.c2} ;
BaseVPS2 x y = twoTable Agr x y ** {c2 = y.c2} ; ---- just remembering the prep of the latter verb
ConsVPS2 x xs = consrTable Agr comma x xs ** {c2 = xs.c2} ;
BaseVPI2 x y = twoTable2 VVType Agr x y ** {c2 = y.c2} ; ---- just remembering the prep of the latter verb
ConsVPI2 x xs = consrTable2 VVType Agr comma x xs ** {c2 = xs.c2} ;
-- : VPSlash -> NP -> VP ; -- be begged by her to go
PassAgentVPSlash vps np = let vp : VP = PassVPSlash vps in vp ** {
adv = vp.adv ++ appCompl True Pos by8agent_Prep np ;
} ;
ConjVPS2 c xs = conjunctDistrTable Agr c xs ** {c2 = xs.c2} ;
ConjVPI2 c xs = conjunctDistrTable2 VVType Agr c xs ** {c2 = xs.c2} ;
-- : VPSlash -> VP ; -- be forced to sleep
PassVPSlash vps = vps ** {
s = \\vf => case vf of {
VIFin t => vps.s ! VIPass t ;
x => vps.s ! x } ;
sc = compl2subjcase vps.c2
} ;
-- : VPSlash -> AP ; -- täna leitud
PastPartAP vp = {
s = \\_,_ => vp2adv vp True (VIPass Past) ;
infl = Invariable
} ;
ComplVPS2 vps2 np = {} ;
ComplVPI2 vpi2 np = {} ;
-- : VP -> AP ; -- (the man) looking at Mary / filme vaatav (mees)
PresPartAP vp = {
s = \\_,_ => vp2adv vp True VIPresPart ;
infl = Invariable
} ;
-- : VPSlash -> NP -> AP -- hobisukeldujate poolt leitud (süvaveepomm)
PastPartAgentAP vp np = {
s = \\_,_ => appCompl True Pos by8agent_Prep np ++ vp2adv vp True (VIPass Past) ;
infl = Invariable
} ;
PositAdVAdj = PositAdvAdj ;
-- : AP -> VP -> Cl ; -- it is good to walk / on hea kõndida
PredAPVP ap vp =
let heaOllaVP : VP = insertObj (\\_,_,_ => ap.s ! True ! NCase Sg Nom) vp ; -- puts AP into the s2 field
heaOllaComp : Comp = CompVP ASimul PPos heaOllaVP ; -- chooses InfDa, fixes word order
heaOlla : VP = UseComp heaOllaComp -- looks silly, but I want to reuse the abstract syntax funs :-P
in existClause noSubj (agrP3 Sg) heaOlla ;
-- : IAdv -> VP -> QCl ; -- how to walk?
PredIAdvVP iadv vp = {s = \\t,a,p => iadv.s ++ infVPdefault vp InfMa} ;
PrepCN prep cn = PrepNP prep (MassNP cn) ;
ProDrop pron = pron ** {s = \\_ => []} ;
ProgrVPSlash vps = ProgrVP vps ** vps ;
PurposeVP = InOrderToVP ; --- is there a difference?
oper
mkVPS : Temp -> Pol -> VP -> VPS = \t,p,vp -> lin VPS {} ;
-- calling infVP with the "default arguments": NPCase Nom, Pos, agrP3 Sg
infVPdefault : VP -> InfForms -> Str = infVP (NPCase Nom) Pos (agrP3 Sg) ;
mkVPI : VP -> VPI = \vp -> lin VPI {} ;
vp2adv : R.VP -> Bool -> VIForm -> Str = \vp,sentIsPos,vif ->
let vpforms : {fin,inf : Str} = case vif of {
VIInf if => applyInfFormsVP {stem=if ; suf="a"} vp ; --- this oper shouldn't be used if you want to use an InfForm but just trying to be robust here
_ => mkVPForms vp.v ! vif ! Simul ! Pos ! agrP3 Sg} ;
in vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut
++ vp.adv -- paremini
++ vp.p -- ära
++ vpforms.fin -- tunda/tundes/tundmata/...
++ vpforms.inf -- TODO is this necessary???
++ vp.ext ;
-----
-}
lin
-- : AP -> IComp ; -- "how old"
ICompAP ap = icompAP "kui" ap ;
-- : Adv -> IAdv ; -- "how often"
IAdvAdv adv = { s = "kui" ++ adv.s } ;
-- : VP -> AP ; -- (the man) looking at Mary / filme vaatav (mees)
PresPartAP vp = {
s = \\_,_ => vp2adv vp True VIPresPart ;
infl = Invariable
} ;
{- TODO: need to change VP to get the following 3 functions to work properly:
1) Add "mine" form into VP (or switch to a BIND solution and just add a stem)
2) Change s2 in VP so that we can manipulate the complement to be in genitive!
-- : VP -> SC ; -- looking at Mary (is fun) / filmide vaatamine (on tore)
EmbedPresPart vp =
let vpGen = vp ; --** { s2 = \\_,_,_ => vp.s2 ! True ! Pos ! }
{s = vp2adv vp True VI } ;
-- : VP -> CN -- publishing of the document (can get a determiner)
GerundCN vp = {} ;
-- : VP -> NP -- publishing the document (by nature definite)
GerundNP vp = {} ;
-}
-- : VPSlash -> AP ; -- täna leitud
PastPartAP vp = {
s = \\_,_ => vp2adv vp True (VIPass Past) ;
infl = Invariable } ;
-- : VPSlash -> NP -> AP -- hobisukeldujate poolt leitud (süvaveepomm)
PastPartAgentAP vp np = {
s = \\_,_ => np.s ! NPCase Gen ++ "poolt"
++ vp2adv vp True (VIPass Past) ;
infl = Invariable } ;
-- : VP -> Adv
GerundAdv vp =
{ s = vp2adv vp True (VIInf InfDes) } ;
WithoutVP vp = -- ilma raamatut nägemata
{ s = "ilma" ++ vp2adv vp False (VIInf InfMata) } ;
InOrderToVP vp = -- et raamatut paremini näha
{ s = "et" ++ vp2adv vp True (VIInf InfDa) } ;
ByVP vp =
{ s = vp2adv vp True (VIInf InfDes) } ;
oper
vp2adv : R.VP -> Bool -> VIForm -> Str = \vp,sentIsPos,vif ->
vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut
++ vp.adv -- paremini
++ vp.p -- ära
++ (vp.s ! vif ! Simul ! Pos ! agrP3 Sg).fin -- tunda/tundes/tundmata/...
++ vp.ext ;
lin
{-
NominalizeVPSlashNP vpslash np = {} ;
PassVPSlash vps = passVPSlash (lin VPS vps) [] ;
PassAgentVPSlash vps np = passVPSlash (lin VPS vps) ("by" ++ np.s ! NPAcc) ;
--- AR 7/3/2013
ComplSlashPartLast vps np = {} ;
-}
-- : NP -> Cl ; -- there exists a number / there exist numbers
ExistsNP = IdiomEst.ExistNP ;
{-
ComplBareVS v s = insertExtra s.s (predV v) ;
SlashBareV2S v s = insertExtrac s.s (predVc v) ;
-}
-- : N -> N -> N ; -- control system / controls system / control-system
CompoundN noun cn = lin N {
s = \\nf => noun.s ! NCase Sg Gen ++ BIND ++ cn.s ! nf
} ;
{-
-- : N -> A -> AP ; -- language independent / language-independent
CompoundAP noun adj = {} ;
-- : VS -> Utt -> VP ; -- say: "today"
ComplDirectVS vs utt = {} ;
-- : VQ -> Utt -> VP ; -- ask: "when"
ComplDirectVQ vq utt = {} ;
-- : NP -> VS -> Utt -> Cl ; -- "I am here", she said
FrontComplDirectVS np vs utt = {} ;
-- : NP -> VQ -> Utt -> Cl ; -- "where", she asked
FrontComplDirectVQ np vq utt = {} ;
-}
-- : AP -> VP -> Cl ; -- it is good to walk / on hea kõndida
PredAPVP ap vp =
let heaOllaVP : VP = insertObj (\\_,_ => ap.s) vp ; -- puts AP into the s2 field
heaOllaComp : Comp = CompVP ASimul PPos heaOlla ; -- chooses InfDa, fixes word order
heaOlla : VP = UseComp heaOllaComp -- looks silly, but I want to reuse the abstract syntax funs :-P
in existClause noSubj (agrP3 Sg) heaOlla ;
oper
testCl = PredAPVP (PositA good_A) (UseV walk_V) ;
---------------------------------
-- S - W
lin
-- : AP -> CN ; -- a green one ; en grön (Swe)
AdjAsCN ap = { s = ap.s ! True } ; -- True = it's a modifier, not a predicate
-- SlashBareV2S v s = insertExtrapos s.s (predV v) ** v ;
AdjAsNP ap = {
s = table { NPCase c => ap.s ! True ! NCase Sg c ;
NPAcc => ap.s ! True ! NCase Sg Gen } ;
a = agrP3 Sg ;
isPron = False
} ;
{-
lincat
RNP = {s : Agr => Str} ;
RNPList = {s1,s2 : Agr => Str} ;
UseDAP,
UseDAPFem,
UseDAPMasc = DetNP ;
lin
ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ;
UttAccIP ip = {s = linIP NPAcc ip} ;
UttAccNP np = {s = linNP NPAcc np} ;
UttAdV adv = adv ;
UttDatIP ip = {s = linIP (NPCase Part) ip} ; -- is partitive a reasonable translation?
UttDatNP np = {s = linNP (NPCase Part) np} ;
-- : RNP
ReflPron = {s = reflPron} ;
ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! Nom ++ cn.s ! num.n ! Nom} ;
PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ;
ConjRNP conj rpns = conjunctDistrTable Agr conj rpns ;
Base_rr_RNP x y = twoTable Agr x y ;
Base_nr_RNP x y = twoTable Agr {s = \\a => x.s ! NPAcc} y ;
Base_rn_RNP x y = twoTable Agr x {s = \\a => y.s ! NPAcc} ;
Cons_rr_RNP x xs = consrTable Agr comma x xs ;
Cons_nr_RNP x xs = consrTable Agr comma {s = \\a => x.s ! NPAcc} xs ;
---- TODO: RNPList construction
ComplGenVV v a p vp = insertObj (\\agr => a.s ++ p.s ++
infVP v.typ vp a.a p.p agr)
(predVV v) ;
-}
-- : S -> Comp ; -- (the fact is) that she sleeps
CompS s = {s = \\_ => "et" ++ s.s} ;
-- : QS -> Comp ; -- (the question is) who sleeps
CompQS qs = {s = \\_ => qs.s } ;
-- : Ant -> Pol -> VP -> Comp ; -- (she is) to go
CompVP ant pol vp = {s = \\a => infVPAnt ant.a (NPCase Nom) pol.p a vp InfDa } ;
-- English-specific
-- : Pol
UncontractedNeg = { s = [] ; p = Neg } ;
-- : VP -> Utt ; -- There's no "short form", so just using InfMa instead of InfDa
UttVPShort vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfMa} ;
--TODO: maybe InfMa should be default in PhraseEst and InfDa here?
-- : VP -> Utt ; -- There's no "short form", so just using InfDa instead of InfMa
UttVPShort vp = {s = infVPdefault vp InfDa} ;
-- : VP -> Adv ; -- ilma raamatut nägemata
WithoutVP vp = {s = "ilma" ++ infVPdefault vp InfMata} ;
}

View File

@@ -1,21 +1,21 @@
concrete ExtraEst of ExtraEstAbs = CatEst **
open ResEst, MorphoEst, Coordination, Prelude, NounEst, StructuralEst, (R = ParamX) in {
open ResEst, MorphoEst, Coordination, Prelude, NounEst, StructuralEst, (R = ParamX), (P = ParadigmsEst) in {
flags coding=utf8;
lin
GenNP np = {
s,sp = \\_,_ => np.s ! NPCase Gen ;
s,sp = \\_,_ => linNP (NPCase Gen) np ;
isNum = False ;
isDef = True ; --- "Jussin kolme autoa ovat" ; thus "...on" is missing
isNeg = False
} ;
GenCN = caseCN Gen ; -- soome mees
ComitCN = caseCN Comit ; -- puudega mets
ElatCN = caseCN Elat ; -- puust laud
AbessCN = caseCN Abess ; -- autota pere
TerminCN = caseCN Termin ; -- maani kleit
GenCN = caseCN Genitive ; -- soome mees
ComitCN = caseCN Comitative ; -- puudega mets
ElatCN = caseCN Elative ; -- puust laud
AbessCN = caseCN Abessive ; -- autota pere
TerminCN = caseCN Terminative ; -- maani kleit
GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ;
GenIP ip = {s = \\_,_ => linIP (NPCase Gen) ip} ;
GenRP num cn = {
s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ;
@@ -23,22 +23,29 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
--- a = RAg (agrP3 num.n)
} ;
oper
caseCN : Case -> NP -> CN -> CN = \c,np,cn ->
lin CN { s = \\nf => np.s ! NPCase c ++ cn.s ! nf } ;
caseCN : CasePlus -> NP -> CN -> CN = \c,np,cn -> cn ** {
s = \\nf => appCompl True Pos (P.casePrep c) np ++ cn.s ! nf
} ;
lincat
VPI = {s : InfForm => Str} ;
[VPI] = {s1,s2 : InfForm => Str} ;
VPI = {s : InfStem => Str} ;
[VPI] = {s1,s2 : InfStem => Str} ;
-- VPI = {s : Str} ;
-- [VPI] = {s1,s2 : Str} ;
lin
BaseVPI = twoTable InfForm ;
ConsVPI = consrTable InfForm comma ;
BaseVPI = twoTable InfStem ;
ConsVPI = consrTable InfStem comma ;
MkVPI vp = {s = \\i => infVP (NPCase Nom) Pos (agrP3 Sg) vp i} ;
ConjVPI = conjunctDistrTable InfForm ;
MkVPI vp = {s = \\i => infVPIF (NPCase Nom) Pos (agrP3 Sg) vp i} ;
ConjVPI = conjunctDistrTable InfStem ;
ComplVPIVV vv vpi =
insertObj (\\_,_,_ => vpi.s ! vv.vi) (predV vv) ;
insertObj (\\_,_,_ => vpi.s ! vv.vi.stem) (predV vv) ;
oper
-- Version that uses InfStem
infVPIF : NPForm -> Polarity -> Agr -> VP -> InfStem -> Str = \sc,pol,agr,vp,if ->
infVPAnt Simul sc pol agr vp {stem=if ; suf="a"} ;
lincat
VPS = {
@@ -60,7 +67,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
} ;
MkVPS t p vp = { -- Temp -> Pol -> VP -> VPS ;
s = \\a => let vps = vp.s ! VIFin t.t ! t.a ! p.p ! a
s = \\a => let vps = mkVPForms vp.v ! VIFin t.t ! t.a ! p.p ! a
in
t.s ++ p.s ++
vps.fin ++ vps.inf ++
@@ -80,7 +87,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
PassAgentVPSlash vp np = vp ;
{-
s = {s = vp.s.s ; h = vp.s.h ; p = vp.s.p ; sc = npform2subjcase vp.c2.c} ;
s2 = \\b,p,a => np.s ! NPCase Nom ++ vp.s2 ! b ! p ! a ;
s2 = \\b,p,a => linNP (NPCase Nom) np ++ vp.s2 ! b ! p ! a ;
adv = vp.adv ;
ext = vp.ext ;
vptyp = vp.vptyp ;
@@ -88,7 +95,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
AdvExistNP adv np =
mkClause (\_ -> adv.s) np.a (insertObj
(\\_,b,_ => np.s ! NPCase Nom) (predV (verbOlema ** {sc = NPCase Nom}))) ;
(\\_,b,_ => linNP (NPCase Nom) np) (predV (verbOlema ** {sc = NPCase Nom}))) ;
RelExistNP prep rp np = {
s = \\t,ant,bo,ag =>
@@ -98,7 +105,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
(\_ -> appCompl True Pos prep (rp2np n rp))
np.a
(insertObj
(\\_,b,_ => np.s ! NPCase Nom)
(\\_,b,_ => linNP (NPCase Nom) np)
(predV (verbOlema ** {sc = NPCase Nom}))) ;
in
cl.s ! t ! ant ! bo ! SDecl ;
@@ -107,26 +114,26 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
AdvPredNP adv v np =
mkClause (\_ -> adv.s) np.a (insertObj
(\\_,b,_ => np.s ! NPCase Nom) (predV v)) ;
(\\_,b,_ => linNP (NPCase Nom) np) (predV v)) ;
ICompExistNP adv np =
let cl = mkClause (\_ -> adv.s ! np.a) np.a (insertObj
(\\_,b,_ => np.s ! NPCase Nom) (predV (verbOlema ** {sc = NPCase Nom}))) ;
(\\_,b,_ => linNP (NPCase Nom) np) (predV (verbOlema ** {sc = NPCase Nom}))) ;
in {
s = \\t,a,p => cl.s ! t ! a ! p ! SDecl
} ;
IAdvPredNP iadv v np =
let cl = mkClause (\_ -> iadv.s) np.a (insertObj
(\\_,b,_ => np.s ! v.sc) (predV v)) ;
(\\_,b,_ => linNP v.sc np) (predV v)) ;
in {
s = \\t,a,p => cl.s ! t ! a ! p ! SDecl
} ;
-- i_implicPron = mkPronoun [] "minun" "minua" "minuna" "minuun" Sg P1 ;
whatPart_IP = {
whatPart_IP = emptyIP ** {
s = table {
NPCase Nom | NPAcc => "mi" ;
NPCase Nom | NPAcc => "mida" ;
c => whatSg_IP.s ! c
} ;
n = Sg
@@ -135,12 +142,11 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
PartCN cn =
let
acn = DetCN (DetQuant IndefArt NumSg) cn
in {
in acn ** {
s = table {
NPCase Nom | NPAcc => acn.s ! NPCase ResEst.Part ;
c => acn.s ! c
} ;
a = acn.a ;
isPron = False ; isNeg = False
} ;

View File

@@ -10,7 +10,7 @@ concrete IdiomEst of Idiom = CatEst **
Pos => NPCase Nom ; -- on olemas lammas
Neg => NPCase Part -- ei ole olemas lammast
} ;
vp = insertObj (\\_,b,_ => "olemas" ++ np.s ! cas b) (predV olla)
vp = insertObj (\\_,b,_ => "olemas" ++ linNP (cas b) np) (predV olla)
in
existClause noSubj (agrP3 Sg) vp ;
@@ -28,7 +28,7 @@ concrete IdiomEst of Idiom = CatEst **
CleftNP np rs = mkClause (\_ -> "see") (agrP3 Sg)
(insertExtrapos (rs.s ! np.a)
(insertObj (\\_,_,_ => np.s ! NPCase Nom) (predV olla))) ;
(insertObj (\\_,_,_ => linNP (NPCase Nom) np) (predV olla))) ;
-- This gives the almost forbidden "se on Porissa kun Matti asuu".
-- Est: "see on Toris, kus Mati elab" (?)
@@ -39,33 +39,18 @@ concrete IdiomEst of Idiom = CatEst **
ImpersCl vp = mkClause noSubj (agrP3 Sg) vp ;
GenericCl vp = mkClause noSubj (agrP3 Sg) {
s = \\_ => vp.s ! VIPass Pres ;
s2 = vp.s2 ;
adv = vp.adv ;
p = vp.p ;
ext = vp.ext ;
sc = vp.sc ;
} ;
GenericCl vp = mkClause noSubj (agrP3 Sg) (passiveVP vp) ;
ProgrVP vp =
let
inf = (vp.s ! VIInf InfMas ! Simul ! Pos ! agrP3 Sg).fin ;
on = predV olla
in {
s = on.s ;
s2 = \\b,p,a => vp.s2 ! b ! p ! a ++ inf ;
adv = vp.adv ;
p = vp.p ;
ext = vp.ext ;
sc = vp.sc ;
} ;
ProgrVP vp = vp ** {
v = verbOlema ;
s2 = \\b,p,a => vp.s2 ! b ! p ! a ++ (applyInfFormsVP InfMas vp).fin ;
} ;
-- This gives "otetaan oluet" instead of "ottakaamme oluet".
-- The imperative is not available in a $VP$.
ImpPl1 vp =
let vps = vp.s ! VIPass Pres ! Simul ! Pos ! Ag Pl P1
let vps = mkVPForms vp.v ! VIPass Pres ! Simul ! Pos ! Ag Pl P1
in
{s = vps.fin ++ vps.inf ++
vp.s2 ! True ! Pos ! Ag Pl P1 ++ vp.p ++ vp.ext

View File

@@ -65,7 +65,7 @@ lin
-- Unfortunately, we cannot use a similar trick for the source (*Põltsamaast vs Põltsamaalt).
distance_N3 = mkN3 (mkN "kaugus") celative (casePrep terminative) ;
doctor_N = mkN "arst" ;
dog_N = mkN "koer" "koera" "koera" ;
dog_N = mkN "koer" "koera" "koera" "koerasse" "koerte" "koeri" ;
door_N = mkN "uks" "ukse" "ust" "uksesse" "uste" "uksi" ;
drink_V2 = mkV2 (mkV "jooma") cpartitive ;
easy_A2V = mkA2 (mkA (mkN "lihtne" "lihtsa" "lihtsat" "lihtsasse" "lihtsate" "lihtsaid")) callative ;
@@ -232,7 +232,7 @@ lin
correct_A = mkA (mkN "õige" "õige" "õiget" "õigesse" "õigete" "õigeid") ;
dry_A = mkA (mkN "kuiv" "kuiva" "kuiva") "kuivem" "kuiveim" ;
dull_A = mkA "igav" ;
full_A = mkA (mkN "täis" "täie" "täit" "täide" "täied" "täite") "täiem" "täiim" Invariable ; -- 'täis' is one of the non-inflecting adjectives
full_A = mkA (mkN "täis" "täie" "täit" "täide" "täite" "täisi") "täiem" "täiim" Invariable ; -- 'täis' is one of the non-inflecting adjectives
heavy_A = mkA "raske" ;
near_A = mkA "lähedane" ;
rotten_A = mkA "mäda" ;
@@ -366,7 +366,7 @@ lin
oper
mkOrd1 : N -> Ord ;
mkOrd1 x = {s = x.s ; lock_Ord = <> } ;
mkOrd1 x = lin Ord x ;
cpartitive = casePrep partitive ;
ctranslative = casePrep translative ;
celative = casePrep elative ;

View File

@@ -1,11 +1,12 @@
resource MakeStructuralEst = open CatEst, ParadigmsEst, MorphoEst, Prelude in {
oper
mkConj : Str -> Str -> ParadigmsEst.Number -> Conj = \x,y,n ->
{s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ;
mkSubj : Str -> Subj = \x ->
{s = x ; lock_Subj = <>} ;
mkIQuant : Str -> IQuant = \s ->
{s = \\n,c => s ; lock_IQuant = <>} ; ----
mkConj : Str -> Str -> ParadigmsEst.Number -> Conj = \x,y,n -> lin Conj {
s1 = x ;
s2 = y ;
n = n
} ;
mkSubj : Str -> Subj = \x -> lin Subj {s = x} ;
mkIQuant : Str -> IQuant = \s -> lin IQuant {s = \\n,c => s} ;
}

View File

@@ -416,23 +416,11 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(satu + "tud") ; -- PastPartPass
-----------------
-- auxiliaries --
-----------------
{- Noun internal opers moved to ResEst
These used to be here:
NForms : Type = Predef.Ints 5 => Str ;
Noun : Type = {s: NForm => Str } ;
nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms ;
n2nforms : Noun -> NForms ;
nForms2N : NForms -> Noun ;
-}
-- Adjective forms
AForms : Type = {
@@ -457,7 +445,6 @@ These used to be here:
AAdv => afs.adv_superl
}
} ;
lock_A = <>
} ;
nforms2aforms : NForms -> AForms = \nforms ->
@@ -473,15 +460,6 @@ These used to be here:
adv_superl = suur + "immin" ;
} ;
{- Verb internal opers moved to ResEst
These used to be here:
VForms : Type = Predef.Ints 7 => Str ;
vForms8 : (x1,_,_,_,_,_,_,x8 : Str) -> VForms ;
regVForms : (x1,_,_,x4 : Str) -> VForms ;
vforms2V : VForms -> Verb ;
-}
-----------------------
-- for Structural
@@ -505,10 +483,9 @@ caseTable : Number -> Noun -> Case => Str = \n,cn ->
-- Here we define personal and relative pronouns.
-- input forms: Nom, Gen, Part
-- Note that the Fin version required 5 input forms, the
-- Est pronouns thus seem to be much simpler.
-- TODO: remove NPAcc?
-- I: keep NPAcc; see appCompl in ResEst, it takes care of finding a right case for various types of complements; incl. when pronouns get different treatment than nouns (PassVP).
-- NPAcc is same as Part for Pron, and same as Gen for other nominals.
-- ResEst.appCompl returns right case for various types of complements,
-- incl. when pronouns get different treatment than nouns (like in PassV2).
mkPronoun : (_,_,_ : Str) -> Number -> Person ->
{s : NPForm => Str ; a : Agr} =
\mina, minu, mind, n, p ->
@@ -520,16 +497,12 @@ caseTable : Number -> Noun -> Case => Str = \n,cn ->
NPCase Gen => minu ;
NPCase Part => mind ;
NPCase Transl => minu + "ks" ;
NPCase Ess => minu + "na" ;
NPCase Iness => minu_short + "s" ;
NPCase Elat => minu_short + "st" ;
NPCase Illat => minu_short + "sse" ;
NPCase Adess => minu_short + "l" ;
NPCase Ablat => minu_short + "lt" ;
NPCase Allat => minu_short + "le" ;
NPCase Abess => minu + "ta" ;
NPCase Comit => minu + "ga" ;
NPCase Termin => minu + "ni" ;
NPAcc => mind
} ;
a = Ag n p
@@ -543,6 +516,11 @@ caseTable : Number -> Noun -> Case => Str = \n,cn ->
_ => x
} ;
-- NB. This doesn't work correctly with stem+suffix based solution:
-- Ess, Abess, Comit, Termin all use the long Gen stem.
-- Alternative 1: let Gen be long form, leaving only Nom and Part actually short
-- Alternative 2: leave Gen short, postprocess Ess, Abess, Comit, Termin in application
-- Alternative 3: include two Gen stems in NPForm
shortPronoun : (_,_,_,_ : Str) -> Number -> Person ->
{s : NPForm => Str ; a : Agr} =
\ma, mu, mind, minu, n, p ->
@@ -554,17 +532,12 @@ caseTable : Number -> Noun -> Case => Str = \n,cn ->
} ;
in shortMa ** { s = table {
NPCase Gen => minu ; -- this is Alternative 1, see comment above. Comment out for Alternative 2.
NPCase Allat => mulle ;
NPCase Transl => minu + "ks" ;
NPCase Ess => minu + "na" ;
NPCase Abess => minu + "ta" ;
NPCase Comit => minu + "ga" ;
NPCase Termin => minu + "ni" ;
x => shortMa.s ! x } } ;
oper
relPron : NForm => Str =
@@ -577,43 +550,33 @@ oper
ProperName = {s : Case => Str} ;
-- TODO: generate using mkPronoun
pronSe : ProperName = {
s = table {
Nom => "see" ;
Gen => "selle" ;
Part => "seda" ;
Transl => "selleks" ;
Ess => "sellena" ;
Iness => "selles" ;
Elat => "sellest" ;
Illat => "sellesse" ;
Adess => "sellel" ;
Ablat => "sellelt" ;
Allat => "sellele" ;
Abess => "selleta" ;
Comit => "sellega" ;
Termin => "selleni"
Allat => "sellele"
} ;
} ;
-- TODO: generate using mkPronoun
pronNe : ProperName = {
s = table {
Nom => "need" ;
Gen => "nende" ;
Part => "neid" ;
Transl => "nendeks" ;
Ess => "nendena" ;
Iness => "nendes" ;
Elat => "nendest" ;
Illat => "nendesse" ;
Adess => "nendel" ;
Ablat => "nendelt" ;
Allat => "nendele" ;
Abess => "nendeta" ;
Comit => "nendega" ;
Termin => "nendeni"
Allat => "nendele"
} ;
} ;

View File

@@ -19,17 +19,10 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
case <n, c, det.isNum, det.isDef> of {
<_, NPAcc, True,_> => <Nom,NCase Sg Part> ; -- kolm kassi (as object)
<_, NPCase Nom, True,_> => <Nom,NCase Sg Part> ; -- kolm kassi (as subject)
--Only the last word gets case ending.
<_, NPCase Comit, _, _> => <Gen,NCase n Comit> ; -- kolme kassiga
<_, NPCase Abess, _, _> => <Gen,NCase n Abess> ; -- kolme kassita
<_, NPCase Ess, _, _> => <Gen,NCase n Ess> ; -- kolme kassina
<_, NPCase Termin,_, _> => <Gen,NCase n Termin> ; -- kolme kassini
<_, _, True,_> => <k, NCase Sg k> ; -- kolmeks kassiks (all other cases)
_ => <k, NCase n k> -- kass, kassi, ... (det is not a number)
}
in {
in cn ** {
s = \\c => let
k = ncase c ;
in
@@ -48,7 +41,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
True => Sg ;
_ => det.n
} ;
in {
in emptyNP ** {
s = \\c => let k = npform2case n c in
det.sp ! k ;
a = agrP3 (case det.isDef of {
@@ -58,37 +51,24 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
isPron = False
} ;
UsePN pn = {
UsePN pn = emptyNP ** {
s = \\c => pn.s ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
UsePron p = p ** {isPron = True} ;
UsePron p = p ** {isPron = True ; postmod = []} ;
PredetNP pred np = {
PredetNP pred np = np ** {
s = \\c => pred.s ! complNumAgr np.a ! c ++ np.s ! c ;
a = np.a ;
isPron = np.isPron -- kaikki minun - ni
} ;
PPartNP np v2 =
let
num : Number = complNumAgr np.a ;
part : Str = v2.s ! (PastPart Pass) ;
adj : NForms = hjk_type_IVb_maakas part ;
partGen : Str = adj ! 1 ;
partEss : Str = partGen + "na"
in {
s = \\c => np.s ! c ++ part ; --partEss ;
a = np.a ;
isPron = np.isPron -- minun täällä - ni
} ;
in np ** {postmod = np.postmod ++ part} ;
AdvNP np adv = {
s = \\c => np.s ! c ++ adv.s ;
a = np.a ;
isPron = np.isPron -- minun täällä - ni
} ;
AdvNP np adv = np ** {postmod = np.postmod ++ adv.s} ;
DetQuantOrd quant num ord = {
s = \\c => quant.s ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ;
@@ -106,13 +86,28 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
isDef = quant.isDef
} ;
DetDAP det = det ;
AdjDAP dap ap = dap ** {
s = \\c => dap.s ! c ++
case ap.infl of {
Regular => ap.s ! True ! NCase dap.n c ;
_ => ap.s ! True ! NCase dap.n Nom ---- participle
} ;
sp = \\c => dap.sp ! c ++
case ap.infl of {
Regular => ap.s ! True ! NCase dap.n c ;
_ => ap.s ! True ! NCase dap.n Nom ---- participle
} ;
} ;
PossPron p = {
s,sp = \\_,_ => p.s ! NPCase Gen ;
isNum = False ;
isDef = True --- "minun kolme autoani ovat" ; thus "...on" is missing
} ;
PossNP cn np = {s = \\nf => np.s ! NPCase Gen ++ cn.s ! nf };
PossNP cn np = np ** {s = \\nf => linNP (NPCase Gen) np ++ cn.s ! nf} ;
NumSg = {s = \\_,_ => [] ; isNum = False ; n = Sg} ;
NumPl = {s = \\_,_ => [] ; isNum = False ; n = Pl} ;
@@ -159,64 +154,65 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
let
n : Number = Sg ;
ncase : Case -> NForm = \c -> NCase n c ;
in {
in cn ** {
s = \\c => let k = npform2case n c in
cn.s ! ncase k ;
a = agrP3 Sg ;
isPron = False
} ;
UseN n = n ;
UseN n = emptyCN ** {
s = n.s
} ;
UseN2 n = n ;
Use2N3 f = lin N2 {
s = f.s ;
c2 = f.c2 ;
isPre = f.isPre
Use2N3 f = f ** {
postmod = []
} ;
Use3N3 f = lin N2 {
s = f.s ;
Use3N3 f = f ** {
c2 = f.c3 ;
isPre = f.isPre2 ;
postmod = []
} ;
ComplN2 f x = let compl : Str = appCompl True Pos f.c2 x in {
s = \\nf => case f.isPre of {
True => f.s ! nf ; -- N2 is pre, so compl goes into postmod
False => compl ++ f.s ! nf -- N2 isn't pre, compl goes in s before the N2
} ;
postmod = f.postmod ++ if_then_Str f.isPre compl []
} ;
-- N2 is subtype of CN, so we can reuse result of ComplN2 as a base for our CN.
-- The decision of noun-complement order is only done once, in ComplN2.
ComplN3 f x = let cn : CN = ComplN2 (Use2N3 f) x in cn ** {
c2 = f.c3 ;
isPre = f.isPre2
} ;
ComplN2 f x = {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x)
} ;
ComplN3 f x = lin N2 {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ;
c2 = f.c3 ;
isPre = f.isPre2
} ;
AdjCN ap cn = {
AdjCN ap cn = cn ** {
s = \\nf =>
case ap.infl of {
(Invariable|Participle) => ap.s ! True ! (NCase Sg Nom) ++ cn.s ! nf ; --valmis kassile; väsinud kassile
Regular => case nf of {
NCase num (Ess|Abess|Comit|Termin) => ap.s ! True ! (NCase num Gen) ++ cn.s ! nf ; --suure kassiga, not *suurega kassiga
_ => ap.s ! True ! nf ++ cn.s ! nf
}
Invariable|Participle => ap.s ! True ! NCase Sg Nom ++ cn.s ! nf ; --valmis kassile; väsinud kassile
Regular => ap.s ! True ! nf ++ cn.s ! nf -- Ess,Abess,Comit,Termin will only get case ending after the CN, so suure kassiga, not *suurega kassiga
}
} ;
RelCN cn rs = {s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)} ;
RelCN cn rs = cn ** { -- exception to postmod rule, because RS depends on Agr
s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)
} ;
RelNP np rs = {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
a = np.a ;
RelNP np rs = np ** {
postmod = np.postmod ++ "," ++ rs.s ! np.a ;
isPron = np.isPron ---- correct ?
} ;
AdvCN cn ad = {s = \\nf => cn.s ! nf ++ ad.s} ;
AdvCN cn ad = cn ** {postmod = cn.postmod ++ ad.s} ;
SentCN cn sc = {s = \\nf=> cn.s ! nf ++ sc.s} ;
SentCN cn sc = cn ** {postmod = cn.postmod ++ sc.s} ;
ApposCN cn np = {s = \\nf=> cn.s ! nf ++ np.s ! NPCase Nom} ; --- luvun x
ApposCN cn np = cn ** {postmod = cn.postmod ++ linNP (NPCase Nom) np} ; --- luvun x
oper
numN : NForm -> Number = \nf -> case nf of {

View File

@@ -27,6 +27,7 @@ resource ParadigmsEst = open
(Predef=Predef),
Prelude,
MorphoEst,
(ResEst=ResEst),
HjkEst,
CatEst
in {
@@ -62,6 +63,8 @@ oper
abessive : Case ; -- e.g. "karbita"
comitative : Case ; -- e.g. "karbiga"
InfForm : Type ;
infDa : InfForm ; -- e.g. "lugeda"
infDes : InfForm ; -- e.g. "lugedes"
infMa : InfForm ; -- e.g. "lugema"
@@ -69,6 +72,7 @@ oper
infMaks : InfForm ; -- e.g. "lugemaks"
infMast : InfForm ; -- e.g. "lugemast"
infMata : InfForm ; -- e.g. "lugemata"
infMine : InfForm ; -- e.g. "lugemine"
-- The following type is used for defining *rection*, i.e. complements
-- of many-place verbs and adjective. A complement can be defined by
@@ -154,7 +158,7 @@ oper
-- Two-place adjectives need a case for the second argument.
mkA2 : A -> Prep -> A2 -- e.g. "vihane" (postGenPrep "peale")
= \a,p -> a ** {c2 = p ; lock_A2 = <>};
= \a,p -> lin A2 (a ** {c2 = p}) ;
invA : Str -> A ; -- invariable adjectives, such as genitive attributes ; no agreement to head, no comparison forms.
@@ -272,47 +276,66 @@ oper
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
Case = MorphoEst.Case ;
Case = MorphoEst.CasePlus ;
Number = MorphoEst.Number ;
singular = Sg ;
plural = Pl ;
nominative = Nom ;
genitive = Gen ;
partitive = Part ;
illative = Illat ;
inessive = Iness ;
elative = Elat ;
allative = Allat ;
adessive = Adess ;
ablative = Ablat ;
translative = Transl ;
terminative = Termin ;
essive = Ess ;
abessive = Abess ;
comitative = Comit ;
nominative = Nominative ;
genitive = Genitive ;
partitive = Partitive ;
illative = Illative ;
inessive = Inessive ;
elative = Elative ;
allative = Allative ;
adessive = Adessive ;
ablative = Ablative ;
translative = Translative ;
terminative = Terminative ;
essive = Essive ;
abessive = Abessive ;
comitative = Comitative ;
-- IL 2022-04: after introducing stem+suffixes, 4 other cases have just genitive stems.
-- isActuallyGenitive is needed for those mkN2 and mkN3 instances that take a Prep as an argument,
-- and actual Gen gets isPre=True, and those with genitive stem+suffix should get False.
-- This is confusing and error-prone, consider restructuring/renaming things later.
isActuallyGenitive : MorphoEst.CasePlus -> Bool = \c -> case c of {
{c = MorphoEst.Gen ; suf = ""} => True ;
_ => False
} ;
-- combination of stem + suffix, e.g. infDes = {stem = InfD ; suf = "es"} ;
InfForm = ResEst.InfForms ;
infDa = InfDa ; infMa = InfMa ; infMast = InfMast ;
infDes = InfDes ; infMas = InfMas ; infMaks = InfMaks ; infMata = InfMata ;
infDes = InfDes ; infMas = InfMas ; infMaks = InfMaks ; infMata = InfMata ; infMine = InfMine ;
prePrep : Case -> Str -> Prep =
\c,p -> {c = NPCase c ; s = p ; isPre = True ; lock_Prep = <>} ;
postPrep : Case -> Str -> Prep =
\c,p -> {c = NPCase c ; s = p ; isPre = False ; lock_Prep = <>} ;
postGenPrep p = {
c = NPCase genitive ; s = p ; isPre = False ; lock_Prep = <>} ;
casePrep : Case -> Prep =
\c -> {c = NPCase c ; s = [] ; isPre = True ; lock_Prep = <>} ;
accPrep = {c = NPAcc ; s = [] ; isPre = True ; lock_Prep = <>} ;
mkPrep : (isPre : Bool) -> Case -> Str -> Prep = \isPre,c,p -> lin Prep {
c = casep2npformp c ;
s = p ;
isPre = isPre
} ;
prePrep : Case -> Str -> Prep = mkPrep True ;
postPrep : Case -> Str -> Prep = mkPrep False ;
postGenPrep : Str -> Prep = postPrep genitive ;
-- The Prep's isPre field is used in a special (hacky) way in mkN3 and mkN2.
-- Used to be able to match whether the Prep's case is Gen, but now several
-- Preps use the genitive stem, so we need to check if it's actually genitive.
casePrep : Case -> Prep = \c -> mkPrep (isActuallyGenitive c) c [] ;
mkAdv : Str -> Adv = \str -> {s = str ; lock_Adv = <>} ;
mkAdV : Str -> AdV = \str -> {s = str ; lock_AdV = <>} ;
mkAdN : Str -> AdN = \str -> {s = str ; lock_AdN = <>} ;
mkAdA : Str -> AdA = \str -> {s = str ; lock_AdA = <>} ;
-- NPAcc is different, it's not formed from a Case(Plus)
accPrep : Prep = lin Prep {
c = case2npformp NPAcc ;
s = [] ;
isPre = True
} ;
mkAdv : Str -> Adv = \str -> lin Adv (ss str) ;
mkAdV : Str -> AdV = \str -> lin AdV (ss str) ;
mkAdN : Str -> AdN = \str -> lin AdN (ss str) ;
mkAdA : Str -> AdA = \str -> lin AdA (ss str) ;
mkConj = overload {
mkConj : Str -> Conj = \ja -> lin Conj ((sd2 "" ja) ** {n = Sg}) ;
@@ -321,7 +344,7 @@ oper
mkConj : Str -> Str -> Number -> Conj = \nii,kui,num -> lin Conj ((sd2 nii kui) ** {n = num}) ;
} ;
mkPConj s = ss s ** {lock_PConj = <>} ;
mkPConj s = lin PConj (ss s) ;
mkN = overload {
mkN : (nisu : Str) -> N = mk1N ;
@@ -337,14 +360,13 @@ oper
-- Adjective forms (incl. comp and sup) are derived from noun forms
mk1A : Str -> A = \suur ->
let aforms = aForms2A (nforms2aforms (hjk_type suur))
in aforms ** {infl = Regular } ;
in lin A (aforms ** {infl = Regular}) ;
mkNA : N -> A = \suur ->
let aforms = aForms2A (nforms2aforms (n2nforms suur)) ;
in aforms ** {infl = Regular } ;
in lin A (aforms ** {infl = Regular}) ;
mk1N : (link : Str) -> N = \s -> nForms2N (hjk_type s) ** {lock_N = <> } ;
mk1N : (link : Str) -> N = \s -> lin N (nForms2N (hjk_type s)) ;
-- mk2N, mk3N, mk4N make sure that the user specified forms end up in the paradigm,
-- even though the rest is wrong
@@ -358,7 +380,7 @@ oper
4 => nfs ! 4 ;
5 => nfs ! 5
} ;
in nForms2N nfs_fixed ** {lock_N = <> } ;
in lin N (nForms2N nfs_fixed) ;
mk3N : (tukk,tuku,tukku : Str) -> N = \tukk,tuku,tukku ->
@@ -371,7 +393,7 @@ oper
4 => nfs ! 4 ;
5 => nfs ! 5
} ;
in nForms2N nfs_fixed ** {lock_N = <> } ;
in lin N (nForms2N nfs_fixed) ;
mk4N : (paat,paadi,paati,paate : Str) -> N = \paat,paadi,paati,paate ->
@@ -384,17 +406,17 @@ oper
4 => nfs ! 4 ;
5 => paate
} ;
in nForms2N nfs_fixed ** {lock_N = <> } ;
in lin N (nForms2N nfs_fixed) ;
mk6N : (oun,ouna,ouna,ounasse,ounte,ounu : Str) -> N =
\a,b,c,d,e,f -> nForms2N (nForms6 a b c d e f) ** {lock_N = <> } ;
\a,b,c,d,e,f -> lin N (nForms2N (nForms6 a b c d e f)) ;
mkStrN : Str -> N -> N = \sora,tie -> {
s = \\c => sora + tie.s ! c ; lock_N = <>
mkStrN : Str -> N -> N = \sora,tie -> tie ** {
s = \\c => sora + tie.s ! c
} ;
mkNN : N -> N -> N = \oma,tunto -> {
s = \\c => oma.s ! c + tunto.s ! c ; lock_N = <>
mkNN : N -> N -> N = \oma,tunto -> tunto ** {
s = \\c => oma.s ! c + tunto.s ! c ;
} ; ---- TODO: oma in possessive suffix forms
@@ -552,51 +574,55 @@ oper
mkN2 : N -> Prep -> N2 = mmkN2
} ;
mmkN2 : N -> Prep -> N2 = \n,c -> n ** {c2 = c ; isPre = mkIsPre c ; lock_N2 = <>} ;
mkN3 = \n,c,e -> n ** {c2 = c ; c3 = e ;
mmkN2 : N -> Prep -> N2 = \n,c -> lin N2 (n ** {
c2 = c ;
isPre = mkIsPre c ;
postmod = []
}) ;
mkN3 = \n,c,e -> lin N3 (n ** {
c2 = c ; c3 = e ;
isPre = mkIsPre c ; -- matka Londonist Pariisi
isPre2 = mkIsPre e ; -- Suomen voitto Ruotsista
lock_N3 = <>
} ;
}) ;
mkIsPre : Prep -> Bool = \p -> case p.c of {
mkIsPre : Prep -> Bool = \p -> case p.c.npf of {
NPCase Gen => notB p.isPre ; -- Jussin veli (prep is <Gen,"",True>, isPre becomes False)
_ => True -- syyte Jussia vastaan, puhe Jussin puolesta
} ;
mkPN = overload {
mkPN : Str -> PN = mkPN_1 ;
mkPN : N -> PN = \s -> {s = \\c => s.s ! NCase Sg c ; lock_PN = <>} ;
mkPN : N -> PN = \s -> lin PN {s = \\c => s.s ! NCase Sg c} ;
} ;
mkPN_1 : Str -> PN = \s -> {s = \\c => (mk1N s).s ! NCase Sg c ; lock_PN = <>} ;
mkPN_1 : Str -> PN = \s -> lin PN {s = \\c => (mk1N s).s ! NCase Sg c} ;
-- adjectives
mkA = overload {
mkA : Str -> A = mkA_1 ;
mkA : N -> A = \n -> noun2adjDeg n ** {infl = Regular ; lock_A = <>} ;
mkA : N -> A = \n -> noun2adjDeg n ** {infl = Regular} ;
mkA : N -> (parem,parim : Str) -> A = regAdjective ;
mkA : N -> (infl : Infl) -> A = \n,infl -> noun2adjDeg n ** {infl = infl ; lock_A = <>} ;
mkA : N -> (infl : Infl) -> A = \n,infl -> noun2adjDeg n ** {infl = infl} ;
-- TODO: temporary usage of regAdjective1
mkA : N -> (valmim,valmeim : Str) -> (infl : Infl) -> A =
\n,c,s,infl -> (regAdjective1 n c s) ** {infl = infl ; lock_A = <>} ;
\n,c,s,infl -> (regAdjective1 n c s) ** {infl = infl} ;
} ;
invA balti = {s = \\_,_ => balti ; infl = Invariable ; lock_A = <>} ;
invA balti = lin A {s = \\_,_ => balti ; infl = Invariable} ;
mkA_1 : Str -> A = \x -> noun2adjDeg (mk1N x) ** {infl = Regular ; lock_A = <>} ;
mkA_1 : Str -> A = \x -> noun2adjDeg (mk1N x) ** {infl = Regular } ;
-- auxiliaries
mkAdjective : (_,_,_ : Adj) -> A = \hea,parem,parim ->
{s = table {
mkAdjective : (_,_,_ : Adj) -> A = \hea,parem,parim -> lin A ({
s = table {
Posit => hea.s ;
Compar => parem.s ;
Superl => parim.s
} ;
infl = Regular ;
lock_A = <>
} ;
}) ;
-- Adjectives whose comparison forms are explicitly given.
-- The inflection of these forms with the audit-rule always works.
@@ -617,7 +643,7 @@ oper
-- e.g. lai -> laiem -> laiim? / laieim?
-- See also: http://www.eki.ee/books/ekk09/index.php?p=3&p1=4&id=208
-- Rather use "kõige" + Comp instead of the superlative.
noun2adjDeg : Noun -> Adjective = \kaunis ->
noun2adjDeg : Noun -> A = \kaunis ->
let
kauni = (kaunis.s ! NCase Sg Gen) ;
-- Convert the final 'i' to 'e' for the superlative
@@ -637,27 +663,13 @@ oper
mkV : (aru : Str) -> (saama : V) -> V = mkPV ; -- particle verbs
} ;
mk1V : Str -> V = \s ->
let vfs = vforms2V (vForms1 s) in
vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mk2V : (_,_ : Str) -> V = \x,y ->
let
vfs = vforms2V (vForms2 x y)
in vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mk3V : (_,_,_ : Str) -> V = \x,y,z ->
let
vfs = vforms2V (vForms3 x y z)
in vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mk4V : (x1,_,_,x4 : Str) -> V = \a,b,c,d ->
let
vfs = vforms2V (vForms4 a b c d)
in vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mk8V : (x1,_,_,_,_,_,_,x8 : Str) -> V = \a,b,c,d,e,f,g,h ->
let
vfs = vforms2V (vForms8 a b c d e f g h)
in vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mkPV : (aru : Str) -> (saama : V) -> V = \aru,saama ->
{s = saama.s ; p = aru ; sc = saama.sc ; lock_V = <> } ;
vforms2v : ResEst.VForms -> CatEst.V = \vfs -> lin V (vforms2verb vfs ** {sc = NPCase Nom}) ;
mk1V : Str -> V = \s -> vforms2v (vForms1 s) ;
mk2V : (_,_ : Str) -> V = \x,y -> vforms2v (vForms2 x y) ;
mk3V : (_,_,_ : Str) -> V = \x,y,z -> vforms2v (vForms3 x y z) ;
mk4V : (x1,_,_,x4 : Str) -> V = \a,b,c,d -> vforms2v (vForms4 a b c d) ;
mk8V : (x1,_,_,_,_,_,_,x8 : Str) -> V = \a,b,c,d,e,f,g,h -> vforms2v (vForms8 a b c d e f g h) ;
mkPV : (aru : Str) -> (saama : V) -> V = \aru,saama -> saama ** {p=aru} ;
-- This used to be the last case: _ => Predef.error (["expected infinitive, found"] ++ ottaa)
@@ -815,12 +827,12 @@ oper
<_,_,_,_> => regVForms jatma jatta jatab jaetakse
} ;
caseV c v = {s = v.s ; p = v.p; sc = NPCase c ; lock_V = <>} ;
caseV c v = v ** {sc = NPCase c.c} ;
vOlema = verbOlema ** {sc = NPCase Nom ; lock_V = <>} ;
vMinema = verbMinema ** {sc = NPCase Nom ; lock_V = <>} ;
vOlema = lin V (verbOlema ** {sc = NPCase Nom}) ;
vMinema = lin V (verbMinema ** {sc = NPCase Nom}) ;
mk2V2 : V -> Prep -> V2 = \v,c -> v ** {c2 = c ; lock_V2 = <>} ;
mk2V2 : V -> Prep -> V2 = \v,c -> lin V2 (v ** {c2 = c}) ;
caseV2 : V -> Case -> V2 = \v,c -> mk2V2 v (casePrep c) ;
dirV2 v = mk2V2 v accPrep ;
@@ -837,69 +849,69 @@ oper
dirV2 : V -> V2 ;
mkV3 = overload {
mkV3 : V -> Prep -> Prep -> V3 = \v,p,q -> v ** {c2 = p ; c3 = q ; lock_V3 = <>} ;
mkV2 : V -> V3 = \v -> v ** {c2 = accPrep ;
c3 = (casePrep allative) ;
lock_V3 = <>} ;
mkV2 : Str -> V3 = \str -> (mkV str) ** {c2 = accPrep ;
c3 = (casePrep allative) ;
lock_V3 = <>} ;
} ;
mkV3 : V -> Prep -> Prep -> V3 = \v,p,q -> lin V3 (v ** {c2 = p ; c3 = q}) ;
mkV3 : V -> V3 = \v -> lin V3 (v ** {c2 = accPrep ; c3 = casePrep allative}) ;
mkV3 : Str -> V3 = \str ->
let v : V = mkV str
in lin V3 (v ** {c2 = accPrep ; c3 = casePrep allative})
} ;
dirV3 v p = mkV3 v accPrep (casePrep p) ;
dirdirV3 v = dirV3 v allative ;
mkVS = overload {
mkVS : V -> VS = \v -> v ** {lock_VS = <>} ;
mkVS : Str -> VS = \str -> (mkV str) ** {lock_VS = <>} ;
mkVS : V -> VS = \v -> lin VS v ;
mkVS : Str -> VS = \str -> let v : V = mkV str in lin VS v ;
} ;
mkVV = overload {
mkVV : V -> VV = \v -> mkVVf v infDa ;
mkVV : Str -> VV = \str -> mkVVf (mkV str) infDa ;
} ;
mkVVf v f = v ** {vi = f ; lock_VV = <>} ;
mkVVf v f = lin VV (v ** {vi = f}) ;
mkVQ = overload {
mkVQ : V -> VQ = \v -> v ** {lock_VQ = <>} ;
mkVQ : Str -> VQ = \str -> (mkV str) ** {lock_VQ = <>} ;
mkVQ : V -> VQ = \v -> lin VQ v ;
mkVQ : Str -> VQ = \str -> let v : V = mkV str in lin VQ v ;
} ;
V0 : Type = V ;
AS, A2S, AV : Type = A ;
A2V : Type = A2 ;
mkV0 v = v ** {lock_V = <>} ;
mkV0 v = v ;
mkV2S = overload {
mkV2S : V -> Prep -> V2S = \v,p -> (mk2V2 v p) ** {lock_V2S = <>} ;
mkV2S : Str -> V2S = \str -> (mk2V2 (mkV str) (casePrep allative)) ** {lock_VS = <>} ;
mkV2S : V -> Prep -> V2S = \v,p -> lin V2S (mk2V2 v p) ;
mkV2S : Str -> V2S = \str ->
let v : V = mkV str
in lin V2S (mk2V2 v (casePrep allative))
} ;
-- mkV2S v p = mk2V2 v p ** {lock_V2S = <>} ;
mkV2V = overload {
mkV2V : V -> Prep -> V2V = \v,p -> mkV2Vf v p infMa ;
mkV2V : V -> V2V = \v -> mkV2Vf v (casePrep genitive) infMa ;
mkV2V : Str -> V2V = \str -> mkV2Vf (mkV str) (casePrep genitive) infMa ;
} ;
mkV2Vf v p f = mk2V2 v p ** {vi = f ; lock_V2V = <>} ;
mkV2Vf v p f = lin V2V (mk2V2 v p ** {vi = f}) ;
mkVA = overload {
mkVA : V -> Prep -> VA = \v,p -> v ** {c2 = p ; lock_VA = <>} ;
mkVA : V -> VA = \v -> v ** {c2 = casePrep translative ; lock_VA = <>} ;
mkVA : Str -> VA = \str -> (mkV str) ** {c2 = casePrep translative ; lock_VA = <>} ;
mkVA : V -> Prep -> VA = \v,p -> lin VA (v ** {c2 = p}) ;
mkVA : V -> VA = \v -> lin VA (v ** {c2 = casePrep genitive}) ;
mkVA : Str -> VA = \str -> let v : V = mkV str in
lin VA (v ** {c2 = casePrep genitive}) ;
} ;
mkV2A = overload {
mkV2A : V -> Prep -> Prep -> V2A = \v,p,q -> v ** {c2 = p ; c3 = q ; lock_V2A = <>} ;
mkV2A : V -> V2A = \v -> v ** {c2 = casePrep genitive ;
c3 = casePrep translative ;
lock_V2A = <>} ;
mkV2A : Str -> V2A = \str -> (mkV str) ** {c2 = casePrep genitive ;
c3 = casePrep translative ;
lock_V2A = <>} ;
mkV2A : V -> Prep -> Prep -> V2A = \v,p,q ->
lin V2A (v ** {c2 = p ; c3 = q}) ;
mkV2A : V -> V2A = \v ->
lin V2A (v ** {c2 = casePrep genitive ; c3 = casePrep translative}) ;
mkV2A : Str -> V2A = \str -> let v : V = mkV str in
lin V2A (v ** {c2 = casePrep genitive ; c3 = casePrep translative}) ;
} ;
mkV2Q v p = mk2V2 v p ** {lock_V2Q = <>} ;
mkV2Q v p = lin V2Q (mk2V2 v p) ;
mkAS v = v ** {lock_A = <>} ;
mkA2S v p = mkA2 v p ** {lock_A = <>} ;
mkAV v = v ** {lock_A = <>} ;
mkA2V v p = mkA2 v p ** {lock_A2 = <>} ;
mkAS a = a ;
mkA2S a p = mkA2 a p ;
mkAV a = a ;
mkA2V a p = mkA2 a p ;
} ;

View File

@@ -9,12 +9,12 @@ concrete PhraseEst of Phrase = CatEst ** open ResEst, (P = Prelude) in {
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Ag Pl P2} ;
UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! AgPol} ;
UttIP ip = {s = ip.s ! NPCase Nom} ;
UttIP ip = {s = linIP (NPCase Nom) ip} ;
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! NPCase Nom} ;
UttVP vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfDa} ;
UttNP np = {s = linNP (NPCase Nom) np} ;
UttVP vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfMa} ;
UttAdv adv = adv ;
UttCN np = {s = np.s ! NCase Sg Nom} ;
UttCN cn = {s = linCN (NCase Sg Nom) cn} ;
UttAP np = {s = np.s ! P.False ! NCase Sg Nom} ;
UttCard n = {s = n.s ! Sg ! Nom} ;
UttInterj i = i ;
@@ -23,6 +23,6 @@ concrete PhraseEst of Phrase = CatEst ** open ResEst, (P = Prelude) in {
PConjConj conj = {s = conj.s2} ;
NoVoc = {s = []} ;
VocNP np = {s = "," ++ np.s ! NPCase Nom} ;
VocNP np = {s = "," ++ linNP (NPCase Nom) np} ;
}

View File

@@ -40,16 +40,15 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in {
PrepIP p ip = {s =
appCompl True Pos p (ip ** {a = agrP3 ip.n ; isPron = False})} ;
AdvIP ip adv = {
s = \\c => ip.s ! c ++ adv.s ;
n = ip.n
AdvIP ip adv = ip ** {
postmod = ip.postmod ++ adv.s ;
} ;
-- The computation of $ncase$ is a special case of that in $NounEst.DetCN$,
-- since we don't have possessive suffixes or definiteness.
--- It could still be nice to have a common oper...
IdetCN idet cn = let n = idet.n in {
IdetCN idet cn = let n = idet.n in emptyIP ** {
s = \\c =>
let
k : Case = npform2case n c ;
@@ -67,7 +66,7 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in {
n = n
} ;
IdetIP idet = let n = idet.n in {
IdetIP idet = let n = idet.n in emptyIP ** {
s = \\c =>
let
k = npform2case n c ;
@@ -97,6 +96,6 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in {
AdvIAdv i a = {s = i.s ++ a.s} ;
CompIAdv a = {s = \\_ => a.s} ;
CompIP ip = {s = \\_ => ip.s ! NPCase Nom} ;
CompIP ip = {s = \\_ => linIP (NPCase Nom) ip} ;
}

View File

@@ -18,8 +18,10 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in
RAg a => a
} ;
cl = mkClause
(subjForm {s = rp.s ! (complNumAgr agr) ;
a = agr ; isPron = False} vp.sc) agr vp
(subjForm
(emptyNP ** {s = rp.s ! complNumAgr agr ; a = agr})
vp.sc)
agr vp
in
cl.s ! t ! ant ! b ! SDecl ;
c = NPCase Nom
@@ -32,11 +34,11 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in
who = appCompl True p slash.c2 (rp2np (complNumAgr ag) rp)
in
who ++ cls ;
c = slash.c2.c
c = slash.c2.c.npf
} ;
FunRP p np rp = {
s = \\n,c => appCompl True Pos p (rp2np n rp) ++ np.s ! c ; --- is c OK?
s = \\n,c => appCompl True Pos p (rp2np n rp) ++ linNP c np ; --- is c OK?
a = RAg np.a
} ;

View File

@@ -15,16 +15,35 @@ resource ResEst = ParamX ** open Prelude in {
-- This is the $Case$ as needed for both nouns and $NP$s.
param
Case = Nom | Gen | Part
Case = Nom | Gen | Part | Transl
| Illat | Iness | Elat | Allat | Adess | Ablat
| Transl | Ess | Termin | Abess | Comit;
;
NForm = NCase Number Case ;
oper
-- Reduce the Case parameter: many cases use the Genitive stem and just add suffix to it
CasePlus : Type = {
c : Case ; -- e.g. Gen
suf : Str -- e.g. "ga" for comitative
} ;
Nominative = {c = Nom ; suf = []} ;
Genitive = {c = Gen ; suf = []} ;
Partitive = {c = Part ; suf = []} ;
Illative = {c = Illat ; suf = []} ;
Inessive = {c = Iness ; suf = []} ;
Elative = {c = Elat ; suf = []} ;
Allative = {c = Allat ; suf = []} ;
Adessive = {c = Adess ; suf = []} ;
Ablative = {c = Ablat ; suf = []} ;
Translative = {c = Transl ; suf = []} ;
Terminative = {c = Gen ; suf = BIND ++ "ni"} ;
Essive = {c = Gen ; suf = BIND ++ "na"} ;
Abessive = {c = Gen ; suf = BIND ++ "ta"} ;
Comitative = {c = Gen ; suf = BIND ++ "ga"} ;
param
-- Agreement of $NP$ has number*person and the polite second ("te olette valmis").
Agr = Ag Number Person | AgPol ;
oper
@@ -38,8 +57,34 @@ resource ResEst = ParamX ** open Prelude in {
} ;
oper
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool} ;
IPhrase : Type = {
s : NPForm => Str ; -- the noun phrase + premodifiers
postmod : Str ; -- adverb, RS, etc. other postmods
n : Number
} ;
NPhrase : Type = {
s : NPForm => Str ; -- the noun phrase + premodifiers
postmod : Str ; -- adverb, RS, etc. other postmods
a : Agr ;
isPron : Bool
} ;
emptyNP : NPhrase = {
s = \\_ => [] ;
postmod = [] ;
a = agrP3 Sg ;
isPron = False
} ;
emptyIP : IPhrase = {
s = \\_ => [] ;
postmod = [] ;
n = Sg ;
} ;
linNP : NPForm -> NPhrase -> Str = \npf,np -> np.s ! npf ++ np.postmod ;
linIP : NPForm -> IPhrase -> Str = \npf,ip -> ip.s ! npf ++ ip.postmod ;
--
--2 Adjectives
--
@@ -52,7 +97,9 @@ param
Infl = Regular | Participle | Invariable ;
oper
Adjective : Type = {s : Degree => AForm => Str; lock_A : {}} ;
Adjective : Type = {s : Degree => AForm => Str} ;
APhrase : Type = {s : Bool => NForm => Str ; infl : Infl} ;
--2 Noun phrases
--
@@ -66,6 +113,14 @@ param
NPForm = NPCase Case | NPAcc ;
oper
NPFormPlus : Type = {
npf : NPForm ; -- e.g. NPCase Gen
suf : Str -- e.g. "ga" for comitative
} ;
casep2npformp : CasePlus -> NPFormPlus = \cp -> cp ** {npf = NPCase cp.c} ;
case2npformp : NPForm -> NPFormPlus = \npf-> {npf = npf ; suf = []} ;
npform2case : Number -> NPForm -> Case = \n,f ->
-- type signature: workaround for gfc bug 9/11/2007
@@ -81,7 +136,7 @@ oper
param
VForm =
Inf InfForm
Inf InfStem
| Presn Number Person
| Impf Number Person
| Condit Number Person
@@ -99,16 +154,32 @@ param
Voice = Act | Pass ;
InfForm =
InfDa -- lugeda
| InfDes -- lugedes
| InfMa -- lugema
| InfMas -- lugemas
| InfMast -- lugemast
| InfMata -- lugemata
| InfMaks -- lugemaks
InfStem =
InfD -- luge+da/des, but can be irregular: tulla, tulles
| InfM -- lugema/mas/mast/maks/mata/mine
;
oper
InfForms : Type = {stem : InfStem ; suf : Str} ;
InfDa, InfDes, InfMa, InfMas, InfMast, InfMata, InfMaks, InfMine : InfForms ;
InfDa = {stem = InfD ; suf = "a"} ; -- lugeda
InfDes = {stem = InfD ; suf = "es"} ; -- lugedes
InfMa = {stem = InfM ; suf = "a"} ; -- lugema
InfMas = {stem = InfM ; suf = "as"} ; -- lugemas
InfMast = {stem = InfM ; suf = "ast"} ; -- lugemast
InfMata = {stem = InfM ; suf = "ata"} ; -- lugemata
InfMaks = {stem = InfM ; suf = "aks"} ; -- lugemaks
InfMine = {stem = InfM ; suf = "ine"} ; -- lugemine
applyInfFormsVP : InfForms -> VP -> {fin,inf : Str} = \if,vp ->
let vpforms : VPForms = mkVPForms vp.v ;
stemOnly : {fin,inf : Str} = vpforms ! VIInf if.stem ! Simul ! Pos ! agrP3 Sg ;
in stemOnly ** {fin = glue stemOnly.fin if.suf} ; -- Despite the name, the infinite form is in the "fin" field, "inf" contains participle
applyInfFormsV : InfForms -> (VForm => Str) -> Str = \if,vf ->
glue (vf ! Inf if.stem) if.suf ;
param
SType = SDecl | SQuest | SInv ;
--2 For $Relative$
@@ -134,11 +205,13 @@ param
---
Compl : Type = {s : Str ; c : NPForm ; isPre : Bool} ;
Compl : Type = {s : Str ; c : NPFormPlus ; isPre : Bool} ;
appCompl : Bool -> Polarity -> Compl -> NP -> Str = \isFin,b,co,np ->
npfplus2compl : NPFormPlus -> Compl = \npf -> {s = [] ; c = npf ; isPre = False} ;
appCompl : Bool -> Polarity -> Compl -> NPhrase -> Str = \isFin,b,co,np ->
let
c = case co.c of {
c = case co.c.npf of {
NPAcc => case b of {
Neg => NPCase Part ; -- ma ei näe raamatut/sind
Pos => case isFin of {
@@ -149,20 +222,18 @@ param
}
}
} ;
_ => co.c
_ => co.c.npf
} ;
{-
c = case <isFin, b, co.c, np.isPron> of {
<_, Neg, NPAcc,_> => NPCase Part ; -- en näe taloa/sinua
<_, Pos, NPAcc,True> => NPAcc ; -- näen/täytyy sinut
<False,Pos, NPAcc,False> => NPCase Nom ; -- täytyy nähdä talo
<_,_,coc,_> => coc
} ;
-}
nps = np.s ! c
nps = np.s ! c ++ co.c.suf ; -- complement's NPFormPlus may include suffix for the cases based on Gen stem, e.g. comitative "ga"
in
preOrPost co.isPre co.s nps ;
preOrPost co.isPre co.s nps ++ np.postmod ;
-- Used for passive; c2 of V2/VPSlash becomes sc of VP
compl2subjcase : Compl -> NPForm = \compl ->
case compl.c.npf of {
NPCase Gen => NPCase Nom ; -- valisin koera -> koer valitakse
_ => compl.c.npf -- rääkisin koerale -> koerale räägitakse
} ;
-- For $Verb$.
Verb : Type = {
@@ -170,10 +241,16 @@ param
p : Str -- particle verbs
} ;
Verb1 : Type = Verb ** {sc : NPForm} ; --subject case, i.e. "ma näen kassi"/"mul on kass"
Verb2 : Type = Verb1 ** {c2 : Compl} ;
Verb3 : Type = Verb2 ** {c3 : Compl} ;
linV2, linV : Verb -> Str = \v -> applyInfFormsV InfMa v.s ++ v.p ;
param
VIForm =
VIFin Tense
| VIInf InfForm
| VIInf InfStem
| VIPass Tense
| VIPresPart
| VIImper
@@ -181,7 +258,7 @@ param
oper
VP : Type = {
s : VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ;
v : Verb ;
s2 : Bool => Polarity => Agr => Str ; -- raamat/raamatu/raamatut
adv : Str ;
p : Str ; --uninflecting component in multi-word verbs
@@ -189,48 +266,64 @@ oper
sc : NPForm ;
} ;
predV : (Verb ** {sc : NPForm}) -> VP = \verb -> {
s = \\vi,ant,b,agr0 =>
let
agr = verbAgr agr0 ;
verbs = verb.s ;
part : Str = case vi of {
VIPass _ => verbs ! (PastPart Pass) ;
_ => verbs ! (PastPart Act)
} ;
passiveVerb : Verb -> Verb = \verb -> verb ** {
s = table {
Presn _ _ => verb.s ! PassPresn True ;
Impf _ _ => verb.s ! PassImpf True ; --# notpresent
Condit _ _ => verb.s ! ConditPass ; --# notpresent
ImperP3 => verb.s ! ImperPass ;
Imper Sg => verb.s ! PassPresn False ; -- weird hack, because the Imper Sg field is used for negative form; if VP undergoes PassV*, then its negation should also be in passive.
PresPart _ => verb.s ! PresPart Pass ;
PastPart _ => verb.s ! PastPart Pass ;
x => verb.s ! x }
} ;
einegole : Str * Str * Str = case <vi,agr.n> of {
<VIFin Pres> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Fut> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Cond> => <"ei", verbs ! Condit Sg P3, "oleks"> ;
<VIFin Past> => <"ei", part, "olnud"> ;
<VIImper, Sg> => <"ära", verbs ! Imper Sg, "ole"> ;
<VIImper, Pl> => <"ärge", verbs ! Imper Pl, "olge"> ;
<VIPass Pres> => <"ei", verbs ! PassPresn False, "ole"> ;
<VIPass Fut> => <"ei", verbs ! PassPresn False, "ole"> ; --# notpresent
<VIPass Cond> => <"ei", verbs ! ConditPass, "oleks"> ; --# notpresent
<VIPass Past> => <"ei", verbs ! PassImpf False, "olnud"> ; --# notpresent
<VIPresPart> => <"ei", verbs ! PresPart Act, "olev"> ; --# notpresent
<VIInf i> => <"ei", verbs ! Inf i, verbOlema.s ! Inf i>
-- NB. only chooses passive verb forms, to get subject case need compl2subjcase, used in PassV2
passiveVP : VP -> VP = \vp -> vp ** {v = passiveVerb vp.v} ;
} ;
VPForms : Type = VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ;
ei : Str = einegole.p1 ;
neg : Str = einegole.p2 ;
ole : Str = einegole.p3 ;
mkVPForms : Verb -> VPForms = \verb -> \\vi,ant,b,agr0 =>
let
agr = verbAgr agr0 ;
verbs = verb.s ;
part : Str = case vi of {
VIPass _ => verbs ! PastPart Pass ;
_ => verbs ! PastPart Act
} ;
olema : VForm => Str = verbOlema.s ;
einegole : Str * Str * Str = case <vi,agr.n> of {
<VIFin Pres> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Fut> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Cond> => <"ei", verbs ! Condit Sg P3, "oleks"> ;
<VIFin Past> => <"ei", part, "olnud"> ;
<VIImper, Sg> => <"ära", verbs ! Imper Sg, "ole"> ;
<VIImper, Pl> => <"ärge", verbs ! Imper Pl, "olge"> ;
<VIPass Pres> => <"ei", verbs ! PassPresn False, "ole"> ;
<VIPass Fut> => <"ei", verbs ! PassPresn False, "ole"> ; --# notpresent
<VIPass Cond> => <"ei", verbs ! ConditPass, "oleks"> ; --# notpresent
<VIPass Past> => <"ei", verbs ! PassImpf False, "olnud"> ; --# notpresent
<VIPresPart> => <"ei", verbs ! PresPart Act, "olev"> ; --# notpresent
<VIInf i> => <"ei", verbs ! Inf i, verbOlema.s ! Inf i>
vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ;
} ;
mkvf : VForm -> {fin, inf : Str} = \p -> case <ant,b> of {
<Simul,Pos> => vf (verbs ! p) [] ;
<Anter,Pos> => vf (olema ! p) part ;
<Simul,Neg> => vf (ei ++ neg) [] ;
<Anter,Neg> => vf (ei ++ ole) part
} ;
ei : Str = einegole.p1 ;
neg : Str = einegole.p2 ;
ole : Str = einegole.p3 ;
passPol = case b of {Pos => True ; Neg => False} ;
olema : VForm => Str = verbOlema.s ;
vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ;
mkvf : VForm -> {fin, inf : Str} = \p -> case <ant,b> of {
<Simul,Pos> => vf (verbs ! p) [] ;
<Anter,Pos> => vf (olema ! p) part ;
<Simul,Neg> => vf (ei ++ neg) [] ;
<Anter,Neg> => vf (ei ++ ole) part
} ;
passPol = case b of {Pos => True ; Neg => False} ;
in case vi of {
VIFin Past => mkvf (Impf agr.n agr.p) ; --# notpresent
@@ -246,6 +339,8 @@ oper
VIInf i => mkvf (Inf i)
} ;
predV : Verb1 -> VP = \verb -> {
v = verb ; -- ignoring the subject case of Verb, it is stored in VP.sc later
s2 = \\_,_,_ => [] ;
adv = [] ;
ext = [] ; --relative clause
@@ -323,7 +418,7 @@ oper
NPCase Nom => <agr,True> ;
_ => <agrP3 Sg,False> -- minule meeldib, minul on
} ;
verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ;
verb = mkVPForms vp.v ! VIFin t ! a ! b ! agrfin.p1 ;
in {subj = sub b ;
fin = verb.fin ;
inf = verb.inf ;
@@ -371,20 +466,21 @@ oper
-- This is used for subjects of passives: therefore isFin in False.
subjForm : NP -> NPForm -> Polarity -> Str = \np,sc,b ->
appCompl False b {s = [] ; c = sc ; isPre = True} np ;
subjForm : NPhrase -> NPForm -> Polarity -> Str = \np,sc,b ->
appCompl False b {s = [] ; c = case2npformp sc ; isPre = True} np ;
infVP : NPForm -> Polarity -> Agr -> VP -> InfForm -> Str = infVPAnt Simul ;
infVP : NPForm -> Polarity -> Agr -> VP -> InfForms -> Str = infVPAnt Simul ;
infVPAnt : Anteriority -> NPForm -> Polarity -> Agr -> VP -> InfForm -> Str =
infVPAnt : Anteriority -> NPForm -> Polarity -> Agr -> VP -> InfForms -> Str =
\ant,sc,pol,agr,vp,vi ->
let
fin = case sc of { -- subject case
NPCase Nom => True ; -- mina tahan joosta
_ => False -- minul peab auto olema
complCase = case sc of { -- choosing case for the complement. sometimes this function is called so that sc is the VP's subject case, but other times it's some other form.
NPCase Nom => True ;
_ => False
} ;
verb = vp.s ! VIInf vi ! ant ! Pos ! agr ; -- no "ei"
compl = vp.s2 ! fin ! pol ! agr ; -- but compl. case propagated
verbStem = mkVPForms vp.v ! VIInf vi.stem ! ant ! Pos ! agr ; -- no "ei"
verb = verbStem ** {fin = glue verbStem.fin vi.suf} ;
compl = vp.s2 ! complCase ! pol ! agr ; -- but compl. case propagated
adv = vp.adv
in
-- inverted word order; e.g.
@@ -429,11 +525,8 @@ oper
--Auxiliary for internal use
mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> Verb =
\tulema,tulla,tuleb,tullakse,tulge,tuli,tulnud,tuldud ->
vforms2V (vForms8
tulema tulla tuleb tullakse tulge tuli tulnud tuldud
) ;
vforms2verb (vForms8 tulema tulla tuleb tullakse tulge tuli tulnud tuldud) ;
--below moved here from MorphoEst
VForms : Type = Predef.Ints 7 => Str ;
vForms8 : (x1,_,_,_,_,_,_,x8 : Str) -> VForms =
@@ -449,7 +542,7 @@ oper
7 => tuldud
} ;
vforms2V : VForms -> Verb = \vh ->
vforms2verb : VForms -> Verb = \vh ->
let
tulema = vh ! 0 ;
tulla = vh ! 1 ;
@@ -481,8 +574,8 @@ oper
tulgu = (init tulge) + "u" ;
in
{s = table {
Inf InfDa => tulla ;
Inf InfDes => tulles ;
Inf InfD => tull_ ;
Inf InfM => init tulema ;
Presn Sg P1 => tule_ + "n" ;
Presn Sg P2 => tule_ + "d" ;
Presn Sg P3 => tuleb ;
@@ -516,12 +609,7 @@ oper
PresPart Act => laulev ;
PresPart Pass => tuld_ + "av" ; --d or t
PastPart Act => tulnud ;
PastPart Pass => tuldud ;
Inf InfMa => tulema ;
Inf InfMas => tulema + "s" ;
Inf InfMast => tulema + "st" ;
Inf InfMata => tulema + "ta" ;
Inf InfMaks => tulema + "ks"
PastPart Pass => tuldud
} ;
sc = NPCase Nom ;
p = []
@@ -563,7 +651,7 @@ oper
regVerb : (_,_,_,_ : Str) -> Verb = \kinkima,kinkida,kingib,kingitakse ->
vforms2V (regVForms kinkima kinkida kingib kingitakse) ;
vforms2verb (regVForms kinkima kinkida kingib kingitakse) ;
noun2adj : Noun -> Adj = noun2adjComp True ;
@@ -584,8 +672,16 @@ oper
} ;
} ;
Noun = {s : NForm => Str} ;
Noun : Type = {s : NForm => Str} ;
CNoun : Type = Noun ** {postmod : Str} ;
emptyCN : CNoun = {
s = \\nf => [] ;
postmod = []
} ;
linCN : NForm -> CNoun -> Str = \nf,cn -> cn.s ! nf ++ cn.postmod ;
-- To form an adjective, it is usually enough to give a noun declension: the
-- adverbial form is regular.
@@ -609,13 +705,13 @@ oper
-- Reflexive pronoun.
--- Possessive could be shared with the more general $NounFin.DetCN$.
reflPron : Agr -> NP = \agr ->
reflPron : Agr -> NPhrase = \agr ->
let
ise = nForms2N (nForms6 "ise" "enda" "ennast" "endasse" "endi" "endid") ;
n = case agr of {
AgPol => Sg ;
Ag n _ => n } ;
in {
in emptyNP ** {
s = table {
NPAcc => "ennast" ;
NPCase c => fixPlNom "endid" ise.s ! NCase n c
@@ -654,7 +750,7 @@ oper
-- Converts 6 given strings (Nom, Gen, Part, Illat, Gen, Part) into Noun
-- http://www.eki.ee/books/ekk09/index.php?p=3&p1=5&id=226
nForms2N : NForms -> Noun = \f ->
nForms2N : NForms -> Noun = \f ->
let
jogi = f ! 0 ;
joe = f ! 1 ;
@@ -668,38 +764,33 @@ oper
NCase Sg Gen => joe ;
NCase Sg Part => joge ;
NCase Sg Transl => joe + "ks" ;
NCase Sg Ess => joe + "na" ;
NCase Sg Iness => joe + "s" ;
NCase Sg Elat => joe + "st" ;
NCase Sg Illat => joesse ;
NCase Sg Adess => joe + "l" ;
NCase Sg Ablat => joe + "lt" ;
NCase Sg Allat => joe + "le" ;
NCase Sg Abess => joe + "ta" ;
NCase Sg Comit => joe + "ga" ;
NCase Sg Termin => joe + "ni" ;
NCase Pl Nom => joe + "d" ;
NCase Pl Gen => jogede ;
NCase Pl Part => jogesid ;
NCase Pl Transl => jogede + "ks" ;
NCase Pl Ess => jogede + "na" ;
NCase Pl Iness => jogede + "s" ;
NCase Pl Elat => jogede + "st" ;
NCase Pl Illat => jogede + "sse" ;
NCase Pl Adess => jogede + "l" ;
NCase Pl Ablat => jogede + "lt" ;
NCase Pl Allat => jogede + "le" ;
NCase Pl Abess => jogede + "ta" ;
NCase Pl Comit => jogede + "ga" ;
NCase Pl Termin => jogede + "ni"
NCase Pl Allat => jogede + "le"
} --;
-- lock_N = <>
}
} ;
oper
rp2np : Number -> {s : Number => NPForm => Str ; a : RAgr} -> NP = \n,rp -> {
-- Technically, we could also add a postmod field for RP,
-- because multiple applications of FunRP add multiple complements.
-- But I will only add it if I see a real-world sentence that uses multiple applications of FunRP.
RelPron : Type = {s : Number => NPForm => Str ; a : RAgr} ;
rp2np : Number -> RelPron -> NPhrase = \n,rp -> emptyNP ** {
s = rp.s ! n ;
a = agrP3 Sg ; -- does not matter (--- at least in Slash)
isPron = False -- has no special accusative
@@ -707,7 +798,17 @@ oper
etta_Conj : Str = "et" ;
heavyDet : PDet -> PDet ** {sp : Case => Str} = \d -> d ** {sp = d.s} ;
Determiner : Type = {
s : Case => Str ; -- minun kolme
sp : Case => Str ; -- se (substantival form)
n : Number ; -- Pl (agreement feature for verb)
isNum : Bool ; -- True (a numeral is present)
isDef : Bool -- True (verb agrees in Pl, Nom is not Part) --I: actually, can we get rid of this?
} ;
IDeterminer : Type = {s : Case => Str ; n : Number ; isNum : Bool} ;
heavyDet : PDet -> Determiner = \d -> d ** {sp = d.s} ;
PDet : Type = {
s : Case => Str ;
n : Number ;

View File

@@ -11,7 +11,7 @@ concrete SentenceEst of Sentence = CatEst ** open Prelude, ResEst in {
ImpVP vp = {
s = \\pol,agr =>
let
verb = vp.s ! VIImper ! Simul ! pol ! agr ;
verb = mkVPForms vp.v ! VIImper ! Simul ! pol ! agr ;
compl = vp.s2 ! False ! pol ! agr ++ vp.ext --- False = like inf (osta auto)
in --(ära) loe raamat(ut) läbi
verb.fin ++ verb.inf ++ compl ++ vp.p ;

View File

@@ -34,7 +34,7 @@ concrete StructuralEst of Structural = CatEst **
either7or_DConj = sd2 "kas" "või" ** {n = Sg} ;
everybody_NP = makeNP (mkN "igaüks") Sg ;
every_Det = mkDet Sg (mkN "iga") ;
everything_NP = makeNP ((mkN "kõik") ** {lock_N = <>}) Sg ;
everything_NP = makeNP (mkN "kõik") Sg ;
everywhere_Adv = ss "kõikjal" ;
few_Det = mkDet Sg (mkN "mõni") ;
--- first_Ord = {s = \\n,c => (mkN "ensimmäinen").s ! NCase n c} ;
@@ -78,10 +78,8 @@ concrete StructuralEst of Structural = CatEst **
quite_Adv = ss "üsna" ;
she_Pron = mkPronoun "tema" "tema" "teda" Sg P3 ;
so_AdA = ss "nii" ;
somebody_NP = {
somebody_NP = emptyNP ** {
s = \\c => jokuPron ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
someSg_Det = heavyDet {
s = jokuPron ! Sg ;
@@ -92,10 +90,8 @@ concrete StructuralEst of Structural = CatEst **
isNum = False ; isDef = True ;
n = Pl
} ;
something_NP = {
something_NP = emptyNP ** {
s = \\c => mikaInt ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
somewhere_Adv = ss "kuskil" ;
that_Quant = heavyQuant {
@@ -133,11 +129,11 @@ concrete StructuralEst of Structural = CatEst **
very_AdA = ss "väga" ;
want_VV = mkVV (mkV "tahtma") ;
we_Pron = mkPronoun "meie" "meie" "meid" Pl P1 ;
whatPl_IP = {
whatPl_IP = emptyIP ** {
s = table {NPAcc => "mida" ; c => mikaInt ! Pl ! npform2case Pl c} ;
n = Pl
} ;
whatSg_IP = {
whatSg_IP = emptyIP ** {
s = \\c => mikaInt ! Sg ! npform2case Sg c ;
n = Sg
} ;
@@ -145,11 +141,11 @@ concrete StructuralEst of Structural = CatEst **
when_Subj = ss "kui" ;
where_IAdv = ss "kus" ;
which_IQuant = { s = mikaInt } ;
whoSg_IP = {
whoSg_IP = emptyIP ** {
s = table {NPAcc => "keda" ; c => kukaInt ! Sg ! npform2case Sg c} ;
n = Sg
} ;
whoPl_IP = {
whoPl_IP = emptyIP ** {
s = table {NPAcc => "keda" ; c => kukaInt ! Pl ! npform2case Pl c} ;
n = Pl
} ;
@@ -198,27 +194,21 @@ oper
}
} ;
--TODO does this work?
mikaInt : MorphoEst.Number => (MorphoEst.Case) => Str =
mikaInt : MorphoEst.Number => MorphoEst.Case => Str =
let {
mi = mkN "mille"
mi : N = mkN "mis" "mille" "mida" "millesse" "millede" "mida"
} in
table {
Sg => table {
Nom => "mis" ;
Gen => "mille" ;
Part => "mida" ;
c => mi.s ! NCase Sg c
} ;
Pl => table {
Nom => "mis" ;
Gen => "mille" ;
Part => "mida" ;
c => mi.s ! NCase Pl c
}
} ;
kukaInt : MorphoEst.Number => (MorphoEst.Case) => Str =
kukaInt : MorphoEst.Number => MorphoEst.Case => Str =
let
kuka = mkN "kes" "kelle" "keda" "kellesse"
"kellede" "keda" ;
@@ -256,12 +246,10 @@ oper
oper
makeNP : N -> MorphoEst.Number -> CatEst.NP ;
makeNP noun num = {
makeNP : N -> MorphoEst.Number -> NPhrase ;
makeNP noun num = emptyNP ** {
s = \\c => noun.s ! NCase num (npform2case num c) ;
a = agrP3 num ;
isPron = False ;
lock_NP = <>
} ;
lin
@@ -273,16 +261,14 @@ lin
} ;
if_then_Conj = {s1 = "kui" ; s2 = "siis" ; n = Sg} ;
nobody_NP = {
nobody_NP = emptyNP ** {
s = \\c => "mitte" ++ kukaanPron ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
nothing_NP = {
nothing_NP = emptyNP ** {
s = \\c => "mitte" ++ mikaanPron ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
at_least_AdN = ss "vähemalt" ;

View File

@@ -8,20 +8,14 @@ lin
FloatPN i = {s = \\c => i.s} ; --- c
NumPN i = {s = \\c => i.s!Sg!Nom } ; --- c
CNIntNP cn i = {
s = \\c => cn.s ! NCase Sg (npform2case Sg c) ++ i.s ;
a = agrP3 Sg ;
isPron = False
CNIntNP cn i = let np : NP = NounEst.MassNP cn in np ** {
postmod = np.postmod ++ i.s ;
} ;
CNSymbNP det cn xs = let detcn = NounEst.DetCN det cn in {
s = \\c => detcn.s ! c ++ xs.s ;
a = detcn.a ;
isPron = False
CNSymbNP det cn xs = let np : NP = NounEst.DetCN det cn in np ** {
postmod = np.postmod ++ xs.s ;
} ;
CNNumNP cn i = {
s = \\c => cn.s ! NCase Sg (npform2case Sg c) ++ i.s ! Sg ! Nom ;
a = agrP3 Sg ;
isPron = False
CNNumNP cn i = let np : NP = NounEst.MassNP cn in np ** {
postmod = np.postmod ++ i.s ! Sg ! Nom ;
} ;
SymbS sy = sy ;

View File

@@ -34,7 +34,7 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in {
insertObj
(\\_,b,agr =>
let n = (complNumAgr agr) in
ap.s ! False ! (NCase n (npform2case n v.c2.c))) --- v.cs.s ignored
ap.s ! False ! (NCase n (npform2case n v.c2.c.npf))) --- v.cs.s ignored
(predV v) ;
SlashV2S v s =
@@ -47,7 +47,7 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in {
SlashV2A v ap =
insertObj
(\\fin,b,_ =>
ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c))) ----agr to obj
ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c.npf))) ----agr to obj
(predV v) ** {c2 = v.c2} ;
ComplSlash vp np = insertObjPre (\\fin,b,_ => appCompl fin b vp.c2 np) vp ;
@@ -79,27 +79,15 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in {
ReflVP v = insertObjPre (\\fin,b,agr => appCompl fin b v.c2 (reflPron agr)) v ;
PassV2 v =
let
vp = predV v ;
subjCase = case v.c2.c of { --this is probably a reason to not get rid of NPAcc; TODO check
NPCase Gen => NPCase Nom ; --valisin koera -> koer valitakse
_ => v.c2.c --rääkisin koerale -> koerale räägitakse
}
in {
s = \\_ => vp.s ! VIPass Pres ;
s2 = \\_,_,_ => [] ;
adv = [] ;
p = vp.p ;
ext = vp.ext ;
sc = subjCase -- koer valitakse ; koerale räägitakse
PassV2 v = let vp : VP = passiveVP (predV v) in vp ** {
sc = compl2subjcase v.c2 -- koer valitakse ; koerale räägitakse
} ;
----b UseVS, UseVQ = \v -> v ** {c2 = {s = [] ; c = NPAcc ; isPre = True}} ;
CompAP = compAP ;
CompCN = compCN ;
CompNP np = {s = \\_ => np.s ! NPCase Nom} ;
CompNP np = {s = \\_ => linNP (NPCase Nom) np} ;
CompAdv a = {s = \\_ => a.s} ;
}

View File

@@ -0,0 +1,146 @@
-- Comitative, Essive, Abessive and Terminative cases are not in the inflection table of nominal categories,
-- instead they use the Genitive stem and add a suffix with BIND token.
-- Here are tests for those cases.
-- NB. Ignore any weirdness with the word "koos".
-- That just happens to be the linearisation of with_Prep,
-- we can as easily replace it with just the case -ga,
-- or in an application, have two versions, one "koos …ga" and other just "…ga".
-- But do point out any other unexpected weirdness/ungrammaticality!
-- Comitative, case attaches to the noun
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant NumSg) (UseN dog_N))))
LangEng: I play with this dog
LangEst: mina mängin koos selle koera &+ ga
Lang: PredVP (UsePron we_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant NumPl) (UseN dog_N))))
LangEng: we play with these dogs
LangEst: meie mängime koos nende koerade &+ ga
-- Interrogative versions
-- First, reason why the interrogative pronoun doesn't inflect is this http://www.eki.ee/books/ekk09/index.php?p=5&p1=3&id=452
-- "Üldse ei ühildu: asesõnad mis (kui ta ei osuta omadusele, vaid on identifitseerivas funktsioonis) [..],
-- nt 'Mis keelt te räägite?' "
-- So because of that, it doesn't inflect in any position. Here is the eki example:
Lang: QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN language_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a speak_V2))
LangEng: which language do you speak
LangEst: mis keelt sina räägid
-- But should the interrogative inflect when PrepIP is applied? Or is "koos mis koeraga" still fine?
Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant NumSg) (UseN dog_N))) (PredVP (UsePron youSg_Pron) (UseV play_V))
LangEng: with which dog do you play
LangEst: koos mis koera &+ ga sina mängid
Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant NumPl) (UseN dog_N))) (PredVP (UsePron youPl_Pron) (UseV play_V))
LangEng: with which dogs do you play
LangEst: koos mis koerade &+ ga teie mängite
-- Adding a number, does it affect the behaviour of
-- a) suffix attachment? b) agreement of interrogative?
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))) (UseN dog_N))))
LangEng: I play with these three dogs
LangEst: mina mängin koos nende kolme koera &+ ga
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant (NumCard (NumDigits (IDig D_3)))) (UseN dog_N))))
LangEng: I play with these 3 dogs
LangEst: mina mängin koos nende 3 koera &+ ga
Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))) (UseN dog_N))) (PredVP (UsePron youPol_Pron) (UseV play_V))
LangEng: with which three dogs do you play
-- Which one is best?
-- 1) koos mis kolm koeraga teie mängite
-- 2) koos mis kolme koeraga teie mängite
-- 3) koos mille kolme koeraga teie mängite
-- 4) All are ungrammatical (provide more grammatical translation that is still compositional, not paraphrase)
Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant (NumCard (NumDigits (IDig D_3)))) (UseN dog_N))) (PredVP (UsePron youPl_Pron) (UseV play_V))
LangEng: with which 3 dogs do you play
-- Which one is best?
-- 1) koos mis 3 koeraga teie mängite
-- 2) koos mille 3 koeraga teie mängite
-- 3) All are ungrammatical (provide more grammatical translation)
------------------------------------------------------------------------------------------
-- Now we skip the content word, and make the determiner (possibly with number) into NP/IP
-- The relevant functions are DetNP : Det -> NP and IDetIP : IDet -> IP
-- No number, case attaches to determiner/interrogative
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant NumPl))))
LangEng: I play with these
LangEst: mina mängin koos nende &+ ga
Lang: QuestIAdv (PrepIP with_Prep whoSg_IP) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with whom do you sing
LangEst: koos kelle &+ ga sina laulad
Lang: QuestIAdv (PrepIP with_Prep whoPl_IP) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with whom do you sing
LangEst: koos kellede &+ ga sina laulad
-- Adding a number to a determiner, does this affect the comitative suffix placement?
-- Context of the sentence is an ellipsis, "I sing with these 3 (singers)"
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV sing_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))))))
LangEng: I sing with these three
-- Which one is better?
-- 1) mina laulan koos nende kolmega
-- 2) mina laulan koos nendega kolme
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV sing_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant (NumCard (NumDigits (IDig D_3)))))))
LangEng: I sing with these 3
LangEst: mina laulan koos nende 3 &+ ga
-- Which one is better?
-- 1) mina laulan koos nende 3ga
-- 2) mina laulan koos nendega 3
-- Adding a number to an interrogative, how does suffix placement + agreement work now?
Lang: QuestIAdv (PrepIP with_Prep (IdetIP (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))))) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with which three do you sing
-- Which one is best?
-- 1) koos millede kolmega sina laulad
-- 2) koos mille kolmega sina laulad
-- 3) koos mis kolmega sina laulad
-- 4) koos millega kolme sina laulad
-- 5) koos milledega kolme sina laulad
-- 6) All are ungrammatical (provide more grammatical translation)
Lang: QuestIAdv (PrepIP with_Prep (IdetIP (IdetQuant which_IQuant (NumCard (NumDigits (IDig D_3)))))) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with which 3 do you sing
-- Which one is best?
-- 1) koos millede 3ga sina laulad
-- 2) koos mille 3ga sina laulad
-- 3) koos mis 3ga sina laulad
-- 4) koos millega 3 sina laulad
-- 5) koos milledega 3 sina laulad
-- 6) All are ungrammatical (provide more grammatical translation)
-- Adding premodifiers to the number, does that change anything?
-- Weird sentence, but imagine like, you point to a group of people, "I sing with these at most three",
-- like you are the soloist and want at most 3 backup singers, who are among a group you are pointing at.
-- If there was no ellipsis, the phrase would just be "koos nende kuni kolme lauljatega"?
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV sing_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant (NumCard (AdNum at_most_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))))))))))
LangEng: I sing with these at most three
LangEst: mina laulan koos nende kuni kolme &+ ga
-- Which one is better?
-- 1) mina laulan koos nende kuni kolmega
-- 2) mina laulan koos nendega kuni kolme
Lang: QuestIAdv (PrepIP with_Prep (IdetIP (IdetQuant which_IQuant (NumCard (AdNum at_most_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))))))))) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with which at most three do you sing
LangEst: koos millede kuni kolme &+ ga sina laulad
-- Which one is best?
-- 1) koos millede kuni kolmega sina laulad
-- 2) koos mille kuni kolmega sina laulad
-- 3) koos mis kuni kolmega sina laulad
-- 4) koos millega kuni kolme sina laulad
-- 5) koos milledega kuni kolme sina laulad
-- 6) All are ungrammatical (provide more grammatical translation)