1
0
forked from GitHub/gf-rgl

(Hun) WIP: have_V2 adds possessive suffixes to its object NP

This commit is contained in:
Inari Listenmaa
2020-04-24 08:18:53 +02:00
parent efcfb3cefa
commit 14bed283f4
6 changed files with 131 additions and 93 deletions

View File

@@ -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 ;

View File

@@ -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 ! <P3,Sg> ++ vp.adv ++ vp.s ! VInf} ;
UttAdv adv = adv ;
UttCN cn = {s = linCN cn} ;
UttCard n = {s = n.s ! Indep} ;

View File

@@ -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
<Pl,_> => applyCase' PlStem
} ;
caseFromPossStem : CNoun -> Determiner -> Case -> Str = \cn,det,cas ->
caseFromPossStem : CNLite -> Determiner -> Case -> Str = \cn,det,cas ->
let casetable : Case->HarmForms = case <det.n,det.dt> of {
-- P3 Sg possessive suffix ends in vowel, others in consonant.
<Sg,DetPoss (dSg_rP3 Sg)> => 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
<P2,Pl> => harm "tok" "tök" ;
<P3,Pl> => harm "uk" "ük"
} ;
pronTable : Person*Number => Pronoun = \\agr => case agr of {
<P1,Sg> => 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 } ;
<P2,Sg> => 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 } ;
<P3,Sg> => 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 } ;
<P1,Pl> => 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 } ;
<P2,Pl> => 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 } ;
<P3,Pl> => 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 <vps.sc,vps.c2> of {
<SCDat,Nom> => 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 ! <p,n> ;
-- _ => pronTable ! <P3,Sg> } ;
-- num : Num = case np.a.p2 of {
-- Sg => NumSg ; Pl => NumPl } ;
-- det : Determiner = DetQuant (PossPron pron) num ;
--
-- }
-- in case <vps.sc,vps.c2> of {
-- <SCDat,Nom> => 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 ! <rp.agr.p1,n>
++ vp.adv
++ vp.s ! VPres rp.agr.p1 n -- variable by number
} ;

View File

@@ -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 ;

View File

@@ -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 = <P1,Sg> ;
objdef = Def ;
poss = possForms ! <P1,Sg> ;
} ;
i_Pron = pronTable ! <P1,Sg> ;
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 = <P2,Sg> ;
objdef = Def ;
poss = possForms ! <P2,Sg> ;
} ;
youSg_Pron = pronTable ! <P2,Sg> ;
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 ! <P3,Sg> ;
} ;
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 = <P1,Pl> ;
objdef = Def ;
poss = possForms ! <P1,Pl> ;
} ;
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 = <P2,Pl> ;
objdef = Def ;
poss = possForms ! <P2,Pl> ;
} ;
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 = <P3,Pl> ;
objdef = Def ;
poss = possForms ! <P3,Pl> ;
} ;
she_Pron = pronTable ! <P3,Sg> ;
we_Pron = pronTable ! <P1,Pl> ;
youPl_Pron = pronTable ! <P2,Pl> ;
they_Pron = pronTable ! <P3,Pl> ;
--lin whatPl_IP = ;
--lin whatSg_IP = :

View File

@@ -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 <vps.sc,vps.c2> of {
<SCDat,Nom> => 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 <vps.sc,vps.c2> of {
<SCDat,Nom> => vps.s ! np.objdef ! agr2vf np.agr;
_ => vps.s ! np.objdef ! vf } ;
} ;
}