1
0
forked from GitHub/gf-rgl

(Hun) Stems in N+CN, full infl table in NP.

This commit is contained in:
Inari Listenmaa
2020-04-23 13:36:57 +02:00
parent 15040355e6
commit d7d5f4aa59
8 changed files with 105 additions and 88 deletions

View File

@@ -12,7 +12,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in {
-- : A -> NP -> AP ;
ComparA a np = emptyAP ** {
s = a.s ! Compar ;
compar = applyAdp (caseAdp "nál" "nél") np ; -- Adessive
compar = np.s ! Ade ;
-- compar = applyAdp (prepos Nom "mint") np ;
} ;

View File

@@ -11,8 +11,8 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
s = \\c => case det.caseagr of {
True => det.s ! c ;
False => det.s ! Nom
} ++ cn.s ! det.n ! case2stem c
++ cn.rs ! det.n ! c ;
} ++ caseFromStem True c cn det.n
++ cn.compl ! det.n ! c ;
agr = <P3,det.n> ;
} ;
@@ -57,7 +57,8 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
-- : CN -> NP ;
MassNP cn = emptyNP ** {
s = \\c => cn.s ! Sg ! c ;
s = \\c => caseFromStem True c cn Sg ++
cn.compl ! Sg ! c ;
agr = <P3,Sg> ;
} ;
@@ -161,7 +162,7 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
-- : N -> CN
-- : N2 -> CN ;
UseN,UseN2 = \n -> n ** {
rs = \\_,_ => [] ;
compl = \\_,_ => [] ;
} ;
-- : N2 -> NP -> CN ;
@@ -179,17 +180,18 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
-- : AP -> CN -> CN
AdjCN ap cn = cn ** {
s = \\n,c => ap.s ! Sg ++ cn.s ! n ! c ++ ap.compar
s = \\n,c => ap.s ! Sg ++ cn.s ! n ! c ;
compl = \\n,c => ap.compar ++ cn.compl ! n ! c ;
} ;
-- : CN -> RS -> CN ;
RelCN cn rs = cn ** {
rs = \\n,c => rs.s ! n ! c
compl = \\n,c => cn.compl ! n ! c ++ rs.s ! n ! c
} ;
-- : CN -> Adv -> CN ;
AdvCN cn adv = cn ** {
s = \\n,c => cn.s ! n ! c ++ adv.s
compl = \\n,c => cn.compl ! n ! c ++ adv.s
} ;
-- Nouns can also be modified by embedded sentences and questions.
@@ -205,7 +207,7 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
-- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
ApposCN cn np = cn ** {
s = \\n,c => cn.s ! n ! c ++ np.s ! Nom
compl = \\n,c => cn.compl ! n ! c ++ np.s ! Nom
} ;
--2 Possessive and partitive constructs

View File

