improved performance of ParadigmsFin; merged Param with Res

This commit is contained in:
aarne
2006-02-05 14:19:00 +00:00
parent 827f9ab643
commit d752c36d0f
15 changed files with 614 additions and 672 deletions

View File

@@ -70,16 +70,18 @@ concrete CatFin of Cat = TenseX ** open ResFin, Prelude in {
PConj = {s : Str} ;
CAdv = {s : Str} ;
Subj = {s : Str} ;
Prep = {s : Str} ;
Prep = Compl ;
-- Open lexical classes, e.g. Lexicon
V, VS, VQ, VA = Verb1 ; -- = {s : VForm => Str ; sc : Case} ;
V2, VV, V2A = Verb1 ** {c2 : Compl ; } ;
V2 = Verb1 ** {c2 : Compl} ;
V2A = Verb1 ** {c2, c3 : Compl} ;
VV = Verb1 ; ---- infinitive form
V3 = Verb1 ** {c2, c3 : Compl} ;
A = {s : Degree => AForm => Str} ;
A2 = {s : Degree => AForm => Str ; c2 : Str} ;
A2 = {s : Degree => AForm => Str ; c2 : Compl} ;
N = {s : NForm => Str} ;
N2 = {s : NForm => Str} ** {c2 : Compl} ;

View File

@@ -8,18 +8,18 @@ flags
lin
airplane_N = regN "lentokone" ;
---- answer_V2S = mkV2S (caseV2 (regV "vastata") allative) ;
answer_V2S = mkV2S (regV "vastata") (casePrep allative) ;
apartment_N = regN "asunto" ;
apple_N = nLukko "omena" ; --- omenia, not omenoita
art_N = regN "taide" ;
---- ask_V2Q = mkV2Q (caseV2 (regV "kysyä") ablative) ;
ask_V2Q = mkV2Q (regV "kysyä") (casePrep ablative) ;
baby_N = nLukko "vauva" ;
bad_A = mkADeg (nLukko "paha") "pahempi" "pahin" ;
bank_N = regN "pankki" ;
beautiful_A = mkADeg (regN "kaunis") "kauniimpi" "kaunein" ;
---- become_VA = mkVA (regV "tulla") translative ;
become_VA = mkVA (regV "tulla") (casePrep translative) ;
beer_N = regN "olut" ;
---- beg_V2V = mkV2V (caseV2 (reg2V "pyytää" "pyysi") partitive) ;
beg_V2V = mkV2V (reg2V "pyytää" "pyysi") (casePrep partitive) ;
big_A = mkADeg (sgpartN (nArpi "suuri") "suurta") "suurempi" "suurin" ;
bike_N = nLukko "polkupyörä" ; --- for correct vowel harmony
bird_N = nLukko "lintu" ;
@@ -63,12 +63,12 @@ lin
cow_N = nLukko "lehmä" ;
die_V = regV "kuolla" ;
dirty_A = mkADeg (regN "likainen") "likaisempi" "likaisin" ;
distance_N3 = mkN3 (regN "etäisyys") elative illative ;
distance_N3 = mkN3 (regN "etäisyys") (casePrep elative) (casePrep illative) ;
doctor_N = reg2N "tohtori" "tohtoreita" ;
dog_N = nLukko "koira" ;
door_N = nArpi "ovi" ;
drink_V2 = dirV2 (regV "juoda") ;
---- easy_A2V = mkA2V (mkA2 (mkA (nLukko "helppo")) (caseP allative)) ;
easy_A2V = mkA2V (mkA (nLukko "helppo")) (casePrep allative) ;
eat_V2 = dirV2 (regV "syödä") ;
empty_A = mkADeg (nLukko "tyhjä") "tyhjempi" "tyhjin" ;
enemy_N = regN "vihollinen" ;
@@ -82,7 +82,7 @@ lin
fridge_N = regN "jääkaappi" ;
friend_N = nLukko "ystävä" ;
fruit_N = nLukko "hedelmä" ;
---- fun_AV = mkAV (mkA (nLukko "hauska")) ;
fun_AV = mkAV (mkA (nLukko "hauska")) ;
garden_N = nKukko "puutarha" "puutarhan" "puutarhoja" ;
girl_N = nLukko "tyttö" ;
glove_N = regN "käsine" ;
@@ -121,7 +121,7 @@ lin
love_V2 = caseV2 (regV "rakastaa") partitive ;
man_N = mkN "mies" "miehen" "miehenä" "miestä" "mieheen"
"miehinä" "miehissä" "miesten" "miehiä" "miehiin" ;
married_A2 = mkA2 (mkA (nRae "avioitunut" "avioituneena")) (postpP genitive "kanssa") ;
married_A2 = mkA2 (mkA (nRae "avioitunut" "avioituneena")) (postPrep genitive "kanssa") ;
meat_N = nLukko "liha" ;
milk_N = nLukko "maito" ;
moon_N = regN "kuu" ;
@@ -134,7 +134,7 @@ lin
oil_N = nLukko "öljy" ;
old_A = mkADeg (nLukko "vanha") "vanhempi" "vanhin" ;
open_V2 = dirV2 (regV "avata") ;
---- paint_V2A = mkV2A (dirV2 (regV "maalata")) translative ;
paint_V2A = mkV2A (regV "maalata") accPrep (casePrep translative) ;
paper_N = reg2N "paperi" "papereita" ;
peace_N = nLukko "rauha" ;
pen_N = nLukko "kynä" ;
@@ -143,10 +143,10 @@ lin
play_V2 = dirV2 (regV "pelata") ; --- leikkiä, soittaa
policeman_N = regN "poliisi" ;
priest_N = regN "pappi" ;
---- probable_AS = mkAS (mkA (nNainen "todennäköistä")) ; --- for vowel harmony
probable_AS = mkAS (mkA (nNainen "todennäköistä")) ; --- for vowel harmony
queen_N = regN "kuningatar" ;
radio_N = reg2N "radio" "radioita" ;
---- rain_V = mkV0 (reg2V "sataa" "satoi") ;
rain_V0 = mkV0 (reg2V "sataa" "satoi") ;
read_V2 = dirV2 (regV "lukea") ;
red_A = regADeg "punainen" ;
religion_N = nLukko "uskonto" ;
@@ -189,7 +189,7 @@ lin
switch8off_V2 = dirV2 (regV "sammuttaa") ; ---
switch8on_V2 = dirV2 (regV "sytyttää") ; ---
table_N = nLukko "pöytä" ;
talk_V3 = mkV3 (regV "puhua") (caseP allative) (caseP elative) ;
talk_V3 = mkV3 (regV "puhua") (casePrep allative) (casePrep elative) ;
teacher_N = nLukko "opettaja" ;
teach_V2 = dirV2 (regV "opettaa") ;
television_N = reg2N "televisio" "televisioita" ;

View File

@@ -1071,7 +1071,8 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
in
case taa of {
"it" + _ => vHarkita soutaa ;
("st" | "nn" | "rr" | "ll") + _ => vJuosta soutaa soudan (juo + o+u+"t") (juo + "t"+u) ;
("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 ;
@@ -1080,7 +1081,7 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
reg2VerbH : (soutaa,souti : Str) -> VerbH = \soutaa,souti ->
let
soudat = regVerbH soutaa ;
---- soudat = regVerbH soutaa ;
soudan = weakGrade (init soutaa) + "n" ;
soudin = weakGrade souti + "n" ;
souden = init souti + "en" ;
@@ -1092,8 +1093,10 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
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) ;
_ => soudat
_ + ("da" | "dä") => vJuoda soutaa souti
---- _ => soudat
} ;
reg3VerbH : (_,_,_ : Str) -> VerbH = \soutaa,soudan,souti ->
@@ -1104,14 +1107,12 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
o = last juo ;
a = last taa ;
u = ifTok Str a "a" "u" "y" ;
soudin = weakGrade souti + "n" ;
soudat = reg2VerbH soutaa souti ;
soudin = souti + "n" ; ----weakGrade souti + "n" ;
----soudat = reg2VerbH soutaa souti ;
in case taa of {
"lla" | "llä" => vJuosta soutaa soudan (juo + o+u+"t") (juo + "t"+u) ;
"ota" | "ötä" => vPudota soutaa souti ;
"taa" | "tää" => vHuoltaa soutaa soudan souti soudin ;
_ + ("da" | "dä") => vJuoda soutaa souti ;
_ => soudat
"taa" | "tää" => vHuoltaa soutaa soudan souti soudin
---- _ => soudat
} ;
-- For "harppoa", "hukkua", "löytyä", with grade alternation.

View File

@@ -1,4 +1,4 @@
--# -path=.:../abstract:../../prelude
--# -path=.:../abstract:../common:../../prelude
--1 Finnish Lexical Paradigms
--
@@ -33,7 +33,7 @@ resource ParadigmsFin = open
CatFin
in {
-- flags optimize=values ;
-- flags optimize=all ;
flags optimize=noexpand ;
--2 Parameters
@@ -65,12 +65,10 @@ oper
-- of many-place verbs and adjective. A complement can be defined by
-- just a case, or a pre/postposition and a case.
PPosition : Type ;
prepP : Case -> Str -> PPosition ;
postpP : Case -> Str -> PPosition ;
caseP : Case -> PPosition ;
accusative : PPosition ;
prePrep : Case -> Str -> Prep ;
postPrep : Case -> Str -> Prep ;
casePrep : Case -> Prep ;
accusative : Prep ;
--2 Nouns
@@ -197,15 +195,15 @@ oper
-- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen",
-- have only their last part inflected.
nComp : Str -> N -> N ;
compN : Str -> N -> N ;
-- Nouns used as functions need a case, of which by far the commonest is
-- the genitive.
mkN2 : N -> Case -> N2 ;
genN2 : N -> N2 ;
mkN2 : N -> Prep -> N2 ;
genN2 : N -> N2 ;
mkN3 : N -> Case -> Case -> N3 ;
mkN3 : N -> Prep -> Prep -> N3 ;
-- Proper names can be formed by using declensions for nouns.
-- The plural forms are filtered away by the compiler.
@@ -221,7 +219,7 @@ oper
-- Two-place adjectives need a case for the second argument.
mkA2 : A -> PPosition -> A2 ;
mkA2 : A -> Prep -> A2 ;
-- Comparison adjectives have three forms. The comparative and the superlative
-- are always inflected in the same way, so the nominative of them is actually
@@ -286,7 +284,7 @@ oper
-- Two-place verbs need a case, and can have a pre- or postposition.
mkV2 : V -> PPosition -> V2 ;
mkV2 : V -> Prep -> V2 ;
-- If the complement needs just a case, the following special function can be used.
@@ -304,9 +302,9 @@ oper
-- Three-place (ditransitive) verbs need two prepositions, of which
-- the first one or both can be absent.
mkV3 : V -> PPosition -> PPosition -> V3 ; -- speak, with, about
dirV3 : V -> Case -> V3 ; -- give,_,to
dirdirV3 : V -> V3 ; -- acc, allat
mkV3 : V -> Prep -> Prep -> V3 ; -- speak, with, about
dirV3 : V -> Case -> V3 ; -- give,_,to
dirdirV3 : V -> V3 ; -- acc, allat
--3 Other complement patterns
@@ -316,25 +314,25 @@ oper
mkV0 : V -> V0 ;
mkVS : V -> VS ;
mkV2S : V -> Str -> V2S ;
mkV2S : V -> Prep -> V2S ;
mkVV : V -> VV ;
mkV2V : V -> Str -> Str -> V2V ;
mkVA : V -> VA ;
mkV2A : V -> Str -> V2A ;
mkV2V : V -> Prep -> V2V ;
mkVA : V -> Prep -> VA ;
mkV2A : V -> Prep -> Prep -> V2A ;
mkVQ : V -> VQ ;
mkV2Q : V -> Str -> V2Q ;
mkV2Q : V -> Prep -> V2Q ;
mkAS : A -> AS ;
mkA2S : A -> Str -> A2S ;
mkA2S : A -> Prep -> A2S ;
mkAV : A -> AV ;
mkA2V : A -> Str -> A2V ;
mkA2V : A -> Prep -> A2V ;
-- Notice: categories $V2S, V2V, V2A, V2Q$ are in v 1.0 treated
-- 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, V2A, V2Q : Type ;
V0, V2S, V2V, V2Q : Type ;
AS, A2S, AV, A2V : Type ;
-- The definitions should not bother the user of the API. So they are
@@ -358,25 +356,20 @@ oper
ablative = Ablat ;
allative = Allat ;
PPosition : Type = {c : NPForm ; s3 : Str ; p : Bool} ;
prepP : Case -> Str -> PPosition =
\c,p -> {c = NPCase c ; s3 = p ; p = True} ;
postpP : Case -> Str -> PPosition =
\c,p -> {c = NPCase c ; s3 = p ; p = False} ;
caseP : Case -> PPosition =
\c -> {c = NPCase c ; s3 = [] ; p = True} ;
accusative = {c = NPAccNom ; s3 = [] ; p = True} ;
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 = <>} ;
casePrep : Case -> Prep =
\c -> {c = NPCase c ; s = [] ; isPre = True ; lock_Prep = <>} ;
accPrep = {c = NPAccNom ; s = [] ; isPre = True ; lock_Prep = <>} ;
mkN = \a,b,c,d,e,f,g,h,i,j ->
mkNoun a b c d e f g h i j ** {lock_N = <>} ;
regN = \vesi ->
---- nhn (regNounH vesi) ** {lock_N = <>} ;
let
esi = Predef.dp 3 vesi ; -- analysis: suffixes
si = Predef.dp 2 esi ;
i = last si ;
s = init si ;
a = if_then_Str (pbool2bool (Predef.occurs "aou" vesi)) "a" "ä" ;
ves = init vesi ; -- synthesis: prefixes
vet = strongGrade ves ;
@@ -384,35 +377,29 @@ oper
in nhn (
case esi of {
"uus" | "yys" => sRakkaus vesi ;
"nen" => sNainen (Predef.tk 3 vesi + ("st" + a)) ;
_ => case si of {
"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)) ;
_ => case i of {
"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)
}
}
_ + "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 ->
---- nhn (reg2NounH savi savia)
let
savit = regN savi ;
ia = Predef.dp 2 savia ;
@@ -424,37 +411,33 @@ oper
case <o,ia> of {
<"i","ia"> => nhn (sArpi savi) ;
<"i","iä"> => nhn (sSylki savi) ;
<"i","ta"> | <"i","tä"> => nhn (sTohtori (savi + a)) ;
<"o","ta"> | <"ö","tä"> => nhn (sRadio savi) ;
<"a","ta"> | <"ä","tä"> => nhn (sPeruna savi) ;
<"a","ia"> | <"a","ja"> => nhn (sKukko savi savin savia) ;
<"i","ta"> | <"i",""> => 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
vesit = reg2N vesi vesiä ;
si = Predef.dp 2 vesi ;
i = last si ;
a = last vesiä ;
s = last (Predef.tk 2 vesiä)
a = last vesiä
in
case si of {
"us" | "ys" =>
ifTok CommonNoun (Predef.dp 3 veden) "den"
(nhn (sRakkaus vesi))
(nhn (sTilaus vesi (veden + a))) ;
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 (Predef.tk 1 vesi + ("en" + a))) ;
"si" => nhn (sSusi vesi veden (Predef.tk 2 vesi + ("ten" + 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) ;
_ => case i of {
"a" | "o" | "u" | "y" | "ä" | "ö" => nhn (sKukko vesi veden vesiä) ;
"i" => nhn (sKorpi vesi veden (init veden + "n" + a)) ;
_ => vesit
}
} ** {lock_N = <>} ;
_ + ("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 = <>} ;
@@ -485,14 +468,15 @@ reg3N = \vesi,veden,vesi
let a = vowelHarmony meri in
sgpartN (reg2N meri (meri + a)) (init meri + "ta") ;
nComp = \s,n -> {s = \\c => s ++ n.s ! c ; g = n.g ; lock_N = <>} ;
-- mkN2 = \n,c -> n2n n ** {c = NPCase c ; lock_N2 = <>} ;
-- mkN3 = \n,c,e -> n2n n ** {c = NPCase c ; c2 = NPCase e ; lock_N3 = <>} ;
-- genN2 = \n -> mkN2 n genitive ;
compN = \s,n -> {s = \\c => s ++ n.s ! c ; g = n.g ; lock_N = <>} ;
mkN2 = \n,c -> n ** {c2 = c ; lock_N2 = <>} ;
mkN3 = \n,c,e -> n ** {c2 = c ; c3 = e ; lock_N3 = <>} ;
genN2 = \n -> mkN2 n (casePrep genitive) ;
mkPN n = mkProperName n ** {lock_PN = <>} ;
---- mkA = \x -> noun2adj x ** {lock_A = <>} ;
---- mkA2 = \x,c -> x ** {s3 = c.s3 ; p = c.p ; c = c.c ; lock_A2 = <>} ;
mkA = \x -> {s = \\_ => (noun2adj x).s ; lock_A = <>} ;
mkA2 = \x,c -> x ** {c2 = c ; lock_A2 = <>} ;
mkADeg x kivempi kivin =
let
a = last (x.s ! ((NCase Sg Part))) ; ---- gives "kivinta"
@@ -533,41 +517,37 @@ reg3N = \vesi,veden,vesi
v2v (MorphoFin.vHuoltaa ottaa otan otti otin) ** {sc = NPCase Nom ; lock_V = <>} ;
---- mkV2 = \v,c -> v ** {s3 = c.s3 ; p = c.p ; c = c.c ; lock_V2 = <>} ;
---- caseV2 = \v,c -> mkV2 v (caseP c) ;
---- dirV2 v = mkTransVerbDir v ** {lock_V2 = <>} ;
mkV2 = \v,c -> v ** {c2 = c ; lock_V2 = <>} ;
caseV2 = \v,c -> mkV2 v (casePrep c) ;
dirV2 v = mkV2 v accPrep ;
mkAdv : Str -> Adv = \s -> {s = s ; lock_Adv = <>} ;
{-
mkV3 v p q = v **
{s3 = p.s3 ; p = p.p ; c = p.c ; s5 = q.s3 ; p2 = q.p ; c2 = q.c ;
lock_V3 = <>} ;
dirV3 v p = mkV3 v accusative (caseP p) ;
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 ** {c2 = "to" ; lock_VV = <>} ;
mkVV v = v ** {lock_VV = <>} ;
mkVQ v = v ** {lock_VQ = <>} ;
V0 : Type = V ;
V2S, V2V, V2Q, V2A : Type = V2 ;
V2S, V2V, V2Q : Type = V2 ;
AS, A2S, AV : Type = A ;
A2V : Type = A2 ;
mkV0 v = v ** {lock_V = <>} ;
mkV2S v p = mkV2 v p ** {lock_V2 = <>} ;
mkV2V v p t = mkV2 v p ** {s4 = t ; lock_V2 = <>} ;
mkVA v = v ** {lock_VA = <>} ;
mkV2A v p = mkV2 v p ** {lock_V2A = <>} ;
mkV2V v p = mkV2 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 = mkV2 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 = <>} ;
-}
} ;

View File

@@ -1,95 +0,0 @@
--1 Finnish parameters
--
-- This module defines the parameter types specific to Finnish.
-- Some parameters, such as $Number$, are inherited from $ParamX$.
resource ParamFin = ParamX ** open Prelude in {
--2 For $Noun$
-- This is the $Case$ as needed for both nouns and $NP$s.
param
Case = Nom | Gen | Part | Transl | Ess
| Iness | Elat | Illat | Adess | Ablat | Allat
| Abess ; -- Comit, Instruct in NForm
NForm = NCase Number Case
| NComit | NInstruct -- no number dist
| NPossNom | NPossGenPl | NPossTransl Number | NPossIllat Number ;
-- Agreement of $NP$ is a record. We'll add $Gender$ later.
oper
Agr = {n : Number ; p : Person} ;
--
--2 Adjectives
--
-- The major division is between the comparison degrees. A degree fixed,
-- an adjective is like common nouns, except for the adverbial form.
param
AForm = AN NForm | AAdv ;
oper
Adjective : Type = {s : Degree => AForm => Str} ;
--2 Noun phrases
--
-- Two forms of *virtual accusative* are needed for nouns in singular,
-- the nominative and the genitive one ("ostan talon"/"osta talo").
-- For nouns in plural, only a nominative accusative exist. Pronouns
-- have a uniform, special accusative form ("minut", etc).
param
NPForm = NPCase Case | NPAccNom | NPAccGen ;
--2 For $Verb$
-- A special form is needed for the negated plural imperative.
param
VForm =
Inf
| Presn Number Person
| Impf Number Person
| Condit Number Person
| Imper Number
| ImperP3 Number
| ImperP1Pl
| ImpNegPl
| Pass Bool
| PastPartAct AForm
| PastPartPass AForm
| Inf3Iness -- 5 forms acc. to Karlsson
| Inf3Elat
| Inf3Illat
| Inf3Adess
| Inf3Abess
;
SType = SDecl | SQuest ;
--2 For $Relative$
RAgr = RNoAg | RAg {n : Number ; p : Person} ;
--2 For $Numeral$
CardOrd = NCard | NOrd ;
DForm = unit | teen | ten ;
--2 Transformations between parameter types
oper
agrP3 : Number -> Agr = \n ->
{n = n ; p = P3} ;
conjAgr : Agr -> Agr -> Agr = \a,b -> {
n = conjNumber a.n b.n ;
p = conjPerson a.p b.p
} ;
}

View File

@@ -7,13 +7,101 @@
-- implement $Test$, it moreover contains regular lexical
-- patterns needed for $Lex$.
resource ResFin = ParamFin ** open Prelude in {
resource ResFin = ParamX ** open Prelude in {
flags optimize=all ;
oper
Compl : Type = {s : Str ; c : NPForm} ;
--2 Parameterd for $Noun$
-- This is the $Case$ as needed for both nouns and $NP$s.
param
Case = Nom | Gen | Part | Transl | Ess
| Iness | Elat | Illat | Adess | Ablat | Allat
| Abess ; -- Comit, Instruct in NForm
NForm = NCase Number Case
| NComit | NInstruct -- no number dist
| NPossNom | NPossGenPl | NPossTransl Number | NPossIllat Number ;
-- Agreement of $NP$ is a record. We'll add $Gender$ later.
oper
Agr = {n : Number ; p : Person} ;
--
--2 Adjectives
--
-- The major division is between the comparison degrees. A degree fixed,
-- an adjective is like common nouns, except for the adverbial form.
param
AForm = AN NForm | AAdv ;
oper
Adjective : Type = {s : Degree => AForm => Str} ;
--2 Noun phrases
--
-- Two forms of *virtual accusative* are needed for nouns in singular,
-- the nominative and the genitive one ("ostan talon"/"osta talo").
-- For nouns in plural, only a nominative accusative exist. Pronouns
-- have a uniform, special accusative form ("minut", etc).
param
NPForm = NPCase Case | NPAccNom | NPAccGen ;
--2 For $Verb$
-- A special form is needed for the negated plural imperative.
param
VForm =
Inf
| Presn Number Person
| Impf Number Person
| Condit Number Person
| Imper Number
| ImperP3 Number
| ImperP1Pl
| ImpNegPl
| Pass Bool
| PastPartAct AForm
| PastPartPass AForm
| Inf3Iness -- 5 forms acc. to Karlsson
| Inf3Elat
| Inf3Illat
| Inf3Adess
| Inf3Abess
;
SType = SDecl | SQuest ;
--2 For $Relative$
RAgr = RNoAg | RAg {n : Number ; p : Person} ;
--2 For $Numeral$
CardOrd = NCard | NOrd ;
DForm = unit | teen | ten ;
--2 Transformations between parameter types
oper
agrP3 : Number -> Agr = \n ->
{n = n ; p = P3} ;
conjAgr : Agr -> Agr -> Agr = \a,b -> {
n = conjNumber a.n b.n ;
p = conjPerson a.p b.p
} ;
---
Compl : Type = {s : Str ; c : NPForm ; isPre : Bool} ;
-- For $Verb$.