1
0
forked from GitHub/gf-rgl

(Hun) Add proper inflection tables in NP, stems only up to CN

This commit is contained in:
Inari Listenmaa
2020-04-25 14:03:10 +02:00
parent 234f74b6b0
commit 44603f7db7
7 changed files with 58 additions and 50 deletions

View File

@@ -12,7 +12,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
-- : A -> NP -> AP ;
ComparA a np = emptyAP ** {
s = a.s ! Compar ;
compar = np.s ! Ade ;
compar = applyAdp (caseAdp Ade) np ;
-- compar = applyAdp (prepos Nom "mint") np ;
} ;
@@ -36,7 +36,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
-- : CAdv -> AP -> NP -> AP ; -- as cool as John
CAdvAP adv ap np = ap ** {
s = \\n => adv.s ++ ap.s ! n ;
compar = ap.compar ++ adv.p ++ np.s ! Nom
compar = ap.compar ++ adv.p ++ applyAdp (caseAdp Nom) np ;
} ;
-- The superlative use is covered in $Ord$.

View File

@@ -35,12 +35,12 @@ lin
-- Noun phrases
lincat
[NP] = ResHun.BaseNP ** {s1,s2 : Case => Str} ;
[NP] = ResHun.BaseNP ** {s1,s2 : Possessor => Case => Str} ;
lin
BaseNP x y = twoTable Case x y ** y ;
ConsNP x xs = xs ** consrTable Case comma x xs ;
ConjNP co xs = conjunctDistrTable Case co xs ** xs ** {
BaseNP x y = twoTable2 Possessor Case x y ** y ;
ConsNP x xs = xs ** consrTable2 Possessor Case comma x xs ;
ConjNP co xs = conjunctDistrTable2 Possessor Case co xs ** xs ** {
agr = <P3, case xs.agr.p2 of {
Pl => Pl ;
_ => co.n }>

View File

@@ -9,15 +9,23 @@ concrete NounHun of Noun = CatHun ** open
-- : Det -> CN -> NP
DetCN det cn = emptyNP ** cn ** det ** {
s = \\c =>
let foo : Str = case det.dt of {
NoPoss => caseFromStem glue cn c det.n ;
DetPoss _ => caseFromPossStem cn det c } ;
s = \\p,c =>
let possessed : Str = caseFromPossStem cn det c ;
standalone : Str = caseFromStem glue cn c det.n ;
in case det.caseagr of {
True => det.s ! c ;
False => det.s ! Nom
} ++ foo
++ cn.compl ! det.n ! c ;
True => det.s ! c ;
False => det.s ! Nom
} ++ case <p,det.dt> of {
<NotPossessed, NoPoss>
=> standalone ;
<_, DetPoss _>
=> possessed ;
<Poss per rnum, NoPoss>
=> let pron : Pronoun = pronTable ! <per,rnum> ; -- Possessor's number
dnum : CatHun.Num = case det.n of { -- Possessed's number
Sg => NumSg ; Pl => NumPl } ;
in caseFromPossStem cn (DetQuant (PossPron pron) dnum) c
} ++ cn.compl ! det.n ! c ;
agr = <P3,det.n> ;
} ;
@@ -25,11 +33,13 @@ concrete NounHun of Noun = CatHun ** open
UsePN pn = pn ;
-- : Pron -> NP ;
UsePron pron = pron ;
UsePron pron = pron ** {
s = \\_ => pron.s ;
} ;
-- : Predet -> NP -> NP ; -- only the man
PredetNP predet np = np ** {
s = \\c => predet.s ++ np.s ! c ;
s = \\p,c => predet.s ++ np.s ! p ! c ;
} ;
-- A noun phrase can also be postmodified by the past participle of a
@@ -41,34 +51,32 @@ concrete NounHun of Noun = CatHun ** open
-- : NP -> Adv -> NP ; -- Paris today
AdvNP np adv = np ** {
s = \\c => case adv.isPre of {
True => adv.s ++ np.s ! c ;
False => np.s ! c ++ adv.s } ;
-- compl = \\nc => case adv.isPre of {
-- True => np.compl ! nc ;
-- False => np.compl ! nc ++ adv.s } ;
s = \\p,c => case adv.isPre of {
True => adv.s ++ np.s ! p ! c ;
False => np.s ! p ! c ++ adv.s } ;
} ;
} ;
-- : NP -> Adv -> NP ; -- boys, such as ..
ExtAdvNP np adv = np ** {
s = \\c => np.s ! c ++ bindComma ++ adv.s ;
} ;
s = \\p,c => np.s ! p ! c ++ bindComma ++ adv.s ;
} ;
-- : NP -> RS -> NP ; -- Paris, which is here
RelNP np rs = np ** {
s = \\c => np.s ! c ++ bindComma ++ rs.s ! np.agr.p2 ! c ;
} ;
s = \\p,c => np.s ! p ! c ++ bindComma ++ rs.s ! np.agr.p2 ! c ;
} ;
-- Determiners can form noun phrases directly.
-- : Det -> NP ;
DetNP det = emptyNP ** det ** {
s = det.sp ;
s = \\p => det.sp ;
agr = <P3,det.n> ;
} ;
-- : CN -> NP ;
MassNP cn = emptyNP ** {
s = \\c => caseFromStem glue cn c Sg ++
s = \\p,c => caseFromStem glue cn c Sg ++ -- TODO add possessors
cn.compl ! Sg ! c ;
agr = <P3,Sg> ;
} ;
@@ -227,14 +235,15 @@ concrete NounHun of Noun = CatHun ** open
-- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
ApposCN cn np = cn ** {
compl = \\n,c => cn.compl ! n ! c ++ np.s ! Nom
compl = \\n,c => cn.compl ! n ! c ++ np.s ! NotPossessed ! Nom
} ;
--2 Possessive and partitive constructs
-- : PossNP : CN -> NP -> CN ;
-- PossNP cn np = cn ** {
-- } ;
-- compl = \\n,c => cn.compl ! n ! c ++ np.s ! Poss P3 n ! c -- TODO check
-- } ;
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
-- PartNP cn np = cn ** {

View File

@@ -76,6 +76,9 @@ param
SubjCase = SCNom | SCDat ; -- Limited set of subject cases
CNPossStem = PossPl | PossSg PossStem ;
Possessor = NotPossessed | Poss Person Number ;
oper
caseTable : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,x15 : Str) -> Case=>Str =

