(Hun) Add case to A and AP

This commit is contained in:
Inari Listenmaa
2020-04-26 13:30:00 +02:00
parent 5b8e2eeb23
commit d7e10e843b
8 changed files with 44 additions and 40 deletions

View File

@@ -6,19 +6,19 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
-- : A -> AP ; -- : A -> AP ;
PositA a = emptyAP ** { PositA a = emptyAP ** {
s = a.s ! Posit s = \\n,c =>
let adj : Noun = (a ** {s = a.s ! Posit}) in
caseFromStem glue adj c n ;
} ; } ;
-- : A -> NP -> AP ; -- : A -> NP -> AP ;
ComparA a np = emptyAP ** { ComparA a np = UseComparA a ** {
s = a.s ! Compar ;
compar = applyAdp (caseAdp Ade) np ; compar = applyAdp (caseAdp Ade) np ;
-- compar = applyAdp (prepos Nom "mint") np ; -- compar = applyAdp (prepos Nom "mint") np ;
} ; } ;
-- : A2 -> NP -> AP ; -- married to her -- : A2 -> NP -> AP ; -- married to her
ComplA2 a2 np = emptyAP ** { ComplA2 a2 np = PositA a2 ** {
s = a2.s ! Posit ;
compar = applyAdp a2.c2 np ; compar = applyAdp a2.c2 np ;
} ; } ;
@@ -30,12 +30,14 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
-- : A -> AP ; -- warmer -- : A -> AP ; -- warmer
UseComparA a = emptyAP ** { UseComparA a = emptyAP ** {
s = a.s ! Compar ; s = \\n,c =>
let adj : Noun = (a ** {s = a.s ! Compar}) in
caseFromStem glue adj c n ;
} ; } ;
-- : 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,c => adv.s ++ ap.s ! n ! c ;
compar = ap.compar ++ adv.p ++ applyAdp (caseAdp Nom) np ; compar = ap.compar ++ adv.p ++ applyAdp (caseAdp Nom) np ;
} ; } ;
@@ -54,7 +56,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
-- : AdA -> AP -> AP ; -- : AdA -> AP -> AP ;
AdAP ada ap = ap ** { AdAP ada ap = ap ** {
s = \\af => ada.s ++ ap.s ! af ; s = \\n,c => ada.s ++ ap.s ! n ! c ;
} ; } ;
@@ -62,7 +64,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
-- : AP -> Adv -> AP ; -- warm by nature -- : AP -> Adv -> AP ; -- warm by nature
AdvAP ap adv = ap ** { AdvAP ap adv = ap ** {
s = \\af => ap.s ! af ++ adv.s ; s = \\n,c => ap.s ! n ! c ++ adv.s ;
} ; } ;
} }

View File

@@ -66,7 +66,7 @@ concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in {
Quant = ResHun.Quant ; Quant = ResHun.Quant ;
Num = ResHun.Num ; Num = ResHun.Num ;
Ord = { Ord = {
s : Number => Str ; -- Number => Case => Str ; -- Ord can come from AP and become AP again s : Number => Case => Str ; -- Ord can come from AP and become AP again
n : Number -- Ord can come from Num, which has inherent number n : Number -- Ord can come from Num, which has inherent number
} ; } ;
DAP = ResHun.Determiner ; DAP = ResHun.Determiner ;

View File

@@ -20,18 +20,18 @@ lin
-- Adjectival phrases -- Adjectival phrases
lincat lincat
[AP] = {s1,s2 : Number => Str} ; [AP] = {s1,s2 : Number => Case => Str} ;
lin lin
BaseAP x y = BaseAP x y =
-- Don't try to have discontinuous comparative forms -- Don't try to have discontinuous comparative forms
let xCont : AP = x ** {s = \\n => x.s ! n ++ x.compar} ; let xCont : AP = x ** {s = \\n,c => x.s ! n ! c ++ x.compar} ;
yCont : AP = y ** {s = \\n => y.s ! n ++ y.compar} ; yCont : AP = y ** {s = \\n,c => y.s ! n ! c ++ y.compar} ;
in twoTable Number xCont yCont ; in twoTable2 Number Case xCont yCont ;
ConsAP a as = ConsAP a as =
let aCont : AP = a ** {s = \\n => a.s ! n ++ a.compar} ; let aCont : AP = a ** {s = \\n,c => a.s ! n ! c ++ a.compar} ;
in consrTable Number comma aCont as ; in consrTable2 Number Case comma aCont as ;
ConjAP co as = conjunctDistrTable Number co as ** {compar = []} ; ConjAP co as = conjunctDistrTable2 Number Case co as ** {compar = []} ;
-- Noun phrases -- Noun phrases
lincat lincat

View File

@@ -103,8 +103,8 @@ concrete NounHun of Noun = CatHun ** open
-- : Quant -> Num -> Ord -> Det ; -- these five best -- : Quant -> Num -> Ord -> Det ; -- these five best
DetQuantOrd quant num ord = DetQuantOrd quant num ord =
let theseFive = DetQuant quant num in theseFive ** { let theseFive = DetQuant quant num in theseFive ** {
s = \\c => theseFive.s ! c ++ ord.s ! num.n ; s = \\c => theseFive.s ! c ++ ord.s ! num.n ! Nom ;
sp = \\c => theseFive.sp ! c ++ ord.s ! num.n ; sp = \\c => theseFive.sp ! c ++ ord.s ! num.n ! Nom ;
} ; } ;
-- Whether the resulting determiner is singular or plural depends on the -- Whether the resulting determiner is singular or plural depends on the
@@ -145,7 +145,9 @@ concrete NounHun of Noun = CatHun ** open
-} -}
-- : A -> Ord ; -- : A -> Ord ;
OrdSuperl a = { OrdSuperl a = {
s = a.s ! Superl ; s = \\n,c =>
let adj : Noun = (a ** {s = a.s ! Superl}) in
caseFromStem glue adj c n ;
n = Sg -- ?? is this meaningful? n = Sg -- ?? is this meaningful?
} ; } ;
@@ -201,7 +203,7 @@ concrete NounHun of Noun = CatHun ** open
-- : AP -> CN -> CN -- : AP -> CN -> CN
AdjCN ap cn = cn ** { AdjCN ap cn = cn ** {
s = \\nc => ap.s ! Sg ++ cn.s ! nc ; s = \\nc => ap.s ! Sg ! Nom ++ cn.s ! nc ;
compl = \\n,c => ap.compar ++ cn.compl ! n ! c ; compl = \\n,c => ap.compar ++ cn.compl ! n ! c ;
} ; } ;

