From 14bed283f4c5947908b24a1c12a179ac5f041525 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 24 Apr 2020 08:18:53 +0200 Subject: [PATCH] (Hun) WIP: have_V2 adds possessive suffixes to its object NP --- src/hungarian/NounHun.gf | 2 +- src/hungarian/PhraseHun.gf | 2 +- src/hungarian/ResHun.gf | 115 ++++++++++++++++++++++++++++----- src/hungarian/SentenceHun.gf | 2 +- src/hungarian/StructuralHun.gf | 78 ++-------------------- src/hungarian/VerbHun.gf | 25 ++++++- 6 files changed, 131 insertions(+), 93 deletions(-) diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index 6682c325c..ac4e7fcd7 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -7,7 +7,7 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in { --2 Noun phrases -- : Det -> CN -> NP - DetCN det cn = emptyNP ** det ** { + DetCN det cn = emptyNP ** cn ** det ** { s = \\c => let foo : Str = case det.dt of { NoPoss => caseFromStem glue cn c det.n ; diff --git a/src/hungarian/PhraseHun.gf b/src/hungarian/PhraseHun.gf index 46ed5ad22..9cc252f2d 100644 --- a/src/hungarian/PhraseHun.gf +++ b/src/hungarian/PhraseHun.gf @@ -13,7 +13,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in { -} UttIP, UttNP = \np -> {s = np.s ! Nom} ; - UttVP vp = {s = vp.obj ++ vp.adv ++ vp.s ! VInf} ; + UttVP vp = {s = vp.obj ! ++ vp.adv ++ vp.s ! VInf} ; UttAdv adv = adv ; UttCN cn = {s = linCN cn} ; UttCard n = {s = n.s ! Indep} ; diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index 0863b8fa4..637218216 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -18,6 +18,12 @@ oper pstems : CNPossStem => Str ; } ; + -- Used to possess NPs even after they become NPs + CNLite : Type = { + h : Harm ; + pstems : CNPossStem => Str + } ; + mkCaseNoun : Str -> Number => Case => Str = \s -> \\n,c => caseFromStem (\a,b -> a+b) (mkNoun s) c n ; mkCaseNoun2 : (n,a : Str) -> Number => Case => Str = \no,ac -> @@ -37,7 +43,7 @@ oper => applyCase' PlStem } ; - caseFromPossStem : CNoun -> Determiner -> Case -> Str = \cn,det,cas -> + caseFromPossStem : CNLite -> Determiner -> Case -> Str = \cn,det,cas -> let casetable : Case->HarmForms = case of { -- P3 Sg possessive suffix ends in vowel, others in consonant. => endCasePossVow ; @@ -65,6 +71,7 @@ oper objdef : ObjDef ; empty : Str ; -- standard trick for pro-drop pstems : CNPossStem => Str ; -- Verbs might need to add poss. suffixes + h : Harm ; -- NP may need to be possessed again because of have_V2 } ; NounPhrase : Type = BaseNP ** { @@ -104,6 +111,74 @@ oper => harm "tok" "tök" ; => harm "uk" "ük" } ; + + pronTable : Person*Number => Pronoun = \\agr => case agr of { + => emptyNP ** { + s = caseTable "én" "engem" "nekem" + "belém" "bennem" "belőlem" -- inner locatives + "hozzám" "nálam" "tőlem" -- outer locatives + "rám" "rajtam" "rólam" -- outer locatives + "értem" -- Causative + "velem" -- Instrumental + nonExist ; -- Translative + agr = agr ; + objdef = Def ; + poss = possForms ! agr } ; + => emptyNP ** { + s = caseTable "te" "teged" "neked" + "beléd" "benned" "belőled" + "hozzád" "nálad" "tőled" + "rád" "rajtad" "rólad" + "érted" -- Causative + "veled" -- Instrumental + nonExist ; -- Translative + agr = agr ; + objdef = Def ; + poss = possForms ! agr } ; + => emptyNP ** { + s = caseTable "ő" "őt" "neki" + "belé" "benne" "belőle" + "hozzá" "nála" "tőle" + "rá" "rajta" "róla" + "érte" -- Causative + "vele" -- Instrumental + nonExist ; -- Translative + objdef = Def ; + poss = possForms ! agr } ; + => emptyNP ** { + s = caseTable "mi" "minket" "nekünk" + "belénk" "bennünk" "belőlünk" + "hozzánk" "nálunk" "tőlünk" + "ránk" "rajtunk" "rólunk" + "értünk" -- Causative + "velünk" -- Instrumental + nonExist ; -- Translative + agr = agr ; + objdef = Def ; + poss = possForms ! agr } ; + => emptyNP ** { + s = caseTable "ti" "titeket" "nektek" + "belétek" "bennetek" "belőletek" + "hozzátok" "nálatok" "tőletek" + "rátok" "rajtatok" "rólatok" + "értetek" -- Causative + "veletek" -- Instrumental + nonExist ; -- Translative + agr = agr ; + objdef = Def ; + poss = possForms ! agr } ; + => emptyNP ** { + s = caseTable "ők" "őket" "nekik" + "beléjük" "bennük" "belőlük" + "hozzájuk" "náluk" "tőlük" + "rájuk" "rajtuk" "róluk" + "értük" -- Causative + "velük" -- Instrumental + nonExist ; -- Translative + agr = agr ; + objdef = Def ; + poss = possForms ! agr } + } ; -------------------------------------------------------------------------------- -- Det, Quant, Card, Ord @@ -157,8 +232,6 @@ oper s,sp = mkCaseNoun2 no ac ! n ; } ; - - Numeral : Type = { s : Place => Str ; -- Independent or attribute numtype : NumType ; -- Digit, numeral or Sg/Pl : makes a difference in many languages @@ -206,7 +279,7 @@ oper applyCase : (Str->Str->Str) -> Case -> Noun -> NumCaseStem -> Str = \bind,cas,cn,stem -> bind (cn.s ! stem) (endCase cas ! cn.h) ; - applyCaseSuf : Str -> Case -> CNoun -> CNPossStem -> (Case -> HarmForms) -> Str = + applyCaseSuf : Str -> Case -> CNLite -> CNPossStem -> (Case -> HarmForms) -> Str = \suf,cas,cn,stem,casetable -> glue (glue (cn.pstems ! stem) suf) (casetable cas ! cn.h) ; @@ -382,7 +455,7 @@ oper -- VP VerbPhrase : Type = Verb ** { - obj : Str ; + obj : Person*Number => Str ; adv : Str ; c2 : Case ; -- for RelSlash } ; -- TODO more fields @@ -392,7 +465,8 @@ oper } ; useV : Verb -> VerbPhrase = \v -> v ** { - obj,adv = [] ; + obj = \\_ => [] ; + adv = [] ; c2 = Acc ; -- TODO check } ; @@ -400,14 +474,23 @@ oper adv = [] ; } ; - insertObj : VPSlash -> NounPhrase -> VerbPhrase = \vps,np -> vps ** { - obj = np.s ! vps.c2 ; - - -- If verb's subject case is Dat and object Nom, verb agrees with obj. - s = \\vf => case of { - => vps.s ! np.objdef ! agr2vf np.agr ; - _ => vps.s ! np.objdef ! vf } ; - } ; + -- insertObj : VPSlash -> NounPhrase -> VerbPhrase = \vps,np -> vps ** { + -- obj = np.s ! vps.c2 ; + -- + -- -- If verb's subject case is Dat and object Nom, verb agrees with obj. + -- s = \\vf => + -- let pron : Pronoun = case vf of { + -- VPres p n => pronTable ! ; + -- _ => pronTable ! } ; + -- num : Num = case np.a.p2 of { + -- Sg => NumSg ; Pl => NumPl } ; + -- det : Determiner = DetQuant (PossPron pron) num ; + -- + -- } + -- in case of { + -- => vps.s ! np.objdef ! agr2vf np.agr ; + -- _ => vps.s ! np.objdef ! vf } ; + -- } ; insertAdv : VerbPhrase -> SS -> VerbPhrase = \vp,adv -> vp ** {adv = adv.s} ; insertAdvSlash : VPSlash -> SS -> VPSlash = \vps,adv -> vps ** {adv = adv.s} ; @@ -436,7 +519,7 @@ oper in np.s ! subjcase ++ if_then_Pol p [] "nem" ++ vp.s ! agr2vf np.agr - ++ vp.obj + ++ vp.obj ! np.agr ++ vp.adv ++ np.empty -- standard trick for prodrop+metavariable problem } ; @@ -458,7 +541,7 @@ oper SCDat => Dat } in rp.s ! n ! subjcase ++ if_then_Pol p [] "nem" - ++ vp.obj + ++ vp.obj ! ++ vp.adv ++ vp.s ! VPres rp.agr.p1 n -- variable by number } ; diff --git a/src/hungarian/SentenceHun.gf b/src/hungarian/SentenceHun.gf index 82f884ca0..e402dc22c 100644 --- a/src/hungarian/SentenceHun.gf +++ b/src/hungarian/SentenceHun.gf @@ -15,7 +15,7 @@ lin --2 Clauses missing object noun phrases -- : NP -> VPSlash -> ClSlash ; - SlashVP np vps = predVP np (vps ** {s = vps.s ! Indef ; obj = []}) ; + SlashVP np vps = predVP np (vps ** {s = vps.s ! Indef ; obj = \\_ => []}) ; {- -- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today AdvSlash cls adv = cls ** insertAdv adv cls ; diff --git a/src/hungarian/StructuralHun.gf b/src/hungarian/StructuralHun.gf index 14275ca9c..f980a7310 100644 --- a/src/hungarian/StructuralHun.gf +++ b/src/hungarian/StructuralHun.gf @@ -122,80 +122,14 @@ lin under_Prep = nomAdp "alatt" ; -- Pronouns are closed class, no constructor in ParadigmsHun. -- it_Pron = - i_Pron = emptyNP ** { - s = caseTable "én" "engem" "nekem" - "belém" "bennem" "belőlem" -- inner locatives - "hozzám" "nálam" "tőlem" -- outer locatives - "rám" "rajtam" "rólam" -- outer locatives - "értem" -- Causative - "velem" -- Instrumental - nonExist ; -- Translative - agr = ; - objdef = Def ; - poss = possForms ! ; - } ; + i_Pron = pronTable ! ; youPol_Pron, - youSg_Pron = emptyNP ** { - s = caseTable "te" "teged" "neked" - "beléd" "benned" "belőled" - "hozzád" "nálad" "tőled" - "rád" "rajtad" "rólad" - "érted" -- Causative - "veled" -- Instrumental - nonExist ; -- Translative - agr = ; - objdef = Def ; - poss = possForms ! ; - } ; + youSg_Pron = pronTable ! ; he_Pron, - she_Pron = emptyNP ** { - s = caseTable "ő" "őt" "neki" - "belé" "benne" "belőle" - "hozzá" "nála" "tőle" - "rá" "rajta" "róla" - "érte" -- Causative - "vele" -- Instrumental - nonExist ; -- Translative - objdef = Def ; - poss = possForms ! ; - } ; - we_Pron = emptyNP ** { - s = caseTable "mi" "minket" "nekünk" - "belénk" "bennünk" "belőlünk" - "hozzánk" "nálunk" "tőlünk" - "ránk" "rajtunk" "rólunk" - "értünk" -- Causative - "velünk" -- Instrumental - nonExist ; -- Translative - agr = ; - objdef = Def ; - poss = possForms ! ; - } ; - - youPl_Pron = emptyNP ** { - s = caseTable "ti" "titeket" "nektek" - "belétek" "bennetek" "belőletek" - "hozzátok" "nálatok" "tőletek" - "rátok" "rajtatok" "rólatok" - "értetek" -- Causative - "veletek" -- Instrumental - nonExist ; -- Translative - agr = ; - objdef = Def ; - poss = possForms ! ; - } ; - they_Pron = emptyNP ** { - s = caseTable "ők" "őket" "nekik" - "beléjük" "bennük" "belőlük" - "hozzájuk" "náluk" "tőlük" - "rájuk" "rajtuk" "róluk" - "értük" -- Causative - "velük" -- Instrumental - nonExist ; -- Translative - agr = ; - objdef = Def ; - poss = possForms ! ; - } ; + she_Pron = pronTable ! ; + we_Pron = pronTable ! ; + youPl_Pron = pronTable ! ; + they_Pron = pronTable ! ; --lin whatPl_IP = ; --lin whatSg_IP = : diff --git a/src/hungarian/VerbHun.gf b/src/hungarian/VerbHun.gf index 705805e2a..433864de7 100644 --- a/src/hungarian/VerbHun.gf +++ b/src/hungarian/VerbHun.gf @@ -1,4 +1,5 @@ -concrete VerbHun of Verb = CatHun ** open ResHun, AdverbHun, Prelude in { +concrete VerbHun of Verb = CatHun ** + open ResHun, AdverbHun, NounHun, Prelude in { lin @@ -63,7 +64,7 @@ lin } ; -} -- : VPSlash -> NP -> VP - ComplSlash = ResHun.insertObj ; + ComplSlash = insertObj ; {- -- : VV -> VPSlash -> VPSlash ; -- Just like ComplVV except missing subject! @@ -145,4 +146,24 @@ lin -- : VP -- Copula alone; UseCopula = useV copula ; +oper +insertObj : ResHun.VPSlash -> NounPhrase -> VerbPhrase = \vps,np -> vps ** { + obj = \\agr => + -- have_V2 needs to put object in poss. form + let pron : Pronoun = pronTable ! agr ; + num : CatHun.Num = case np.agr.p2 of { + Sg => NumSg ; Pl => NumPl } ; + det : Determiner = DetQuant (PossPron pron) num ; + possessedNP : Str = caseFromPossStem np det vps.c2 ; + in case of { + => possessedNP ; -- TODO loses stuff from np.s + _ => np.s ! vps.c2 } ; + + s = \\vf => + -- If verb's subject case is Dat and object Nom, verb agrees with obj. + case of { + => vps.s ! np.objdef ! agr2vf np.agr; + _ => vps.s ! np.objdef ! vf } ; + } ; + }