mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 17:08:54 -06:00
(Hun) Add possessive suffixes to nouns in DetCN
This commit is contained in:
@@ -8,10 +8,14 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
|
|||||||
|
|
||||||
-- : Det -> CN -> NP
|
-- : Det -> CN -> NP
|
||||||
DetCN det cn = emptyNP ** det ** {
|
DetCN det cn = emptyNP ** det ** {
|
||||||
s = \\c => case det.caseagr of {
|
s = \\c =>
|
||||||
|
let foo : Str = case det.dt of {
|
||||||
|
NoPoss => caseFromStem glue cn c det.n ;
|
||||||
|
DetPoss _ => caseFromPossStem cn det c } ;
|
||||||
|
in case det.caseagr of {
|
||||||
True => det.s ! c ;
|
True => det.s ! c ;
|
||||||
False => det.s ! Nom
|
False => det.s ! Nom
|
||||||
} ++ caseFromStem glue cn c det.n
|
} ++ foo
|
||||||
++ cn.compl ! det.n ! c ;
|
++ cn.compl ! det.n ! c ;
|
||||||
agr = <P3,det.n> ;
|
agr = <P3,det.n> ;
|
||||||
} ;
|
} ;
|
||||||
@@ -77,6 +81,8 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
|
|||||||
<True,True> => [] ;
|
<True,True> => [] ;
|
||||||
_ => quant.sp ! num.n ! c }
|
_ => quant.sp ! num.n ! c }
|
||||||
++ num.s ! Indep ;
|
++ num.s ! Indep ;
|
||||||
|
dt = case quant.qt of { QuantPoss stem => DetPoss stem ;
|
||||||
|
_ => NoPoss } ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : Quant -> Num -> Ord -> Det ; -- these five best
|
-- : Quant -> Num -> Ord -> Det ; -- these five best
|
||||||
@@ -134,28 +140,28 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
|
|||||||
-- OrdNumeralSuperl num a = num ** { } ;
|
-- OrdNumeralSuperl num a = num ** { } ;
|
||||||
|
|
||||||
-- : Quant
|
-- : Quant
|
||||||
DefArt = {
|
DefArt = mkQuant "a" "a" ** {
|
||||||
s,
|
s,
|
||||||
sp = \\_,_ => pre {"a" ; "az" / v } ;
|
sp = \\_,_ => pre {"a" ; "az" / v } ;
|
||||||
qt = Article ;
|
qt = Article ;
|
||||||
objdef = Def ;
|
objdef = Def ;
|
||||||
caseagr = True ;
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : Quant
|
-- : Quant
|
||||||
IndefArt = {
|
IndefArt = mkQuant "egy" [] ** {
|
||||||
s = \\n,_ => case n of {Sg => "egy" ; Pl => []} ;
|
s = \\n,_ => case n of {Sg => "egy" ; Pl => []} ;
|
||||||
sp = \\n,_ => case n of {Sg => "egy" ; Pl => "sok"} ;
|
sp = \\n,_ => case n of {Sg => "egy" ; Pl => "sok"} ;
|
||||||
qt = Article ;
|
qt = Article ;
|
||||||
objdef = Indef ;
|
objdef = Indef ;
|
||||||
caseagr = True ;
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : Pron -> Quant
|
-- : Pron -> Quant
|
||||||
-- PossPron pron =
|
PossPron pron = pron ** {
|
||||||
-- let p = pron.poss ;
|
s,sp = \\_ => pron.s ;
|
||||||
-- in DefArt ** {
|
qt = QuantPoss (agr2PossStem pron.agr) ;
|
||||||
-- } ;
|
objdef = Def ;
|
||||||
|
caseagr = False ;
|
||||||
|
} ;
|
||||||
|
|
||||||
--2 Common nouns
|
--2 Common nouns
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,19 @@ oper
|
|||||||
-- Quant
|
-- Quant
|
||||||
|
|
||||||
param
|
param
|
||||||
QuantType = Possessive | Article ;
|
QuantType =
|
||||||
|
Article -- Needed to prevent "a 2 cars"
|
||||||
|
| Other -- Not poss, not article
|
||||||
|
| QuantPoss PossStem -- Which possessive stem it takes
|
||||||
|
;
|
||||||
|
|
||||||
|
DetType =
|
||||||
|
NoPoss -- distinction between Article and Other no longer needed
|
||||||
|
| DetPoss PossStem -- Sill need to know which stem it takes if Poss
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Singular stems. Plural is always same, no need to add here.
|
||||||
|
PossStem = dSg_rSg1P2 | dSg_rP3 | dSg_rPl1 ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
-- standard trick to prevent "a one car"
|
-- standard trick to prevent "a one car"
|
||||||
@@ -27,6 +39,13 @@ oper
|
|||||||
_ => False
|
_ => False
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
agr2PossStem : Person*Number -> PossStem = \pn ->
|
||||||
|
case <pn.p1,pn.p2> of {
|
||||||
|
<P1,Pl> => dSg_rPl1 ;
|
||||||
|
<P3,_> => dSg_rP3 ;
|
||||||
|
_ => dSg_rSg1P2
|
||||||
|
} ;
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Nouns
|
-- Nouns
|
||||||
|
|
||||||
@@ -56,8 +75,6 @@ param
|
|||||||
|
|
||||||
SubjCase = SCNom | SCDat ; -- Limited set of subject cases
|
SubjCase = SCNom | SCDat ; -- Limited set of subject cases
|
||||||
|
|
||||||
Possessor = NoPoss | Poss Number Person ;
|
|
||||||
|
|
||||||
oper
|
oper
|
||||||
|
|
||||||
caseTable : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,x15 : Str) -> Case=>Str =
|
caseTable : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,x15 : Str) -> Case=>Str =
|
||||||
|
|||||||
@@ -29,13 +29,24 @@ oper
|
|||||||
<Sg,Acc> => bind (cn.s ! SgAccStem) "t" ;
|
<Sg,Acc> => bind (cn.s ! SgAccStem) "t" ;
|
||||||
<Sg,Sup> => cn.s ! SgSup ;
|
<Sg,Sup> => cn.s ! SgSup ;
|
||||||
<Pl,Acc> => cn.s ! PlAcc ;
|
<Pl,Acc> => cn.s ! PlAcc ;
|
||||||
<Pl,Nom> => cn.s ! PlStem ;
|
<Pl,Nom> => cn.s ! PlStem ; -- don't use applyCase', it adds a BIND which breaks everything!
|
||||||
<Sg,Ins|Tra> => applyCase' SgInsStem ;
|
<Sg,Ins|Tra> => applyCase' SgInsStem ;
|
||||||
<Pl,Ins|Tra> => bind (bind (cn.s ! PlStem) "k") (endCase cas ! cn.h) ;
|
<Pl,Ins|Tra> => bind (bind (cn.s ! PlStem) "k") (endCase cas ! cn.h) ;
|
||||||
<Sg,_> => applyCase' SgStem ;
|
<Sg,_> => applyCase' SgStem ;
|
||||||
<Pl,_> => applyCase' PlStem
|
<Pl,_> => applyCase' PlStem
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
caseFromPossStem : Noun -> Determiner -> Case -> Str = \cn,det,cas ->
|
||||||
|
let stem : NumCaseStem = case <det.n,det.dt> of {
|
||||||
|
<Sg,DetPoss st> => case st of {
|
||||||
|
dSg_rSg1P2 => SgAccStem ;
|
||||||
|
dSg_rP3 => PossdSg_PossrP3 ;
|
||||||
|
dSg_rPl1 => PossdSg_PossrPl1 } ;
|
||||||
|
<Pl,DetPoss _> => PossdPl ;
|
||||||
|
_ => Predef.error "caseFromPossStem: Trying to apply to non-possessive Det"
|
||||||
|
} ;
|
||||||
|
in applyCaseSuf (det.poss ! cn.h) cas cn stem ;
|
||||||
|
|
||||||
BaseNP : Type = {
|
BaseNP : Type = {
|
||||||
agr : Person*Number ;
|
agr : Person*Number ;
|
||||||
objdef : ObjDef ;
|
objdef : ObjDef ;
|
||||||
@@ -82,6 +93,7 @@ oper
|
|||||||
-- Det, Quant, Card, Ord
|
-- Det, Quant, Card, Ord
|
||||||
|
|
||||||
BaseQuant : Type = {
|
BaseQuant : Type = {
|
||||||
|
poss : HarmForms ; -- Quants made by PossPron need this, empty for others
|
||||||
objdef : ObjDef ; -- How V2 agrees if NP with this Det is an object
|
objdef : ObjDef ; -- How V2 agrees if NP with this Det is an object
|
||||||
caseagr : Bool ; -- If it agrees in case: "azoknak a nőknek" vs. "sok nőknek"
|
caseagr : Bool ; -- If it agrees in case: "azoknak a nőknek" vs. "sok nőknek"
|
||||||
} ;
|
} ;
|
||||||
@@ -97,9 +109,10 @@ oper
|
|||||||
mkQuant : (s,sp : Str) -> Quant = \s,sp -> {
|
mkQuant : (s,sp : Str) -> Quant = \s,sp -> {
|
||||||
s = mkCaseNoun s ;
|
s = mkCaseNoun s ;
|
||||||
sp = mkCaseNoun sp ;
|
sp = mkCaseNoun sp ;
|
||||||
qt = Article ;
|
qt = Other ;
|
||||||
objdef = Def ;
|
objdef = Def ;
|
||||||
caseagr = True ;
|
caseagr = True ;
|
||||||
|
poss = harm1 [] ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- Det is formed in DetQuant : Quant -> Num -> Det
|
-- Det is formed in DetQuant : Quant -> Num -> Det
|
||||||
@@ -108,7 +121,8 @@ oper
|
|||||||
s,
|
s,
|
||||||
sp : Case => Str ;
|
sp : Case => Str ;
|
||||||
n : Number ;
|
n : Number ;
|
||||||
numtype : NumType ; -- Whether its Num component is digit, numeral or Sg/Pl
|
-- numtype : NumType ; -- Whether its Num component is digit, numeral or Sg/Pl
|
||||||
|
dt : DetType ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkDet : (s : Str) -> ObjDef -> Number -> Bool -> Determiner = \s,d,n,ca -> {
|
mkDet : (s : Str) -> ObjDef -> Number -> Bool -> Determiner = \s,d,n,ca -> {
|
||||||
@@ -118,6 +132,8 @@ oper
|
|||||||
numtype = NoNum ;
|
numtype = NoNum ;
|
||||||
objdef = d ;
|
objdef = d ;
|
||||||
caseagr = ca ;
|
caseagr = ca ;
|
||||||
|
dt = NoPoss ;
|
||||||
|
poss = harm1 [] ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkDet2 : (n,a : Str) -> ObjDef -> Number -> Bool -> Determiner = \no,ac,d,n,ca ->
|
mkDet2 : (n,a : Str) -> ObjDef -> Number -> Bool -> Determiner = \no,ac,d,n,ca ->
|
||||||
@@ -173,7 +189,11 @@ oper
|
|||||||
adp.pr ++ np.s ! adp.c ++ adp.s ;
|
adp.pr ++ np.s ! 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) ;
|
||||||
|
|
||||||
|
applyCaseSuf : Str -> Case -> Noun -> NumCaseStem -> Str =
|
||||||
|
\suf,cas,cn,stem -> glue (glue (cn.s ! stem) suf) (endCase cas ! cn.h) ;
|
||||||
|
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
-- Conj
|
-- Conj
|
||||||
|
|||||||
Reference in New Issue
Block a user