(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 ;
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 ;
ComparA a np = emptyAP ** {
s = a.s ! Compar ;
ComparA a np = UseComparA a ** {
compar = applyAdp (caseAdp Ade) np ;
-- compar = applyAdp (prepos Nom "mint") np ;
} ;
-- : A2 -> NP -> AP ; -- married to her
ComplA2 a2 np = emptyAP ** {
s = a2.s ! Posit ;
ComplA2 a2 np = PositA a2 ** {
compar = applyAdp a2.c2 np ;
} ;
@@ -30,12 +30,14 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
-- : A -> AP ; -- warmer
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
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 ;
} ;
@@ -54,7 +56,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
-- : 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
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 ;
Num = ResHun.Num ;
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
} ;
DAP = ResHun.Determiner ;

View File

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

View File

@@ -103,8 +103,8 @@ concrete NounHun of Noun = CatHun ** open
-- : Quant -> Num -> Ord -> Det ; -- these five best
DetQuantOrd quant num ord =
let theseFive = DetQuant quant num in theseFive ** {
s = \\c => theseFive.s ! c ++ ord.s ! num.n ;
sp = \\c => theseFive.sp ! c ++ ord.s ! num.n ;
s = \\c => theseFive.s ! c ++ ord.s ! num.n ! Nom ;
sp = \\c => theseFive.sp ! c ++ ord.s ! num.n ! Nom ;
} ;
-- Whether the resulting determiner is singular or plural depends on the
@@ -145,7 +145,9 @@ concrete NounHun of Noun = CatHun ** open
-}
-- : A -> Ord ;
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?
} ;
@@ -201,7 +203,7 @@ concrete NounHun of Noun = CatHun ** open
-- : 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 ;
} ;

View File

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

View File

@@ -17,7 +17,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in {
UttAdv adv = adv ;
UttCN cn = {s = linCN cn} ;
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 ;
NoPConj = {s = []} ;

View File

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

View File

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