1
0
forked from GitHub/gf-core

Finnish vowel harmony

Changed the structure of N,CN,Det,Quant, and functions that build and use them.
This commit is contained in:
inari.listenmaa
2013-01-22 18:16:24 +00:00
parent 3c5955685e
commit 64fa0ba3fc
9 changed files with 79 additions and 43 deletions

View File

@@ -47,12 +47,12 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in {
-- The $Bool$ tells if a possessive suffix is attached, which affects the case. -- The $Bool$ tells if a possessive suffix is attached, which affects the case.
CN = {s : NForm => Str} ; CN = {s : NForm => Str ; h : Harmony} ;
Pron = {s : NPForm => Str ; a : Agr} ; Pron = {s : NPForm => Str ; a : Agr} ;
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool ; isNeg : Bool} ; NP = {s : NPForm => Str ; a : Agr ; isPron : Bool ; isNeg : Bool} ;
Det = { Det = {
s1 : Case => Str ; -- minun kolme s1 : Case => Str ; -- minun kolme
s2 : Str ; -- -ni s2 : Harmony => Str ; -- -ni (Front for -nsä, Back for -nsa)
sp : Case => Str ; -- se (substantival form) sp : Case => Str ; -- se (substantival form)
n : Number ; -- Pl (agreement feature for verb) n : Number ; -- Pl (agreement feature for verb)
isNum : Bool ; -- True (a numeral is present) isNum : Bool ; -- True (a numeral is present)
@@ -63,7 +63,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in {
---- QuantSg, QuantPl = {s1 : Case => Str ; s2 : Str ; isPoss, isDef : Bool} ; ---- QuantSg, QuantPl = {s1 : Case => Str ; s2 : Str ; isPoss, isDef : Bool} ;
Ord = {s : NForm => Str} ; Ord = {s : NForm => Str} ;
Predet = {s : Number => NPForm => Str} ; Predet = {s : Number => NPForm => Str} ;
Quant = {s1,sp : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool ; isNeg : Bool} ; Quant = {s1,sp : Number => Case => Str ; s2 : Harmony => Str ; isPoss : Bool ; isDef : Bool ; isNeg : Bool} ;
Card = {s : Number => Case => Str ; n : Number} ; Card = {s : Number => Case => Str ; n : Number} ;
Num = {s : Number => Case => Str ; isNum : Bool ; n : Number} ; Num = {s : Number => Case => Str ; isNum : Bool ; n : Number} ;
@@ -91,9 +91,9 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in {
A = {s : Degree => AForm => Str} ; A = {s : Degree => AForm => Str} ;
A2 = {s : Degree => AForm => Str ; c2 : Compl} ; A2 = {s : Degree => AForm => Str ; c2 : Compl} ;
N = {s : NForm => Str} ; N = {s : NForm => Str ; h : Harmony} ;
N2 = {s : NForm => Str} ** {c2 : Compl ; isPre : Bool} ; N2 = {s : NForm => Str ; h: Harmony} ** {c2 : Compl ; isPre : Bool} ;
N3 = {s : NForm => Str} ** {c2,c3 : Compl ; isPre,isPre2 : Bool} ; N3 = {s : NForm => Str ; h: Harmony} ** {c2,c3 : Compl ; isPre,isPre2 : Bool} ;
PN = {s : Case => Str} ; PN = {s : Case => Str} ;
oper Verb1 = {s : VForm => Str ; sc : NPForm ; qp : Bool} ; oper Verb1 = {s : VForm => Str ; sc : NPForm ; qp : Bool} ;

View File

@@ -20,7 +20,9 @@ concrete ConjunctionFin of Conjunction =
c = ss.c c = ss.c
} ; } ;
ConjCN conj ss = conjunctDistrTable NForm conj ss ; ConjCN conj ss =
let s = (conjunctDistrTable NForm conj ss).s
in {s = s ; h = Back } ; ---- harmony?
-- These fun's are generated from the list cat's. -- These fun's are generated from the list cat's.

View File

@@ -6,7 +6,7 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
lin lin
GenNP np = { GenNP np = {
s1,sp = \\_,_ => np.s ! NPCase Gen ; s1,sp = \\_,_ => np.s ! NPCase Gen ;
s2 = [] ; s2 = \\_ => [] ;
isNum = False ; isNum = False ;
isPoss = False ; isPoss = False ;
isDef = True ; --- "Jussin kolme autoa ovat" ; thus "...on" is missing isDef = True ; --- "Jussin kolme autoa ovat" ; thus "...on" is missing
@@ -15,7 +15,8 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ; GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ;
GenCN n1 n2 = {s = \\nf => n1.s ! NPCase Gen ++ n2.s ! nf} ; GenCN n1 n2 = {s = \\nf => n1.s ! NPCase Gen ++ n2.s ! nf ;
h = n2.h } ;
lincat lincat
VPI = {s : Str} ; VPI = {s : Str} ;
@@ -153,7 +154,8 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
ProDropPoss p = { ProDropPoss p = {
s1 = \\_,_ => [] ; s1 = \\_,_ => [] ;
sp = \\_,_ => p.s ! NPCase Gen ; sp = \\_,_ => p.s ! NPCase Gen ;
s2 = BIND ++ possSuffix p.a ; s2 = table {Front => BIND ++ possSuffixFront p.a ;
Back => BIND ++ possSuffix p.a } ;
isNum = False ; isNum = False ;
isPoss = True ; isPoss = True ;
isDef = True ; --- "minun kolme autoani ovat" ; thus "...on" is missing isDef = True ; --- "minun kolme autoani ovat" ; thus "...on" is missing

View File

@@ -365,7 +365,7 @@ resource MorphoFin = ResFin ** open Prelude in {
9 => ukkoihin 9 => ukkoihin
} ; } ;
Noun = {s : NForm => Str; lock_N : {}} ; Noun = {s : NForm => Str; h : Harmony; lock_N : {}} ;
nForms2N : NForms -> Noun = \f -> nForms2N : NForms -> Noun = \f ->
let let
@@ -384,6 +384,8 @@ resource MorphoFin = ResFin ** open Prelude in {
ukko = Predef.tk 2 ukkona ; ukko = Predef.tk 2 ukkona ;
ukkoi = Predef.tk 2 ukkoina ; ukkoi = Predef.tk 2 ukkoina ;
ukoi = Predef.tk 3 ukoissa ; ukoi = Predef.tk 3 ukoissa ;
harmony : Harmony = case a of
{"a" => Back ; _ => Front } ;
in in
{s = table { {s = table {
NCase Sg Nom => Ukko ; NCase Sg Nom => Ukko ;
@@ -423,6 +425,7 @@ resource MorphoFin = ResFin ** open Prelude in {
NPossIllat Sg => init ukkoon ; NPossIllat Sg => init ukkoon ;
NPossIllat Pl => init ukkoihin NPossIllat Pl => init ukkoihin
} ; } ;
h = harmony ;
lock_N = <> lock_N = <>
} ; } ;
@@ -839,7 +842,7 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
mkDet : Number -> CommonNoun -> { mkDet : Number -> CommonNoun -> {
s1,sp : Case => Str ; -- minun kolme s1,sp : Case => Str ; -- minun kolme
s2 : Str ; -- -ni s2 : Harmony => Str ; -- -ni ; nsa/nsä
n : Number ; -- Pl (agreement feature for verb) n : Number ; -- Pl (agreement feature for verb)
isNum : Bool ; -- True (a numeral is present) isNum : Bool ; -- True (a numeral is present)
isPoss : Bool ; -- True (a possessive suffix is present) isPoss : Bool ; -- True (a possessive suffix is present)
@@ -847,7 +850,7 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
isNeg : Bool isNeg : Bool
} = \n, noun -> heavyDet { } = \n, noun -> heavyDet {
s1 = \\c => noun.s ! NCase n c ; s1 = \\c => noun.s ! NCase n c ;
s2 = [] ; s2 = \\_ => [] ;
n = n ; n = n ;
isNum, isPoss = False ; isNum, isPoss = False ;
isDef = True ; --- does this hold for all new dets? isDef = True ; --- does this hold for all new dets?

View File

@@ -33,7 +33,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
s = \\c => let s = \\c => let
k = ncase c ; k = ncase c ;
in in
det.s1 ! k.p1 ++ cn.s ! k.p2 ++ det.s2 ; det.s1 ! k.p1 ++ cn.s ! k.p2 ++ det.s2 ! cn.h ;
a = agrP3 (case <det.isDef, det.isNum> of { a = agrP3 (case <det.isDef, det.isNum> of {
<False,True> => Sg ; -- kolme kytkintä on <False,True> => Sg ; -- kolme kytkintä on
_ => det.n _ => det.n
@@ -108,7 +108,8 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
PossPron p = { PossPron p = {
s1,sp = \\_,_ => p.s ! NPCase Gen ; s1,sp = \\_,_ => p.s ! NPCase Gen ;
s2 = BIND ++ possSuffix p.a ; s2 = table {Front => BIND ++ possSuffixFront p.a ;
Back => BIND ++ possSuffix p.a } ;
isNum = False ; isNum = False ;
isPoss = True ; isPoss = True ;
isDef = True ; --- "minun kolme autoani ovat" ; thus "...on" is missing isDef = True ; --- "minun kolme autoani ovat" ; thus "...on" is missing
@@ -142,7 +143,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
DefArt = { DefArt = {
s1 = \\_,_ => [] ; s1 = \\_,_ => [] ;
sp = table {Sg => pronSe.s ; Pl => pronNe.s} ; sp = table {Sg => pronSe.s ; Pl => pronNe.s} ;
s2 = [] ; s2 = \\_ => [] ;
isNum,isPoss,isNeg = False ; isNum,isPoss,isNeg = False ;
isDef = True -- autot ovat isDef = True -- autot ovat
} ; } ;
@@ -152,7 +153,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
sp = \\n,c => sp = \\n,c =>
(nhn (mkSubst "ä" "yksi" "yhde" "yhte" "yhtä" "yhteen" "yksi" "yksi" (nhn (mkSubst "ä" "yksi" "yhde" "yhte" "yhtä" "yhteen" "yksi" "yksi"
"yksien" "yksiä" "yksiin")).s ! NCase n c ; "yksien" "yksiä" "yksiin")).s ! NCase n c ;
s2 = [] ; s2 = \\_ => [] ;
isNum,isPoss,isDef,isNeg = False -- autoja on isNum,isPoss,isDef,isNeg = False -- autoja on
} ; } ;
@@ -174,11 +175,13 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
Use2N3 f = { Use2N3 f = {
s = f.s ; s = f.s ;
c2 = f.c2 ; c2 = f.c2 ;
h = f.h ;
isPre = f.isPre isPre = f.isPre
} ; } ;
Use3N3 f = { Use3N3 f = {
s = f.s ; s = f.s ;
c2 = f.c3 ; c2 = f.c3 ;
h = f.h ;
isPre = f.isPre2 isPre = f.isPre2
} ; } ;
@@ -186,19 +189,21 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
--- If a possessive suffix is added here it goes after the complements... --- If a possessive suffix is added here it goes after the complements...
ComplN2 f x = { ComplN2 f x = {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ;
} ; h = f.h } ;
ComplN3 f x = { ComplN3 f x = {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ; s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ;
c2 = f.c3 ; c2 = f.c3 ;
h = f.h ;
isPre = f.isPre2 isPre = f.isPre2
} ; } ;
AdjCN ap cn = { AdjCN ap cn = {
s = \\nf => ap.s ! True ! (n2nform nf) ++ cn.s ! nf s = \\nf => ap.s ! True ! (n2nform nf) ++ cn.s ! nf ;
} ; h = cn.h } ;
RelCN cn rs = {s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)} ; RelCN cn rs = {s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf) ;
h = cn.h } ;
RelNP np rs = { RelNP np rs = {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
@@ -207,11 +212,14 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
isNeg = np.isNeg isNeg = np.isNeg
} ; } ;
AdvCN cn ad = {s = \\nf => cn.s ! nf ++ ad.s} ; AdvCN cn ad = {s = \\nf => cn.s ! nf ++ ad.s ;
h = cn.h} ;
SentCN cn sc = {s = \\nf=> cn.s ! nf ++ sc.s} ; SentCN cn sc = {s = \\nf=> cn.s ! nf ++ sc.s;
h = cn.h } ;
ApposCN cn np = {s = \\nf=> cn.s ! nf ++ np.s ! NPCase Nom} ; --- luvun x ApposCN cn np = {s = \\nf=> cn.s ! nf ++ np.s ! NPCase Nom ;
h = cn.h } ; --- luvun x
oper oper
numN : NForm -> Number = \nf -> case nf of { numN : NForm -> Number = \nf -> case nf of {

View File

@@ -75,7 +75,8 @@ lin
} ; } ;
oper oper
co : (c,o : {s : NForm => Str}) -> {s : CardOrd => Str} = \c,o -> { -- co : (c,o : {s : NForm => Str}) -> {s : CardOrd => Str} = \c,o -> {
co : (c,o : CommonNoun) -> {s : CardOrd => Str} = \c,o -> {
s = table { s = table {
NCard nf => c.s ! nf ; NCard nf => c.s ! nf ;
NOrd nf => o.s ! nf NOrd nf => o.s ! nf
@@ -86,7 +87,8 @@ oper
-- Too much trouble to infer vowel, cf. "kuudes" vs. "viides". -- Too much trouble to infer vowel, cf. "kuudes" vs. "viides".
ordN : Str -> Str -> {s : NForm => Str} = \a,sadas -> -- ordN : Str -> Str -> {s : NForm => Str} = \a,sadas ->
ordN : Str -> Str -> CommonNoun = \a,sadas ->
let let
sada = init sadas sada = init sadas
in in

View File

@@ -293,7 +293,8 @@ oper
s = table { s = table {
NCase Sg Nom => nom ; NCase Sg Nom => nom ;
f => noun.s ! f f => noun.s ! f
} } ;
h = noun.h
} ; } ;
@@ -311,10 +312,14 @@ oper
nForms2N (nForms10 a b c d e f g h i j) ; nForms2N (nForms10 a b c d e f g h i j) ;
mkStrN : Str -> N -> N = \sora,tie -> { mkStrN : Str -> N -> N = \sora,tie -> {
s = \\c => sora + tie.s ! c ; lock_N = <> s = \\c => sora + tie.s ! c ;
h = tie.h ;
lock_N = <>
} ; } ;
mkNN : N -> N -> N = \oma,tunto -> { mkNN : N -> N -> N = \oma,tunto -> {
s = \\c => oma.s ! c + tunto.s ! c ; lock_N = <> s = \\c => oma.s ! c + tunto.s ! c ;
h = tunto.h ;
lock_N = <>
} ; ---- TODO: oma in possessive suffix forms } ; ---- TODO: oma in possessive suffix forms
nForms1 : Str -> NForms = \ukko -> nForms1 : Str -> NForms = \ukko ->

View File

@@ -30,7 +30,13 @@ resource ResFin = ParamX ** open Prelude in {
Agr = Ag Number Person | AgPol ; Agr = Ag Number Person | AgPol ;
-- Vowel harmony, used for CNs in determining the correct possessive suffix.
Harmony = Back | Front ;
oper oper
complNumAgr : Agr -> Number = \a -> case a of { complNumAgr : Agr -> Number = \a -> case a of {
Ag n _ => n ; Ag n _ => n ;
@@ -546,7 +552,7 @@ oper
} }
} ; } ;
CommonNoun = {s : NForm => Str} ; CommonNoun = {s : NForm => Str ; h : Harmony } ; --IL 11/2012, vowharmony
-- To form an adjective, it is usually enough to give a noun declension: the -- To form an adjective, it is usually enough to give a noun declension: the
-- adverbial form is regular. -- adverbial form is regular.
@@ -586,7 +592,9 @@ oper
vesii = nh.vesii ; vesii = nh.vesii ;
vesien = nh.vesien ; vesien = nh.vesien ;
vesia = nh.vesia ; vesia = nh.vesia ;
vesiin = nh.vesiin vesiin = nh.vesiin ;
harmony : Harmony = case a of
{"a" => Back ; _ => Front }
in in
{s = table { {s = table {
NCase Sg Nom => vesi ; NCase Sg Nom => vesi ;
@@ -625,9 +633,10 @@ oper
NPossTransl Pl => vesii + "kse" ; NPossTransl Pl => vesii + "kse" ;
NPossIllat Sg => Predef.tk 1 veteen ; NPossIllat Sg => Predef.tk 1 veteen ;
NPossIllat Pl => Predef.tk 1 vesiin NPossIllat Pl => Predef.tk 1 vesiin
} } ;
h = harmony
} ; } ;
-- Surpraisingly, making the test for the partitive, this not only covers -- Surprisingly, making the test for the partitive, this not only covers
-- "rae", "perhe", "savuke", but also "rengas", "lyhyt" (except $Sg Illat$), etc. -- "rae", "perhe", "savuke", but also "rengas", "lyhyt" (except $Sg Illat$), etc.
sRae : (_,_ : Str) -> NounH = \rae,rakeena -> sRae : (_,_ : Str) -> NounH = \rae,rakeena ->
@@ -713,7 +722,7 @@ oper
heavyDet : PDet -> PDet ** {sp : Case => Str} = \d -> d ** {sp = d.s1} ; heavyDet : PDet -> PDet ** {sp : Case => Str} = \d -> d ** {sp = d.s1} ;
PDet : Type = { PDet : Type = {
s1 : Case => Str ; s1 : Case => Str ;
s2 : Str ; s2 : Harmony => Str ;
n : Number ; n : Number ;
isNum : Bool ; isNum : Bool ;
isPoss : Bool ; isPoss : Bool ;
@@ -723,7 +732,12 @@ oper
heavyQuant : PQuant -> PQuant ** {sp : Number => Case => Str} = \d -> heavyQuant : PQuant -> PQuant ** {sp : Number => Case => Str} = \d ->
d ** {sp = d.s1} ; d ** {sp = d.s1} ;
PQuant : Type = PQuant : Type = {
{s1 : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool ; isNeg : Bool} ; s1 : Number => Case => Str ;
s2 : Harmony => Str ;
isPoss : Bool ;
isDef : Bool ;
isNeg : Bool
} ;
} }

View File

@@ -62,7 +62,7 @@ concrete StructuralFin of Structural = CatFin **
many_Det = mkDet Sg (mkN "moni" "monia") ; many_Det = mkDet Sg (mkN "moni" "monia") ;
more_CAdv = X.mkCAdv "enemmän" "kuin" ; more_CAdv = X.mkCAdv "enemmän" "kuin" ;
most_Predet = {s = \\n,c => (nForms2N (dSuurin "useinta")).s ! NCase n (npform2case n c)} ; most_Predet = {s = \\n,c => (nForms2N (dSuurin "useinta")).s ! NCase n (npform2case n c)} ;
much_Det = mkDet Sg {s = \\_ => "paljon"} ; much_Det = mkDet Sg {s = \\_ => "paljon" ; h = Back} ; --Harmony not relevant, it's just a CommonNoun
must_VV = mkVV (caseV genitive (mkV "täytyä")) ; must_VV = mkVV (caseV genitive (mkV "täytyä")) ;
no_Utt = ss "ei" ; no_Utt = ss "ei" ;
on_Prep = casePrep adessive ; on_Prep = casePrep adessive ;
@@ -83,12 +83,12 @@ concrete StructuralFin of Structural = CatFin **
} ; } ;
someSg_Det = heavyDet { someSg_Det = heavyDet {
s1 = jokuPron ! Sg ; s1 = jokuPron ! Sg ;
s2 = [] ; s2 = \\_ => [] ;
isNum,isPoss = False ; isDef = True ; isNeg = False ; n = Sg isNum,isPoss = False ; isDef = True ; isNeg = False ; n = Sg
} ; } ;
somePl_Det = heavyDet { somePl_Det = heavyDet {
s1 = jokuPron ! Pl ; s1 = jokuPron ! Pl ;
s2 = [] ; isNum,isPoss = False ; isNeg = False ; isDef = True ; s2 = \\_ => [] ; isNum,isPoss = False ; isNeg = False ; isDef = True ;
n = Pl ; isNeg = False n = Pl ; isNeg = False
} ; } ;
something_NP = { something_NP = {
@@ -106,7 +106,7 @@ concrete StructuralFin of Structural = CatFin **
c => (mkPronoun "nuo" "noiden" "noita" "noina" "noihin" Sg P3).s ! NPCase c c => (mkPronoun "nuo" "noiden" "noita" "noina" "noihin" Sg P3).s ! NPCase c
} }
} ; } ;
s2 = [] ; isNum,isPoss = False ; isDef = True ; isNeg = False s2 = \\_ => [] ; isNum,isPoss = False ; isDef = True ; isNeg = False
} ; } ;
that_Subj = ss "että" ; that_Subj = ss "että" ;
there_Adv = ss "siellä" ; --- tuolla there_Adv = ss "siellä" ; --- tuolla
@@ -123,7 +123,7 @@ concrete StructuralFin of Structural = CatFin **
c => (mkPronoun "nämä" "näiden" "näitä" "näinä" "näihin" Sg P3).s ! NPCase c c => (mkPronoun "nämä" "näiden" "näitä" "näinä" "näihin" Sg P3).s ! NPCase c
} }
} ; } ;
s2 = [] ; isNum,isPoss = False ; isDef = True ; isNeg = False s2 = \\_ => [] ; isNum,isPoss = False ; isDef = True ; isNeg = False
} ; } ;
through_Prep = postGenPrep "kautta" ; through_Prep = postGenPrep "kautta" ;
too_AdA = ss "liian" ; too_AdA = ss "liian" ;
@@ -284,7 +284,7 @@ lin
no_Quant = heavyQuant { no_Quant = heavyQuant {
s1 = \\n,c => mikaanPron ! n ! c ; -- requires negative or question polarity s1 = \\n,c => mikaanPron ! n ! c ; -- requires negative or question polarity
s2 = [] ; isNum,isPoss = False ; isDef = True ; isNeg = True s2 = \\_ => [] ; isNum,isPoss = False ; isDef = True ; isNeg = True
} ; } ;
if_then_Conj = {s1 = "jos" ; s2 = "niin" ; n = Sg} ; if_then_Conj = {s1 = "jos" ; s2 = "niin" ; n = Sg} ;