View File

@@ -12,7 +12,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in {
UttImpPol = UttImpSg ;
-}
UttIP,
UttNP = \np -> {s = np.s ! Nom} ;
UttNP = \np -> {s = np.s ! NotPossessed ! Nom} ;
UttVP vp = {s = vp.obj ! <P3,Sg> ++ vp.adv ++ vp.s ! VInf} ;
UttAdv adv = adv ;
UttCN cn = {s = linCN cn} ;

View File

@@ -79,11 +79,11 @@ oper
} ;
NounPhrase : Type = BaseNP ** {
s : Case => Str ;
s : Possessor => Case => Str ;
} ;
emptyNP : NounPhrase = {
s = \\_ => [] ;
s = \\_,_ => [] ;
agr = <P3,Sg> ;
objdef = Indef ;
empty = [] ;
@@ -91,10 +91,10 @@ oper
pstems = \\_ => [] ;
} ;
indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\c => s} ;
indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\p,c => s} ;
defNP : Str -> Number -> NounPhrase = \s,n -> emptyNP ** {
s = mkCaseNoun s ! n ;
s = \\c => mkCaseNoun s ! n ;
n = n ;
objdef = Def ;
} ;
@@ -103,7 +103,8 @@ oper
--------------------------------------------------------------------------------
-- Pronouns
Pronoun : Type = NounPhrase ** {
Pronoun : Type = BaseNP ** {
s : Case => Str ;
poss : HarmForms ; -- for PossPron : Pron -> Quant
} ;
@@ -278,7 +279,7 @@ oper
emptyAdp : Adposition = nomAdp [] ;
applyAdp : Adposition -> NounPhrase -> Str = \adp,np ->
adp.pr ++ np.s ! adp.c ++ adp.s ;
adp.pr ++ np.s ! NotPossessed ! adp.c ++ adp.s ;
applyCase : (Str->Str->Str) -> Case -> Noun -> NumCaseStem -> Str =
\bind,cas,cn,stem -> bind (cn.s ! stem) (endCase cas ! cn.h) ;
@@ -504,7 +505,7 @@ oper
s = \\t,a,p => let subjcase : Case = case vp.sc of {
SCNom => Nom ;
SCDat => Dat }
in np.s ! subjcase
in np.s ! NotPossessed ! subjcase
++ if_then_Pol p [] "nem"
++ vp.s ! agr2vf np.agr
++ vp.obj ! np.agr

View File

@@ -134,8 +134,8 @@ lin
-- : NP -> Comp ;
CompNP np = UseCopula ** {
s = \\vf => case vf of {
VPres P3 _ => np.s ! Nom ;
_ => np.s ! Nom ++ copula.s ! vf } ;
VPres P3 _ => np.s ! NotPossessed ! Nom ;
_ => np.s ! NotPossessed ! Nom ++ copula.s ! vf } ;
} ;
-- : Adv -> Comp ;
@@ -149,15 +149,10 @@ lin
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 } ;
-- have_V2 needs its object possessed by the subject
case <vps.sc,vps.c2> of {
<SCDat,Nom> => np.s ! Poss agr.p1 agr.p2 ! vps.c2 ;
_ => np.s ! NotPossessed ! vps.c2 } ;
s = \\vf =>
-- If verb's subject case is Dat and object Nom, verb agrees with obj.