diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index ec771952e..a91a245e0 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -89,8 +89,8 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { A2 = A ** {c2 : Compl} ; N = Noun ; - N2 = CommonNoun ** {c2 : Compl ; isPre : Bool ; lock_N2 : {}} ; - N3 = CommonNoun ** {c2,c3 : Compl ; isPre,isPre2 : Bool ; lock_N3 : {}} ; + N2 = Noun ** {c2 : Compl ; isPre : Bool ; lock_N2 : {}} ; + N3 = Noun ** {c2,c3 : Compl ; isPre,isPre2 : Bool ; lock_N3 : {}} ; PN = {s : Case => Str} ; oper Verb1 = Verb ** { sc : NPForm} ; --what is this for? --subject case, i.e. "ma näen kassi"/"mul on kass" diff --git a/src/estonian/ExtendEst.gf b/src/estonian/ExtendEst.gf index 7230bb6db..42551d197 100644 --- a/src/estonian/ExtendEst.gf +++ b/src/estonian/ExtendEst.gf @@ -28,6 +28,7 @@ concrete ExtendEst of Extend = Coordination, Prelude, MorphoEst, + LexiconEst, ParadigmsEst in { lin @@ -44,7 +45,7 @@ concrete ExtendEst of Extend = -- : Num -> CN -> RP ; -- whose car 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 } ; @@ -115,26 +116,34 @@ concrete ExtendEst of Extend = 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 = { s = \\_,_ => vp2adv vp True VIPresPart ; 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) 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 @@ -147,13 +156,7 @@ concrete ExtendEst of Extend = s = \\_,_ => np.s ! NPCase Gen ++ "poolt" ++ vp2adv vp True (VIPass Past) ; 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 GerundAdv vp = { s = vp2adv vp True (VIInf InfDes) } ; @@ -192,22 +195,38 @@ lin 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 ---- AR genitive best? + s = \\nf => noun.s ! NCase Sg Gen ++ BIND ++ cn.s ! nf } ; {- + -- : N -> A -> AP ; -- language independent / language-independent CompoundAP noun adj = {} ; - FrontExtPredVP np vp = {} ; - - InvFrontExtPredVP np vp = {} ; + -- : 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) ; lin --} + -- : AP -> CN ; -- a green one ; en grön (Swe) AdjAsCN ap = { s = ap.s ! True } ; -- True = it's a modifier, not a predicate @@ -224,7 +243,10 @@ lin lin ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ; + + -- : 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} ; diff --git a/src/estonian/ExtraEst.gf b/src/estonian/ExtraEst.gf index fd091dca7..b9be4010a 100644 --- a/src/estonian/ExtraEst.gf +++ b/src/estonian/ExtraEst.gf @@ -9,14 +9,16 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** isNeg = False } ; - GenCN = caseCN Gen ; -- auton merkki + 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 GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ; 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 = RAg (agrP3 num.n) } ; @@ -190,8 +192,9 @@ concrete ExtraEst of ExtraEstAbs = CatEst ** a = p.a } ; + -- : Pron -> Quant ; ProDropPoss p = { - s = \\_,_ => "oma" ; --??? + s = \\_,_ => "oma" ; sp = \\_,_ => p.s ! NPCase Gen ; isNum = False ; isDef = True ; diff --git a/src/estonian/ExtraEstAbs.gf b/src/estonian/ExtraEstAbs.gf index 761200cf8..0e09f3d4a 100644 --- a/src/estonian/ExtraEstAbs.gf +++ b/src/estonian/ExtraEstAbs.gf @@ -7,9 +7,11 @@ abstract ExtraEstAbs = Extra [ flags coding=utf8 ; fun - GenCN : NP -> CN -> CN ; -- auton merkki + GenCN : NP -> CN -> CN ; -- soome mees ComitCN : NP -> CN -> CN ; -- põlenud puudega mets 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 AdvPredNP : Adv -> V -> NP -> Cl ; -- kuvassa hymyilee Veikko diff --git a/src/estonian/LexiconEst.gf b/src/estonian/LexiconEst.gf index dde11f96b..fb7634579 100644 --- a/src/estonian/LexiconEst.gf +++ b/src/estonian/LexiconEst.gf @@ -119,7 +119,7 @@ lin love_N = mkN "armastus" ; love_V2 = mkV2 (mkV "armastama") partitive ; 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" ; milk_N = mkN "piim" "piima" "piima" ; moon_N = mkN "kuu" ; diff --git a/src/estonian/MorphoEst.gf b/src/estonian/MorphoEst.gf index eb3591c78..dfd3af921 100644 --- a/src/estonian/MorphoEst.gf +++ b/src/estonian/MorphoEst.gf @@ -487,10 +487,10 @@ These used to be here: -- for Structural ----------------------- -caseTable : Number -> CommonNoun -> Case => Str = \n,cn -> +caseTable : Number -> Noun -> Case => Str = \n,cn -> \\c => cn.s ! NCase n c ; - mkDet : Number -> CommonNoun -> { + mkDet : Number -> Noun -> { s,sp : Case => Str ; -- minun kolme n : Number ; -- Pl (agreement feature for verb) isNum : Bool ; -- True (a numeral is present) @@ -563,24 +563,18 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn -> 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 - relPron : Number => Case => Str = - let mis = nForms2N (nForms6 "mis" "mille" "mida" "millesse" "mille" "mida") in - \\n,c => case of { - => "mis" ; - <> => mis.s ! NCase n c } ; + relPron : NForm => Str = + let mis = nForms2N (nForms6 "mis" "mille" "mida" "millesse" "mille" "mida") + in fixPlNom "mis" mis.s ; + + kesPron : NForm => Str = + let kes = nForms2N (nForms6 "kes" "kelle" "keda" "kellesse" "kelle" "keda") + in fixPlNom "kes" kes.s ; - kesPron : Number => Case => Str = - let kes = nForms2N (nForms6 "kes" "kelle" "keda" "kellesse" "kelle" "keda") in - \\n,c => case of { - => "kes" ; - <> => kes.s ! NCase n c } ; - ProperName = {s : Case => Str} ; -- TODO: generate using mkPronoun diff --git a/src/estonian/RelativeEst.gf b/src/estonian/RelativeEst.gf index c58c2fd5e..705d77a86 100644 --- a/src/estonian/RelativeEst.gf +++ b/src/estonian/RelativeEst.gf @@ -41,7 +41,7 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in } ; IdRP = { - s = \\n,c => relPron ! n ! npform2case n c ; + s = \\n,c => relPron ! NCase n (npform2case n c) ; a = RNoAg } ; diff --git a/src/estonian/ResEst.gf b/src/estonian/ResEst.gf index fb3bd9ff2..6418b9a27 100644 --- a/src/estonian/ResEst.gf +++ b/src/estonian/ResEst.gf @@ -321,7 +321,7 @@ oper let agrfin = case vp.sc of { NPCase Nom => ; - _ => -- minun täytyy, minulla on + _ => -- minule meeldib, minul on } ; verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ; in {subj = sub b ; @@ -566,17 +566,14 @@ oper 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 -- ilus -> ilusti | ilusalt? -- hea -> hästi -- parem -> paremini -- parim -> kõige paremini | parimalt? - noun2adjComp : Bool -> CommonNoun -> Adj = \isPos,tuore -> --- noun2adjComp : Bool -> Noun -> Adj = \isPos,tuore -> + noun2adjComp : Bool -> Noun -> Adj = \isPos,tuore -> let tuoreesti = Predef.tk 1 (tuore.s ! NCase Sg Gen) + "sti" ; 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 -- adverbial form is regular. 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. --- Possessive could be shared with the more general $NounFin.DetCN$. ---oper - --Estonian version started reflPron : Agr -> NP = \agr -> let - ise = nForms2N (nForms6 "ise" "enda" "ennast" "endasse" "IGNORE" "IGNORE") - in { + ise = nForms2N (nForms6 "ise" "enda" "ennast" "endasse" "endi" "endid") ; + n = case agr of { + AgPol => Sg ; + Ag n _ => n } ; + in { s = table { NPAcc => "ennast" ; - NPCase c => ise.s ! NCase Sg c + NPCase c => fixPlNom "endid" ise.s ! NCase n c } ; a = agr ; 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 : {}} ; - NForms : Type = Predef.Ints 5 => Str ; - - nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms = + nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms = \jogi,joe,joge,joesse, -- sg nom, gen, part, ill jogede,jogesid -> table { -- pl gen, part, 0 => jogi ; @@ -628,7 +643,7 @@ oper 5 => jogesid } ; - n2nforms : CommonNoun -> NForms = \ukko -> table { + n2nforms : Noun -> NForms = \ukko -> table { 0 => ukko.s ! NCase Sg Nom ; 1 => ukko.s ! NCase Sg Gen ; 2 => ukko.s ! NCase Sg Part ; @@ -639,7 +654,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 -> CommonNoun = \f -> + nForms2N : NForms -> Noun = \f -> let jogi = f ! 0 ; joe = f ! 1 ; diff --git a/src/estonian/VerbEst.gf b/src/estonian/VerbEst.gf index 9b0379578..8c84e22f2 100644 --- a/src/estonian/VerbEst.gf +++ b/src/estonian/VerbEst.gf @@ -97,19 +97,8 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in { ----b UseVS, UseVQ = \v -> v ** {c2 = {s = [] ; c = NPAcc ; isPre = True}} ; - CompAP ap = { - s = \\agr => - 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) - } ; + CompAP = compAP ; + CompCN = compCN ; CompNP np = {s = \\_ => np.s ! NPCase Nom} ; CompAdv a = {s = \\_ => a.s} ; diff --git a/src/translator/ExtensionsEst.gf b/src/translator/ExtensionsEst.gf index b6f1a21dd..1a0f6e9bd 100644 --- a/src/translator/ExtensionsEst.gf +++ b/src/translator/ExtensionsEst.gf @@ -152,7 +152,7 @@ lin {s = \\agr => infVPAnt ant.a (NPCase Nom) pol.p agr vp InfDa } ; -- 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 } ; that_RP = which_RP ;