mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-13 06:49:31 -06:00
improved performance of ParadigmsFin; merged Param with Res
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
--1 English parameters
|
||||
--
|
||||
-- This module defines the parameter types specific to English.
|
||||
-- Some parameters, such as $Number$, are inherited from $ParamX$.
|
||||
|
||||
resource ParamEng = ParamX ** {
|
||||
|
||||
--2 For $Noun$
|
||||
|
||||
-- This is the worst-case $Case$ needed for pronouns.
|
||||
|
||||
param
|
||||
Case = Nom | Acc | Gen ;
|
||||
|
||||
-- Agreement of $NP$ is a record. We'll add $Gender$ later.
|
||||
|
||||
oper
|
||||
Agr = {n : Number ; p : Person} ;
|
||||
|
||||
param
|
||||
Gender = Neutr | Masc | Fem ;
|
||||
|
||||
--2 For $Verb$
|
||||
|
||||
-- Only these five forms are needed for open-lexicon verbs.
|
||||
|
||||
param
|
||||
VForm = VInf | VPres | VPast | VPPart | VPresPart ;
|
||||
|
||||
-- The order of sentence is needed already in $VP$.
|
||||
|
||||
Order = ODir | OQuest ;
|
||||
|
||||
|
||||
--2 For $Adjective$
|
||||
|
||||
AForm = AAdj Degree | AAdv ;
|
||||
|
||||
--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
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -7,11 +7,63 @@
|
||||
-- implement $Test$, it moreover contains regular lexical
|
||||
-- patterns needed for $Lex$.
|
||||
|
||||
resource ResEng = ParamEng ** open Prelude in {
|
||||
resource ResEng = ParamX ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
|
||||
-- Some parameters, such as $Number$, are inherited from $ParamX$.
|
||||
|
||||
--2 For $Noun$
|
||||
|
||||
-- This is the worst-case $Case$ needed for pronouns.
|
||||
|
||||
param
|
||||
Case = Nom | Acc | Gen ;
|
||||
|
||||
-- Agreement of $NP$ is a record. We'll add $Gender$ later.
|
||||
|
||||
oper
|
||||
Agr = {n : Number ; p : Person} ;
|
||||
|
||||
param
|
||||
Gender = Neutr | Masc | Fem ;
|
||||
|
||||
--2 For $Verb$
|
||||
|
||||
-- Only these five forms are needed for open-lexicon verbs.
|
||||
|
||||
param
|
||||
VForm = VInf | VPres | VPast | VPPart | VPresPart ;
|
||||
|
||||
-- The order of sentence is needed already in $VP$.
|
||||
|
||||
Order = ODir | OQuest ;
|
||||
|
||||
|
||||
--2 For $Adjective$
|
||||
|
||||
AForm = AAdj Degree | AAdv ;
|
||||
|
||||
--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
|
||||
} ;
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
|
||||
@@ -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} ;
|
||||
|
||||
@@ -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" ;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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","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
|
||||
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 = <>} ;
|
||||
-}
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
@@ -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
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -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$.
|
||||
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
--1 German parameters
|
||||
--
|
||||
-- This module defines the parameter types specific to German.
|
||||
-- Some parameters, such as $Number$, are inherited from $ParamX$.
|
||||
--
|
||||
|
||||
resource ParamGer = ParamX ** {
|
||||
|
||||
--2 For $Noun$
|
||||
|
||||
-- These are the standard four-value case and three-value gender.
|
||||
|
||||
param
|
||||
Case = Nom | Acc | Dat | Gen ;
|
||||
Gender = Masc | Fem | Neutr ;
|
||||
|
||||
-- Complex $CN$s, like adjectives, have strong and weak forms.
|
||||
|
||||
Adjf = Strong | Weak ;
|
||||
|
||||
-- Gender distinctions are only made in the singular.
|
||||
|
||||
GenNum = GSg Gender | GPl ;
|
||||
|
||||
-- Agreement of $NP$ is a record.
|
||||
|
||||
oper Agr = {n : Number ; p : Person} ;
|
||||
|
||||
-- Pronouns are the worst-case noun phrases, which have both case
|
||||
-- and possessive forms.
|
||||
|
||||
param NPForm = NPCase Case | NPPoss GenNum Case ;
|
||||
|
||||
--2 For $Adjective$
|
||||
|
||||
-- The predicative form of adjectives is not inflected further.
|
||||
|
||||
param AForm = APred | AMod GenNum Case ;
|
||||
|
||||
|
||||
--2 For $Verb$
|
||||
|
||||
param VForm =
|
||||
VInf
|
||||
| VPresInd Number Person
|
||||
| VPresSubj Number Person
|
||||
| VImper Number
|
||||
| VImpfInd Number Person
|
||||
| VImpfSubj Number Person
|
||||
| VPresPart AForm
|
||||
| VPastPart AForm ;
|
||||
|
||||
param VPForm =
|
||||
VPFinite Tense Anteriority
|
||||
| VPImperat
|
||||
| VPInfinit Anteriority ;
|
||||
|
||||
param VAux = VHaben | VSein ;
|
||||
|
||||
param VType = VAct | VRefl Case ;
|
||||
|
||||
-- The order of sentence is depends on whether it is used as a main
|
||||
-- clause, inverted, or subordinate.
|
||||
|
||||
param
|
||||
Order = Main | Inv | Sub ;
|
||||
|
||||
|
||||
--2 For $Relative$
|
||||
|
||||
RAgr = RNoAg | RAg {n : Number ; p : Person} ;
|
||||
|
||||
--2 For $Numeral$
|
||||
|
||||
CardOrd = NCard | NOrd AForm ;
|
||||
DForm = DUnit | DTeen | DTen ;
|
||||
|
||||
--2 Transformations between parameter types
|
||||
|
||||
oper
|
||||
agrP3 : Number -> Agr = \n ->
|
||||
{n = n ; p = P3} ;
|
||||
|
||||
gennum : Gender -> Number -> GenNum = \g,n ->
|
||||
case n of {
|
||||
Sg => GSg g ;
|
||||
Pl => GPl
|
||||
} ;
|
||||
|
||||
-- Needed in $RelativeGer$.
|
||||
|
||||
numGenNum : GenNum -> Number = \gn ->
|
||||
case gn of {
|
||||
GSg _ => Sg ;
|
||||
GPl => Pl
|
||||
} ;
|
||||
|
||||
-- Used in $NounGer$.
|
||||
|
||||
agrAdj : Gender -> Adjf -> Number -> Case -> AForm = \g,a,n,c ->
|
||||
let
|
||||
gn = gennum g n ;
|
||||
e = AMod (GSg Fem) Nom ;
|
||||
en = AMod (GSg Masc) Acc ;
|
||||
in
|
||||
case a of {
|
||||
Strong => AMod gn c ;
|
||||
_ => case <gn,c> of {
|
||||
<GSg _, Nom> => e ;
|
||||
<GSg Masc,Acc> => en ;
|
||||
<GSg _, Acc> => e ;
|
||||
_ => en
|
||||
}
|
||||
} ;
|
||||
|
||||
-- This is used twice in NounGer.
|
||||
|
||||
adjfCase : Adjf -> Case -> Adjf = \a,c -> case <a,c> of {
|
||||
<Strong, Nom|Acc> => Strong ;
|
||||
_ => Weak
|
||||
} ;
|
||||
|
||||
vFin : Tense -> Agr -> VForm = \t,a ->
|
||||
case t of {
|
||||
Pres => VPresInd a.n a.p ;
|
||||
Past => VImpfInd a.n a.p ;
|
||||
_ => VInf --- never used
|
||||
} ;
|
||||
|
||||
conjAgr : Agr -> Agr -> Agr = \a,b -> {
|
||||
n = conjNumber a.n b.n ;
|
||||
p = conjPerson a.p b.p
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -9,10 +9,136 @@
|
||||
-- implement $Test$, it moreover contains some lexical
|
||||
-- patterns needed for $Lex$.
|
||||
|
||||
resource ResGer = ParamGer ** open Prelude in {
|
||||
resource ResGer = ParamX ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
--2 For $Noun$
|
||||
|
||||
-- These are the standard four-value case and three-value gender.
|
||||
|
||||
param
|
||||
Case = Nom | Acc | Dat | Gen ;
|
||||
Gender = Masc | Fem | Neutr ;
|
||||
|
||||
-- Complex $CN$s, like adjectives, have strong and weak forms.
|
||||
|
||||
Adjf = Strong | Weak ;
|
||||
|
||||
-- Gender distinctions are only made in the singular.
|
||||
|
||||
GenNum = GSg Gender | GPl ;
|
||||
|
||||
-- Agreement of $NP$ is a record.
|
||||
|
||||
oper Agr = {n : Number ; p : Person} ;
|
||||
|
||||
-- Pronouns are the worst-case noun phrases, which have both case
|
||||
-- and possessive forms.
|
||||
|
||||
param NPForm = NPCase Case | NPPoss GenNum Case ;
|
||||
|
||||
--2 For $Adjective$
|
||||
|
||||
-- The predicative form of adjectives is not inflected further.
|
||||
|
||||
param AForm = APred | AMod GenNum Case ;
|
||||
|
||||
|
||||
--2 For $Verb$
|
||||
|
||||
param VForm =
|
||||
VInf
|
||||
| VPresInd Number Person
|
||||
| VPresSubj Number Person
|
||||
| VImper Number
|
||||
| VImpfInd Number Person
|
||||
| VImpfSubj Number Person
|
||||
| VPresPart AForm
|
||||
| VPastPart AForm ;
|
||||
|
||||
param VPForm =
|
||||
VPFinite Tense Anteriority
|
||||
| VPImperat
|
||||
| VPInfinit Anteriority ;
|
||||
|
||||
param VAux = VHaben | VSein ;
|
||||
|
||||
param VType = VAct | VRefl Case ;
|
||||
|
||||
-- The order of sentence is depends on whether it is used as a main
|
||||
-- clause, inverted, or subordinate.
|
||||
|
||||
param
|
||||
Order = Main | Inv | Sub ;
|
||||
|
||||
|
||||
--2 For $Relative$
|
||||
|
||||
RAgr = RNoAg | RAg {n : Number ; p : Person} ;
|
||||
|
||||
--2 For $Numeral$
|
||||
|
||||
CardOrd = NCard | NOrd AForm ;
|
||||
DForm = DUnit | DTeen | DTen ;
|
||||
|
||||
--2 Transformations between parameter types
|
||||
|
||||
oper
|
||||
agrP3 : Number -> Agr = \n ->
|
||||
{n = n ; p = P3} ;
|
||||
|
||||
gennum : Gender -> Number -> GenNum = \g,n ->
|
||||
case n of {
|
||||
Sg => GSg g ;
|
||||
Pl => GPl
|
||||
} ;
|
||||
|
||||
-- Needed in $RelativeGer$.
|
||||
|
||||
numGenNum : GenNum -> Number = \gn ->
|
||||
case gn of {
|
||||
GSg _ => Sg ;
|
||||
GPl => Pl
|
||||
} ;
|
||||
|
||||
-- Used in $NounGer$.
|
||||
|
||||
agrAdj : Gender -> Adjf -> Number -> Case -> AForm = \g,a,n,c ->
|
||||
let
|
||||
gn = gennum g n ;
|
||||
e = AMod (GSg Fem) Nom ;
|
||||
en = AMod (GSg Masc) Acc ;
|
||||
in
|
||||
case a of {
|
||||
Strong => AMod gn c ;
|
||||
_ => case <gn,c> of {
|
||||
<GSg _, Nom> => e ;
|
||||
<GSg Masc,Acc> => en ;
|
||||
<GSg _, Acc> => e ;
|
||||
_ => en
|
||||
}
|
||||
} ;
|
||||
|
||||
-- This is used twice in NounGer.
|
||||
|
||||
adjfCase : Adjf -> Case -> Adjf = \a,c -> case <a,c> of {
|
||||
<Strong, Nom|Acc> => Strong ;
|
||||
_ => Weak
|
||||
} ;
|
||||
|
||||
vFin : Tense -> Agr -> VForm = \t,a ->
|
||||
case t of {
|
||||
Pres => VPresInd a.n a.p ;
|
||||
Past => VImpfInd a.n a.p ;
|
||||
_ => VInf --- never used
|
||||
} ;
|
||||
|
||||
conjAgr : Agr -> Agr -> Agr = \a,b -> {
|
||||
n = conjNumber a.n b.n ;
|
||||
p = conjPerson a.p b.p
|
||||
} ;
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
-- For conciseness and abstraction, we first define a method for
|
||||
|
||||
@@ -6,10 +6,143 @@
|
||||
-- which depends on [DiffRomance DiffRomance.html].
|
||||
--
|
||||
|
||||
resource CommonRomance = ParamRomance ** open Prelude in {
|
||||
resource CommonRomance = ParamX ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
--2 Enumerated parameter types for morphology
|
||||
--
|
||||
-- These types are the ones found in school grammars.
|
||||
-- Their parameter values are atomic.
|
||||
|
||||
param
|
||||
|
||||
Gender = Masc | Fem ;
|
||||
|
||||
Mood = Indic | Conjunct ;
|
||||
|
||||
-- There are different types of clitic pronouns (as for position).
|
||||
-- Examples of each: "Giovanni" ; "io" ; "lui" ; "noi".
|
||||
|
||||
ClitType = Clit0 | Clit1 | Clit2 | Clit3 ;
|
||||
|
||||
-- Adjectives are inflected in gender and number, and there is also an
|
||||
-- adverbial form (e.g. "infiniment"), which has different paradigms and
|
||||
-- can even be irregular ("bien").
|
||||
-- Comparative adjectives are moreover inflected in degree
|
||||
-- (which in Romance is usually syntactic, though).
|
||||
|
||||
AForm = AF Gender Number | AA ;
|
||||
|
||||
-- Gender is not morphologically determined for first and second person pronouns.
|
||||
|
||||
PronGen = PGen Gender | PNoGen ;
|
||||
|
||||
-- Cardinal numerals have gender, ordinal numerals have full number as well.
|
||||
|
||||
CardOrd = NCard Gender | NOrd Gender Number ;
|
||||
|
||||
-- The following coercions are useful:
|
||||
|
||||
oper
|
||||
prongen2gender : PronGen -> Gender = \p -> case p of {
|
||||
PGen g => g ;
|
||||
PNoGen => variants {Masc ; Fem} --- the best we can do for je, tu, nous, vous
|
||||
} ;
|
||||
|
||||
|
||||
aform2gender : AForm -> Gender = \a -> case a of {
|
||||
AF g _ => g ;
|
||||
_ => Masc -- "le plus lentement"
|
||||
} ;
|
||||
aform2number : AForm -> Number = \a -> case a of {
|
||||
AF _ n => n ;
|
||||
_ => Sg -- "le plus lentement"
|
||||
} ;
|
||||
|
||||
conjGender : Gender -> Gender -> Gender = \m,n ->
|
||||
case <m,n> of {
|
||||
<Fem,Fem> => Fem ;
|
||||
_ => Fem
|
||||
} ;
|
||||
|
||||
conjAgr : Agr -> Agr -> Agr = \a,b -> {
|
||||
g = conjGender a.g b.g ;
|
||||
n = conjNumber a.n b.n ;
|
||||
p = conjPerson a.p b.p
|
||||
} ;
|
||||
|
||||
|
||||
--3 Verbs
|
||||
--
|
||||
-- In the current syntax, we use
|
||||
-- a reduced conjugation with only the present tense infinitive,
|
||||
-- indicative, subjunctive, and imperative forms.
|
||||
-- But our morphology has full Bescherelle conjunctions:
|
||||
-- so we use a coercion between full and reduced verbs.
|
||||
-- The full conjugations and the coercions are defined separately for French
|
||||
-- and Italian, since they are not identical. The differences are mostly due
|
||||
-- to Bescherelle structuring the forms in different groups; the
|
||||
-- gerund and the present participles show real differences.
|
||||
|
||||
param
|
||||
VF =
|
||||
VInfin
|
||||
| VFin TMood Number Person
|
||||
| VImper NumPersI
|
||||
| VPart Gender Number
|
||||
| VGer
|
||||
;
|
||||
|
||||
TMood =
|
||||
VPres Mood
|
||||
| VImperf Mood
|
||||
| VPasse
|
||||
| VFut
|
||||
| VCondit
|
||||
;
|
||||
|
||||
NumPersI = SgP2 | PlP1 | PlP2 ;
|
||||
|
||||
VPForm =
|
||||
VPFinite TMood Anteriority
|
||||
| VPImperat
|
||||
| VPInfinit Anteriority ;
|
||||
|
||||
-- Agreement of adjectives, verb phrases, and relative pronouns.
|
||||
|
||||
oper
|
||||
AAgr : Type = {g : Gender ; n : Number} ;
|
||||
Agr : Type = AAgr ** {p : Person} ;
|
||||
|
||||
param
|
||||
RAgr = RAg {g : Gender ; n : Number} | RNoAg ; --- AAgr
|
||||
|
||||
oper
|
||||
aagr : Gender -> Number -> AAgr = \g,n ->
|
||||
{g = g ; n = n} ;
|
||||
agrP3 : Gender -> Number -> Agr = \g,n ->
|
||||
aagr g n ** {p = P3} ;
|
||||
|
||||
|
||||
vf2numpers : VF -> (Number * Person) = \v -> case v of {
|
||||
VFin _ n p => <n,p> ;
|
||||
_ => <Sg,P3> ----
|
||||
} ;
|
||||
|
||||
presInd = VPres Indic ;
|
||||
|
||||
-- The imperative forms depend on number and person.
|
||||
|
||||
vImper : Number -> Person -> VF = \n,p -> case <n,p> of {
|
||||
<Sg,P2> => VImper SgP2 ;
|
||||
<Pl,P1> => VImper PlP1 ;
|
||||
<Pl,P2> => VImper PlP2 ;
|
||||
_ => VInfin
|
||||
} ;
|
||||
|
||||
---
|
||||
|
||||
oper
|
||||
genForms : Str -> Str -> Gender => Str = \bon,bonne ->
|
||||
table {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete ConjunctionRomance of Conjunction =
|
||||
CatRomance ** open ParamRomance, ResRomance, Coordination, Prelude in {
|
||||
CatRomance ** open CommonRomance, ResRomance, Coordination, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
--1 Romance Word Classes and Morphological Parameters
|
||||
--
|
||||
|
||||
resource ParamRomance = ParamX ** open Prelude in {
|
||||
|
||||
-- This is a resource module for Romance grammars, currently instantiated for
|
||||
-- French, Italian, and Spanish. It defines the
|
||||
-- morphological parameters that are common to all Romance languages.
|
||||
-- The guiding principle has been
|
||||
-- to share as much as possible, which has two advantages: it saves work in
|
||||
-- encoding, and it shows how the languages are related.
|
||||
-- Those parameters that differ are defined in [DiffRomance DiffRomance.html].
|
||||
-- Some parameters are shared even more widely, such as $Number$ and $Person$.
|
||||
-- They are defined in [ParamX ParamX.html].
|
||||
|
||||
|
||||
--2 Enumerated parameter types for morphology
|
||||
--
|
||||
-- These types are the ones found in school grammars.
|
||||
-- Their parameter values are atomic.
|
||||
|
||||
param
|
||||
|
||||
Gender = Masc | Fem ;
|
||||
|
||||
Mood = Indic | Conjunct ;
|
||||
|
||||
-- There are different types of clitic pronouns (as for position).
|
||||
-- Examples of each: "Giovanni" ; "io" ; "lui" ; "noi".
|
||||
|
||||
ClitType = Clit0 | Clit1 | Clit2 | Clit3 ;
|
||||
|
||||
-- Adjectives are inflected in gender and number, and there is also an
|
||||
-- adverbial form (e.g. "infiniment"), which has different paradigms and
|
||||
-- can even be irregular ("bien").
|
||||
-- Comparative adjectives are moreover inflected in degree
|
||||
-- (which in Romance is usually syntactic, though).
|
||||
|
||||
AForm = AF Gender Number | AA ;
|
||||
|
||||
-- Gender is not morphologically determined for first and second person pronouns.
|
||||
|
||||
PronGen = PGen Gender | PNoGen ;
|
||||
|
||||
-- Cardinal numerals have gender, ordinal numerals have full number as well.
|
||||
|
||||
CardOrd = NCard Gender | NOrd Gender Number ;
|
||||
|
||||
-- The following coercions are useful:
|
||||
|
||||
oper
|
||||
prongen2gender : PronGen -> Gender = \p -> case p of {
|
||||
PGen g => g ;
|
||||
PNoGen => variants {Masc ; Fem} --- the best we can do for je, tu, nous, vous
|
||||
} ;
|
||||
|
||||
|
||||
aform2gender : AForm -> Gender = \a -> case a of {
|
||||
AF g _ => g ;
|
||||
_ => Masc -- "le plus lentement"
|
||||
} ;
|
||||
aform2number : AForm -> Number = \a -> case a of {
|
||||
AF _ n => n ;
|
||||
_ => Sg -- "le plus lentement"
|
||||
} ;
|
||||
|
||||
conjGender : Gender -> Gender -> Gender = \m,n ->
|
||||
case <m,n> of {
|
||||
<Fem,Fem> => Fem ;
|
||||
_ => Fem
|
||||
} ;
|
||||
|
||||
conjAgr : Agr -> Agr -> Agr = \a,b -> {
|
||||
g = conjGender a.g b.g ;
|
||||
n = conjNumber a.n b.n ;
|
||||
p = conjPerson a.p b.p
|
||||
} ;
|
||||
|
||||
|
||||
--3 Verbs
|
||||
--
|
||||
-- In the current syntax, we use
|
||||
-- a reduced conjugation with only the present tense infinitive,
|
||||
-- indicative, subjunctive, and imperative forms.
|
||||
-- But our morphology has full Bescherelle conjunctions:
|
||||
-- so we use a coercion between full and reduced verbs.
|
||||
-- The full conjugations and the coercions are defined separately for French
|
||||
-- and Italian, since they are not identical. The differences are mostly due
|
||||
-- to Bescherelle structuring the forms in different groups; the
|
||||
-- gerund and the present participles show real differences.
|
||||
|
||||
param
|
||||
VF =
|
||||
VInfin
|
||||
| VFin TMood Number Person
|
||||
| VImper NumPersI
|
||||
| VPart Gender Number
|
||||
| VGer
|
||||
;
|
||||
|
||||
TMood =
|
||||
VPres Mood
|
||||
| VImperf Mood
|
||||
| VPasse
|
||||
| VFut
|
||||
| VCondit
|
||||
;
|
||||
|
||||
NumPersI = SgP2 | PlP1 | PlP2 ;
|
||||
|
||||
VPForm =
|
||||
VPFinite TMood Anteriority
|
||||
| VPImperat
|
||||
| VPInfinit Anteriority ;
|
||||
|
||||
-- Agreement of adjectives, verb phrases, and relative pronouns.
|
||||
|
||||
oper
|
||||
AAgr : Type = {g : Gender ; n : Number} ;
|
||||
Agr : Type = AAgr ** {p : Person} ;
|
||||
|
||||
param
|
||||
RAgr = RAg {g : Gender ; n : Number} | RNoAg ; --- AAgr
|
||||
|
||||
oper
|
||||
aagr : Gender -> Number -> AAgr = \g,n ->
|
||||
{g = g ; n = n} ;
|
||||
agrP3 : Gender -> Number -> Agr = \g,n ->
|
||||
aagr g n ** {p = P3} ;
|
||||
|
||||
|
||||
vf2numpers : VF -> (Number * Person) = \v -> case v of {
|
||||
VFin _ n p => <n,p> ;
|
||||
_ => <Sg,P3> ----
|
||||
} ;
|
||||
|
||||
presInd = VPres Indic ;
|
||||
|
||||
-- The imperative forms depend on number and person.
|
||||
|
||||
vImper : Number -> Person -> VF = \n,p -> case <n,p> of {
|
||||
<Sg,P2> => VImper SgP2 ;
|
||||
<Pl,P1> => VImper PlP1 ;
|
||||
<Pl,P2> => VImper PlP2 ;
|
||||
_ => VInfin
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -5,11 +5,109 @@
|
||||
-- implement [Test Test.html] is defined in [ResScandinavian ResScandinavian.html],
|
||||
-- which depends on [DiffScandinavian DiffScandinavian.html].
|
||||
|
||||
resource CommonScand = ParamScand ** open Prelude in {
|
||||
resource CommonScand = ParamX ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
oper
|
||||
param
|
||||
Species = Indef | Def ;
|
||||
Case = Nom | Gen ;
|
||||
Voice = Act | Pass ;
|
||||
|
||||
Order = Main | Inv | Sub ;
|
||||
|
||||
DetSpecies = DIndef | DDef Species ;
|
||||
|
||||
GenNum = SgUtr | SgNeutr | Plg ;
|
||||
|
||||
AForm = AF AFormGrad Case ;
|
||||
|
||||
AFormGrad =
|
||||
APosit AFormPos
|
||||
| ACompar
|
||||
| ASuperl AFormSup ;
|
||||
|
||||
-- The $Number$ in $Weak$ only matters in "lilla"/"små".
|
||||
|
||||
AFormPos = Strong GenNum | Weak Number ;
|
||||
AFormSup = SupStrong | SupWeak ;
|
||||
|
||||
VForm =
|
||||
VF VFin
|
||||
| VI VInf ;
|
||||
|
||||
VFin =
|
||||
VPres Voice
|
||||
| VPret Voice
|
||||
| VImper Voice ;
|
||||
|
||||
VInf =
|
||||
VInfin Voice
|
||||
| VSupin Voice
|
||||
| VPtPret AFormPos Case ;
|
||||
|
||||
VPForm =
|
||||
VPFinite Tense Anteriority
|
||||
| VPImperat
|
||||
| VPInfinit Anteriority ;
|
||||
|
||||
VType = VAct | VPass | VRefl ;
|
||||
|
||||
NPForm = NPNom | NPAcc | NPPoss GenNum ;
|
||||
--- AdjPronForm = APron GenNum Case ;
|
||||
--- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ;
|
||||
|
||||
RCase = RNom | RGen | RPrep ;
|
||||
|
||||
RAgr = RNoAg | RAg {gn : GenNum ; p : Person} ;
|
||||
|
||||
oper
|
||||
Agr : PType = {gn : GenNum ; p : Person} ;
|
||||
|
||||
nominative : NPForm = NPNom ;
|
||||
accusative : NPForm = NPAcc ;
|
||||
|
||||
caseNP : NPForm -> Case = \np -> case np of {
|
||||
NPPoss _ => Gen ;
|
||||
_ => Nom
|
||||
} ;
|
||||
|
||||
specDet : DetSpecies -> Species = \d -> case d of {
|
||||
DDef Def => Def ;
|
||||
_ => Indef
|
||||
} ;
|
||||
|
||||
-- Used in $Noun.AdjCN$.
|
||||
|
||||
agrAdj : GenNum -> DetSpecies -> AFormPos = \gn,d -> case <gn,d> of {
|
||||
<_, DIndef> => Strong gn ;
|
||||
<Plg,DDef _> => Weak Pl ;
|
||||
_ => Weak Sg
|
||||
} ;
|
||||
|
||||
-- Used in $DiffScand.predV$.
|
||||
|
||||
vFin : Tense -> Voice -> VForm = \t,v -> case t of {
|
||||
Pres => VF (VPres v) ;
|
||||
Past => VF (VPret v) ;
|
||||
_ => VI (VInfin v) --- not to be used?
|
||||
} ;
|
||||
|
||||
-- Used in $ConjunctionScand$.
|
||||
|
||||
conjGenNum : (_,_ : GenNum) -> GenNum = \g,h -> case <g,h> of {
|
||||
<SgUtr,SgUtr> => SgUtr ;
|
||||
<Plg, _> => Plg ;
|
||||
<_, Plg> => Plg ;
|
||||
_ => SgNeutr
|
||||
} ;
|
||||
|
||||
conjAgr : (_,_ : Agr) -> Agr = \a,b -> {
|
||||
gn = conjGenNum a.gn b.gn ;
|
||||
p = conjPerson a.p b.p
|
||||
} ;
|
||||
|
||||
---
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
resource ParamScand = ParamX ** open Prelude in {
|
||||
|
||||
param
|
||||
Species = Indef | Def ;
|
||||
Case = Nom | Gen ;
|
||||
Voice = Act | Pass ;
|
||||
|
||||
Order = Main | Inv | Sub ;
|
||||
|
||||
DetSpecies = DIndef | DDef Species ;
|
||||
|
||||
GenNum = SgUtr | SgNeutr | Plg ;
|
||||
|
||||
AForm = AF AFormGrad Case ;
|
||||
|
||||
AFormGrad =
|
||||
APosit AFormPos
|
||||
| ACompar
|
||||
| ASuperl AFormSup ;
|
||||
|
||||
-- The $Number$ in $Weak$ only matters in "lilla"/"små".
|
||||
|
||||
AFormPos = Strong GenNum | Weak Number ;
|
||||
AFormSup = SupStrong | SupWeak ;
|
||||
|
||||
VForm =
|
||||
VF VFin
|
||||
| VI VInf ;
|
||||
|
||||
VFin =
|
||||
VPres Voice
|
||||
| VPret Voice
|
||||
| VImper Voice ;
|
||||
|
||||
VInf =
|
||||
VInfin Voice
|
||||
| VSupin Voice
|
||||
| VPtPret AFormPos Case ;
|
||||
|
||||
VPForm =
|
||||
VPFinite Tense Anteriority
|
||||
| VPImperat
|
||||
| VPInfinit Anteriority ;
|
||||
|
||||
VType = VAct | VPass | VRefl ;
|
||||
|
||||
NPForm = NPNom | NPAcc | NPPoss GenNum ;
|
||||
--- AdjPronForm = APron GenNum Case ;
|
||||
--- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ;
|
||||
|
||||
RCase = RNom | RGen | RPrep ;
|
||||
|
||||
RAgr = RNoAg | RAg {gn : GenNum ; p : Person} ;
|
||||
|
||||
oper
|
||||
Agr : PType = {gn : GenNum ; p : Person} ;
|
||||
|
||||
nominative : NPForm = NPNom ;
|
||||
accusative : NPForm = NPAcc ;
|
||||
|
||||
caseNP : NPForm -> Case = \np -> case np of {
|
||||
NPPoss _ => Gen ;
|
||||
_ => Nom
|
||||
} ;
|
||||
|
||||
specDet : DetSpecies -> Species = \d -> case d of {
|
||||
DDef Def => Def ;
|
||||
_ => Indef
|
||||
} ;
|
||||
|
||||
-- Used in $Noun.AdjCN$.
|
||||
|
||||
agrAdj : GenNum -> DetSpecies -> AFormPos = \gn,d -> case <gn,d> of {
|
||||
<_, DIndef> => Strong gn ;
|
||||
<Plg,DDef _> => Weak Pl ;
|
||||
_ => Weak Sg
|
||||
} ;
|
||||
|
||||
-- Used in $DiffScand.predV$.
|
||||
|
||||
vFin : Tense -> Voice -> VForm = \t,v -> case t of {
|
||||
Pres => VF (VPres v) ;
|
||||
Past => VF (VPret v) ;
|
||||
_ => VI (VInfin v) --- not to be used?
|
||||
} ;
|
||||
|
||||
-- Used in $ConjunctionScand$.
|
||||
|
||||
conjGenNum : (_,_ : GenNum) -> GenNum = \g,h -> case <g,h> of {
|
||||
<SgUtr,SgUtr> => SgUtr ;
|
||||
<Plg, _> => Plg ;
|
||||
<_, Plg> => Plg ;
|
||||
_ => SgNeutr
|
||||
} ;
|
||||
|
||||
conjAgr : (_,_ : Agr) -> Agr = \a,b -> {
|
||||
gn = conjGenNum a.gn b.gn ;
|
||||
p = conjPerson a.p b.p
|
||||
} ;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user