(Est) Use genitive stem+suffix for 4 other cases

This commit is contained in:
Inari Listenmaa
2022-04-14 19:07:03 +08:00
parent e8503511ca
commit 76f23214c1
9 changed files with 128 additions and 115 deletions

View File

@@ -11,7 +11,7 @@ concrete AdverbEst of Adverb = CatEst ** open ResEst, Prelude in {
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

@@ -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 -> {
@@ -248,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

@@ -1,5 +1,5 @@
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 = {
@@ -9,11 +9,11 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
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} ;
@@ -23,8 +23,9 @@ 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 : InfStem => Str} ;

View File

@@ -520,16 +520,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
@@ -584,16 +580,12 @@ oper
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"
} ;
} ;
@@ -604,16 +596,12 @@ oper
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,13 +19,6 @@ 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)
}
@@ -212,10 +205,7 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
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
}
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
}
} ;

View File

@@ -276,50 +276,67 @@ 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 ; 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 [] ;
-- 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 -> {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 = <>} ;
mkConj = overload {
mkConj : Str -> Conj = \ja -> lin Conj ((sd2 "" ja) ** {n = Sg}) ;
mkConj : Str -> Number -> Conj = \ja,num -> lin Conj ((sd2 "" ja) ** {n = num}) ;
@@ -565,7 +582,7 @@ oper
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
} ;
@@ -821,7 +838,7 @@ 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 = <>} ;

View File

@@ -32,7 +32,7 @@ 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 = {

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
@@ -66,6 +85,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
@@ -150,11 +177,11 @@ 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 ->
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 {
@@ -165,25 +192,17 @@ 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 ;
-- Used for passive; c2 of V2/VPSlash becomes sc of VP
compl2subjcase : Compl -> NPForm = \compl ->
case compl.c of {
case compl.c.npf of {
NPCase Gen => NPCase Nom ; -- valisin koera -> koer valitakse
_ => compl.c -- rääkisin koerale -> koerale räägitakse
_ => compl.c.npf -- rääkisin koerale -> koerale räägitakse
} ;
-- For $Verb$.
@@ -418,7 +437,7 @@ 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 ;
appCompl False b {s = [] ; c = case2npformp sc ; isPre = True} np ;
infVP : NPForm -> Polarity -> Agr -> VP -> InfForms -> Str = infVPAnt Simul ;
@@ -709,31 +728,23 @@ 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 = <>

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 ;