forked from GitHub/gf-core
saved old Finnish paradigms for back up
This commit is contained in:
899
lib/resource/finnish/Morpho1Fin.gf
Normal file
899
lib/resource/finnish/Morpho1Fin.gf
Normal file
@@ -0,0 +1,899 @@
|
||||
--# -path=.:../../prelude
|
||||
|
||||
--1 A Simple Finnish Resource Morphology
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2005
|
||||
--
|
||||
-- This resource morphology contains definitions needed in the resource
|
||||
-- syntax. To build a lexicon, it is better to use $ParadigmsFin$, which
|
||||
-- gives a higher-level access to this module.
|
||||
|
||||
resource Morpho1Fin = ResFin ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
--- flags optimize=noexpand ;
|
||||
|
||||
--2 Nouns
|
||||
--
|
||||
|
||||
oper
|
||||
|
||||
|
||||
-- A user-friendly variant takes existing forms and infers the vowel harmony.
|
||||
|
||||
mkNoun : (_,_,_,_,_,_,_,_,_,_ : Str) -> CommonNoun =
|
||||
\talo,talon,talona,taloa,taloon,taloina,taloissa,talojen,taloja,taloihin ->
|
||||
nhn (mkSubst (ifTok Str (Predef.dp 1 talona) "a" "a" "ä")
|
||||
talo (Predef.tk 1 talon) (Predef.tk 2 talona) taloa taloon
|
||||
(Predef.tk 2 taloina) (Predef.tk 3 taloissa) talojen taloja taloihin) ;
|
||||
|
||||
|
||||
-- Here some useful special cases; more are given in $ParadigmsFin.gf$.
|
||||
--
|
||||
|
||||
sLukko : Str -> NounH = \lukko ->
|
||||
let
|
||||
o = last lukko ;
|
||||
lukk = init lukko ;
|
||||
a = getHarmony o ;
|
||||
lukkoja = case o of {
|
||||
"a" => lukk + if_then_Str (pbool2bool (Predef.occurs "ou" lukk)) "ia" "oja" ;
|
||||
"ä" => lukk + "iä" ;
|
||||
_ => lukko + "j" + a
|
||||
}
|
||||
in
|
||||
sKukko lukko (weakGrade lukko + "n") lukkoja ;
|
||||
|
||||
-- The special case with no alternations.
|
||||
|
||||
sTalo : Str -> NounH = sLukko ;
|
||||
|
||||
sBaari : Str -> NounH = \baaria ->
|
||||
let
|
||||
baari = Predef.tk 1 baaria ;
|
||||
baar = Predef.tk 1 baari ;
|
||||
a = getHarmony (Predef.dp 1 baaria)
|
||||
in
|
||||
sKukko baari (weakGrade baari + "n") (baar + ("ej" + a)) ;
|
||||
|
||||
sKorpi : (_,_,_ : Str) -> NounH = \korpi,korven,korpena ->
|
||||
let
|
||||
a = Predef.dp 1 korpena ;
|
||||
korpe = Predef.tk 2 korpena ;
|
||||
korp = init korpi ;
|
||||
korpea = case last korp of {
|
||||
"r" | "l" | "n" => korp + "t" + a ;
|
||||
_ => korpe + a
|
||||
} ;
|
||||
korve = Predef.tk 1 korven ;
|
||||
korvi = Predef.tk 1 korve + "i" ;
|
||||
korpien = case last korp of {
|
||||
"r" | "l" | "n" => korp + "ten" ;
|
||||
_ => korpi + "en"
|
||||
} ;
|
||||
in
|
||||
mkSubst a
|
||||
korpi
|
||||
korve
|
||||
korpe
|
||||
korpea
|
||||
(korpe + "en")
|
||||
korpi
|
||||
korvi
|
||||
korpien
|
||||
(korpi + a)
|
||||
(korpi + "in") ;
|
||||
|
||||
sArpi : Str -> NounH = \arpi ->
|
||||
sKorpi arpi (init (weakGrade arpi) + "en") (init arpi + "ena") ;
|
||||
sSylki : Str -> NounH = \sylki ->
|
||||
sKorpi sylki (init (weakGrade sylki) + "en") (init sylki + "enä") ;
|
||||
|
||||
sKoira : Str -> NounH = \koira ->
|
||||
let a = getHarmony (last koira) in
|
||||
sKukko koira (koira + "n") (init koira + "i" + a) ;
|
||||
|
||||
-- Loan words ending in consonants are actually similar to words like
|
||||
-- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached
|
||||
-- to the singular nominative.
|
||||
|
||||
sLinux : Str -> NounH = \linuxia ->
|
||||
let {
|
||||
linux = Predef.tk 2 linuxia ;
|
||||
a = getHarmony (Predef.dp 1 linuxia) ;
|
||||
linuxi = linux + "i"
|
||||
} in
|
||||
mkSubst a
|
||||
linux
|
||||
linuxi
|
||||
linuxi
|
||||
(linuxi + a)
|
||||
(linuxi + "in")
|
||||
(linux + "ei")
|
||||
(linux + "ei")
|
||||
(linux + "ien")
|
||||
(linux + "ej" + a)
|
||||
(linux + "eihin") ;
|
||||
|
||||
-- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "rytinä".
|
||||
|
||||
sPeruna : Str -> NounH = \peruna ->
|
||||
let {
|
||||
a = Predef.dp 1 peruna ;
|
||||
perun = Predef.tk 1 peruna ;
|
||||
perunoi = perun + (ifTok Str a "a" "o" "ö" + "i")
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
peruna
|
||||
peruna
|
||||
peruna
|
||||
(peruna + a)
|
||||
(peruna + a + "n")
|
||||
perunoi
|
||||
perunoi
|
||||
(perunoi + "den")
|
||||
(perunoi + ("t" + a))
|
||||
(perunoi + "hin") ;
|
||||
|
||||
sTohtori : Str -> NounH = \tohtoria ->
|
||||
let
|
||||
a = last tohtoria ;
|
||||
tohtori = init tohtoria ;
|
||||
tohtorei = init tohtori + "ei" ;
|
||||
in
|
||||
mkSubst a
|
||||
tohtori
|
||||
tohtori
|
||||
tohtori
|
||||
tohtoria
|
||||
(tohtori + "in")
|
||||
tohtorei
|
||||
tohtorei
|
||||
(tohtorei + "den")
|
||||
(tohtorei + "t" + a)
|
||||
(tohtorei + "hin") ;
|
||||
|
||||
sRadio : Str -> NounH = \radio ->
|
||||
let
|
||||
o = last radio ;
|
||||
a = getHarmony o ;
|
||||
radioi = radio + "i" ;
|
||||
in
|
||||
mkSubst a
|
||||
radio
|
||||
radio
|
||||
radio
|
||||
(radio + "t" + a)
|
||||
(radio + o + "n")
|
||||
radioi
|
||||
radioi
|
||||
(radioi + "den")
|
||||
(radioi + "t" + a)
|
||||
(radioi + "hin") ;
|
||||
|
||||
|
||||
sSusi : (_,_,_ : Str) -> NounH = \susi,suden,sutena ->
|
||||
let
|
||||
a = Predef.dp 1 sutena ;
|
||||
sude = Predef.tk 1 suden ;
|
||||
sute = Predef.tk 2 sutena ;
|
||||
sutt = Predef.tk 1 sute + "t"
|
||||
in
|
||||
mkSubst a
|
||||
susi
|
||||
sude
|
||||
sute
|
||||
(sutt + a)
|
||||
(sute + "en")
|
||||
susi
|
||||
susi
|
||||
(sutt + "en") --- var susi + "en" bad with suuri
|
||||
(susi + a)
|
||||
(susi + "in") ;
|
||||
|
||||
sPuu : Str -> NounH = \puu ->
|
||||
let {
|
||||
u = Predef.dp 1 puu ;
|
||||
a = getHarmony u ;
|
||||
pu = Predef.tk 1 puu ;
|
||||
pui = pu + "i"
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
puu
|
||||
puu
|
||||
puu
|
||||
(puu + ("t" + a))
|
||||
(puu + ("h" + u + "n"))
|
||||
pui
|
||||
pui
|
||||
(pui + "den")
|
||||
(pui + ("t" + a))
|
||||
(pui + "hin") ;
|
||||
|
||||
sSuo : Str -> NounH = \suo ->
|
||||
let {
|
||||
o = Predef.dp 1 suo ;
|
||||
a = getHarmony o ;
|
||||
soi = Predef.tk 2 suo + (o + "i")
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
suo
|
||||
suo
|
||||
suo
|
||||
(suo + ("t" + a))
|
||||
(suo + ("h" + o + "n"))
|
||||
soi
|
||||
soi
|
||||
(soi + "den")
|
||||
(soi + ("t" + a))
|
||||
(soi + "hin") ;
|
||||
|
||||
-- Here in fact it is handy to use the partitive form as the only stem.
|
||||
|
||||
sNainen : Str -> NounH = \naista ->
|
||||
let {
|
||||
nainen = Predef.tk 3 naista + "nen" ;
|
||||
nais = Predef.tk 2 naista ;
|
||||
naise = nais + "e" ;
|
||||
naisi = nais + "i" ;
|
||||
a = Predef.dp 1 naista
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
nainen
|
||||
naise
|
||||
naise
|
||||
(nais + ("t" + a))
|
||||
(nais + "een")
|
||||
naisi
|
||||
naisi
|
||||
(nais + "ten")
|
||||
(nais + ("i" + a))
|
||||
(nais + "iin") ;
|
||||
|
||||
-- The following covers: "tilaus", "kaulin", "paimen", "laidun", "sammal",
|
||||
-- "kyynel" (excep $Sg Iness$ for the last two?).
|
||||
|
||||
sTilaus : (_,_ : Str) -> NounH = \tilaus, tilauksena ->
|
||||
let {
|
||||
tilauks = Predef.tk 3 tilauksena ;
|
||||
tilaukse = tilauks + "e" ;
|
||||
tilauksi = tilauks + "i" ;
|
||||
a = Predef.dp 1 tilauksena
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
tilaus
|
||||
tilaukse
|
||||
tilaukse
|
||||
(tilaus + ("t" + a))
|
||||
(tilauks + "een")
|
||||
tilauksi
|
||||
tilauksi
|
||||
(tilaus + "ten")
|
||||
(tilauks + ("i" + a))
|
||||
(tilauks + "iin") ;
|
||||
|
||||
-- Some words have the three grades ("rakkaus","rakkauden","rakkautena"), which
|
||||
-- are however derivable from the stem.
|
||||
|
||||
sRakkaus : Str -> NounH = \rakkaus ->
|
||||
let {
|
||||
rakkau = Predef.tk 1 rakkaus ;
|
||||
rakkaut = rakkau + "t" ;
|
||||
rakkaute = rakkau + "te" ;
|
||||
rakkaude = rakkau + "de" ;
|
||||
rakkauksi = rakkau + "ksi" ;
|
||||
u = Predef.dp 1 rakkau ;
|
||||
a = ifTok Str u "u" "a" "ä"
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
rakkaus
|
||||
rakkaude
|
||||
rakkaute
|
||||
(rakkaut + ("t" + a))
|
||||
(rakkaut + "een")
|
||||
rakkauksi
|
||||
rakkauksi
|
||||
(rakkauksi + "en")
|
||||
(rakkauksi + a)
|
||||
(rakkauksi + "in") ;
|
||||
|
||||
-- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris".
|
||||
|
||||
sNauris : (_ : Str) -> NounH = \naurista ->
|
||||
let {
|
||||
a = Predef.dp 1 naurista ;
|
||||
nauris = Predef.tk 2 naurista ;
|
||||
nauri = Predef.tk 3 naurista ;
|
||||
i = Predef.dp 1 nauri ;
|
||||
naurii = nauri + i ;
|
||||
naurei = nauri + "i"
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
nauris
|
||||
naurii
|
||||
naurii
|
||||
(nauris + ("t" + a))
|
||||
(naurii + "seen")
|
||||
naurei
|
||||
naurei
|
||||
(naurei + "den")
|
||||
(naurei + ("t" + a))
|
||||
(naurei + "siin") ;
|
||||
|
||||
-- Words of the form "siitin", "avain", "höyhen" (w or wo grade alternation).
|
||||
|
||||
sLiitin : Str -> Str -> NounH = \liitin,liittimen ->
|
||||
let
|
||||
liittime = init liittimen ;
|
||||
liitti = Predef.tk 2 liittime ;
|
||||
m = last (init liittime) ;
|
||||
liittimi = liitti + m + "i" ;
|
||||
a = vowelHarmony liitin ;
|
||||
in
|
||||
mkSubst a
|
||||
liitin
|
||||
liittime
|
||||
liittime
|
||||
(liitin + "t" + a)
|
||||
(liittime + "en")
|
||||
(liittimi)
|
||||
(liittimi)
|
||||
(liittimi + "en")
|
||||
(liittimi + a)
|
||||
(liittimi + "in") ;
|
||||
|
||||
-- The following covers adjectives like "kapea", "leveä".
|
||||
|
||||
sKapea : (_ : Str) -> NounH = \kapea ->
|
||||
let
|
||||
a = last kapea ;
|
||||
kape = init kapea ;
|
||||
kapei = kape + "i"
|
||||
in
|
||||
mkSubst a
|
||||
kapea
|
||||
kapea
|
||||
kapea
|
||||
(kapea + a)
|
||||
(kapea + a+"n")
|
||||
kapei
|
||||
kapei
|
||||
(kapei + "den")
|
||||
(kapei + ("t" + a))
|
||||
(kapei + "siin") ;
|
||||
|
||||
-- The following two are used for adjective comparison.
|
||||
|
||||
sSuurempi : Str -> NounH = \suurempaa ->
|
||||
let {
|
||||
a = Predef.dp 1 suurempaa ;
|
||||
suure = Predef.tk 4 suurempaa ;
|
||||
suurempi = suure + "mpi" ;
|
||||
suurempa = suure + ("mp" + a) ;
|
||||
suuremm = suure + "mm"
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
suurempi
|
||||
(suuremm + a)
|
||||
suurempa
|
||||
(suurempa + a)
|
||||
(suurempa + (a + "n"))
|
||||
suurempi
|
||||
(suuremm + "i")
|
||||
(suurempi + "en")
|
||||
(suurempi + a)
|
||||
(suurempi + "in") ;
|
||||
|
||||
sSuurin : Str -> NounH = \suurinta ->
|
||||
let {
|
||||
a = Predef.dp 1 suurinta ;
|
||||
suuri = Predef.tk 3 suurinta ;
|
||||
suurin = suuri + "n" ;
|
||||
suurimma = suuri + ("mm" + a) ;
|
||||
suurimpa = suuri + ("mp" + a) ;
|
||||
suurimpi = suuri + "mpi" ;
|
||||
suurimmi = suuri + "mmi"
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
suurin
|
||||
suurimma
|
||||
suurimpa
|
||||
(suurin + ("t" + a))
|
||||
(suurimpa + (a + "n"))
|
||||
suurimpi
|
||||
suurimmi
|
||||
(suurimpi + "en")
|
||||
(suurimpi + a)
|
||||
(suurimpi + "in") ;
|
||||
|
||||
-- This auxiliary resolves vowel harmony from a given letter.
|
||||
|
||||
getHarmony : Str -> Str = \u -> case u of {
|
||||
"a"|"o"|"u" => "a" ;
|
||||
_ => "ä"
|
||||
} ;
|
||||
|
||||
-- This function inspects the whole word.
|
||||
|
||||
vowelHarmony : Str -> Str = \liitin ->
|
||||
if_then_Str (pbool2bool (Predef.occurs "aou" liitin)) "a" "ä" ;
|
||||
|
||||
-- The following function defines how grade alternation works if it is active.
|
||||
-- In general, *whether there is* grade alternation must be given in the lexicon
|
||||
-- (cf. "auto - auton" not "audon"; "vihje - vihjeen" not "vihkeen").
|
||||
|
||||
weakGrade : Str -> Str = \kukko ->
|
||||
let
|
||||
ku = Predef.tk 3 kukko ;
|
||||
kko = Predef.dp 3 kukko ;
|
||||
o = last kukko
|
||||
in
|
||||
case kko of {
|
||||
"kk" + _ => ku + "k" + o ;
|
||||
"pp" + _ => ku + "p" + o ;
|
||||
"tt" + _ => ku + "t" + o ;
|
||||
"nk" + _ => ku + "ng" + o ;
|
||||
"nt" + _ => ku + "nn" + o ;
|
||||
"mp" + _ => ku + "mm" + o ;
|
||||
"rt" + _ => ku + "rr" + o ;
|
||||
"lt" + _ => ku + "ll" + o ;
|
||||
"lk" + ("i" | "e") => ku + "lj" + o ;
|
||||
"rk" + ("i" | "e") => ku + "rj" + o ;
|
||||
"lk" + _ => ku + "l" + o ;
|
||||
"rk" + _ => ku + "r" + o ;
|
||||
("hk" | "tk") + _ => kukko ; -- *tahko-tahon, *pitkä-pitkän
|
||||
"s" + ("k" | "p" | "t") + _ => kukko ; -- *lasku-lasvun, *raspi-rasvin, *lastu-lasdun
|
||||
x + "ku" => ku + x + "vu" ;
|
||||
x + "k" + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") => ku + x + o ;
|
||||
x + "p" + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") => ku + x + "v" + o ;
|
||||
x + "t" + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") => ku + x + "d" + o ;
|
||||
_ => kukko
|
||||
} ;
|
||||
|
||||
--- This is only used to analyse nouns "rae", "hake", etc.
|
||||
|
||||
strongGrade : Str -> Str = \hake ->
|
||||
let
|
||||
ha = Predef.tk 2 hake ;
|
||||
e = last hake ;
|
||||
hak = init hake ;
|
||||
hd = Predef.dp 2 hak
|
||||
in
|
||||
case hd of {
|
||||
"ng" => ha + "k" ;
|
||||
"nn" => ha + "t" ;
|
||||
"mm" => ha + "p" ;
|
||||
"rr" | "ll" => ha + "t" ;
|
||||
"hj" | "lj" => ha + "k" ; -- pohje/lahje impossible
|
||||
"hk" | "sk" | "sp" | "st" => hak ;
|
||||
_ + "k" => ha + "kk" ;
|
||||
_ + "p" => ha + "pp" ;
|
||||
_ + "t" => ha + "tt" ;
|
||||
_ + "d" => ha + "t" ;
|
||||
_ + ("a" | "ä") => hak + "k" ; -- säe, tae
|
||||
_ + "v" => ha + "p" ; -- rove/hyve impossible
|
||||
_ => hak
|
||||
} + e ;
|
||||
|
||||
--3 Proper names
|
||||
--
|
||||
-- Proper names are similar to common nouns in the singular.
|
||||
|
||||
ProperName = {s : Case => Str} ;
|
||||
|
||||
mkProperName : CommonNoun -> ProperName = \jussi ->
|
||||
{s = \\c => jussi.s ! NCase Sg c} ;
|
||||
|
||||
-- An ending given to a symbol cannot really be decided
|
||||
-- independently. The string $a$ gives the vowel harmony.
|
||||
-- Only some South-West dialects have the generally valid
|
||||
-- Illative form.
|
||||
|
||||
caseEnding : Str -> Case -> Str = \a,c -> case c of {
|
||||
Nom => [] ;
|
||||
Gen => "n" ;
|
||||
Part => a ; ---
|
||||
Transl => "ksi" ;
|
||||
Ess => "n" + a ;
|
||||
Iness => "ss" + a ;
|
||||
Elat => "st" + a ;
|
||||
Illat => "sse" ; ---
|
||||
Adess => "ll" + a ;
|
||||
Ablat => "lt" + a ;
|
||||
Allat => "lle" ;
|
||||
Abess => "tt" + a
|
||||
} ;
|
||||
|
||||
symbProperName : Str -> ProperName = \x ->
|
||||
{s = table {
|
||||
Nom => x ;
|
||||
c => glue x (":" + caseEnding "a" c)
|
||||
}
|
||||
} ;
|
||||
|
||||
--2 Pronouns
|
||||
--
|
||||
-- Here we define personal and relative pronouns.
|
||||
|
||||
mkPronoun : (_,_,_,_,_ : Str) -> Number -> Person ->
|
||||
{s : NPForm => Str ; a : Agr} =
|
||||
\mina, minun, minua, minuna, minuun, n, p ->
|
||||
let {
|
||||
minu = Predef.tk 2 minuna ;
|
||||
a = Predef.dp 1 minuna
|
||||
} in
|
||||
{s = table {
|
||||
NPCase Nom => mina ;
|
||||
NPCase Gen => minun ;
|
||||
NPCase Part => minua ;
|
||||
NPCase Transl => minu + "ksi" ;
|
||||
NPCase Ess => minuna ;
|
||||
NPCase Iness => minu + ("ss" + a) ;
|
||||
NPCase Elat => minu + ("st" + a) ;
|
||||
NPCase Illat => minuun ;
|
||||
NPCase Adess => minu + ("ll" + a) ;
|
||||
NPCase Ablat => minu + ("lt" + a) ;
|
||||
NPCase Allat => minu + "lle" ;
|
||||
NPCase Abess => minu + ("tt" + a) ;
|
||||
NPAcc => Predef.tk 1 minun + "t"
|
||||
} ;
|
||||
a = {n = n ; p = p}
|
||||
} ;
|
||||
|
||||
mkDemPronoun : (_,_,_,_,_ : Str) -> Number ->
|
||||
{s : NPForm => Str ; a : Agr} =
|
||||
\tuo, tuon, tuota, tuona, tuohon, n ->
|
||||
let pro = mkPronoun tuo tuon tuota tuona tuohon n P3
|
||||
in {
|
||||
s = table {
|
||||
NPAcc => tuo ;
|
||||
c => pro.s ! c
|
||||
} ;
|
||||
a = pro.a
|
||||
} ;
|
||||
|
||||
-- Determiners
|
||||
|
||||
mkDet : Number -> CommonNoun -> {
|
||||
s1 : Case => Str ; -- minun kolme
|
||||
s2 : Str ; -- -ni
|
||||
n : Number ; -- Pl (agreement feature for verb)
|
||||
isNum : Bool ; -- True (a numeral is present)
|
||||
isPoss : Bool ; -- True (a possessive suffix is present)
|
||||
isDef : Bool -- True (verb agrees in Pl, Nom is not Part)
|
||||
} = \n, noun -> {
|
||||
s1 = \\c => noun.s ! NCase n c ;
|
||||
s2 = [] ;
|
||||
n = n ;
|
||||
isNum, isPoss = False ;
|
||||
isDef = True --- does this hold for all new dets?
|
||||
} ;
|
||||
|
||||
mkQuant : CommonNoun -> {
|
||||
s1 : Number => Case => Str ;
|
||||
s2 : Str ;
|
||||
isPoss, isDef : Bool
|
||||
} = \noun -> {
|
||||
s1 = \\n,c => noun.s ! NCase n c ;
|
||||
s2 = [] ;
|
||||
isPoss = False ;
|
||||
isDef = True --- does this hold for all new dets?
|
||||
} ;
|
||||
|
||||
-- The relative pronoun, "joka", is inflected in case and number,
|
||||
-- like common nouns, but it does not take possessive suffixes.
|
||||
-- The inflextion shows a surprising similarity with "suo".
|
||||
|
||||
oper
|
||||
relPron : Number => Case => Str =
|
||||
let {jo = nhn (sSuo "jo")} in
|
||||
table {
|
||||
Sg => table {
|
||||
Nom => "joka" ;
|
||||
Gen => "jonka" ;
|
||||
c => jo.s ! NCase Sg c
|
||||
} ;
|
||||
Pl => table {
|
||||
Nom => "jotka" ;
|
||||
c => "j" + (jo.s ! NCase Pl c)
|
||||
}
|
||||
} ;
|
||||
|
||||
caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
||||
\\c => cn.s ! NCase n c ;
|
||||
|
||||
|
||||
--2 Adjectives
|
||||
--
|
||||
|
||||
-- For the comparison of adjectives, three noun declensions
|
||||
-- are needed in the worst case.
|
||||
|
||||
mkAdjective : (_,_,_ : Adj) -> Adjective = \hyva,parempi,paras ->
|
||||
{s = table {
|
||||
Posit => hyva.s ;
|
||||
Compar => parempi.s ;
|
||||
Superl => paras.s
|
||||
}
|
||||
} ;
|
||||
|
||||
-- However, it is usually enough to give the positive declension and
|
||||
-- the characteristic forms of comparative and superlative.
|
||||
|
||||
regAdjective : CommonNoun -> Str -> Str -> Adjective = \kiva, kivempaa, kivinta ->
|
||||
mkAdjective
|
||||
(noun2adj kiva)
|
||||
(noun2adjComp False (nhn (sSuurempi kivempaa)))
|
||||
(noun2adjComp False (nhn (sSuurin kivinta))) ;
|
||||
|
||||
|
||||
|
||||
regVerbH : Str -> VerbH = \soutaa ->
|
||||
let
|
||||
taa = Predef.dp 3 soutaa ;
|
||||
juo = Predef.tk 2 soutaa ;
|
||||
souda = weakGrade (init soutaa) ;
|
||||
soudan = juo + "en" ;
|
||||
o = Predef.dp 1 juo ;
|
||||
a = last soutaa ;
|
||||
u = ifTok Str a "a" "u" "y" ;
|
||||
joi = Predef.tk 2 juo + (o + "i")
|
||||
in
|
||||
case taa of {
|
||||
"it" + _ => vHarkita soutaa ;
|
||||
("st" | "nn" | "rr" | "ll") + _ =>
|
||||
vJuosta soutaa soudan (juo + o+u+"t") (juo + "t"+u) ;
|
||||
_ + ("aa" | "ää") => vOttaa soutaa (souda + "n") ;
|
||||
("o" | "u" | "y" | "ö") + ("da" | "dä") => vJuoda soutaa joi ;
|
||||
("ata" | "ätä") => vOsata soutaa ;
|
||||
_ => vHukkua soutaa souda
|
||||
} ;
|
||||
|
||||
reg2VerbH : (soutaa,souti : Str) -> VerbH = \soutaa,souti ->
|
||||
let
|
||||
soudan = weakGrade (init soutaa) + "n" ;
|
||||
soudin = weakGrade souti + "n" ;
|
||||
souden = init souti + "en" ;
|
||||
juo = Predef.tk 2 soutaa ;
|
||||
o = Predef.dp 1 juo ;
|
||||
u = ifTok Str (last soutaa) "a" "u" "y" ;
|
||||
taa = Predef.dp 3 soutaa ;
|
||||
in
|
||||
case taa of {
|
||||
"taa" | "tää" => vHuoltaa soutaa soudan souti soudin ;
|
||||
"ata" | "ätä" => vPalkata soutaa souti ;
|
||||
"ota" | "ötä" => vPudota soutaa souti ;
|
||||
"sta" | "stä" => vJuosta soutaa souden (juo + o+u+"t") (juo + "t"+u) ;
|
||||
_ + ("da" | "dä") => vJuoda soutaa souti ;
|
||||
_ => regVerbH soutaa
|
||||
} ;
|
||||
|
||||
reg3VerbH : (_,_,_ : Str) -> VerbH = \soutaa,soudan,souti ->
|
||||
let
|
||||
taa = Predef.dp 3 soutaa ;
|
||||
souda = init soudan ;
|
||||
juo = Predef.tk 2 soutaa ;
|
||||
o = last juo ;
|
||||
a = last taa ;
|
||||
u = ifTok Str a "a" "u" "y" ;
|
||||
soudin = weakGrade (init souti) + "in" ;
|
||||
in case taa of {
|
||||
"lla" | "llä" => vJuosta soutaa soudan (juo + o+u+"t") (juo + "t"+u) ;
|
||||
"taa" | "tää" => vHuoltaa soutaa soudan souti soudin ;
|
||||
_ => reg2VerbH soutaa souti
|
||||
} ;
|
||||
|
||||
-- For "harppoa", "hukkua", "löytyä", with grade alternation.
|
||||
|
||||
vHukkua : (_,_ : Str) -> VerbH = \hukkua,huku ->
|
||||
let {
|
||||
a = Predef.dp 1 hukkua ;
|
||||
hukku = Predef.tk 1 hukkua ;
|
||||
u = Predef.dp 1 huku ;
|
||||
i = case u of {
|
||||
"e" | "i" => [] ;
|
||||
_ => u
|
||||
} ;
|
||||
y = case a of {
|
||||
"a" => "u" ;
|
||||
_ => "y"
|
||||
} ;
|
||||
hukkui = init hukku + i + "i" ;
|
||||
hukui = init huku + i + "i" ;
|
||||
} in
|
||||
mkVerbH
|
||||
hukkua
|
||||
(hukku + u)
|
||||
(huku + "n")
|
||||
(hukku + "v" + a + "t")
|
||||
(hukku + (("k" + a) + a))
|
||||
(huku + ((("t" + a) + a) + "n"))
|
||||
(hukkui)
|
||||
(hukui + "n")
|
||||
(hukkui + "si")
|
||||
(hukku + "n" + y + "t")
|
||||
(huku + "tt" + y)
|
||||
(huku + "t" + y + "t") ;
|
||||
|
||||
-- For cases with or without alternation: "sanoa", "valua", "kysyä".
|
||||
|
||||
vSanoa : Str -> VerbH = \sanoa ->
|
||||
vHukkua sanoa (Predef.tk 1 sanoa) ;
|
||||
---- vHukkua sanoa (weakGrade (Predef.tk 1 sanoa)) ;
|
||||
---- The gfr file becomes 6* bigger if this change is done
|
||||
|
||||
-- For "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää".
|
||||
|
||||
vHuoltaa : (_,_,_,_ : Str) -> VerbH = \ottaa,otan,otti,otin ->
|
||||
let {
|
||||
a = Predef.dp 1 ottaa ;
|
||||
aa = a + a ;
|
||||
u = case a of {"a" => "u" ; _ => "y"} ;
|
||||
ota = Predef.tk 1 otan ;
|
||||
otta = Predef.tk 1 ottaa ;
|
||||
ote = Predef.tk 1 ota + "e"
|
||||
} in
|
||||
mkVerbH
|
||||
ottaa
|
||||
ottaa
|
||||
otan
|
||||
(otta + "v" + a + "t")
|
||||
(otta + "k" + aa)
|
||||
(ote + "t" + aa + "n")
|
||||
otti
|
||||
otin
|
||||
(otta + "isi")
|
||||
(otta + "n" + u + "t")
|
||||
(ote + "tt" + u)
|
||||
(ote + "t" + u + "n") ;
|
||||
|
||||
-- For cases where grade alternation is not affected by the imperfect "i".
|
||||
|
||||
vOttaa : (_,_ : Str) -> VerbH = \ottaa,otan ->
|
||||
let
|
||||
i = "i" ; --- wrong rule if_then_Str (pbool2bool (Predef.occurs "ou" ottaa)) "i" "oi"
|
||||
in
|
||||
vHuoltaa ottaa otan (Predef.tk 2 ottaa + i) (Predef.tk 2 otan + i + "n") ;
|
||||
|
||||
-- For "poistaa", "ryystää".
|
||||
|
||||
vPoistaa : Str -> VerbH = \poistaa ->
|
||||
vOttaa poistaa ((Predef.tk 1 poistaa + "n")) ;
|
||||
|
||||
|
||||
-- For "osata", "lisätä"; grade alternation is unpredictable, as seen
|
||||
-- from "pelätä-pelkäsi" vs. "palata-palasi"
|
||||
|
||||
|
||||
vOsata : Str -> VerbH = \osata ->
|
||||
vPalkata osata (Predef.tk 2 osata + "si") ;
|
||||
|
||||
vPalkata : Str -> Str -> VerbH = \palkata,palkkasi ->
|
||||
let
|
||||
a = Predef.dp 1 palkata ;
|
||||
palka = Predef.tk 2 palkata ;
|
||||
palkka = Predef.tk 2 palkkasi ;
|
||||
u = case a of {"a" => "u" ; _ => "y"}
|
||||
in
|
||||
mkVerbH
|
||||
palkata
|
||||
(palkka + a)
|
||||
(palkka + (a + "n"))
|
||||
(palkka + (((a + "v") + a) + "t"))
|
||||
(palka + ((("t" + "k") + a) + a))
|
||||
(palkata + (a + "n"))
|
||||
(palkka + "si")
|
||||
(palkka + "sin")
|
||||
(palkka + "isi")
|
||||
(palka + "nn" + u + "t")
|
||||
(palka + "tt" + u)
|
||||
(palka + "t" + u + "n") ;
|
||||
|
||||
vPudota : Str -> Str -> VerbH = \pudota, putosi ->
|
||||
let
|
||||
a = Predef.dp 1 pudota ;
|
||||
pudo = Predef.tk 2 pudota ;
|
||||
puto = Predef.tk 2 putosi ;
|
||||
putoa = puto + a ;
|
||||
u = case a of {"a" => "u" ; _ => "y"}
|
||||
in
|
||||
mkVerbH
|
||||
pudota
|
||||
(putoa + a)
|
||||
(putoa + "n")
|
||||
(putoa + "v" + a + "t")
|
||||
(pudo + "tk" + a + a)
|
||||
(pudota + a + "n")
|
||||
(puto + "si")
|
||||
(puto + "sin")
|
||||
(puto + a + "isi")
|
||||
(pudo + "nn" + u + "t")
|
||||
(pudo + "tt" + u)
|
||||
(pudo + "t" + u + "n") ;
|
||||
|
||||
vHarkita : Str -> VerbH = \harkita ->
|
||||
let
|
||||
a = Predef.dp 1 harkita ;
|
||||
harki = Predef.tk 2 harkita ;
|
||||
harkitse = harki + "tse" ;
|
||||
harkitsi = harki + "tsi" ;
|
||||
u = case a of {"a" => "u" ; _ => "y"}
|
||||
in
|
||||
mkVerbH
|
||||
harkita
|
||||
(harkitse + "e")
|
||||
(harkitse + "n")
|
||||
(harkitse + "v" + a + "t")
|
||||
(harki + "tk"+ a + a)
|
||||
(harkita + a + "n")
|
||||
(harkitsi)
|
||||
(harkitsi + "n")
|
||||
(harkitsi + "si")
|
||||
(harki + "nn" + u + "t")
|
||||
(harki + "tt" + u)
|
||||
(harki + "t" + u + "n") ;
|
||||
|
||||
|
||||
----- tulla,tulee,tulen,tulevat,tulkaa,tullaan,tuli,tulin,tulisi,tullut,tultu,tullun
|
||||
|
||||
-- For "juosta", "piestä", "nousta", "rangaista", "kävellä", "surra", "panna".
|
||||
|
||||
vJuosta : (_,_,_,_ : Str) -> VerbH = \juosta,juoksen,juossut,juostu ->
|
||||
let
|
||||
a = Predef.dp 1 juosta ;
|
||||
t = last (init juosta) ;
|
||||
juokse = Predef.tk 1 juoksen ;
|
||||
juoksi = Predef.tk 2 juoksen + "i" ;
|
||||
juos = Predef.tk 2 juosta ;
|
||||
juostun = ifTok Str t "t" (juostu + "n") (init juossut + "n") ;
|
||||
in
|
||||
mkVerbH
|
||||
juosta
|
||||
(juokse + "e")
|
||||
juoksen
|
||||
(juokse + (("v" + a) + "t"))
|
||||
(juos + (("k" + a) + a))
|
||||
(juosta + (a + "n"))
|
||||
juoksi
|
||||
(juoksi + "n")
|
||||
(juoksi + "si")
|
||||
juossut
|
||||
juostu
|
||||
juostun ;
|
||||
|
||||
-- For "juoda", "syödä", "viedä", "naida", "saada".
|
||||
|
||||
vJuoda : (_,_ : Str) -> VerbH = \juoda, joi ->
|
||||
let
|
||||
a = Predef.dp 1 juoda ;
|
||||
juo = Predef.tk 2 juoda ;
|
||||
u = case a of {"a" => "u" ; _ => "y"}
|
||||
in
|
||||
mkVerbH
|
||||
juoda
|
||||
juo
|
||||
(juo + "n")
|
||||
(juo + (("v" + a) + "t"))
|
||||
(juo + (("k" + a) + a))
|
||||
(juoda + (a + "n"))
|
||||
joi
|
||||
(joi + "n")
|
||||
(joi + "si")
|
||||
(juo + "n" + u + "t")
|
||||
(juo + "t" + u)
|
||||
(juo + "d" + u + "n") ;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
639
lib/resource/finnish/Paradigms1Fin.gf
Normal file
639
lib/resource/finnish/Paradigms1Fin.gf
Normal file
@@ -0,0 +1,639 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
--1 Finnish Lexical Paradigms
|
||||
--
|
||||
-- Aarne Ranta 2003--2005
|
||||
--
|
||||
-- This is an API to the user of the resource grammar
|
||||
-- for adding lexical items. It gives functions for forming
|
||||
-- expressions of open categories: nouns, adjectives, verbs.
|
||||
--
|
||||
-- Closed categories (determiners, pronouns, conjunctions) are
|
||||
-- accessed through the resource syntax API, $Structural.gf$.
|
||||
--
|
||||
-- The main difference with $MorphoFin.gf$ is that the types
|
||||
-- referred to are compiled resource grammar types. We have moreover
|
||||
-- had the design principle of always having existing forms, rather
|
||||
-- than stems, as string arguments of the paradigms.
|
||||
--
|
||||
-- The structure of functions for each word class $C$ is the following:
|
||||
-- first we give a handful of patterns that aim to cover all
|
||||
-- regular cases. Then we give a worst-case function $mkC$, which serves as an
|
||||
-- escape to construct the most irregular words of type $C$.
|
||||
-- However, this function should only seldom be needed.
|
||||
|
||||
resource Paradigms1Fin = open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
Morpho1Fin,
|
||||
CatFin
|
||||
in {
|
||||
|
||||
flags optimize=noexpand ;
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over gender, number, and (some) case names,
|
||||
-- we define the following identifiers. The application programmer
|
||||
-- should always use these constants instead of the constructors
|
||||
-- defined in $ResFin$.
|
||||
|
||||
oper
|
||||
Number : Type ;
|
||||
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
Case : Type ;
|
||||
nominative : Case ;
|
||||
genitive : Case ;
|
||||
partitive : Case ;
|
||||
translative : Case ;
|
||||
inessive : Case ;
|
||||
elative : Case ;
|
||||
illative : Case ;
|
||||
adessive : Case ;
|
||||
ablative : Case ;
|
||||
allative : Case ;
|
||||
|
||||
-- The following type is used for defining *rection*, i.e. complements
|
||||
-- of many-place verbs and adjective. A complement can be defined by
|
||||
-- just a case, or a pre/postposition and a case.
|
||||
|
||||
prePrep : Case -> Str -> Prep ; -- ilman, partitive
|
||||
postPrep : Case -> Str -> Prep ; -- takana, genitive
|
||||
postGenPrep : Str -> Prep ; -- takana
|
||||
casePrep : Case -> Prep ; -- adessive
|
||||
|
||||
--2 Nouns
|
||||
|
||||
-- The worst case gives ten forms.
|
||||
-- In practice just a couple of forms are needed to define the different
|
||||
-- stems, vowel alternation, and vowel harmony.
|
||||
|
||||
oper
|
||||
|
||||
-- The regular noun heuristic takes just one form (singular
|
||||
-- nominative) and analyses it to pick the correct paradigm.
|
||||
-- It does automatic grade alternation, and is hence not usable
|
||||
-- for words like "auto" (whose genitive would become "audon").
|
||||
--
|
||||
-- If the one-argument paradigm does not give the correct result, one can try and give
|
||||
-- two or three forms. Most notably, the two-argument variant is used
|
||||
-- for nouns like "kivi - kiviä", which would otherwise become like
|
||||
-- "rivi - rivejä". Three arguments are used e.g. for
|
||||
-- "sydän - sydämen - sydämiä", which would otherwise become
|
||||
-- "sydän - sytämen".
|
||||
|
||||
mkN : overload {
|
||||
mkN : (talo : Str) -> N ;
|
||||
mkN : (savi,savia : Str) -> N ;
|
||||
mkN : (vesi,veden,vesiä : Str) -> N ;
|
||||
mkN : (olo,oln,olona,oloa,oloon,oloina,oloissa,olojen,oloja,oloihin : Str) -> N
|
||||
} ;
|
||||
|
||||
|
||||
-- Some nouns have an unexpected singular partitive, e.g. "meri", "lumi".
|
||||
|
||||
sgpartN : (meri : N) -> (merta : Str) -> N ;
|
||||
nMeri : (meri : Str) -> N ;
|
||||
|
||||
-- The rest of the noun paradigms are mostly covered by the three
|
||||
-- heuristics.
|
||||
--
|
||||
-- Nouns with partitive "a","ä" are a large group.
|
||||
-- To determine for grade and vowel alternation, three forms are usually needed:
|
||||
-- singular nominative and genitive, and plural partitive.
|
||||
-- Examples: "talo", "kukko", "huippu", "koira", "kukka", "syylä", "särki"...
|
||||
|
||||
nKukko : (kukko,kukon,kukkoja : Str) -> N ;
|
||||
|
||||
-- A special case:
|
||||
-- the vowel harmony is inferred from the last letter,
|
||||
-- which must be one of "o", "u", "ö", "y". Regular weak-grade alternation
|
||||
-- is performed.
|
||||
|
||||
nTalo : (talo : Str) -> N ;
|
||||
|
||||
-- Another special case are nouns where the last two consonants
|
||||
-- undergo regular weak-grade alternation:
|
||||
-- "kukko - kukon", "rutto - ruton", "hyppy - hypyn", "sampo - sammon",
|
||||
-- "kunto - kunnon", "sisältö - sisällön", .
|
||||
|
||||
nLukko : (lukko : Str) -> N ;
|
||||
|
||||
-- "arpi - arven", "sappi - sapen", "kampi - kammen";"sylki - syljen"
|
||||
|
||||
nArpi : (arpi : Str) -> N ;
|
||||
nSylki : (sylki : Str) -> N ;
|
||||
|
||||
-- Foreign words ending in consonants are actually similar to words like
|
||||
-- "malli"-"mallin"-"malleja", with the exception that the "i" is not attached
|
||||
-- to the singular nominative. Examples: "linux", "savett", "screen".
|
||||
-- The singular partitive form is used to get the vowel harmony.
|
||||
-- (N.B. more than 1-syllabic words ending in "n" would have variant
|
||||
-- plural genitive and partitive forms, like
|
||||
-- "sultanien", "sultaneiden", which are not covered.)
|
||||
|
||||
nLinux : (linuxia : Str) -> N ;
|
||||
|
||||
-- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "tavara",
|
||||
-- "rytinä".
|
||||
|
||||
nPeruna : (peruna : Str) -> N ;
|
||||
|
||||
-- The following paradigm covers both nouns ending in an aspirated "e", such as
|
||||
-- "rae", "perhe", "savuke", and also many ones ending in a consonant
|
||||
-- ("rengas", "kätkyt"). The singular nominative and essive are given.
|
||||
|
||||
nRae : (rae, rakeena : Str) -> N ;
|
||||
|
||||
-- The following covers nouns with partitive "ta","tä", such as
|
||||
-- "susi", "vesi", "pieni". To get all stems and the vowel harmony, it takes
|
||||
-- the singular nominative, genitive, and essive.
|
||||
|
||||
nSusi : (susi,suden,sutta : Str) -> N ;
|
||||
|
||||
-- Nouns ending with a long vowel, such as "puu", "pää", "pii", "leikkuu",
|
||||
-- are inflected according to the following.
|
||||
|
||||
nPuu : (puu : Str) -> N ;
|
||||
|
||||
-- One-syllable diphthong nouns, such as "suo", "tie", "työ", are inflected by
|
||||
-- the following.
|
||||
|
||||
nSuo : (suo : Str) -> N ;
|
||||
|
||||
-- Many adjectives but also nouns have the nominative ending "nen" which in other
|
||||
-- cases becomes "s": "nainen", "ihminen", "keltainen".
|
||||
-- To capture the vowel harmony, we use the partitive form as the argument.
|
||||
|
||||
nNainen : (naista : Str) -> N ;
|
||||
|
||||
-- The following covers some nouns ending with a consonant, e.g.
|
||||
-- "tilaus", "kaulin", "paimen", "laidun".
|
||||
|
||||
nTilaus : (tilaus,tilauksena : Str) -> N ;
|
||||
|
||||
-- Special case:
|
||||
|
||||
nKulaus : (kulaus : Str) -> N ;
|
||||
|
||||
-- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris".
|
||||
-- The partitive form is taken to get the vowel harmony.
|
||||
|
||||
nNauris : (naurista : Str) -> N ;
|
||||
|
||||
-- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen",
|
||||
-- have only their last part inflected.
|
||||
|
||||
compN : Str -> N -> N ;
|
||||
|
||||
-- Nouns used as functions need a case, of which the default is
|
||||
-- the genitive.
|
||||
|
||||
mkN2 = overload {
|
||||
mkN2 : N -> N2 = genN2 ;
|
||||
mkN2 : N -> Prep -> N2 = mmkN2
|
||||
} ;
|
||||
|
||||
mkN3 : N -> Prep -> Prep -> N3 ;
|
||||
|
||||
-- Proper names can be formed by using declensions for nouns.
|
||||
-- The plural forms are filtered away by the compiler.
|
||||
|
||||
mkPN : overload {
|
||||
mkPN : Str -> PN ;
|
||||
mkPN : N -> PN
|
||||
} ;
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
-- Non-comparison one-place adjectives are just like nouns.
|
||||
-- The regular adjectives are based on $regN$ in the positive.
|
||||
-- Comparison adjectives have three forms.
|
||||
-- The comparative and the superlative
|
||||
-- are always inflected in the same way, so the nominative of them is actually
|
||||
-- enough (except for the superlative "paras" of "hyvä").
|
||||
|
||||
mkA : overload {
|
||||
mkA : Str -> A ;
|
||||
mkA : N -> A ;
|
||||
mkA : N -> (kivempaa,kivinta : Str) -> A
|
||||
} ;
|
||||
|
||||
-- Two-place adjectives need a case for the second argument.
|
||||
|
||||
mkA2 : A -> Prep -> A2 ;
|
||||
|
||||
|
||||
|
||||
--2 Verbs
|
||||
--
|
||||
-- The grammar does not cover the potential mood and some nominal
|
||||
-- forms. One way to see the coverage is to linearize a verb to
|
||||
-- a table.
|
||||
-- The worst case needs twelve forms, as shown in the following.
|
||||
|
||||
|
||||
-- The following heuristics cover more and more verbs.
|
||||
|
||||
mkV : overload {
|
||||
mkV : (soutaa : Str) -> V ;
|
||||
mkV : (soutaa,souti : Str) -> V ;
|
||||
mkV : (soutaa,soudan,souti : Str) -> V ;
|
||||
mkV : (tulla,tulee,tulen,tulevat,tulkaa,tullaan,tuli,tulin,tulisi,tullut,tultu,tullun : Str) -> V ;
|
||||
|
||||
-- The subject case of verbs is by default nominative. This function can change it.
|
||||
|
||||
mkV : V -> Case -> V
|
||||
} ;
|
||||
|
||||
|
||||
-- The rest of the paradigms are special cases mostly covered by the heuristics.
|
||||
-- A simple special case is the one with just one stem and without grade alternation.
|
||||
|
||||
vValua : (valua : Str) -> V ;
|
||||
|
||||
-- With two forms, the following function covers a variety of verbs, such as
|
||||
-- "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää".
|
||||
|
||||
vKattaa : (kattaa, katan : Str) -> V ;
|
||||
|
||||
-- When grade alternation is not present, just a one-form special case is needed
|
||||
-- ("poistaa", "ryystää").
|
||||
|
||||
vOstaa : (ostaa : Str) -> V ;
|
||||
|
||||
-- The following covers
|
||||
-- "juosta", "piestä", "nousta", "rangaista", "kävellä", "surra", "panna".
|
||||
|
||||
vNousta : (nousta, nousen : Str) -> V ;
|
||||
|
||||
-- This is for one-syllable diphthong verbs like "juoda", "syödä".
|
||||
|
||||
vTuoda : (tuoda : Str) -> V ;
|
||||
|
||||
-- All the patterns above have $nominative$ as subject case.
|
||||
-- If another case is wanted, use the following.
|
||||
|
||||
caseV : Case -> V -> V ;
|
||||
|
||||
-- The verbs "be" is special.
|
||||
|
||||
vOlla : V ;
|
||||
|
||||
--3 Two-place verbs
|
||||
--
|
||||
-- Two-place verbs need an object case, and can have a pre- or postposition.
|
||||
-- The default is direct (accusative) object. There is also a special case
|
||||
-- with case only. The string-only argument case yields a regular verb with
|
||||
-- accusative object.
|
||||
|
||||
mkV2 : overload {
|
||||
mkV2 : Str -> V2 ;
|
||||
mkV2 : V -> V2 ;
|
||||
mkV2 : V -> Case -> V2 ;
|
||||
mkV2 : V -> Prep -> V2 ;
|
||||
} ;
|
||||
|
||||
|
||||
--3 Three-place verbs
|
||||
--
|
||||
-- Three-place (ditransitive) verbs need two prepositions, of which
|
||||
-- the first one or both can be absent.
|
||||
|
||||
mkV3 : V -> Prep -> Prep -> V3 ; -- puhua, allative, elative
|
||||
dirV3 : V -> Case -> V3 ; -- siirtää, (accusative), illative
|
||||
dirdirV3 : V -> V3 ; -- antaa, (accusative), (allative)
|
||||
|
||||
|
||||
--3 Other complement patterns
|
||||
--
|
||||
-- Verbs and adjectives can take complements such as sentences,
|
||||
-- questions, verb phrases, and adjectives.
|
||||
|
||||
mkV0 : V -> V0 ;
|
||||
mkVS : V -> VS ;
|
||||
mkV2S : V -> Prep -> V2S ;
|
||||
mkVV : V -> VV ;
|
||||
mkV2V : V -> Prep -> V2V ;
|
||||
mkVA : V -> Prep -> VA ;
|
||||
mkV2A : V -> Prep -> Prep -> V2A ;
|
||||
mkVQ : V -> VQ ;
|
||||
mkV2Q : V -> Prep -> V2Q ;
|
||||
|
||||
mkAS : A -> AS ;
|
||||
mkA2S : A -> Prep -> A2S ;
|
||||
mkAV : A -> AV ;
|
||||
mkA2V : A -> Prep -> A2V ;
|
||||
|
||||
-- Notice: categories $V2S, V2V, V2Q$ are in v 1.0 treated
|
||||
-- just as synonyms of $V2$, and the second argument is given
|
||||
-- as an adverb. Likewise $AS, A2S, AV, A2V$ are just $A$.
|
||||
-- $V0$ is just $V$.
|
||||
|
||||
V0, V2S, V2V, V2Q : Type ;
|
||||
AS, A2S, AV, A2V : Type ;
|
||||
|
||||
--.
|
||||
-- The definitions should not bother the user of the API. So they are
|
||||
-- hidden from the document.
|
||||
|
||||
Case = Morpho1Fin.Case ;
|
||||
Number = Morpho1Fin.Number ;
|
||||
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
|
||||
nominative = Nom ;
|
||||
genitive = Gen ;
|
||||
partitive = Part ;
|
||||
translative = Transl ;
|
||||
inessive = Iness ;
|
||||
elative = Elat ;
|
||||
illative = Illat ;
|
||||
adessive = Adess ;
|
||||
ablative = Ablat ;
|
||||
allative = Allat ;
|
||||
|
||||
prePrep : Case -> Str -> Prep =
|
||||
\c,p -> {c = NPCase c ; s = p ; isPre = True ; lock_Prep = <>} ;
|
||||
postPrep : Case -> Str -> Prep =
|
||||
\c,p -> {c = NPCase c ; s = p ; isPre = False ; lock_Prep = <>} ;
|
||||
postGenPrep p = {
|
||||
c = NPCase genitive ; s = p ; isPre = False ; lock_Prep = <>} ;
|
||||
casePrep : Case -> Prep =
|
||||
\c -> {c = NPCase c ; s = [] ; isPre = True ; lock_Prep = <>} ;
|
||||
accPrep = {c = NPAcc ; s = [] ; isPre = True ; lock_Prep = <>} ;
|
||||
|
||||
mk10N= \a,b,c,d,e,f,g,h,i,j ->
|
||||
mkNoun a b c d e f g h i j ** {lock_N = <>} ;
|
||||
|
||||
mkN = overload {
|
||||
mkN : (talo : Str) -> N = regN ;
|
||||
mkN : (savi,savia : Str) -> N = reg2N ;
|
||||
mkN : (vesi,veden,vesiä : Str) -> N = reg3N ;
|
||||
mkN : (talo, talon, talona, taloa, taloon,
|
||||
taloina,taloissa,talojen,taloja,taloihin : Str) -> N = mk10N
|
||||
} ;
|
||||
|
||||
regN = \vesi ->
|
||||
let
|
||||
esi = Predef.dp 3 vesi ; -- analysis: suffixes
|
||||
a = if_then_Str (pbool2bool (Predef.occurs "aou" vesi)) "a" "ä" ;
|
||||
ves = init vesi ; -- synthesis: prefixes
|
||||
vet = strongGrade ves ;
|
||||
ve = init ves ;
|
||||
in nhn (
|
||||
case esi of {
|
||||
"uus" | "yys" => sRakkaus vesi ;
|
||||
_ + "nen" => sNainen (Predef.tk 3 vesi + ("st" + a)) ;
|
||||
_ + ("aa" | "ee" | "ii" | "oo" | "uu" | "yy" | "ää" | "öö") => sPuu vesi ;
|
||||
_ + ("ie" | "uo" | "yö") => sSuo vesi ;
|
||||
_ + ("ea" | "eä") =>
|
||||
mkSubst
|
||||
a
|
||||
vesi (vesi) (vesi) (vesi + a) (vesi + a+"n")
|
||||
(ves + "i") (ves + "i") (ves + "iden") (ves + "it"+a)
|
||||
(ves + "isiin") ;
|
||||
_ + "is" => sNauris (vesi + ("t" + a)) ;
|
||||
_ + ("ut" | "yt") => sRae vesi (ves + ("en" + a)) ;
|
||||
_ + ("as" | "äs") => sRae vesi (vet + (a + "n" + a)) ;
|
||||
_ + ("ar" | "är") => sRae vesi (vet + ("ren" + a)) ;
|
||||
_ + "n" => sLiitin vesi (vet + "men") ;
|
||||
_ + "s" => sTilaus vesi (ves + ("ksen" + a)) ;
|
||||
_ + "i" => sBaari (vesi + a) ;
|
||||
_ + "e" => sRae vesi (strongGrade vesi + "en" + a) ;
|
||||
_ + ("a" | "o" | "u" | "y" | "ä" | "ö") => sLukko vesi ;
|
||||
_ => sLinux (vesi + "i" + a)
|
||||
}
|
||||
) ** {lock_N = <>} ;
|
||||
|
||||
reg2N : (savi,savia : Str) -> N = \savi,savia ->
|
||||
let
|
||||
savit = regN savi ;
|
||||
ia = Predef.dp 2 savia ;
|
||||
i = init ia ;
|
||||
a = last ia ;
|
||||
o = last savi ;
|
||||
savin = weakGrade savi + "n" ;
|
||||
in
|
||||
case <o,ia> of {
|
||||
<"i","ia"> => nhn (sArpi savi) ;
|
||||
<"i","iä"> => nhn (sSylki savi) ;
|
||||
<"o","ta"> | <"ö","tä"> => nhn (sRadio savi) ;
|
||||
<"a","ta"> | <"ä","tä"> => nhn (sPeruna savi) ;
|
||||
<"i","ta"> | <"i","tä"> => nhn (sTohtori (savi + a)) ; -- from 10 to 90 ms
|
||||
-- <"a","ia"> | <"a","ja"> => nhn (sKukko savi savin savia) ; ---needless?
|
||||
_ => savit
|
||||
}
|
||||
** {lock_N = <>} ;
|
||||
|
||||
reg3N = \vesi,veden,vesiä ->
|
||||
let
|
||||
si = Predef.dp 2 vesi ;
|
||||
a = last vesiä
|
||||
in
|
||||
case si of {
|
||||
"us" | "ys" =>
|
||||
nhn (case Predef.dp 3 veden of {
|
||||
"den" => sRakkaus vesi ;
|
||||
_ => sTilaus vesi (veden + a)
|
||||
}) ;
|
||||
"as" | "äs" => nhn (sRae vesi (veden + a)) ;
|
||||
"li" | "ni" | "ri" => nhn (sSusi vesi veden (init vesi + ("en" + a))) ;
|
||||
"si" => nhn (sSusi vesi veden (Predef.tk 2 vesi + ("ten" + a))) ;
|
||||
"in" | "en" | "än" => nhn (sLiitin vesi veden) ;
|
||||
_ + ("a" | "o" | "u" | "y" | "ä" | "ö") => nhn (sKukko vesi veden vesiä) ;
|
||||
_ {- + "i" -} => nhn (sKorpi vesi veden (init veden + "n" + a))
|
||||
}
|
||||
** {lock_N = <>} ;
|
||||
|
||||
nKukko = \a,b,c -> nhn (sKukko a b c) ** {lock_N = <>} ;
|
||||
|
||||
nLukko = \a -> nhn (sLukko a) ** {lock_N = <>} ;
|
||||
nTalo = \a -> nhn (sTalo a) ** {lock_N = <>} ;
|
||||
nArpi = \a -> nhn (sArpi a) ** {lock_N = <>} ;
|
||||
nSylki = \a -> nhn (sSylki a) ** {lock_N = <>} ;
|
||||
nLinux = \a -> nhn (sLinux a) ** {lock_N = <>} ;
|
||||
nPeruna = \a -> nhn (sPeruna a) ** {lock_N = <>} ;
|
||||
nRae = \a,b -> nhn (sRae a b) ** {lock_N = <>} ;
|
||||
nSusi = \a,b,c -> nhn (sSusi a b c) ** {lock_N = <>} ;
|
||||
nPuu = \a -> nhn (sPuu a) ** {lock_N = <>} ;
|
||||
nSuo = \a -> nhn (sSuo a) ** {lock_N = <>} ;
|
||||
nNainen = \a -> nhn (sNainen a) ** {lock_N = <>} ;
|
||||
nTilaus = \a,b -> nhn (sTilaus a b) ** {lock_N = <>} ;
|
||||
nKulaus = \a -> nTilaus a (init a + "ksen" + getHarmony (last
|
||||
(init a))) ;
|
||||
nNauris = \a -> nhn (sNauris a) ** {lock_N = <>} ;
|
||||
sgpartN noun part = {
|
||||
s = table {
|
||||
NCase Sg Part => part ;
|
||||
c => noun.s ! c
|
||||
} ;
|
||||
g = noun.g ;
|
||||
lock_N = noun.lock_N
|
||||
} ;
|
||||
nMeri meri =
|
||||
let a = vowelHarmony meri in
|
||||
sgpartN (reg2N meri (meri + a)) (init meri + "ta") ;
|
||||
|
||||
compN = \s,n -> {s = \\c => s ++ n.s ! c ; g = n.g ; lock_N = <>} ;
|
||||
|
||||
|
||||
makeNP : N -> Number -> CatFin.NP ;
|
||||
makeNP noun num = {
|
||||
s = \\c => noun.s ! NCase num (npform2case num c) ;
|
||||
a = agrP3 num ;
|
||||
isPron = False ;
|
||||
lock_NP = <>
|
||||
} ;
|
||||
|
||||
mkPN = overload {
|
||||
mkPN : Str -> PN = regPN ;
|
||||
mkPN : N -> PN = mmkPN
|
||||
} ;
|
||||
|
||||
mkA = overload {
|
||||
mkA : Str -> A = regA ;
|
||||
mkA : N -> A = mk1A ;
|
||||
mkA : N -> (kivempaa,kivinta : Str) -> A = mkADeg
|
||||
} ;
|
||||
|
||||
mk1A = \x -> {s = \\_ => (noun2adj x).s ; lock_A = <>} ;
|
||||
---- mkADeg (noun2adj x).s ...
|
||||
|
||||
mkA2 = \x,c -> x ** {c2 = c ; lock_A2 = <>} ;
|
||||
mkADeg x kivempi kivin =
|
||||
let
|
||||
a = last (x.s ! ((NCase Sg Part))) ; ---- gives "kivinta"
|
||||
kivempaa = init kivempi + a + a ;
|
||||
kivinta = kivin + "t" + a
|
||||
in
|
||||
regAdjective x kivempaa kivinta ** {lock_A = <>} ;
|
||||
|
||||
regA suuri =
|
||||
let suur = regN suuri in
|
||||
mkADeg
|
||||
suur
|
||||
(init (suur.s ! NCase Sg Gen) + "mpi")
|
||||
(init (suur.s ! NCase Pl Ess)) ;
|
||||
|
||||
regADeg = regA ; -- for bw compat
|
||||
|
||||
mk12V a b c d e f g h i j k l = mkVerb a b c d e f g h i j k l **
|
||||
{sc = NPCase Nom ; lock_V = <>} ;
|
||||
|
||||
mkV = overload {
|
||||
mkV : (soutaa : Str) -> V = regV ;
|
||||
mkV : (soutaa,souti : Str) -> V = reg2V ;
|
||||
mkV : (soutaa,soudan,souti : Str) -> V = reg3V ;
|
||||
mkV : (tulla,tulee,tulen,tulevat,tulkaa,tullaan,
|
||||
tuli,tulin,tulisi,tullut,tultu,tullun : Str) -> V = mk12V ;
|
||||
mkV : V -> Case -> V = subjcaseV
|
||||
} ;
|
||||
|
||||
regV soutaa = v2v (regVerbH soutaa) ** {sc = NPCase Nom ; lock_V = <>} ;
|
||||
|
||||
reg2V : (soutaa,souti : Str) -> V = \soutaa,souti ->
|
||||
v2v (reg2VerbH soutaa souti) ** {sc = NPCase Nom ; lock_V = <>} ;
|
||||
|
||||
reg3V soutaa soudan souti =
|
||||
v2v (reg3VerbH soutaa soudan souti) ** {sc = NPCase Nom ; lock_V = <>} ;
|
||||
|
||||
subjcaseV v c = {s = v.s ; sc = NPCase c ; lock_V = v.lock_V} ;
|
||||
|
||||
vValua v = v2v (vSanoa v) ** {sc = NPCase Nom ; lock_V = <>} ;
|
||||
vKattaa v u = v2v (vOttaa v u) ** {sc = NPCase Nom ; lock_V = <>} ;
|
||||
vOstaa v = v2v (vPoistaa v) ** {sc = NPCase Nom ; lock_V = <>} ;
|
||||
vNousta v u = v2v (vJuosta v u [] []) ** {sc = NPCase Nom ; lock_V = <>} ; -----
|
||||
vTuoda v = v2v (vJuoda v []) ** {sc = NPCase Nom ; lock_V = <>} ; -----
|
||||
caseV c v = {s = v.s ; sc = NPCase c ; lock_V = <>} ;
|
||||
|
||||
vOlla = verbOlla ** {sc = NPCase Nom ; lock_V = <>} ;
|
||||
|
||||
vHuoltaa : (_,_,_,_ : Str) -> Verb = \ottaa,otan,otti,otin ->
|
||||
v2v (Morpho1Fin.vHuoltaa ottaa otan otti otin) ** {sc = NPCase Nom ; lock_V = <>} ;
|
||||
|
||||
|
||||
mk2V2 = \v,c -> v ** {c2 = c ; lock_V2 = <>} ;
|
||||
caseV2 = \v,c -> mk2V2 v (casePrep c) ;
|
||||
dirV2 v = mk2V2 v accPrep ;
|
||||
|
||||
mkAdv : Str -> Adv = \s -> {s = s ; lock_Adv = <>} ;
|
||||
|
||||
|
||||
mkV3 v p q = v ** {c2 = p ; c3 = q ; lock_V3 = <>} ;
|
||||
dirV3 v p = mkV3 v accPrep (casePrep p) ;
|
||||
dirdirV3 v = dirV3 v allative ;
|
||||
|
||||
mkVS v = v ** {lock_VS = <>} ;
|
||||
mkVV v = v ** {lock_VV = <>} ;
|
||||
mkVQ v = v ** {lock_VQ = <>} ;
|
||||
|
||||
V0 : Type = V ;
|
||||
V2S, V2V, V2Q : Type = V2 ;
|
||||
AS, A2S, AV : Type = A ;
|
||||
A2V : Type = A2 ;
|
||||
|
||||
mkV0 v = v ** {lock_V = <>} ;
|
||||
mkV2S v p = mk2V2 v p ** {lock_V2 = <>} ;
|
||||
mkV2V v p = mk2V2 v p ** {lock_V2 = <>} ;
|
||||
mkVA v p = v ** {c2 = p ; lock_VA = <>} ;
|
||||
mkV2A v p q = v ** {c2 = p ; c3 = q ; lock_V2A = <>} ;
|
||||
mkV2Q v p = mk2V2 v p ** {lock_V2 = <>} ;
|
||||
|
||||
mkAS v = v ** {lock_A = <>} ;
|
||||
mkA2S v p = mkA2 v p ** {lock_A = <>} ;
|
||||
mkAV v = v ** {lock_A = <>} ;
|
||||
mkA2V v p = mkA2 v p ** {lock_A2 = <>} ;
|
||||
|
||||
|
||||
--- old stuff
|
||||
|
||||
reg2N : (savi,savia : Str) -> N ;
|
||||
reg3N : (vesi,veden,vesiä : Str) -> N ;
|
||||
|
||||
mk10N: (talo, talon, talona, taloa, taloon,
|
||||
taloina,taloissa,talojen,taloja,taloihin : Str) -> N ;
|
||||
|
||||
regN : (talo : Str) -> N ;
|
||||
|
||||
mmkN2 : N -> Prep -> N2 = \n,c -> n ** {c2 = c ; lock_N2 = <>} ;
|
||||
mkN3 = \n,c,e -> n ** {c2 = c ; c3 = e ; lock_N3 = <>} ;
|
||||
genN2 = \n -> mmkN2 n (casePrep genitive) ;
|
||||
regPN m = mmkPN (regN m) ;
|
||||
mmkPN : N -> PN = \n -> mkProperName n ** {lock_PN = <>} ;
|
||||
|
||||
genN2 : N -> N2 ;
|
||||
|
||||
|
||||
mk1A : N -> A ;
|
||||
mkADeg : (kiva : N) -> (kivempaa,kivinta : Str) -> A ;
|
||||
regA : (punainen : Str) -> A ;
|
||||
|
||||
mk12V : (tulla,tulee,tulen,tulevat,tulkaa,tullaan,
|
||||
tuli,tulin,tulisi,tullut,tultu,tullun : Str) -> V ;
|
||||
|
||||
regV : (soutaa : Str) -> V ;
|
||||
reg2V : (soutaa,souti : Str) -> V ;
|
||||
reg3V : (soutaa,soudan,souti : Str) -> V ;
|
||||
|
||||
subjcaseV : V -> Case -> V ;
|
||||
|
||||
regPN : Str -> PN ;
|
||||
|
||||
mkV2 = overload {
|
||||
mkV2 : Str -> V2 = \s -> dirV2 (regV s) ;
|
||||
mkV2 : V -> V2 = dirV2 ;
|
||||
mkV2 : V -> Case -> V2 = caseV2 ;
|
||||
mkV2 : V -> Prep -> V2 = mk2V2 ;
|
||||
} ;
|
||||
|
||||
dirV2 : V -> V2 ;
|
||||
mk2V2 : V -> Prep -> V2 ;
|
||||
caseV2 : V -> Case -> V2 ;
|
||||
dirV2 : V -> V2 ;
|
||||
|
||||
} ;
|
||||
Reference in New Issue
Block a user