(Hun) Add parameter in Det,Quant whether it agrees in case as attribute

This commit is contained in:
Inari Listenmaa
2020-04-20 10:38:53 +02:00
parent 252ecd0bb3
commit 5814f788bc
3 changed files with 35 additions and 13 deletions

View File

@@ -8,7 +8,10 @@ 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 => det.s ! Nom ++ cn.s ! det.n ! c ; s = \\c => case det.caseagr of {
True => det.s ! c ;
False => det.s ! Nom
} ++ cn.s ! det.n ! c ;
agr = <P3,det.n> ; agr = <P3,det.n> ;
} ; } ;
@@ -46,7 +49,7 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
-- Determiners can form noun phrases directly. -- Determiners can form noun phrases directly.
-- : Det -> NP ; -- : Det -> NP ;
DetNP det = emptyNP ** { DetNP det = emptyNP ** det ** {
s = det.sp ; s = det.sp ;
agr = <P3,det.n> ; agr = <P3,det.n> ;
} ; } ;
@@ -134,6 +137,7 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
sp = \\_,_ => pre {"a" ; "az" / v } ; sp = \\_,_ => pre {"a" ; "az" / v } ;
isIndefArt = False ; isIndefArt = False ;
objdef = Def ; objdef = Def ;
caseagr = True ;
} ; } ;
-- : Quant -- : Quant
@@ -142,6 +146,7 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
sp = \\n,_ => case n of {Sg => "egy" ; Pl => []} ; sp = \\n,_ => case n of {Sg => "egy" ; Pl => []} ;
isIndefArt = True ; isIndefArt = True ;
objdef = Indef ; objdef = Indef ;
caseagr = True ;
} ; } ;
-- : Pron -> Quant -- : Pron -> Quant

View File

@@ -47,13 +47,17 @@ oper
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Det, Quant, Card, Ord -- Det, Quant, Card, Ord
BaseQuant : Type = {
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"
} ;
-- Quant has variable number: -- Quant has variable number:
-- e.g. this_Quant has both "this" and "these" -- e.g. this_Quant has both "this" and "these"
Quant : Type = { Quant : Type = BaseQuant ** {
s, -- form that comes before noun: "{this} car" s, -- form that comes before noun: "{this} car"
sp : Number => Case => Str ; -- independent form, "I like {this}" (DetNP) sp : Number => Case => Str ; -- independent form, "I like {this}" (DetNP)
isIndefArt : Bool ; -- standard trick to prevent "a one car" isIndefArt : Bool ; -- standard trick to prevent "a one car"
objdef : ObjDef ; -- How V2 agrees if NP with this Det is an object
} ; } ;
mkQuant : (s,sp : Str) -> Quant = \s,sp -> { mkQuant : (s,sp : Str) -> Quant = \s,sp -> {
@@ -61,26 +65,35 @@ oper
sp = (mkNoun sp).s ; sp = (mkNoun sp).s ;
isIndefArt = False ; isIndefArt = False ;
objdef = Def ; objdef = Def ;
caseagr = True ;
} ; } ;
-- Det is formed in DetQuant : Quant -> Num -> Det -- Det is formed in DetQuant : Quant -> Num -> Det
-- so it has an inherent number. -- so it has an inherent number.
Determiner : Type = { Determiner : Type = BaseQuant ** {
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
objdef : ObjDef ; -- How V2 agrees if NP with this Det is an object
} ; } ;
mkDet : (s : Str) -> ObjDef -> Number -> Determiner = \s,d,n -> { mkDet : (s : Str) -> ObjDef -> Number -> Bool -> Determiner = \s,d,n,ca -> {
s, s,
sp = (mkNoun s).s ! n ; sp = (mkNoun s).s ! n ;
n = n ; n = n ;
numtype = NoNum ; numtype = NoNum ;
objdef = d ; objdef = d ;
caseagr = ca ;
} ; } ;
mkDet2 : (n,a : Str) -> ObjDef -> Number -> Bool -> Determiner = \no,ac,d,n,ca ->
let reg : Determiner = mkDet no d n ca
in reg ** {
s,sp = (regNounNomAcc no ac).s ! n ;
} ;
Numeral : Type = { Numeral : Type = {
s : Place => Str ; -- Independent or attribute s : Place => Str ; -- Independent or attribute
numtype : NumType ; -- Digit, numeral or Sg/Pl : makes a difference in many languages numtype : NumType ; -- Digit, numeral or Sg/Pl : makes a difference in many languages

View File

@@ -61,16 +61,20 @@ lin most_Predet = {s = ""} ;
-} -}
--lin every_Det = --lin every_Det =
lin few_Det = mkDet "kevés" Def Sg ; -- TODO check lin few_Det = mkDet "kevés" Def Sg False ; -- TODO check
lin many_Det = mkDet "sok" Def Sg ; -- TODO check lin many_Det = mkDet "sok" Def Sg False ; -- TODO check
--lin much_Det = --lin much_Det =
lin somePl_Det = mkDet "néhány" Indef Sg ; lin someSg_Det,
lin someSg_Det = mkDet "néhány" Indef Sg ; somePl_Det = mkDet2 "néhány" "néhányat" Indef Sg False ;
--lin no_Quant = --lin no_Quant =
lin that_Quant = mkQuant "az" "az" ; lin that_Quant =
lin this_Quant = mkQuant "ez" "ez" ; let az : Quant = mkQuant "az" "az" ;
in az ** {s = \\n,c => az.s ! n ! c ++ pre {"a" ; "az" / v }} ;
lin this_Quant =
let ez : Quant = mkQuant "ez" "ez" ;
in ez ** {s = \\n,c => ez.s ! n ! c ++ pre {"a" ; "az" / v }} ;
{-lin which_IQuant = {-lin which_IQuant =