1
0
forked from GitHub/gf-rgl

minor Estonian additions from last summer (#51)

* add two new nominal modifiers of type NP -> CN -> CN

* change married_A2 to invariant adjective

* rename CommonNoun to Noun

* change type of relPron

* merge CompAP and ICompAP using the same oper ; fix reflPron (ise, enda, ...) and add a helper function fixPlNom

* minor cleanup

* change in who_RP, reflecting the change of relative pronouns in ResEst

* Add new functions to ExtendEst ; update comments in ResEst
This commit is contained in:
Inari Listenmaa
2018-05-24 14:17:11 +01:00
committed by GitHub
parent 9bd63b9d8d
commit 8ae61cc1a8
10 changed files with 100 additions and 75 deletions

View File

@@ -89,8 +89,8 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in {
A2 = A ** {c2 : Compl} ; A2 = A ** {c2 : Compl} ;
N = Noun ; N = Noun ;
N2 = CommonNoun ** {c2 : Compl ; isPre : Bool ; lock_N2 : {}} ; N2 = Noun ** {c2 : Compl ; isPre : Bool ; lock_N2 : {}} ;
N3 = CommonNoun ** {c2,c3 : Compl ; isPre,isPre2 : Bool ; lock_N3 : {}} ; N3 = Noun ** {c2,c3 : Compl ; isPre,isPre2 : Bool ; lock_N3 : {}} ;
PN = {s : Case => Str} ; PN = {s : Case => Str} ;
oper Verb1 = Verb ** { sc : NPForm} ; --what is this for? --subject case, i.e. "ma näen kassi"/"mul on kass" oper Verb1 = Verb ** { sc : NPForm} ; --what is this for? --subject case, i.e. "ma näen kassi"/"mul on kass"

View File

@@ -28,6 +28,7 @@ concrete ExtendEst of Extend =
Coordination, Coordination,
Prelude, Prelude,
MorphoEst, MorphoEst,
LexiconEst,
ParadigmsEst in { ParadigmsEst in {
lin lin
@@ -44,7 +45,7 @@ concrete ExtendEst of Extend =
-- : Num -> CN -> RP ; -- whose car -- : Num -> CN -> RP ; -- whose car
GenRP num cn = { GenRP num cn = {
s = \\n,c => let k = npform2case num.n c in relPron ! n ! Gen ++ cn.s ! NCase num.n k ; s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ;
a = RNoAg a = RNoAg
} ; } ;
@@ -115,26 +116,34 @@ concrete ExtendEst of Extend =
mkVPI : VP -> VPI = \vp -> lin VPI {} ; mkVPI : VP -> VPI = \vp -> lin VPI {} ;
----- -----
lin
ICompAP ap = {} ; ---- IComp should have agr!
IAdvAdv adv = {} ;
-} -}
-- : VP -> AP ; -- (the man) looking at Mary / filme vaatav (mees) 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 = { PresPartAP vp = {
s = \\_,_ => vp2adv vp True VIPresPart ; s = \\_,_ => vp2adv vp True VIPresPart ;
infl = Invariable infl = Invariable
} ; } ;
{- TODO: need to change VP to get this to work properly: {- 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) 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! 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) -- : VP -> SC ; -- looking at Mary (is fun) / filmide vaatamine (on tore)
EmbedPresPart vp = EmbedPresPart vp =
let vpGen = vp ; --** { s2 = \\_,_,_ => vp.s2 ! True ! Pos ! } let vpGen = vp ; --** { s2 = \\_,_,_ => vp.s2 ! True ! Pos ! }
{s = vp2adv vp True VI } ; {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 -- : VPSlash -> AP ; -- täna leitud
@@ -147,13 +156,7 @@ concrete ExtendEst of Extend =
s = \\_,_ => np.s ! NPCase Gen ++ "poolt" s = \\_,_ => np.s ! NPCase Gen ++ "poolt"
++ vp2adv vp True (VIPass Past) ; ++ vp2adv vp True (VIPass Past) ;
infl = Invariable } ; infl = Invariable } ;
{-
-- : VP -> CN -- publishing of the document (can get a determiner)
GerundCN vp = {} ;
-- : VP -> NP -- publishing the document (by nature definite)
GerundNP vp = {} ;
-}
-- : VP -> Adv -- : VP -> Adv
GerundAdv vp = GerundAdv vp =
{ s = vp2adv vp True (VIInf InfDes) } ; { s = vp2adv vp True (VIInf InfDes) } ;
@@ -192,22 +195,38 @@ lin
ComplBareVS v s = insertExtra s.s (predV v) ; ComplBareVS v s = insertExtra s.s (predV v) ;
SlashBareV2S v s = insertExtrac s.s (predVc v) ; SlashBareV2S v s = insertExtrac s.s (predVc v) ;
-} -}
-- : N -> N -> N ; -- control system / controls system / control-system -- : N -> N -> N ; -- control system / controls system / control-system
CompoundN noun cn = lin N { CompoundN noun cn = lin N {
s = \\nf => noun.s ! NCase Sg Gen ++ BIND ++ cn.s ! nf ---- AR genitive best? s = \\nf => noun.s ! NCase Sg Gen ++ BIND ++ cn.s ! nf
} ; } ;
{- {-
-- : N -> A -> AP ; -- language independent / language-independent
CompoundAP noun adj = {} ; CompoundAP noun adj = {} ;
FrontExtPredVP np vp = {} ; -- : VS -> Utt -> VP ; -- say: "today"
ComplDirectVS vs utt = {} ;
InvFrontExtPredVP np vp = {} ; -- : 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) ;
lin lin
-}
-- : AP -> CN ; -- a green one ; en grön (Swe) -- : AP -> CN ; -- a green one ; en grön (Swe)
AdjAsCN ap = { s = ap.s ! True } ; -- True = it's a modifier, not a predicate AdjAsCN ap = { s = ap.s ! True } ; -- True = it's a modifier, not a predicate
@@ -224,7 +243,10 @@ lin
lin lin
ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ; ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ;
-- : RNP
ReflPron = {s = reflPron} ; ReflPron = {s = reflPron} ;
ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! Nom ++ cn.s ! num.n ! Nom} ; 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} ; PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ;

