forked from GitHub/gf-rgl
(Hun) Add proper inflection tables in NP, stems only up to CN
This commit is contained in:
@@ -12,7 +12,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
|
|||||||
-- : A -> NP -> AP ;
|
-- : A -> NP -> AP ;
|
||||||
ComparA a np = emptyAP ** {
|
ComparA a np = emptyAP ** {
|
||||||
s = a.s ! Compar ;
|
s = a.s ! Compar ;
|
||||||
compar = np.s ! Ade ;
|
compar = applyAdp (caseAdp Ade) np ;
|
||||||
-- compar = applyAdp (prepos Nom "mint") 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
|
-- : CAdv -> AP -> NP -> AP ; -- as cool as John
|
||||||
CAdvAP adv ap np = ap ** {
|
CAdvAP adv ap np = ap ** {
|
||||||
s = \\n => adv.s ++ ap.s ! n ;
|
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$.
|
-- The superlative use is covered in $Ord$.
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ lin
|
|||||||
|
|
||||||
-- Noun phrases
|
-- Noun phrases
|
||||||
lincat
|
lincat
|
||||||
[NP] = ResHun.BaseNP ** {s1,s2 : Case => Str} ;
|
[NP] = ResHun.BaseNP ** {s1,s2 : Possessor => Case => Str} ;
|
||||||
|
|
||||||
lin
|
lin
|
||||||
BaseNP x y = twoTable Case x y ** y ;
|
BaseNP x y = twoTable2 Possessor Case x y ** y ;
|
||||||
ConsNP x xs = xs ** consrTable Case comma x xs ;
|
ConsNP x xs = xs ** consrTable2 Possessor Case comma x xs ;
|
||||||
ConjNP co xs = conjunctDistrTable Case co xs ** xs ** {
|
ConjNP co xs = conjunctDistrTable2 Possessor Case co xs ** xs ** {
|
||||||
agr = <P3, case xs.agr.p2 of {
|
agr = <P3, case xs.agr.p2 of {
|
||||||
Pl => Pl ;
|
Pl => Pl ;
|
||||||
_ => co.n }>
|
_ => co.n }>
|
||||||
|
|||||||
@@ -9,15 +9,23 @@ concrete NounHun of Noun = CatHun ** open
|
|||||||
|
|
||||||
-- : Det -> CN -> NP
|
-- : Det -> CN -> NP
|
||||||
DetCN det cn = emptyNP ** cn ** det ** {
|
DetCN det cn = emptyNP ** cn ** det ** {
|
||||||
s = \\c =>
|
s = \\p,c =>
|
||||||
let foo : Str = case det.dt of {
|
let possessed : Str = caseFromPossStem cn det c ;
|
||||||
NoPoss => caseFromStem glue cn c det.n ;
|
standalone : Str = caseFromStem glue cn c det.n ;
|
||||||
DetPoss _ => caseFromPossStem cn det c } ;
|
|
||||||
in case det.caseagr of {
|
in case det.caseagr of {
|
||||||
True => det.s ! c ;
|
True => det.s ! c ;
|
||||||
False => det.s ! Nom
|
False => det.s ! Nom
|
||||||
} ++ foo
|
} ++ case <p,det.dt> of {
|
||||||
++ cn.compl ! det.n ! c ;
|
<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> ;
|
agr = <P3,det.n> ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -25,11 +33,13 @@ concrete NounHun of Noun = CatHun ** open
|
|||||||
UsePN pn = pn ;
|
UsePN pn = pn ;
|
||||||
|
|
||||||
-- : Pron -> NP ;
|
-- : Pron -> NP ;
|
||||||
UsePron pron = pron ;
|
UsePron pron = pron ** {
|
||||||
|
s = \\_ => pron.s ;
|
||||||
|
} ;
|
||||||
|
|
||||||
-- : Predet -> NP -> NP ; -- only the man
|
-- : Predet -> NP -> NP ; -- only the man
|
||||||
PredetNP predet np = np ** {
|
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
|
-- 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
|
-- : NP -> Adv -> NP ; -- Paris today
|
||||||
AdvNP np adv = np ** {
|
AdvNP np adv = np ** {
|
||||||
s = \\c => case adv.isPre of {
|
s = \\p,c => case adv.isPre of {
|
||||||
True => adv.s ++ np.s ! c ;
|
True => adv.s ++ np.s ! p ! c ;
|
||||||
False => np.s ! c ++ adv.s } ;
|
False => np.s ! p ! c ++ adv.s } ;
|
||||||
-- compl = \\nc => case adv.isPre of {
|
|
||||||
-- True => np.compl ! nc ;
|
|
||||||
-- False => np.compl ! nc ++ adv.s } ;
|
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : NP -> Adv -> NP ; -- boys, such as ..
|
-- : NP -> Adv -> NP ; -- boys, such as ..
|
||||||
ExtAdvNP np adv = np ** {
|
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
|
-- : NP -> RS -> NP ; -- Paris, which is here
|
||||||
RelNP np rs = np ** {
|
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.
|
-- Determiners can form noun phrases directly.
|
||||||
|
|
||||||
-- : Det -> NP ;
|
-- : Det -> NP ;
|
||||||
DetNP det = emptyNP ** det ** {
|
DetNP det = emptyNP ** det ** {
|
||||||
s = det.sp ;
|
s = \\p => det.sp ;
|
||||||
agr = <P3,det.n> ;
|
agr = <P3,det.n> ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : CN -> NP ;
|
-- : CN -> NP ;
|
||||||
MassNP cn = emptyNP ** {
|
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 ;
|
cn.compl ! Sg ! c ;
|
||||||
agr = <P3,Sg> ;
|
agr = <P3,Sg> ;
|
||||||
} ;
|
} ;
|
||||||
@@ -227,13 +235,14 @@ concrete NounHun of Noun = CatHun ** open
|
|||||||
|
|
||||||
-- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
|
-- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
|
||||||
ApposCN cn np = cn ** {
|
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
|
--2 Possessive and partitive constructs
|
||||||
|
|
||||||
-- : PossNP : CN -> NP -> CN ;
|
-- : PossNP : CN -> NP -> CN ;
|
||||||
-- 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
|
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ param
|
|||||||
SubjCase = SCNom | SCDat ; -- Limited set of subject cases
|
SubjCase = SCNom | SCDat ; -- Limited set of subject cases
|
||||||
|
|
||||||
CNPossStem = PossPl | PossSg PossStem ;
|
CNPossStem = PossPl | PossSg PossStem ;
|
||||||
|
|
||||||
|
Possessor = NotPossessed | Poss Person Number ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
|
|
||||||
caseTable : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,x15 : Str) -> Case=>Str =
|
caseTable : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,x15 : Str) -> Case=>Str =
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in {
|
|||||||
UttImpPol = UttImpSg ;
|
UttImpPol = UttImpSg ;
|
||||||
-}
|
-}
|
||||||
UttIP,
|
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} ;
|
UttVP vp = {s = vp.obj ! <P3,Sg> ++ vp.adv ++ vp.s ! VInf} ;
|
||||||
UttAdv adv = adv ;
|
UttAdv adv = adv ;
|
||||||
UttCN cn = {s = linCN cn} ;
|
UttCN cn = {s = linCN cn} ;
|
||||||
|
|||||||
@@ -79,11 +79,11 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
NounPhrase : Type = BaseNP ** {
|
NounPhrase : Type = BaseNP ** {
|
||||||
s : Case => Str ;
|
s : Possessor => Case => Str ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
emptyNP : NounPhrase = {
|
emptyNP : NounPhrase = {
|
||||||
s = \\_ => [] ;
|
s = \\_,_ => [] ;
|
||||||
agr = <P3,Sg> ;
|
agr = <P3,Sg> ;
|
||||||
objdef = Indef ;
|
objdef = Indef ;
|
||||||
empty = [] ;
|
empty = [] ;
|
||||||
@@ -91,10 +91,10 @@ oper
|
|||||||
pstems = \\_ => [] ;
|
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 ** {
|
defNP : Str -> Number -> NounPhrase = \s,n -> emptyNP ** {
|
||||||
s = mkCaseNoun s ! n ;
|
s = \\c => mkCaseNoun s ! n ;
|
||||||
n = n ;
|
n = n ;
|
||||||
objdef = Def ;
|
objdef = Def ;
|
||||||
} ;
|
} ;
|
||||||
@@ -103,7 +103,8 @@ oper
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Pronouns
|
-- Pronouns
|
||||||
|
|
||||||
Pronoun : Type = NounPhrase ** {
|
Pronoun : Type = BaseNP ** {
|
||||||
|
s : Case => Str ;
|
||||||
poss : HarmForms ; -- for PossPron : Pron -> Quant
|
poss : HarmForms ; -- for PossPron : Pron -> Quant
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -278,7 +279,7 @@ oper
|
|||||||
emptyAdp : Adposition = nomAdp [] ;
|
emptyAdp : Adposition = nomAdp [] ;
|
||||||
|
|
||||||
applyAdp : Adposition -> NounPhrase -> Str = \adp,np ->
|
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 =
|
applyCase : (Str->Str->Str) -> Case -> Noun -> NumCaseStem -> Str =
|
||||||
\bind,cas,cn,stem -> bind (cn.s ! stem) (endCase cas ! cn.h) ;
|
\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 {
|
s = \\t,a,p => let subjcase : Case = case vp.sc of {
|
||||||
SCNom => Nom ;
|
SCNom => Nom ;
|
||||||
SCDat => Dat }
|
SCDat => Dat }
|
||||||
in np.s ! subjcase
|
in np.s ! NotPossessed ! subjcase
|
||||||
++ if_then_Pol p [] "nem"
|
++ if_then_Pol p [] "nem"
|
||||||
++ vp.s ! agr2vf np.agr
|
++ vp.s ! agr2vf np.agr
|
||||||
++ vp.obj ! np.agr
|
++ vp.obj ! np.agr
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ lin
|
|||||||
-- : NP -> Comp ;
|
-- : NP -> Comp ;
|
||||||
CompNP np = UseCopula ** {
|
CompNP np = UseCopula ** {
|
||||||
s = \\vf => case vf of {
|
s = \\vf => case vf of {
|
||||||
VPres P3 _ => np.s ! Nom ;
|
VPres P3 _ => np.s ! NotPossessed ! Nom ;
|
||||||
_ => np.s ! Nom ++ copula.s ! vf } ;
|
_ => np.s ! NotPossessed ! Nom ++ copula.s ! vf } ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : Adv -> Comp ;
|
-- : Adv -> Comp ;
|
||||||
@@ -149,15 +149,10 @@ lin
|
|||||||
oper
|
oper
|
||||||
insertObj : ResHun.VPSlash -> NounPhrase -> VerbPhrase = \vps,np -> vps ** {
|
insertObj : ResHun.VPSlash -> NounPhrase -> VerbPhrase = \vps,np -> vps ** {
|
||||||
obj = \\agr =>
|
obj = \\agr =>
|
||||||
-- have_V2 needs to put object in poss. form
|
-- have_V2 needs its object possessed by the subject
|
||||||
let pron : Pronoun = pronTable ! agr ;
|
case <vps.sc,vps.c2> of {
|
||||||
num : CatHun.Num = case np.agr.p2 of {
|
<SCDat,Nom> => np.s ! Poss agr.p1 agr.p2 ! vps.c2 ;
|
||||||
Sg => NumSg ; Pl => NumPl } ;
|
_ => np.s ! NotPossessed ! vps.c2 } ;
|
||||||
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 =>
|
s = \\vf =>
|
||||||
-- If verb's subject case is Dat and object Nom, verb agrees with obj.
|
-- If verb's subject case is Dat and object Nom, verb agrees with obj.
|
||||||
|
|||||||
Reference in New Issue
Block a user