@@ -1,7 +1,7 @@
resource NounMorphoHun = ParamHun ** open Prelude, Predef in {
oper
Noun = {s : Number => Case => Str ; h : Harm} ;
Noun = {s : Number => CaseStem => Str ; h : Harm} ;
-- Paradigm functions
-- http://www.cse.chalmers.se/~aarne/articles/smart-preprint.pdf
@@ -15,7 +15,7 @@ oper
in nAlmá ** {
s = \\n,c => case <n,c> of {
-- Singular nominative uses the given form, e.g. "alma" or "kefe"
<Sg,Nom> => alma ;
<Sg,NomFull> => alma ;
-- The rest of the forms are formed with the regular constructor,
-- using "almá" or "kefé" as the stem.
@@ -35,8 +35,8 @@ oper
s = \\n,c => case <n,c> of {
-- All plural forms and Sg Acc, Sg Sup use the "lova" stem
<Pl,_>| <Sg,Acc> => nLova.s ! n ! c ;
<Sg,Sup> => nLov.s ! n ! c ;
<Pl,_>| <Sg,AccFull> => nLova.s ! n ! c ;
<Sg,SupFull> => nLov.s ! n ! c ;
-- The rest of the forms are formed with the regular constructor,
-- using "ló" as the stem.
@@ -74,8 +74,8 @@ oper
in nMajmo ** {
s = \\n,c => case <n,c> of {
-- All plural forms and Sg Acc and Sg Sup use the "majmo" stem
<Pl,_> | <Sg,Acc> => nMajmo.s ! n ! c ;
<Sg,Sup> => nMajmo.s ! n ! c ;
<Pl,_> | <Sg,AccFull> => nMajmo.s ! n ! c ;
<Sg,SupFull> => nMajmo.s ! n ! c ;
-- The rest of the forms are formed with the regular constructor,
-- using "majom" as the stem.
@@ -93,7 +93,7 @@ oper
in nTolla ** {
s = \\n,c => case <n,c> of {
-- All plural forms and Sg Acc use the "tolla" stem
<Pl,_> | <Sg,Acc> => nTolla.s ! n ! c ;
<Pl,_> | <Sg,AccFull> => nTolla.s ! n ! c ;
-- The rest of the forms are formed with the regular constructor,
-- using "toll" as the stem.
@@ -300,22 +300,28 @@ oper
harm1 : Str -> HarmForms = \i -> harm i i ;
-- Variant of case forms when the noun stem ends in consonant.
endCaseCons : Case -> HarmForms = \c -> case c of {
endCaseCons : CaseStem -> HarmForms = \c -> case c of {
AccFull => harm3 "ot" "et" "öt" ;
SupFull => harm3 "on" "en" "ön" ;
_ => harm1 []
} ;
endCase : Case -> HarmForms = \c -> case c of {
Nom => harm1 [] ;
Acc => harm3 "ot" "et" "öt" ;
Sup => harm3 "on" "en" "ön" ;
Dat => harm "nak" "nek" ;
Ins => harm "al" "el" ;
Tra => harm "á" "é" ;
Dat => harm "nak" "nek" ;
_Nom => harm1 []
-- All => harm3 "hoz" "hez" "höz" ;
-- Ade => harm "nál" "nél" ;
-- Abl => harm "l" "l" ;
-- Sub => harm "ra" "re" ;
-- Ill => harm "ba" "be" ;
-- Ine => harm "ban" "ben" ;
-- Ela => harm "ból" "ből" ;
-- Del => harm "ról" "ről" ;
-- Cau => harm1 "ért" ;
Ill => harm "ba" "be" ;
Ine => harm "ban" "ben" ;
Ela => harm "ból" "ből" ;
All => harm3 "hoz" "hez" "höz" ;
Ade => harm "l" "l" ;
Abl => harm "tól" "től" ;
Sub => harm "ra" "re" ;
Sup => harm3 "on" "en" "ön" ;
Del => harm "ról" "ről" ;
Cau => harm1 "ért"
-- Ess => harm "stul" "stül" ; -- Essive-modal 'with <the noun> and its parts'
-- Ter => harm1 "ig" ; -- Terminative 'as far as <the noun>'
-- For => harm1 "ként" ; -- Formal 'as <the noun>'
@@ -323,25 +329,23 @@ oper
} ;
-- Variant where accusative has the allomorph -at
endCaseConsAccAt : Case -> HarmForms = \c -> case c of {
Acc => harm3 "at" "et" "öt" ;
endCaseConsAccAt : CaseStem -> HarmForms = \c -> case c of {
AccFull => harm3 "at" "et" "öt" ;
_ => endCaseCons c
} ;
-- Variant where accusative has the allomorph -t for consonants
-- Examples: "pénz, bor, orr, szín, lány, kés, dal"
endCaseConsAcc : Case -> HarmForms = \c -> case c of {
Acc => harm1 "t" ;
endCaseConsAcc : CaseStem -> HarmForms = \c -> case c of {
AccFull => harm1 "t" ;
_ => endCaseCons c
} ;
-- Variant of case forms when the noun stem ends in vowel.
endCaseVow : Case -> HarmForms = \c -> case c of {
Acc => harm1 "t" ;
Sup => harm1 "n" ;
Ins => harm "val" "vel" ;
Tra => harm "vá" "vé" ;
endCaseVow : CaseStem -> HarmForms = \c -> case c of {
AccFull => harm1 "t" ;
SupFull => harm1 "n" ;
InsTraStem => harm1 "v" ;
-- Other forms are shared with endCaseCons.
_ => endCaseCons c
} ;
@@ -368,7 +372,7 @@ oper
mkNounHarm : Harm -> (plural : Str) -> Str -> Noun = mkNounHarmAcc True ;
mkNounHarmAcc : (useAt : Bool) -> Harm -> (plural : Str) -> Str -> Noun = \useAt,h,plural,w ->
let endCaseSg : Case -> HarmForms = case <useAt, w> of {
let endCaseSg : CaseStem -> HarmForms = case <useAt, w> of {
<_,_ + #v> => endCaseVow ;
<_,_ + #v + ("sz"|"z"|"s"|"zs"|"j"
|"ly"|"l"|"r"|"n"|"ny"|"ssz"|"zz"
@@ -376,7 +380,7 @@ oper
|"nz")> => endCaseConsAcc ;
<True,_> => endCaseConsAccAt ;
_ => endCaseCons } ;
endCasePl : Case -> HarmForms = case <plural, useAt> of {
endCasePl : CaseStem -> HarmForms = case <plural, useAt> of {
<"ak",_> => endCaseConsAccAt ;
<_,True> => endCaseConsAccAt ;
_ => endCaseCons } ;
@@ -390,12 +394,12 @@ oper
s = table {
Sg => table {
-- Double the last letter (if consonant) before Ins, Tra
c@(Ins|Tra) => duplConsStem + endCaseSg c ! h ;
c@(InsTraStem) => duplConsStem + endCaseSg c ! h ;
c@_ => w + endCaseSg c ! h } ;
Pl => table {
-- Double the plural k before Ins, Tra
c@(Ins|Tra) => w + plural + "k" + endCasePl c ! h ;
c@(InsTraStem) => w + plural + "k" + endCasePl c ! h ;
-- endCaseCons, because we only use -k as plural morpheme.
-- If we add possessive forms with allomorph -i, then revise.

View File

@@ -20,27 +20,26 @@ oper
param
Case =
Nom | Acc -- Practical to have core cases as full strings
| Dat -- Would be nice but is very regular, so skip it
| Sup -- Depends on the word which stem it uses
-- | All -- Can have irregularities in suffix (k)
| Ins | Tra -- Different for vowels and consonants
CaseStem =
NomFull | AccFull | SupFull -- These may use 2-3 different stems
| InsTraStem -- Instrumental and translative: -v after vowels
| OblStem ; -- The rest of the cases are regular and attach to this stem
-- | Ill | Ine | Ela | Ade | Abl | Sub | Sup | Del -- Locatives
-- | Cau -- Causal-final 'for the purpose of, for the reason that'
-- | Ins -- Instrumental
-- | Tra -- Translative
Case =
Nom | Acc | Dat
| Ill | Ine | Ela | All | Ade | Abl | Sub | Sup | Del -- Locatives
| Cau -- Causal-final 'for the purpose of, for the reason that'
| Ins -- Instrumental
| Tra -- Translative
-- | Ess | Ter | For
-- | Tem -- Temporal, e.g. hatkor six oclock (from hat 6)
;
SubjCase = SCNom | SCDat ; -- Limited set of subject cases
Possessor = NoPoss | Poss Number Person ;
oper
case2stem : Case -> Case = id Case ; -- TODO add stems and cases as separate types
caseTable : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,x15 : Str) -> Case=>Str =
\n,a,d,il,ine,el,al,ad,ab,sub,sup,del,ca,ins,tra -> table {
@@ -49,7 +48,6 @@ oper
Dat => d ;
Ins => ins ;
Tra => tra ;
OblStem => init a ;
Sup => sup ;
Sub => sub ;
Del => del ;

View File

@@ -15,7 +15,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in {
UttNP = \np -> {s = np.s ! Nom} ;
UttVP vp = {s = vp.obj ++ vp.adv ++ vp.s ! VInf} ;
UttAdv adv = adv ;
UttCN cn = {s = cn.s ! Sg ! Nom} ;
UttCN cn = {s = linCN cn} ;
UttCard n = {s = n.s ! Indep} ;
UttAP ap = {s = ap.s ! Sg ++ ap.compar} ;
UttInterj i = i ;

View File

@@ -14,14 +14,28 @@ resource ResHun = NounMorphoHun ** open Prelude, Predef in {
oper
CNoun : Type = Noun ** {
rs : Number => Case => Str ;
compl : Number => Case => Str ;
} ;
mkCaseNoun : Str -> Number => Case => Str = \s ->
\\n,c => caseFromStem False c (mkNoun s) n ;
mkCaseNoun2 : (n,a : Str) -> Number => Case => Str = \no,ac ->
\\n,c => caseFromStem False c (regNounNomAcc no ac) n ;
caseFromStem : Bool -> Case -> Noun -> Number -> Str = \usebind,cas,cn,n ->
case cas of {
Nom => cn.s ! n ! NomFull ;
Acc => cn.s ! n ! AccFull ;
Sup => cn.s ! n ! SupFull ;
Ins => glueIf usebind (cn.s ! n ! InsTraStem) (endCase Ins ! cn.h) ;
Tra => glueIf usebind (cn.s ! n ! InsTraStem) (endCase Tra ! cn.h) ;
_ => applyOblCase usebind (endCase cas) n cn
} ;
BaseNP : Type = {
agr : Person*Number ;
objdef : ObjDef ;
empty : Str ; -- standard trick for pro-drop
h : Harm ;
} ;
NounPhrase : Type = BaseNP ** {
@@ -39,12 +53,12 @@ oper
indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\c => s} ;
defNP : Str -> Number -> NounPhrase = \s,n -> emptyNP ** {
s = (mkNoun s).s ! n ;
s = mkCaseNoun s ! n ;
n = n ;
objdef = Def ;
} ;
linCN : CNoun -> Str = \cn -> cn.s ! Sg ! Nom ++ cn.rs ! Sg ! Nom ;
linCN : CNoun -> Str = \cn -> cn.s ! Sg ! NomFull ++ cn.compl ! Sg ! Nom ;
--------------------------------------------------------------------------------
-- Pronouns
@@ -69,8 +83,8 @@ oper
} ;
mkQuant : (s,sp : Str) -> Quant = \s,sp -> {
s = (mkNoun s).s ;
sp = (mkNoun sp).s ;
s = mkCaseNoun s ;
sp = mkCaseNoun sp ;
isIndefArt = False ;
objdef = Def ;
caseagr = True ;
@@ -87,7 +101,7 @@ oper
mkDet : (s : Str) -> ObjDef -> Number -> Bool -> Determiner = \s,d,n,ca -> {
s,
sp = (mkNoun s).s ! n ;
sp = mkCaseNoun s ! n ;
n = n ;
numtype = NoNum ;
objdef = d ;
@@ -97,7 +111,7 @@ oper
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 ;
s,sp = mkCaseNoun2 no ac ! n ;
} ;
@@ -128,35 +142,29 @@ oper
-- TODO: personal suffixes, e.g. felettem, általam, not *felett/által én
Adposition : Type = {
pr : Str ; -- Preposition
s : HarmForms ; -- Postposition
s : Str ; -- Postposition
c : Case ;
} ;
nomAdp : Str -> Adposition = \s -> postpos Nom (harm1 s) ;
nomAdp : Str -> Adposition = \s -> postpos Nom s ;
caseAdp = overload {
caseAdp : Case -> Adposition = \c -> postpos c (harm1 []) ;
caseAdp : Case -> Str -> Adposition = \c,s -> postpos c (harm1 s) ;
caseAdp : Str -> Adposition = \ért ->
postpos OblStem (harm1 ért) ;
caseAdp : (x,y : Str) -> Adposition = \nál,nél ->
postpos OblStem (harm nál nél) ;
caseAdp : (x,y,z : Str) -> Adposition = \hoz,hez,höz ->
postpos OblStem (harm3 hoz hez höz)
caseAdp : Case -> Adposition = \c -> postpos c [] ;
caseAdp : Case -> Str -> Adposition = \c,s -> postpos c s ;
} ;
postpos : Case -> HarmForms -> Adposition = \c,h-> {s=h ; c=c ; pr=[]} ;
prepos : Case -> Str -> Adposition = \c,s -> {s=harm1 [] ; c=c ; pr=s} ;
postpos : Case -> Str -> Adposition = \c,s-> {s=s ; c=c ; pr=[]} ;
prepos : Case -> Str -> Adposition = \c,s -> {s=[] ; c=c ; pr=s} ;
emptyAdp : Adposition = nomAdp [] ;
applyAdp : Adposition -> NounPhrase -> Str = \adp,np ->
adp.pr ++ glueIf adp.c (np.s ! adp.c) (adp.s ! np.h) ;
adp.pr ++ np.s ! adp.c ++ adp.s ;
glueIf : Case -> (_,_ : Str) -> Str = \cas,a,b ->
case cas of {
OblStem => glue a b ;
_ => a ++ b
} ;
applyOblCase : Bool -> HarmForms -> Number -> Noun -> Str = \usebind,adp,n,np ->
glueIf usebind (np.s ! n ! OblStem) (adp ! np.h) ;
glueIf : Bool -> (_,_ : Str) -> Str = \f,a,b ->
if_then_Str f (glue a b) (a + b) ;
------------------
-- Conj

View File

@@ -106,12 +106,12 @@ lin by8means_Prep = caseAdp Ins ;
lin for_Prep = caseAdp Dat ;
-- lin from_Prep = mkPrep "" ;
-- lin in8front_Prep = mkPrep "" ;
lin in_Prep = caseAdp "ban" "ben" ;
lin in_Prep = caseAdp Ine ;
lin on_Prep = caseAdp Sup ;
-- lin part_Prep = casePrep ;
-- lin possess_Prep = -- Suffix attaches to possessee, not possessor
-- lin through_Prep = mkPrep ;
lin to_Prep = caseAdp "hoz" "hez" "höz" ;
lin to_Prep = caseAdp All ;
lin under_Prep = nomAdp "alatt" ;
-- lin with_Prep = mkPrep "" ;
-- lin without_Prep = mkPrep "" ;

View File

@@ -118,9 +118,14 @@ lin
-- : CN -> Comp ;
CompCN cn = UseCopula ** {
s = \\vf => case vf of {
VPres P3 n => cn.s ! n ! Nom ;
VPres _ n => cn.s ! n ! Nom ++ copula.s ! vf ;
_ => cn.s ! Sg ! Nom ++ copula.s ! vf} ;
VPres P3 n => cn.s ! n ! NomFull
++ cn.compl ! n ! Nom ;
VPres _ n => cn.s ! n ! NomFull
++ cn.compl ! n ! Nom
++ copula.s ! vf ;
_ => cn.s ! Sg ! NomFull
++ cn.compl ! Sg ! Nom
++ copula.s ! vf} ;
} ;
-- : NP -> Comp ;