View File

@@ -9,14 +9,16 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
isNeg = False isNeg = False
} ; } ;
GenCN = caseCN Gen ; -- auton merkki GenCN = caseCN Gen ; -- soome mees
ComitCN = caseCN Comit ; -- puudega mets ComitCN = caseCN Comit ; -- puudega mets
ElatCN = caseCN Elat ; -- puust laud ElatCN = caseCN Elat ; -- puust laud
AbessCN = caseCN Abess ; -- autota pere
TerminCN = caseCN Termin ; -- maani kleit
GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ; GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ;
GenRP num cn = { GenRP num cn = {
s = \\n,c => let k = npform2case num.n c in relPron ! n ! Gen ++ cn.s ! NCase num.n k ; s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ;
a = RNoAg a = RNoAg
--- a = RAg (agrP3 num.n) --- a = RAg (agrP3 num.n)
} ; } ;
@@ -190,8 +192,9 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
a = p.a a = p.a
} ; } ;
-- : Pron -> Quant ;
ProDropPoss p = { ProDropPoss p = {
s = \\_,_ => "oma" ; --??? s = \\_,_ => "oma" ;
sp = \\_,_ => p.s ! NPCase Gen ; sp = \\_,_ => p.s ! NPCase Gen ;
isNum = False ; isNum = False ;
isDef = True ; isDef = True ;

View File

@@ -7,9 +7,11 @@ abstract ExtraEstAbs = Extra [
flags coding=utf8 ; flags coding=utf8 ;
fun fun
GenCN : NP -> CN -> CN ; -- auton merkki GenCN : NP -> CN -> CN ; -- soome mees
ComitCN : NP -> CN -> CN ; -- põlenud puudega mets ComitCN : NP -> CN -> CN ; -- põlenud puudega mets
ElatCN : NP -> CN -> CN ; -- puust laud ElatCN : NP -> CN -> CN ; -- puust laud
AbessCN : NP -> CN -> CN ; -- autota pere
TerminCN : NP -> CN -> CN ; -- maani kleit
AdvExistNP : Adv -> NP -> Cl ; -- kuvassa olemme me AdvExistNP : Adv -> NP -> Cl ; -- kuvassa olemme me
AdvPredNP : Adv -> V -> NP -> Cl ; -- kuvassa hymyilee Veikko AdvPredNP : Adv -> V -> NP -> Cl ; -- kuvassa hymyilee Veikko

View File

@@ -119,7 +119,7 @@ lin
love_N = mkN "armastus" ; love_N = mkN "armastus" ;
love_V2 = mkV2 (mkV "armastama") partitive ; love_V2 = mkV2 (mkV "armastama") partitive ;
man_N = mkN "mees" "mehe" "meest" "mehesse" "meeste" "mehi" ; man_N = mkN "mees" "mehe" "meest" "mehesse" "meeste" "mehi" ;
married_A2 = mkA2 (mkA "abielus") (casePrep comitative) ; married_A2 = mkA2 (invA "abielus") (casePrep comitative) ;
meat_N = mkN "liha" ; meat_N = mkN "liha" ;
milk_N = mkN "piim" "piima" "piima" ; milk_N = mkN "piim" "piima" "piima" ;
moon_N = mkN "kuu" ; moon_N = mkN "kuu" ;

View File

@@ -487,10 +487,10 @@ These used to be here:
-- for Structural -- for Structural
----------------------- -----------------------
caseTable : Number -> CommonNoun -> Case => Str = \n,cn -> caseTable : Number -> Noun -> Case => Str = \n,cn ->
\\c => cn.s ! NCase n c ; \\c => cn.s ! NCase n c ;
mkDet : Number -> CommonNoun -> { mkDet : Number -> Noun -> {
s,sp : Case => Str ; -- minun kolme s,sp : Case => Str ; -- minun kolme
n : Number ; -- Pl (agreement feature for verb) n : Number ; -- Pl (agreement feature for verb)
isNum : Bool ; -- True (a numeral is present) isNum : Bool ; -- True (a numeral is present)
@@ -563,23 +563,17 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
x => shortMa.s ! x } } ; x => shortMa.s ! x } } ;
-- The relative pronoun, "joka", is inflected in case and number,
-- like common nouns, but it does not take possessive suffixes.
-- The inflextion shows a surprising similarity with "suo".
oper oper
relPron : Number => Case => Str = relPron : NForm => Str =
let mis = nForms2N (nForms6 "mis" "mille" "mida" "millesse" "mille" "mida") in let mis = nForms2N (nForms6 "mis" "mille" "mida" "millesse" "mille" "mida")
\\n,c => case <n,c> of { in fixPlNom "mis" mis.s ;
<Pl,Nom> => "mis" ;
<> => mis.s ! NCase n c } ;
kesPron : Number => Case => Str = kesPron : NForm => Str =
let kes = nForms2N (nForms6 "kes" "kelle" "keda" "kellesse" "kelle" "keda") in let kes = nForms2N (nForms6 "kes" "kelle" "keda" "kellesse" "kelle" "keda")
\\n,c => case <n,c> of { in fixPlNom "kes" kes.s ;
<Pl,Nom> => "kes" ;
<> => kes.s ! NCase n c } ;
ProperName = {s : Case => Str} ; ProperName = {s : Case => Str} ;

View File

@@ -41,7 +41,7 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in
} ; } ;
IdRP = { IdRP = {
s = \\n,c => relPron ! n ! npform2case n c ; s = \\n,c => relPron ! NCase n (npform2case n c) ;
a = RNoAg a = RNoAg
} ; } ;

