mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -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
|
-- implement $Test$, it moreover contains regular lexical
|
||||||
-- patterns needed for $Lex$.
|
-- patterns needed for $Lex$.
|
||||||
|
|
||||||
resource ResEng = ParamEng ** open Prelude in {
|
resource ResEng = ParamX ** open Prelude in {
|
||||||
|
|
||||||
flags optimize=all ;
|
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
|
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$.
|
-- For $Lex$.
|
||||||
|
|
||||||
|
|||||||
@@ -70,16 +70,18 @@ concrete CatFin of Cat = TenseX ** open ResFin, Prelude in {
|
|||||||
PConj = {s : Str} ;
|
PConj = {s : Str} ;
|
||||||
CAdv = {s : Str} ;
|
CAdv = {s : Str} ;
|
||||||
Subj = {s : Str} ;
|
Subj = {s : Str} ;
|
||||||
Prep = {s : Str} ;
|
Prep = Compl ;
|
||||||
|
|
||||||
-- Open lexical classes, e.g. Lexicon
|
-- Open lexical classes, e.g. Lexicon
|
||||||
|
|
||||||
V, VS, VQ, VA = Verb1 ; -- = {s : VForm => Str ; sc : Case} ;
|
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} ;
|
V3 = Verb1 ** {c2, c3 : Compl} ;
|
||||||
|
|
||||||
A = {s : Degree => AForm => Str} ;
|
A = {s : Degree => AForm => Str} ;
|
||||||
A2 = {s : Degree => AForm => Str ; c2 : Str} ;
|
A2 = {s : Degree => AForm => Str ; c2 : Compl} ;
|
||||||
|
|
||||||
N = {s : NForm => Str} ;
|
N = {s : NForm => Str} ;
|
||||||
N2 = {s : NForm => Str} ** {c2 : Compl} ;
|
N2 = {s : NForm => Str} ** {c2 : Compl} ;
|
||||||
|
|||||||
@@ -8,18 +8,18 @@ flags
|
|||||||
|
|
||||||
lin
|
lin
|
||||||
airplane_N = regN "lentokone" ;
|
airplane_N = regN "lentokone" ;
|
||||||
---- answer_V2S = mkV2S (caseV2 (regV "vastata") allative) ;
|
answer_V2S = mkV2S (regV "vastata") (casePrep allative) ;
|
||||||
apartment_N = regN "asunto" ;
|
apartment_N = regN "asunto" ;
|
||||||
apple_N = nLukko "omena" ; --- omenia, not omenoita
|
apple_N = nLukko "omena" ; --- omenia, not omenoita
|
||||||
art_N = regN "taide" ;
|
art_N = regN "taide" ;
|
||||||
---- ask_V2Q = mkV2Q (caseV2 (regV "kysyä") ablative) ;
|
ask_V2Q = mkV2Q (regV "kysyä") (casePrep ablative) ;
|
||||||
baby_N = nLukko "vauva" ;
|
baby_N = nLukko "vauva" ;
|
||||||
bad_A = mkADeg (nLukko "paha") "pahempi" "pahin" ;
|
bad_A = mkADeg (nLukko "paha") "pahempi" "pahin" ;
|
||||||
bank_N = regN "pankki" ;
|
bank_N = regN "pankki" ;
|
||||||
beautiful_A = mkADeg (regN "kaunis") "kauniimpi" "kaunein" ;
|
beautiful_A = mkADeg (regN "kaunis") "kauniimpi" "kaunein" ;
|
||||||
---- become_VA = mkVA (regV "tulla") translative ;
|
become_VA = mkVA (regV "tulla") (casePrep translative) ;
|
||||||
beer_N = regN "olut" ;
|
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" ;
|
big_A = mkADeg (sgpartN (nArpi "suuri") "suurta") "suurempi" "suurin" ;
|
||||||
bike_N = nLukko "polkupyörä" ; --- for correct vowel harmony
|
bike_N = nLukko "polkupyörä" ; --- for correct vowel harmony
|
||||||
bird_N = nLukko "lintu" ;
|
bird_N = nLukko "lintu" ;
|
||||||
@@ -63,12 +63,12 @@ lin
|
|||||||
cow_N = nLukko "lehmä" ;
|
cow_N = nLukko "lehmä" ;
|
||||||
die_V = regV "kuolla" ;
|
die_V = regV "kuolla" ;
|
||||||
dirty_A = mkADeg (regN "likainen") "likaisempi" "likaisin" ;
|
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" ;
|
doctor_N = reg2N "tohtori" "tohtoreita" ;
|
||||||
dog_N = nLukko "koira" ;
|
dog_N = nLukko "koira" ;
|
||||||
door_N = nArpi "ovi" ;
|
door_N = nArpi "ovi" ;
|
||||||
drink_V2 = dirV2 (regV "juoda") ;
|
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ä") ;
|
eat_V2 = dirV2 (regV "syödä") ;
|
||||||
empty_A = mkADeg (nLukko "tyhjä") "tyhjempi" "tyhjin" ;
|
empty_A = mkADeg (nLukko "tyhjä") "tyhjempi" "tyhjin" ;
|
||||||
enemy_N = regN "vihollinen" ;
|
enemy_N = regN "vihollinen" ;
|
||||||
@@ -82,7 +82,7 @@ lin
|
|||||||
fridge_N = regN "jääkaappi" ;
|
fridge_N = regN "jääkaappi" ;
|
||||||
friend_N = nLukko "ystävä" ;
|
friend_N = nLukko "ystävä" ;
|
||||||
fruit_N = nLukko "hedelmä" ;
|
fruit_N = nLukko "hedelmä" ;
|
||||||
---- fun_AV = mkAV (mkA (nLukko "hauska")) ;
|
fun_AV = mkAV (mkA (nLukko "hauska")) ;
|
||||||
garden_N = nKukko "puutarha" "puutarhan" "puutarhoja" ;
|
garden_N = nKukko "puutarha" "puutarhan" "puutarhoja" ;
|
||||||
girl_N = nLukko "tyttö" ;
|
girl_N = nLukko "tyttö" ;
|
||||||
glove_N = regN "käsine" ;
|
glove_N = regN "käsine" ;
|
||||||
@@ -121,7 +121,7 @@ lin
|
|||||||
love_V2 = caseV2 (regV "rakastaa") partitive ;
|
love_V2 = caseV2 (regV "rakastaa") partitive ;
|
||||||
man_N = mkN "mies" "miehen" "miehenä" "miestä" "mieheen"
|
man_N = mkN "mies" "miehen" "miehenä" "miestä" "mieheen"
|
||||||
"miehinä" "miehissä" "miesten" "miehiä" "miehiin" ;
|
"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" ;
|
meat_N = nLukko "liha" ;
|
||||||
milk_N = nLukko "maito" ;
|
milk_N = nLukko "maito" ;
|
||||||
moon_N = regN "kuu" ;
|
moon_N = regN "kuu" ;
|
||||||
@@ -134,7 +134,7 @@ lin
|
|||||||
oil_N = nLukko "öljy" ;
|
oil_N = nLukko "öljy" ;
|
||||||
old_A = mkADeg (nLukko "vanha") "vanhempi" "vanhin" ;
|
old_A = mkADeg (nLukko "vanha") "vanhempi" "vanhin" ;
|
||||||
open_V2 = dirV2 (regV "avata") ;
|
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" ;
|
paper_N = reg2N "paperi" "papereita" ;
|
||||||
peace_N = nLukko "rauha" ;
|
peace_N = nLukko "rauha" ;
|
||||||
pen_N = nLukko "kynä" ;
|
pen_N = nLukko "kynä" ;
|
||||||
@@ -143,10 +143,10 @@ lin
|
|||||||
play_V2 = dirV2 (regV "pelata") ; --- leikkiä, soittaa
|
play_V2 = dirV2 (regV "pelata") ; --- leikkiä, soittaa
|
||||||
policeman_N = regN "poliisi" ;
|
policeman_N = regN "poliisi" ;
|
||||||
priest_N = regN "pappi" ;
|
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" ;
|
queen_N = regN "kuningatar" ;
|
||||||
radio_N = reg2N "radio" "radioita" ;
|
radio_N = reg2N "radio" "radioita" ;
|
||||||
---- rain_V = mkV0 (reg2V "sataa" "satoi") ;
|
rain_V0 = mkV0 (reg2V "sataa" "satoi") ;
|
||||||
read_V2 = dirV2 (regV "lukea") ;
|
read_V2 = dirV2 (regV "lukea") ;
|
||||||
red_A = regADeg "punainen" ;
|
red_A = regADeg "punainen" ;
|
||||||
religion_N = nLukko "uskonto" ;
|
religion_N = nLukko "uskonto" ;
|
||||||
@@ -189,7 +189,7 @@ lin
|
|||||||
switch8off_V2 = dirV2 (regV "sammuttaa") ; ---
|
switch8off_V2 = dirV2 (regV "sammuttaa") ; ---
|
||||||
switch8on_V2 = dirV2 (regV "sytyttää") ; ---
|
switch8on_V2 = dirV2 (regV "sytyttää") ; ---
|
||||||
table_N = nLukko "pöytä" ;
|
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" ;
|
teacher_N = nLukko "opettaja" ;
|
||||||
teach_V2 = dirV2 (regV "opettaa") ;
|
teach_V2 = dirV2 (regV "opettaa") ;
|
||||||
television_N = reg2N "televisio" "televisioita" ;
|
television_N = reg2N "televisio" "televisioita" ;
|
||||||
|
|||||||
@@ -1071,7 +1071,8 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
|||||||
in
|
in
|
||||||
case taa of {
|
case taa of {
|
||||||
"it" + _ => vHarkita soutaa ;
|
"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") ;
|
_ + ("aa" | "ää") => vOttaa soutaa (souda + "n") ;
|
||||||
("o" | "u" | "y" | "ö") + ("da" | "dä") => vJuoda soutaa joi ;
|
("o" | "u" | "y" | "ö") + ("da" | "dä") => vJuoda soutaa joi ;
|
||||||
("ata" | "ätä") => vOsata soutaa ;
|
("ata" | "ätä") => vOsata soutaa ;
|
||||||
@@ -1080,7 +1081,7 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
|||||||
|
|
||||||
reg2VerbH : (soutaa,souti : Str) -> VerbH = \soutaa,souti ->
|
reg2VerbH : (soutaa,souti : Str) -> VerbH = \soutaa,souti ->
|
||||||
let
|
let
|
||||||
soudat = regVerbH soutaa ;
|
---- soudat = regVerbH soutaa ;
|
||||||
soudan = weakGrade (init soutaa) + "n" ;
|
soudan = weakGrade (init soutaa) + "n" ;
|
||||||
soudin = weakGrade souti + "n" ;
|
soudin = weakGrade souti + "n" ;
|
||||||
souden = init souti + "en" ;
|
souden = init souti + "en" ;
|
||||||
@@ -1092,8 +1093,10 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
|||||||
case taa of {
|
case taa of {
|
||||||
"taa" | "tää" => vHuoltaa soutaa soudan souti soudin ;
|
"taa" | "tää" => vHuoltaa soutaa soudan souti soudin ;
|
||||||
"ata" | "ätä" => vPalkata soutaa souti ;
|
"ata" | "ätä" => vPalkata soutaa souti ;
|
||||||
|
"ota" | "ötä" => vPudota soutaa souti ;
|
||||||
"sta" | "stä" => vJuosta soutaa souden (juo + o+u+"t") (juo + "t"+u) ;
|
"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 ->
|
reg3VerbH : (_,_,_ : Str) -> VerbH = \soutaa,soudan,souti ->
|
||||||
@@ -1104,14 +1107,12 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
|||||||
o = last juo ;
|
o = last juo ;
|
||||||
a = last taa ;
|
a = last taa ;
|
||||||
u = ifTok Str a "a" "u" "y" ;
|
u = ifTok Str a "a" "u" "y" ;
|
||||||
soudin = weakGrade souti + "n" ;
|
soudin = souti + "n" ; ----weakGrade souti + "n" ;
|
||||||
soudat = reg2VerbH soutaa souti ;
|
----soudat = reg2VerbH soutaa souti ;
|
||||||
in case taa of {
|
in case taa of {
|
||||||
"lla" | "llä" => vJuosta soutaa soudan (juo + o+u+"t") (juo + "t"+u) ;
|
"lla" | "llä" => vJuosta soutaa soudan (juo + o+u+"t") (juo + "t"+u) ;
|
||||||
"ota" | "ötä" => vPudota soutaa souti ;
|
"taa" | "tää" => vHuoltaa soutaa soudan souti soudin
|
||||||
"taa" | "tää" => vHuoltaa soutaa soudan souti soudin ;
|
---- _ => soudat
|
||||||
_ + ("da" | "dä") => vJuoda soutaa souti ;
|
|
||||||
_ => soudat
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- For "harppoa", "hukkua", "löytyä", with grade alternation.
|
-- For "harppoa", "hukkua", "löytyä", with grade alternation.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--# -path=.:../abstract:../../prelude
|
--# -path=.:../abstract:../common:../../prelude
|
||||||
|
|
||||||
--1 Finnish Lexical Paradigms
|
--1 Finnish Lexical Paradigms
|
||||||
--
|
--
|
||||||
@@ -33,7 +33,7 @@ resource ParadigmsFin = open
|
|||||||
CatFin
|
CatFin
|
||||||
in {
|
in {
|
||||||
|
|
||||||
-- flags optimize=values ;
|
-- flags optimize=all ;
|
||||||
flags optimize=noexpand ;
|
flags optimize=noexpand ;
|
||||||
|
|
||||||
--2 Parameters
|
--2 Parameters
|
||||||
@@ -65,12 +65,10 @@ oper
|
|||||||
-- of many-place verbs and adjective. A complement can be defined by
|
-- of many-place verbs and adjective. A complement can be defined by
|
||||||
-- just a case, or a pre/postposition and a case.
|
-- just a case, or a pre/postposition and a case.
|
||||||
|
|
||||||
PPosition : Type ;
|
prePrep : Case -> Str -> Prep ;
|
||||||
|
postPrep : Case -> Str -> Prep ;
|
||||||
prepP : Case -> Str -> PPosition ;
|
casePrep : Case -> Prep ;
|
||||||
postpP : Case -> Str -> PPosition ;
|
accusative : Prep ;
|
||||||
caseP : Case -> PPosition ;
|
|
||||||
accusative : PPosition ;
|
|
||||||
|
|
||||||
--2 Nouns
|
--2 Nouns
|
||||||
|
|
||||||
@@ -197,15 +195,15 @@ oper
|
|||||||
-- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen",
|
-- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen",
|
||||||
-- have only their last part inflected.
|
-- 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
|
-- Nouns used as functions need a case, of which by far the commonest is
|
||||||
-- the genitive.
|
-- the genitive.
|
||||||
|
|
||||||
mkN2 : N -> Case -> N2 ;
|
mkN2 : N -> Prep -> N2 ;
|
||||||
genN2 : N -> N2 ;
|
genN2 : N -> N2 ;
|
||||||
|
|
||||||
mkN3 : N -> Case -> Case -> N3 ;
|
mkN3 : N -> Prep -> Prep -> N3 ;
|
||||||
|
|
||||||
-- Proper names can be formed by using declensions for nouns.
|
-- Proper names can be formed by using declensions for nouns.
|
||||||
-- The plural forms are filtered away by the compiler.
|
-- The plural forms are filtered away by the compiler.
|
||||||
@@ -221,7 +219,7 @@ oper
|
|||||||
|
|
||||||
-- Two-place adjectives need a case for the second argument.
|
-- 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
|
-- Comparison adjectives have three forms. The comparative and the superlative
|
||||||
-- are always inflected in the same way, so the nominative of them is actually
|
-- 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.
|
-- 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.
|
-- 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
|
-- Three-place (ditransitive) verbs need two prepositions, of which
|
||||||
-- the first one or both can be absent.
|
-- the first one or both can be absent.
|
||||||
|
|
||||||
mkV3 : V -> PPosition -> PPosition -> V3 ; -- speak, with, about
|
mkV3 : V -> Prep -> Prep -> V3 ; -- speak, with, about
|
||||||
dirV3 : V -> Case -> V3 ; -- give,_,to
|
dirV3 : V -> Case -> V3 ; -- give,_,to
|
||||||
dirdirV3 : V -> V3 ; -- acc, allat
|
dirdirV3 : V -> V3 ; -- acc, allat
|
||||||
|
|
||||||
|
|
||||||
--3 Other complement patterns
|
--3 Other complement patterns
|
||||||
@@ -316,25 +314,25 @@ oper
|
|||||||
|
|
||||||
mkV0 : V -> V0 ;
|
mkV0 : V -> V0 ;
|
||||||
mkVS : V -> VS ;
|
mkVS : V -> VS ;
|
||||||
mkV2S : V -> Str -> V2S ;
|
mkV2S : V -> Prep -> V2S ;
|
||||||
mkVV : V -> VV ;
|
mkVV : V -> VV ;
|
||||||
mkV2V : V -> Str -> Str -> V2V ;
|
mkV2V : V -> Prep -> V2V ;
|
||||||
mkVA : V -> VA ;
|
mkVA : V -> Prep -> VA ;
|
||||||
mkV2A : V -> Str -> V2A ;
|
mkV2A : V -> Prep -> Prep -> V2A ;
|
||||||
mkVQ : V -> VQ ;
|
mkVQ : V -> VQ ;
|
||||||
mkV2Q : V -> Str -> V2Q ;
|
mkV2Q : V -> Prep -> V2Q ;
|
||||||
|
|
||||||
mkAS : A -> AS ;
|
mkAS : A -> AS ;
|
||||||
mkA2S : A -> Str -> A2S ;
|
mkA2S : A -> Prep -> A2S ;
|
||||||
mkAV : A -> AV ;
|
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
|
-- just as synonyms of $V2$, and the second argument is given
|
||||||
-- as an adverb. Likewise $AS, A2S, AV, A2V$ are just $A$.
|
-- as an adverb. Likewise $AS, A2S, AV, A2V$ are just $A$.
|
||||||
-- $V0$ is just $V$.
|
-- $V0$ is just $V$.
|
||||||
|
|
||||||
V0, V2S, V2V, V2A, V2Q : Type ;
|
V0, V2S, V2V, V2Q : Type ;
|
||||||
AS, A2S, AV, A2V : Type ;
|
AS, A2S, AV, A2V : Type ;
|
||||||
|
|
||||||
-- The definitions should not bother the user of the API. So they are
|
-- The definitions should not bother the user of the API. So they are
|
||||||
@@ -358,25 +356,20 @@ oper
|
|||||||
ablative = Ablat ;
|
ablative = Ablat ;
|
||||||
allative = Allat ;
|
allative = Allat ;
|
||||||
|
|
||||||
PPosition : Type = {c : NPForm ; s3 : Str ; p : Bool} ;
|
prePrep : Case -> Str -> Prep =
|
||||||
prepP : Case -> Str -> PPosition =
|
\c,p -> {c = NPCase c ; s = p ; isPre = True ; lock_Prep = <>} ;
|
||||||
\c,p -> {c = NPCase c ; s3 = p ; p = True} ;
|
postPrep : Case -> Str -> Prep =
|
||||||
postpP : Case -> Str -> PPosition =
|
\c,p -> {c = NPCase c ; s = p ; isPre = False ; lock_Prep = <>} ;
|
||||||
\c,p -> {c = NPCase c ; s3 = p ; p = False} ;
|
casePrep : Case -> Prep =
|
||||||
caseP : Case -> PPosition =
|
\c -> {c = NPCase c ; s = [] ; isPre = True ; lock_Prep = <>} ;
|
||||||
\c -> {c = NPCase c ; s3 = [] ; p = True} ;
|
accPrep = {c = NPAccNom ; s = [] ; isPre = True ; lock_Prep = <>} ;
|
||||||
accusative = {c = NPAccNom ; s3 = [] ; p = True} ;
|
|
||||||
|
|
||||||
mkN = \a,b,c,d,e,f,g,h,i,j ->
|
mkN = \a,b,c,d,e,f,g,h,i,j ->
|
||||||
mkNoun a b c d e f g h i j ** {lock_N = <>} ;
|
mkNoun a b c d e f g h i j ** {lock_N = <>} ;
|
||||||
|
|
||||||
regN = \vesi ->
|
regN = \vesi ->
|
||||||
---- nhn (regNounH vesi) ** {lock_N = <>} ;
|
|
||||||
let
|
let
|
||||||
esi = Predef.dp 3 vesi ; -- analysis: suffixes
|
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" "ä" ;
|
a = if_then_Str (pbool2bool (Predef.occurs "aou" vesi)) "a" "ä" ;
|
||||||
ves = init vesi ; -- synthesis: prefixes
|
ves = init vesi ; -- synthesis: prefixes
|
||||||
vet = strongGrade ves ;
|
vet = strongGrade ves ;
|
||||||
@@ -384,35 +377,29 @@ oper
|
|||||||
in nhn (
|
in nhn (
|
||||||
case esi of {
|
case esi of {
|
||||||
"uus" | "yys" => sRakkaus vesi ;
|
"uus" | "yys" => sRakkaus vesi ;
|
||||||
"nen" => sNainen (Predef.tk 3 vesi + ("st" + a)) ;
|
_ + "nen" => sNainen (Predef.tk 3 vesi + ("st" + a)) ;
|
||||||
|
_ + ("aa" | "ee" | "ii" | "oo" | "uu" | "yy" | "ää" | "öö") => sPuu vesi ;
|
||||||
_ => case si of {
|
_ + ("ie" | "uo" | "yö") => sSuo vesi ;
|
||||||
"aa" | "ee" | "ii" | "oo" | "uu" | "yy" | "ää" | "öö" => sPuu vesi ;
|
_ + ("ea" | "eä") =>
|
||||||
"ie" | "uo" | "yö" => sSuo vesi ;
|
mkSubst
|
||||||
"ea" | "eä" =>
|
a
|
||||||
mkSubst
|
vesi (vesi) (vesi) (vesi + a) (vesi + a+"n")
|
||||||
a
|
(ves + "i") (ves + "i") (ves + "iden") (ves + "it"+a)
|
||||||
vesi (vesi) (vesi) (vesi + a) (vesi + a+"n")
|
(ves + "isiin") ;
|
||||||
(ves + "i") (ves + "i") (ves + "iden") (ves + "it"+a)
|
_ + "is" => sNauris (vesi + ("t" + a)) ;
|
||||||
(ves + "isiin") ;
|
_ + ("ut" | "yt") => sRae vesi (ves + ("en" + a)) ;
|
||||||
"is" => sNauris (vesi + ("t" + a)) ;
|
_ + ("as" | "äs") => sRae vesi (vet + (a + "n" + a)) ;
|
||||||
"ut" | "yt" => sRae vesi (ves + ("en" + a)) ;
|
_ + ("ar" | "är") => sRae vesi (vet + ("ren" + a)) ;
|
||||||
"as" | "äs" => sRae vesi (vet + (a + "n" + a)) ;
|
_ + "n" => sLiitin vesi (vet + "men") ;
|
||||||
"ar" | "är" => sRae vesi (vet + ("ren" + a)) ;
|
_ + "s" => sTilaus vesi (ves + ("ksen" + a)) ;
|
||||||
_ => case i of {
|
_ + "i" => sBaari (vesi + a) ;
|
||||||
"n" => sLiitin vesi (vet + "men") ;
|
_ + "e" => sRae vesi (strongGrade vesi + "en" + a) ;
|
||||||
"s" => sTilaus vesi (ves + ("ksen" + a)) ;
|
_ + ("a" | "o" | "u" | "y" | "ä" | "ö") => sLukko vesi ;
|
||||||
"i" => sBaari (vesi + a) ;
|
_ => sLinux (vesi + "i" + a)
|
||||||
"e" => sRae vesi (strongGrade vesi + "en" + a) ;
|
|
||||||
"a" | "o" | "u" | "y" | "ä" | "ö" => sLukko vesi ;
|
|
||||||
_ => sLinux (vesi + "i" + a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
) ** {lock_N = <>} ;
|
) ** {lock_N = <>} ;
|
||||||
|
|
||||||
reg2N : (savi,savia : Str) -> N = \savi,savia ->
|
reg2N : (savi,savia : Str) -> N = \savi,savia ->
|
||||||
---- nhn (reg2NounH savi savia)
|
|
||||||
let
|
let
|
||||||
savit = regN savi ;
|
savit = regN savi ;
|
||||||
ia = Predef.dp 2 savia ;
|
ia = Predef.dp 2 savia ;
|
||||||
@@ -424,37 +411,33 @@ oper
|
|||||||
case <o,ia> of {
|
case <o,ia> of {
|
||||||
<"i","ia"> => nhn (sArpi savi) ;
|
<"i","ia"> => nhn (sArpi savi) ;
|
||||||
<"i","iä"> => nhn (sSylki savi) ;
|
<"i","iä"> => nhn (sSylki savi) ;
|
||||||
<"i","ta"> | <"i","tä"> => nhn (sTohtori (savi + a)) ;
|
|
||||||
<"o","ta"> | <"ö","tä"> => nhn (sRadio savi) ;
|
<"o","ta"> | <"ö","tä"> => nhn (sRadio savi) ;
|
||||||
<"a","ta"> | <"ä","tä"> => nhn (sPeruna 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
|
_ => savit
|
||||||
}
|
}
|
||||||
** {lock_N = <>} ;
|
** {lock_N = <>} ;
|
||||||
|
|
||||||
reg3N = \vesi,veden,vesiä ->
|
reg3N = \vesi,veden,vesiä ->
|
||||||
let
|
let
|
||||||
vesit = reg2N vesi vesiä ;
|
|
||||||
si = Predef.dp 2 vesi ;
|
si = Predef.dp 2 vesi ;
|
||||||
i = last si ;
|
a = last vesiä
|
||||||
a = last vesiä ;
|
|
||||||
s = last (Predef.tk 2 vesiä)
|
|
||||||
in
|
in
|
||||||
case si of {
|
case si of {
|
||||||
"us" | "ys" =>
|
"us" | "ys" =>
|
||||||
ifTok CommonNoun (Predef.dp 3 veden) "den"
|
nhn (case Predef.dp 3 veden of {
|
||||||
(nhn (sRakkaus vesi))
|
"den" => sRakkaus vesi ;
|
||||||
(nhn (sTilaus vesi (veden + a))) ;
|
_ => sTilaus vesi (veden + a)
|
||||||
|
}) ;
|
||||||
"as" | "äs" => nhn (sRae vesi (veden + a)) ;
|
"as" | "äs" => nhn (sRae vesi (veden + a)) ;
|
||||||
"li" | "ni" | "ri" => nhn (sSusi vesi veden (Predef.tk 1 vesi + ("en" + a))) ;
|
"li" | "ni" | "ri" => nhn (sSusi vesi veden (init vesi + ("en" + a))) ;
|
||||||
"si" => nhn (sSusi vesi veden (Predef.tk 2 vesi + ("ten" + a))) ;
|
"si" => nhn (sSusi vesi veden (Predef.tk 2 vesi + ("ten" + a))) ;
|
||||||
"in" | "en" | "än" => nhn (sLiitin vesi veden) ;
|
"in" | "en" | "än" => nhn (sLiitin vesi veden) ;
|
||||||
_ => case i of {
|
_ + ("a" | "o" | "u" | "y" | "ä" | "ö") => nhn (sKukko vesi veden vesiä) ;
|
||||||
"a" | "o" | "u" | "y" | "ä" | "ö" => nhn (sKukko vesi veden vesiä) ;
|
_ {- + "i" -} => nhn (sKorpi vesi veden (init veden + "n" + a))
|
||||||
"i" => nhn (sKorpi vesi veden (init veden + "n" + a)) ;
|
}
|
||||||
_ => vesit
|
** {lock_N = <>} ;
|
||||||
}
|
|
||||||
} ** {lock_N = <>} ;
|
|
||||||
|
|
||||||
nKukko = \a,b,c -> nhn (sKukko a b c) ** {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
|
let a = vowelHarmony meri in
|
||||||
sgpartN (reg2N meri (meri + a)) (init meri + "ta") ;
|
sgpartN (reg2N meri (meri + a)) (init meri + "ta") ;
|
||||||
|
|
||||||
nComp = \s,n -> {s = \\c => s ++ n.s ! c ; g = n.g ; lock_N = <>} ;
|
compN = \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 = <>} ;
|
mkN2 = \n,c -> n ** {c2 = c ; lock_N2 = <>} ;
|
||||||
-- genN2 = \n -> mkN2 n genitive ;
|
mkN3 = \n,c,e -> n ** {c2 = c ; c3 = e ; lock_N3 = <>} ;
|
||||||
|
genN2 = \n -> mkN2 n (casePrep genitive) ;
|
||||||
mkPN n = mkProperName n ** {lock_PN = <>} ;
|
mkPN n = mkProperName n ** {lock_PN = <>} ;
|
||||||
|
|
||||||
---- mkA = \x -> noun2adj x ** {lock_A = <>} ;
|
mkA = \x -> {s = \\_ => (noun2adj x).s ; lock_A = <>} ;
|
||||||
---- mkA2 = \x,c -> x ** {s3 = c.s3 ; p = c.p ; c = c.c ; lock_A2 = <>} ;
|
mkA2 = \x,c -> x ** {c2 = c ; lock_A2 = <>} ;
|
||||||
mkADeg x kivempi kivin =
|
mkADeg x kivempi kivin =
|
||||||
let
|
let
|
||||||
a = last (x.s ! ((NCase Sg Part))) ; ---- gives "kivinta"
|
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 = <>} ;
|
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 = <>} ;
|
mkV2 = \v,c -> v ** {c2 = c ; lock_V2 = <>} ;
|
||||||
---- caseV2 = \v,c -> mkV2 v (caseP c) ;
|
caseV2 = \v,c -> mkV2 v (casePrep c) ;
|
||||||
---- dirV2 v = mkTransVerbDir v ** {lock_V2 = <>} ;
|
dirV2 v = mkV2 v accPrep ;
|
||||||
|
|
||||||
mkAdv : Str -> Adv = \s -> {s = s ; lock_Adv = <>} ;
|
mkAdv : Str -> Adv = \s -> {s = s ; lock_Adv = <>} ;
|
||||||
|
|
||||||
{-
|
|
||||||
mkV3 v p q = v **
|
mkV3 v p q = v ** {c2 = p ; c3 = q ; lock_V3 = <>} ;
|
||||||
{s3 = p.s3 ; p = p.p ; c = p.c ; s5 = q.s3 ; p2 = q.p ; c2 = q.c ;
|
dirV3 v p = mkV3 v accPrep (casePrep p) ;
|
||||||
lock_V3 = <>} ;
|
|
||||||
dirV3 v p = mkV3 v accusative (caseP p) ;
|
|
||||||
dirdirV3 v = dirV3 v allative ;
|
dirdirV3 v = dirV3 v allative ;
|
||||||
|
|
||||||
|
|
||||||
mkVS v = v ** {lock_VS = <>} ;
|
mkVS v = v ** {lock_VS = <>} ;
|
||||||
mkVV v = v ** {c2 = "to" ; lock_VV = <>} ;
|
mkVV v = v ** {lock_VV = <>} ;
|
||||||
mkVQ v = v ** {lock_VQ = <>} ;
|
mkVQ v = v ** {lock_VQ = <>} ;
|
||||||
|
|
||||||
V0 : Type = V ;
|
V0 : Type = V ;
|
||||||
V2S, V2V, V2Q, V2A : Type = V2 ;
|
V2S, V2V, V2Q : Type = V2 ;
|
||||||
AS, A2S, AV : Type = A ;
|
AS, A2S, AV : Type = A ;
|
||||||
A2V : Type = A2 ;
|
A2V : Type = A2 ;
|
||||||
|
|
||||||
mkV0 v = v ** {lock_V = <>} ;
|
mkV0 v = v ** {lock_V = <>} ;
|
||||||
mkV2S v p = mkV2 v p ** {lock_V2 = <>} ;
|
mkV2S v p = mkV2 v p ** {lock_V2 = <>} ;
|
||||||
mkV2V v p t = mkV2 v p ** {s4 = t ; lock_V2 = <>} ;
|
mkV2V v p = mkV2 v p ** {lock_V2 = <>} ;
|
||||||
mkVA v = v ** {lock_VA = <>} ;
|
mkVA v p = v ** {c2 = p ; lock_VA = <>} ;
|
||||||
mkV2A v p = mkV2 v p ** {lock_V2A = <>} ;
|
mkV2A v p q = v ** {c2 = p ; c3 = q ; lock_V2A = <>} ;
|
||||||
mkV2Q v p = mkV2 v p ** {lock_V2 = <>} ;
|
mkV2Q v p = mkV2 v p ** {lock_V2 = <>} ;
|
||||||
|
|
||||||
mkAS v = v ** {lock_A = <>} ;
|
mkAS v = v ** {lock_A = <>} ;
|
||||||
mkA2S v p = mkA2 v p ** {lock_A = <>} ;
|
mkA2S v p = mkA2 v p ** {lock_A = <>} ;
|
||||||
mkAV v = v ** {lock_A = <>} ;
|
mkAV v = v ** {lock_A = <>} ;
|
||||||
mkA2V v p = mkA2 v p ** {lock_A2 = <>} ;
|
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
|
-- implement $Test$, it moreover contains regular lexical
|
||||||
-- patterns needed for $Lex$.
|
-- patterns needed for $Lex$.
|
||||||
|
|
||||||
resource ResFin = ParamFin ** open Prelude in {
|
resource ResFin = ParamX ** open Prelude in {
|
||||||
|
|
||||||
flags optimize=all ;
|
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$.
|
-- 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
|
-- implement $Test$, it moreover contains some lexical
|
||||||
-- patterns needed for $Lex$.
|
-- patterns needed for $Lex$.
|
||||||
|
|
||||||
resource ResGer = ParamGer ** open Prelude in {
|
resource ResGer = ParamX ** open Prelude in {
|
||||||
|
|
||||||
flags optimize=all ;
|
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 $Lex$.
|
||||||
|
|
||||||
-- For conciseness and abstraction, we first define a method for
|
-- For conciseness and abstraction, we first define a method for
|
||||||
|
|||||||
@@ -6,10 +6,143 @@
|
|||||||
-- which depends on [DiffRomance DiffRomance.html].
|
-- which depends on [DiffRomance DiffRomance.html].
|
||||||
--
|
--
|
||||||
|
|
||||||
resource CommonRomance = ParamRomance ** open Prelude in {
|
resource CommonRomance = ParamX ** open Prelude in {
|
||||||
|
|
||||||
flags optimize=all ;
|
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
|
oper
|
||||||
genForms : Str -> Str -> Gender => Str = \bon,bonne ->
|
genForms : Str -> Str -> Gender => Str = \bon,bonne ->
|
||||||
table {
|
table {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
incomplete concrete ConjunctionRomance of Conjunction =
|
incomplete concrete ConjunctionRomance of Conjunction =
|
||||||
CatRomance ** open ParamRomance, ResRomance, Coordination, Prelude in {
|
CatRomance ** open CommonRomance, ResRomance, Coordination, Prelude in {
|
||||||
|
|
||||||
flags optimize=all_subs ;
|
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],
|
-- implement [Test Test.html] is defined in [ResScandinavian ResScandinavian.html],
|
||||||
-- which depends on [DiffScandinavian DiffScandinavian.html].
|
-- which depends on [DiffScandinavian DiffScandinavian.html].
|
||||||
|
|
||||||
resource CommonScand = ParamScand ** open Prelude in {
|
resource CommonScand = ParamX ** open Prelude in {
|
||||||
|
|
||||||
flags optimize=all ;
|
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$.
|
-- 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