View File

@@ -159,9 +159,9 @@ oper
mkA2 = overload { mkA2 = overload {
mkA2 : A -> A2 = \a -> a ** {c2 = casePrep Nom} ; mkA2 : A -> A2 = \a -> a ** {c2 = casePrep Nom} ;
mkA2 : Str -> Prep -> A2 = \s,p -> mkA2 : Str -> Prep -> A2 = \s,p ->
lin A2 {s = (mkAdj s).s ; c2 = p} ; lin A2 ((mkAdj s) ** {c2 = p}) ;
mkA2 : Str -> Case -> A2 = \s,c -> mkA2 : Str -> Case -> A2 = \s,c ->
lin A2 {s = (mkAdj s).s ; c2 = casePrep c} ; lin A2 ((mkAdj s) ** {c2 = casePrep c}) ;
mkA2 : A -> Prep -> A2 = \a,p -> mkA2 : A -> Prep -> A2 = \a,p ->
lin A2 (a ** {c2 = p}) ; lin A2 (a ** {c2 = p}) ;
} ; } ;

View File

@@ -17,7 +17,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in {
UttAdv adv = adv ; UttAdv adv = adv ;
UttCN cn = {s = linCN cn} ; UttCN cn = {s = linCN cn} ;
UttCard n = {s = n.s ! Indep} ; UttCard n = {s = n.s ! Indep} ;
UttAP ap = {s = ap.s ! Sg ++ ap.compar} ; UttAP ap = {s = ap.s ! Sg ! Nom ++ ap.compar} ;
UttInterj i = i ; UttInterj i = i ;
NoPConj = {s = []} ; NoPConj = {s = []} ;

View File

@@ -305,35 +305,35 @@ oper
-- Adjectives -- Adjectives
AdjPhrase : Type = { AdjPhrase : Type = {
s : Number => Str ; s : Number => Case => Str ;
compar : Str -- Discontinuous: Én *nagyobb* vagyok *nálad*. compar : Str -- Discontinuous: Én *nagyobb* vagyok *nálad*.
} ; } ;
emptyAP : AdjPhrase = { emptyAP : AdjPhrase = {
s = \\_ => [] ; s = \\_,_ => [] ;
compar = [] ; compar = [] ;
} ; } ;
Adjective : Type = { Adjective : Type = {
s : Degree => Number => Str s : Degree => NumCaseStem => Str ;
h : Harm ;
} ; } ;
Adjective2 : Type = Adjective ** { Adjective2 : Type = Adjective ** {
c2 : Adposition ; c2 : Adposition ;
} ; } ;
mkAdj : Str -> Adjective = \sg -> { mkAdj : Str -> Adjective = \sgnom -> {
s = \\d,n => s = \\d,nc =>
let adj = case d of { let adj = case d of {
Compar => comparAdj sg ; Compar => comparAdj sgnom ;
Superl => "leg" + comparAdj sg ; Superl => "leg" + comparAdj sgnom ;
_ => sg } ; _ => sgnom } ;
plural = case n of { in (mkNoun adj).s ! nc ;
Sg => [] ; h = (mkNoun sgnom).h ;
Pl => pluralAdj adj }
in adj + plural
} ; } ;
invarAP : Str -> AdjPhrase = \s -> emptyAP ** {s = \\_ => s} ; invarAP : Str -> AdjPhrase = \s -> emptyAP ** {s = \\_,_ => s} ;
-- https://en.wikisource.org/wiki/Simplified_Grammar_of_the_Hungarian_Language/Adjectives -- https://en.wikisource.org/wiki/Simplified_Grammar_of_the_Hungarian_Language/Adjectives
comparAdj : Str -> Str = \stem -> comparAdj : Str -> Str = \stem ->

View File

@@ -110,9 +110,9 @@ lin
-- : AP -> Comp ; -- : AP -> Comp ;
CompAP ap = UseCopula ** { CompAP ap = UseCopula ** {
s = \\vf => case vf of { s = \\vf => case vf of {
VPres P3 n => ap.s ! n ; VPres P3 n => ap.s ! n ! Nom ;
VPres _ n => ap.s ! n ++ copula.s ! vf ; VPres _ n => ap.s ! n ! Nom ++ copula.s ! vf ;
_ => ap.s ! Sg ++ copula.s ! vf} _ => ap.s ! Sg ! Nom ++ copula.s ! vf}
++ ap.compar ; ++ ap.compar ;
} ; } ;