View File

@@ -321,7 +321,7 @@ oper
let let
agrfin = case vp.sc of { agrfin = case vp.sc of {
NPCase Nom => <agr,True> ; NPCase Nom => <agr,True> ;
_ => <agrP3 Sg,False> -- minun täytyy, minulla on _ => <agrP3 Sg,False> -- minule meeldib, minul on
} ; } ;
verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ; verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ;
in {subj = sub b ; in {subj = sub b ;
@@ -566,17 +566,14 @@ oper
vforms2V (regVForms kinkima kinkida kingib kingitakse) ; vforms2V (regVForms kinkima kinkida kingib kingitakse) ;
noun2adj : CommonNoun -> Adj = noun2adjComp True ; noun2adj : Noun -> Adj = noun2adjComp True ;
-- noun2adj : Noun -> Adj = noun2adjComp True ;
-- TODO: remove the unused arguments and clean up the code
-- TODO: AAdv is current just Sg Ablat, which seems OK in most cases, although -- TODO: AAdv is current just Sg Ablat, which seems OK in most cases, although
-- ilus -> ilusti | ilusalt? -- ilus -> ilusti | ilusalt?
-- hea -> hästi -- hea -> hästi
-- parem -> paremini -- parem -> paremini
-- parim -> kõige paremini | parimalt? -- parim -> kõige paremini | parimalt?
noun2adjComp : Bool -> CommonNoun -> Adj = \isPos,tuore -> noun2adjComp : Bool -> Noun -> Adj = \isPos,tuore ->
-- noun2adjComp : Bool -> Noun -> Adj = \isPos,tuore ->
let let
tuoreesti = Predef.tk 1 (tuore.s ! NCase Sg Gen) + "sti" ; tuoreesti = Predef.tk 1 (tuore.s ! NCase Sg Gen) + "sti" ;
tuoreemmin = Predef.tk 2 (tuore.s ! NCase Sg Gen) + "in" tuoreemmin = Predef.tk 2 (tuore.s ! NCase Sg Gen) + "in"
@@ -587,37 +584,55 @@ oper
} ; } ;
} ; } ;
CommonNoun = {s : NForm => Str} ; Noun = {s : NForm => Str} ;
-- To form an adjective, it is usually enough to give a noun declension: the -- To form an adjective, it is usually enough to give a noun declension: the
-- adverbial form is regular. -- adverbial form is regular.
Adj : Type = {s : AForm => Str} ; Adj : Type = {s : AForm => Str} ;
-- Helper functions to form Comps.
compAP = icompAP [] ;
icompAP : Str -> {s : Bool => NForm => Str} -> {s : Agr => Str} = \kui,ap ->
{ s = \\agr =>
let n = complNumAgr agr ;
in kui ++ ap.s ! False ! NCase n Nom } ;
compCN : Noun -> {s : Agr => Str} = \cn ->
{ s = \\agr =>
let n = complNumAgr agr ;
in cn.s ! NCase n Nom } ;
-- Reflexive pronoun. -- Reflexive pronoun.
--- Possessive could be shared with the more general $NounFin.DetCN$. --- Possessive could be shared with the more general $NounFin.DetCN$.
--oper
--Estonian version started
reflPron : Agr -> NP = \agr -> reflPron : Agr -> NP = \agr ->
let let
ise = nForms2N (nForms6 "ise" "enda" "ennast" "endasse" "IGNORE" "IGNORE") ise = nForms2N (nForms6 "ise" "enda" "ennast" "endasse" "endi" "endid") ;
in { n = case agr of {
AgPol => Sg ;
Ag n _ => n } ;
in {
s = table { s = table {
NPAcc => "ennast" ; NPAcc => "ennast" ;
NPCase c => ise.s ! NCase Sg c NPCase c => fixPlNom "endid" ise.s ! NCase n c
} ; } ;
a = agr ; a = agr ;
isPron = False -- no special acc form isPron = False -- no special acc form
} ; } ;
-- Using nForms6 as a shortcut works pretty nicely, but plural nominative is often wrong.
-- This is used at least 3 times :-D
fixPlNom : Str -> (NForm => Str) -> (NForm => Str) = \mis,n ->
table { NCase Pl Nom => mis ;
x => n ! x } ;
NForms : Type = Predef.Ints 5 => Str ;
Noun = CommonNoun ** {lock_N : {}} ; nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms =
NForms : Type = Predef.Ints 5 => Str ;
nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms =
\jogi,joe,joge,joesse, -- sg nom, gen, part, ill \jogi,joe,joge,joesse, -- sg nom, gen, part, ill
jogede,jogesid -> table { -- pl gen, part, jogede,jogesid -> table { -- pl gen, part,
0 => jogi ; 0 => jogi ;
@@ -628,7 +643,7 @@ oper
5 => jogesid 5 => jogesid
} ; } ;
n2nforms : CommonNoun -> NForms = \ukko -> table { n2nforms : Noun -> NForms = \ukko -> table {
0 => ukko.s ! NCase Sg Nom ; 0 => ukko.s ! NCase Sg Nom ;
1 => ukko.s ! NCase Sg Gen ; 1 => ukko.s ! NCase Sg Gen ;
2 => ukko.s ! NCase Sg Part ; 2 => ukko.s ! NCase Sg Part ;
@@ -639,7 +654,7 @@ oper
-- Converts 6 given strings (Nom, Gen, Part, Illat, Gen, Part) into Noun -- 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 -- http://www.eki.ee/books/ekk09/index.php?p=3&p1=5&id=226
nForms2N : NForms -> CommonNoun = \f -> nForms2N : NForms -> Noun = \f ->
let let
jogi = f ! 0 ; jogi = f ! 0 ;
joe = f ! 1 ; joe = f ! 1 ;

View File

@@ -97,19 +97,8 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in {
----b UseVS, UseVQ = \v -> v ** {c2 = {s = [] ; c = NPAcc ; isPre = True}} ; ----b UseVS, UseVQ = \v -> v ** {c2 = {s = [] ; c = NPAcc ; isPre = True}} ;
CompAP ap = { CompAP = compAP ;
s = \\agr => CompCN = compCN ;
let
n = complNumAgr agr ;
in ap.s ! False ! (NCase n Nom)
} ;
CompCN cn = {
s = \\agr =>
let
n = complNumAgr agr ;
in cn.s ! (NCase n Nom)
} ;
CompNP np = {s = \\_ => np.s ! NPCase Nom} ; CompNP np = {s = \\_ => np.s ! NPCase Nom} ;
CompAdv a = {s = \\_ => a.s} ; CompAdv a = {s = \\_ => a.s} ;

View File

@@ -152,7 +152,7 @@ lin
{s = \\agr => infVPAnt ant.a (NPCase Nom) pol.p agr vp InfDa } ; {s = \\agr => infVPAnt ant.a (NPCase Nom) pol.p agr vp InfDa } ;
-- TODO: revisit pronouns? Looks a bit overly complicated. /IL -- TODO: revisit pronouns? Looks a bit overly complicated. /IL
who_RP = { s = \\n,c => MorphoEst.kesPron ! n ! npform2case n c ; who_RP = { s = \\n,c => MorphoEst.kesPron ! NCase n (npform2case n c) ;
a = RNoAg } ; a = RNoAg } ;
that_RP = which_RP ; that_RP = which_RP ;