From 827f9ab6434fdf4c29769583b7f016ae4d3e87b9 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 3 Feb 2006 20:07:41 +0000 Subject: [PATCH] started Finnish (Param, Morpho, Cat, Param appr. OK) --- lib/resource-1.0/finnish/AdjectiveFin.gf | 38 + lib/resource-1.0/finnish/AdverbFin.gf | 21 + lib/resource-1.0/finnish/CatFin.gf | 91 ++ lib/resource-1.0/finnish/ConjunctionFin.gf | 45 + lib/resource-1.0/finnish/LangFin.gf | 20 + lib/resource-1.0/finnish/LexiconFin.gf | 248 ++++ lib/resource-1.0/finnish/MorphoFin.gf | 1402 ++++++++++++++++++++ lib/resource-1.0/finnish/NounFin.gf | 71 + lib/resource-1.0/finnish/NumeralFin.gf | 44 + lib/resource-1.0/finnish/ParadigmsFin.gf | 573 ++++++++ lib/resource-1.0/finnish/ParamFin.gf | 95 ++ lib/resource-1.0/finnish/PhraseFin.gf | 23 + lib/resource-1.0/finnish/QuestionFin.gf | 54 + lib/resource-1.0/finnish/RelativeFin.gf | 34 + lib/resource-1.0/finnish/ResFin.gf | 175 +++ lib/resource-1.0/finnish/SentenceFin.gf | 46 + lib/resource-1.0/finnish/StructuralFin.gf | 106 ++ lib/resource-1.0/finnish/VerbFin.gf | 37 + 18 files changed, 3123 insertions(+) create mode 100644 lib/resource-1.0/finnish/AdjectiveFin.gf create mode 100644 lib/resource-1.0/finnish/AdverbFin.gf create mode 100644 lib/resource-1.0/finnish/CatFin.gf create mode 100644 lib/resource-1.0/finnish/ConjunctionFin.gf create mode 100644 lib/resource-1.0/finnish/LangFin.gf create mode 100644 lib/resource-1.0/finnish/LexiconFin.gf create mode 100644 lib/resource-1.0/finnish/MorphoFin.gf create mode 100644 lib/resource-1.0/finnish/NounFin.gf create mode 100644 lib/resource-1.0/finnish/NumeralFin.gf create mode 100644 lib/resource-1.0/finnish/ParadigmsFin.gf create mode 100644 lib/resource-1.0/finnish/ParamFin.gf create mode 100644 lib/resource-1.0/finnish/PhraseFin.gf create mode 100644 lib/resource-1.0/finnish/QuestionFin.gf create mode 100644 lib/resource-1.0/finnish/RelativeFin.gf create mode 100644 lib/resource-1.0/finnish/ResFin.gf create mode 100644 lib/resource-1.0/finnish/SentenceFin.gf create mode 100644 lib/resource-1.0/finnish/StructuralFin.gf create mode 100644 lib/resource-1.0/finnish/VerbFin.gf diff --git a/lib/resource-1.0/finnish/AdjectiveFin.gf b/lib/resource-1.0/finnish/AdjectiveFin.gf new file mode 100644 index 000000000..d6ad527ac --- /dev/null +++ b/lib/resource-1.0/finnish/AdjectiveFin.gf @@ -0,0 +1,38 @@ +concrete AdjectiveFin of Adjective = CatFin ** open ResFin, Prelude in { + + lin + + PositA a = { + s = \\_ => a.s ! AAdj Posit ; + isPre = True + } ; + ComparA a np = { + s = \\_ => a.s ! AAdj Compar ++ "than" ++ np.s ! Nom ; + isPre = False + } ; + +-- $SuperlA$ belongs to determiner syntax in $Noun$. + + ComplA2 a np = { + s = \\_ => a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ; + isPre = False + } ; + + ReflA2 a = { + s = \\ag => a.s ! AAdj Posit ++ a.c2 ++ reflPron ! ag ; + isPre = False + } ; + + SentAP ap sc = { + s = \\a => ap.s ! a ++ sc.s ; + isPre = False + } ; + + AdAP ada ap = { + s = \\a => ada.s ++ ap.s ! a ; + isPre = ap.isPre + } ; + + UseA2 a = a ; + +} diff --git a/lib/resource-1.0/finnish/AdverbFin.gf b/lib/resource-1.0/finnish/AdverbFin.gf new file mode 100644 index 000000000..5e786a418 --- /dev/null +++ b/lib/resource-1.0/finnish/AdverbFin.gf @@ -0,0 +1,21 @@ +concrete AdverbFin of Adverb = CatFin ** open ResFin, Prelude in { + + lin + PositAdvAdj a = {s = a.s ! AAdv} ; + ComparAdvAdj cadv a np = { + s = cadv.s ++ a.s ! AAdv ++ "than" ++ np.s ! Nom + } ; + ComparAdvAdjS cadv a s = { + s = cadv.s ++ a.s ! AAdv ++ "than" ++ s.s + } ; + + PrepNP prep np = {s = prep.s ++ np.s ! Acc} ; + + AdAdv = cc2 ; + + SubjS = cc2 ; + AdvSC s = s ; --- this rule give stack overflow in ordinary parsing + + AdnCAdv cadv = {s = cadv.s ++ "than"} ; + +} diff --git a/lib/resource-1.0/finnish/CatFin.gf b/lib/resource-1.0/finnish/CatFin.gf new file mode 100644 index 000000000..20342777a --- /dev/null +++ b/lib/resource-1.0/finnish/CatFin.gf @@ -0,0 +1,91 @@ +concrete CatFin of Cat = TenseX ** open ResFin, Prelude in { + + flags optimize=all_subs ; + + lincat + +-- Phrase + + Text, Phr, Utt, Voc = {s : Str} ; + +-- Tensed/Untensed + + S = {s : Str} ; + QS = {s : Str} ; + RS = {s : Agr => Str} ; + +-- Sentence + + Cl = {s : Tense => Anteriority => Polarity => SType => Str} ; + Slash = {s : Tense => Anteriority => Polarity => Str ; c2 : Compl} ; + Imp = {s : Polarity => Number => Str} ; + +-- Question + + QCl = {s : Tense => Anteriority => Polarity => Str} ; + IP = {s : NPForm => Str ; n : Number} ; + IAdv = {s : Str} ; + IDet = {s : Case => Str ; n : Number} ; + +-- Relative + + RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ; + RP = {s : Number => Case => Str ; a : RAgr} ; + +-- Verb + + VP = { + s : Tense => Anteriority => Polarity => Agr => {fin, inf : Str} ; + s2 : Agr => Str + } ; + Comp = {s : Agr => Str} ; + SC = {s : Str} ; + +-- Adjective + + AP = {s : Bool => AForm => Str} ; + +-- Noun + + CN = {s : Bool => Number => Case => Str} ; + Pron = {s : NPForm => Str ; a : Agr} ; + NP = {s : NPForm => Str ; a : Agr} ; + Det = {s : Case => Str ; n : Number ; isNum : Bool} ; + QuantSg, QuantPl = {s : Case => Str} ; + Predet, Quant, Ord = {s : Number => Case => Str} ; + Num = {s : Number => Case => Str ; isNum : Bool} ; + +-- Adverb + + Adv, AdV, AdA, AdS, AdN = {s : Str} ; + +-- Numeral + + Numeral = {s : CardOrd => Str ; n : Number} ; + +-- Structural + + Conj = {s : Str ; n : Number} ; + DConj = {s1,s2 : Str ; n : Number} ; + PConj = {s : Str} ; + CAdv = {s : Str} ; + Subj = {s : Str} ; + Prep = {s : Str} ; + +-- Open lexical classes, e.g. Lexicon + + V, VS, VQ, VA = Verb1 ; -- = {s : VForm => Str ; sc : Case} ; + V2, VV, V2A = Verb1 ** {c2 : Compl ; } ; + V3 = Verb1 ** {c2, c3 : Compl} ; + + A = {s : Degree => AForm => Str} ; + A2 = {s : Degree => AForm => Str ; c2 : Str} ; + + N = {s : NForm => Str} ; + N2 = {s : NForm => Str} ** {c2 : Compl} ; + N3 = {s : NForm => Str} ** {c2,c3 : Compl} ; + PN = {s : Case => Str} ; + +oper Verb1 = {s : VForm => Str ; sc : NPForm} ; + +} diff --git a/lib/resource-1.0/finnish/ConjunctionFin.gf b/lib/resource-1.0/finnish/ConjunctionFin.gf new file mode 100644 index 000000000..a37ef8c67 --- /dev/null +++ b/lib/resource-1.0/finnish/ConjunctionFin.gf @@ -0,0 +1,45 @@ +concrete ConjunctionFin of Conjunction = + CatFin ** open ResFin, Coordination, Prelude in { + + flags optimize=all_subs ; + + lin + + ConjS = conjunctSS ; + DConjS = conjunctDistrSS ; + + ConjAdv = conjunctSS ; + DConjAdv = conjunctDistrSS ; + + ConjNP conj ss = conjunctTable Case conj ss ** { + a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p} + } ; + DConjNP conj ss = conjunctDistrTable Case conj ss ** { + a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p} + } ; + + ConjAP conj ss = conjunctTable Agr conj ss ** { + isPre = ss.isPre + } ; + DConjAP conj ss = conjunctDistrTable Agr conj ss ** { + isPre = ss.isPre + } ; + +-- These fun's are generated from the list cat's. + + BaseS = twoSS ; + ConsS = consrSS comma ; + BaseAdv = twoSS ; + ConsAdv = consrSS comma ; + BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ; + ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ; + BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ; + ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ; + + lincat + [S] = {s1,s2 : Str} ; + [Adv] = {s1,s2 : Str} ; + [NP] = {s1,s2 : Case => Str ; a : Agr} ; + [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ; + +} diff --git a/lib/resource-1.0/finnish/LangFin.gf b/lib/resource-1.0/finnish/LangFin.gf new file mode 100644 index 000000000..1df23e389 --- /dev/null +++ b/lib/resource-1.0/finnish/LangFin.gf @@ -0,0 +1,20 @@ +--# -path=.:../abstract:../common:prelude + +concrete LangFin of Lang = + NounFin, + VerbFin, + AdjectiveFin, + AdverbFin, + NumeralFin, + SentenceFin, + QuestionFin, + RelativeFin, + ConjunctionFin, + PhraseFin, + StructuralFin, + LexiconFin + ** { + +flags startcat = Phr ; + +} ; diff --git a/lib/resource-1.0/finnish/LexiconFin.gf b/lib/resource-1.0/finnish/LexiconFin.gf new file mode 100644 index 000000000..df6025455 --- /dev/null +++ b/lib/resource-1.0/finnish/LexiconFin.gf @@ -0,0 +1,248 @@ +--# -path=.:prelude + +concrete LexiconFin of Lexicon = CatFin ** open ParadigmsFin in { + +flags + optimize=values ; + + +lin + airplane_N = regN "lentokone" ; +---- answer_V2S = mkV2S (caseV2 (regV "vastata") allative) ; + apartment_N = regN "asunto" ; + apple_N = nLukko "omena" ; --- omenia, not omenoita + art_N = regN "taide" ; +---- ask_V2Q = mkV2Q (caseV2 (regV "kysyä") 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 ; + beer_N = regN "olut" ; +---- beg_V2V = mkV2V (caseV2 (reg2V "pyytää" "pyysi") partitive) ; + big_A = mkADeg (sgpartN (nArpi "suuri") "suurta") "suurempi" "suurin" ; + bike_N = nLukko "polkupyörä" ; --- for correct vowel harmony + bird_N = nLukko "lintu" ; + black_A = mkADeg (nLukko "musta") "mustempi" "mustin" ; + blue_A = mkADeg (regN "sininen") "sinisempi" "sinisin" ; + boat_N = regN "vene" ; + book_N = nLukko "kirja" ; + boot_N = regN "saapas" ; + boss_N = nLukko "pomo" ; + boy_N = nKukko "poika" "pojan" "poikia" ; + bread_N = nLukko "leipä" ; + break_V2 = dirV2 (regV "rikkoa") ; + broad_A = mkADeg (regN "leveä") "leveämpi" "levein" ; + brother_N2 = genN2 ( + mkN "veli" "veljen" "veljenä" "veljeä" "veljeen" + "veljinä" "veljissä" "veljien" "veljiä" "veljiin") ; + brown_A = mkADeg (regN "ruskea") "ruskeampi" "ruskein" ; + butter_N = reg3N "voi" "voin" "voita" ; ---- errors in Part + buy_V2 = dirV2 (regV "ostaa") ; + camera_N = nLukko "kamera" ; + cap_N = regN "lakki" ; + car_N = reg3N "auto" "auton" "autoja" ; -- regN: audon + carpet_N = nLukko "matto" ; + cat_N = nLukko "kissa" ; + ceiling_N = nLukko "katto" ; + chair_N = regN "tuoli" ; + cheese_N = nLukko "juusto" ; + child_N = mkN "lapsi" "lapsen" "lapsena" "lasta" "lapseen" + "lapsina" "lapsissa" "lasten" "lapsia" "lapsiin" ; + church_N = nLukko "kirkko" ; + city_N = regN "kaupunki" ; + clean_A = regADeg "puhdas" ; + clever_A = regADeg "viisas" ; + close_V2 = dirV2 (regV "sulkea") ; + coat_N = regN "takki" ; + cold_A = mkADeg (nLukko "kylmä") "kylmempi" "kylmin" ; + come_V = regV "tulla" ; + computer_N = regN "tietokone" ; + country_N = regN "maa" ; + cousin_N = nLukko "serkku" ; + cow_N = nLukko "lehmä" ; + die_V = regV "kuolla" ; + dirty_A = mkADeg (regN "likainen") "likaisempi" "likaisin" ; + distance_N3 = mkN3 (regN "etäisyys") elative 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)) ; + eat_V2 = dirV2 (regV "syödä") ; + empty_A = mkADeg (nLukko "tyhjä") "tyhjempi" "tyhjin" ; + enemy_N = regN "vihollinen" ; + factory_N = regN "tehdas" ; + father_N2 = genN2 (nLukko "isä") ; + fear_VS = mkVS (reg2V "pelätä" "pelkäsi") ; + find_V2 = dirV2 (reg2V "löytää" "löysi") ; + fish_N = nLukko "kala" ; + floor_N = reg2N "lattia" "lattioita" ; + forget_V2 = dirV2 (regV "unohtaa") ; + fridge_N = regN "jääkaappi" ; + friend_N = nLukko "ystävä" ; + fruit_N = nLukko "hedelmä" ; +---- fun_AV = mkAV (mkA (nLukko "hauska")) ; + garden_N = nKukko "puutarha" "puutarhan" "puutarhoja" ; + girl_N = nLukko "tyttö" ; + glove_N = regN "käsine" ; + gold_N = nLukko "kulta" ; + good_A = mkADeg (nLukko "hyvä") "parempi" "parhain" ; --- paras + go_V = regV "mennä" ; + green_A = mkADeg (regN "vihreä") "vihreämpi" "vihrein" ; + harbour_N = nKukko "satama" "sataman" "satamia" ; + hate_V2 = dirV2 (regV "vihata") ; + hat_N = nLukko "hattu" ; + have_V2 = caseV2 (caseV adessive vOlla) nominative ; + hear_V2 = dirV2 (regV "kuulla") ; + hill_N = nLukko "kukkula" ; + hope_VS = mkVS (regV "toivoa") ; + horse_N = regN "hevonen" ; + hot_A = mkADeg (nLukko "kuuma") "kuumempi" "kuumin" ; + house_N = nLukko "talo" ; + important_A = mkADeg (regN "tärkeä") "tärkeämpi" "tärkein" ; + industry_N = regN "teollisuus" ; + iron_N = nLukko "rauta" ; + king_N = regN "kuningas" ; + know_V2 = dirV2 (reg2V "tietää" "tiesi") ; --- tuntea; gives tietänyt + lake_N = nSylki "järvi" ; + lamp_N = nLukko "lamppu" ; + learn_V2 = + dirV2 (mkV "oppia" "oppii" "opin" "oppivat" "oppikaa" "opitaan" + "oppi" "opin" "oppisi" "oppinut" "opittu" "opitun") ; + leather_N = nLukko "nahka" ; --- nahan + leave_V2 = dirV2 (regV "jättää") ; + like_V2 = caseV2 (regV "pitää") elative ; + listen_V2 = caseV2 (reg3V "kuunnella" "kuuntelen" "kuunteli") partitive ; + live_V = regV "elää" ; + long_A = mkADeg (nLukko "pitkä") "pitempi" "pisin" ; + lose_V2 = dirV2 (regV "hävitä") ; --- hukata + love_N = reg3N "rakkaus" "rakkauden" "rakkauksia" ; + 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") ; + meat_N = nLukko "liha" ; + milk_N = nLukko "maito" ; + moon_N = regN "kuu" ; + mother_N2 = genN2 (regN "äiti") ; + mountain_N = nArpi "vuori" ; + music_N = regN "musiikki" ; + narrow_A = mkADeg (regN "kapea") "kapeampi" "kapein" ; + new_A = mkADeg (reg3N "uusi" "uuden" "uusia") "uudempi" "uusin" ; + newspaper_N = nSylki "sanomalehti" ; --- for correct vowel harmony + oil_N = nLukko "öljy" ; + old_A = mkADeg (nLukko "vanha") "vanhempi" "vanhin" ; + open_V2 = dirV2 (regV "avata") ; +---- paint_V2A = mkV2A (dirV2 (regV "maalata")) translative ; + paper_N = reg2N "paperi" "papereita" ; + peace_N = nLukko "rauha" ; + pen_N = nLukko "kynä" ; + planet_N = nLukko "planeetta" ; + plastic_N = regN "muovi" ; + 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 + queen_N = regN "kuningatar" ; + radio_N = reg2N "radio" "radioita" ; +---- rain_V = mkV0 (reg2V "sataa" "satoi") ; + read_V2 = dirV2 (regV "lukea") ; + red_A = regADeg "punainen" ; + religion_N = nLukko "uskonto" ; + restaurant_N = nLukko "ravintola" ; + river_N = nArpi "joki" ; + rock_N = reg2N "kallio" "kallioita" ; + roof_N = nLukko "katto" ; + rubber_N = regN "kumi" ; + run_V = reg2V "juosta" "juoksi" ; + say_VS = mkVS (regV "sanoa") ; + school_N = nLukko "koulu" ; + science_N = regN "tiede" ; + sea_N = nMeri "meri" ; + seek_V2 = dirV2 (regV "etsiä") ; + see_V2 = dirV2 ( + mkV "nähdä" "näkee" "näen" "näkevät" "nähkää" "nähdään" + "näki" "näin" "näkisi" "nähnyt" "nähty" "nähdyn") ; + sell_V3 = dirV3 (regV "myydä") allative ; + send_V3 = dirV3 (regV "lähettää") allative ; + sheep_N = regN "lammas" ; + ship_N = nLukko "laiva" ; + shirt_N = nLukko "paita" ; + shoe_N = nLukko "kenkä" ; + shop_N = nLukko "kauppa" ; + short_A = regADeg "lyhyt" ; + silver_N = regN "hopea" ; + sister_N = nLukko "sisko" ; + sleep_V = regV "nukkua" ; + small_A = mkADeg (reg2N "pieni" "pieniä") "pienempi" "pienin" ; + snake_N = regN "käärme" ; + sock_N = nLukko "sukka" ; + speak_V2 = dirV2 (regV "puhua") ; + star_N = nSylki "tähti" ; + steel_N = regN "teräs" ; + stone_N = nSylki "kivi" ; + stove_N = reg3N "liesi" "lieden" "liesiä" ; + student_N = reg2N "opiskelija" "opiskelijoita" ; + stupid_A = regADeg "tyhmä" ; + sun_N = nLukko "aurinko" ; + switch8off_V2 = dirV2 (regV "sammuttaa") ; --- + switch8on_V2 = dirV2 (regV "sytyttää") ; --- + table_N = nLukko "pöytä" ; + talk_V3 = mkV3 (regV "puhua") (caseP allative) (caseP elative) ; + teacher_N = nLukko "opettaja" ; + teach_V2 = dirV2 (regV "opettaa") ; + television_N = reg2N "televisio" "televisioita" ; + thick_A = regADeg "paksu" ; + thin_A = regADeg "ohut" ; + train_N = nLukko "juna" ; + travel_V = regV "matkustaa" ; + tree_N = regN "puu" ; + ---- trousers_N = regN "trousers" ; + ugly_A = mkADeg (nLukko "ruma") "rumempi" "rumin" ; + understand_V2 = dirV2 (reg3V "ymmärtää" "ymmärrän" "ymmärsi") ; + university_N = nLukko "yliopisto" ; + village_N = nLukko "kylä" ; + wait_V2 = caseV2 (regV "odottaa") partitive ; + walk_V = regV "kävellä" ; + warm_A = mkADeg + (mkN "lämmin" "lämpimän" "lämpimänä" "lämmintä" "lämpimään" + "lämpiminä" "lämpimissä" "lämpimien" "lämpimiä" "lämpimiin" + ) + "lämpimämpi" "lämpimin" ; + war_N = nLukko "sota" ; + watch_V2 = dirV2 (regV "katsella") ; + water_N = reg3N "vesi" "veden" "vesiä" ; + white_A = regADeg "valkoinen" ; + window_N = reg2N "ikkuna" "ikkunoita" ; + wine_N = regN "viini" ; + win_V2 = dirV2 (regV "voittaa") ; + woman_N = regN "nainen" ; + wonder_VQ = mkVQ (regV "ihmetellä") ; + wood_N = regN "puu" ; + write_V2 = dirV2 (regV "kirjoittaa") ; + yellow_A = regADeg "keltainen" ; + young_A = mkADeg (nArpi "nuori") "nuorempi" "nuorin" ; + + do_V2 = dirV2 ( + mkV "tehdä" "tekee" "teen" "tekevät" "tehkää" "tehdään" + "teki" "tein" "tekisi" "tehnyt" "tehty" "tehdyn") ; + + now_Adv = mkAdv "nyt" ; + already_Adv = mkAdv "jo" ; + song_N = nLukko "laulu" ; + add_V3 = dirV3 (regV "lisätä") illative ; + number_N = reg2N "numero" "numeroita" ; + put_V2 = dirV2 (regV "panna") ; + stop_V = regV "pysähtyä" ; + jump_V = regV "hypätä" ; +{- + here_Adv = mkAdv "täällä" ; + here7to_Adv = mkAdv "tänne" ; + here7from_Adv = mkAdv "täältä" ; + there_Adv = mkAdv "siellä" ; --- tuolla + there7to_Adv = mkAdv "sinne" ; + there7from_Adv = mkAdv "sieltä" ; +-} + +} ; diff --git a/lib/resource-1.0/finnish/MorphoFin.gf b/lib/resource-1.0/finnish/MorphoFin.gf new file mode 100644 index 000000000..9b9a5e773 --- /dev/null +++ b/lib/resource-1.0/finnish/MorphoFin.gf @@ -0,0 +1,1402 @@ +--# -path=.:../../prelude + +--1 A Simple Finnish Resource Morphology +-- +-- Aarne Ranta 2002 -- 2005 +-- +-- This resource morphology contains definitions needed in the resource +-- syntax. To build a lexicon, it is better to use $ParadigmsFin$, which +-- gives a higher-level access to this module. + +resource MorphoFin = ResFin ** open Prelude in { + + flags optimize=all ; + +--- flags optimize=noexpand ; + +--2 Nouns +-- + +oper + + NounH : Type = { + a,vesi,vede,vete,vetta,veteen,vetii,vesii,vesien,vesia,vesiin : Str + } ; + + CommonNoun = {s : NForm => Str} ; + +-- worst-case macro + + mkSubst : Str -> (_,_,_,_,_,_,_,_,_,_ : Str) -> NounH = + \a,vesi,vede,vete,vetta,veteen,vetii,vesii,vesien,vesia,vesiin -> + {a = a ; + vesi = vesi ; + vede = vede ; + vete = vete ; + vetta = vetta ; + veteen = veteen ; + vetii = vetii ; + vesii = vesii ; + vesien = vesien ; + vesia = vesia ; + vesiin = vesiin + } ; + + nhn : NounH -> CommonNoun = \nh -> + let + a = nh.a ; + vesi = nh.vesi ; + vede = nh.vede ; + vete = nh.vete ; + vetta = nh.vetta ; + veteen = nh.veteen ; + vetii = nh.vetii ; + vesii = nh.vesii ; + vesien = nh.vesien ; + vesia = nh.vesia ; + vesiin = nh.vesiin + in + {s = table { + NCase Sg Nom => vesi ; + NCase Sg Gen => vede + "n" ; + NCase Sg Part => vetta ; + NCase Sg Transl => vede + "ksi" ; + NCase Sg Ess => vete + ("n" + a) ; + NCase Sg Iness => vede + ("ss" + a) ; + NCase Sg Elat => vede + ("st" + a) ; + NCase Sg Illat => veteen ; + NCase Sg Adess => vede + ("ll" + a) ; + NCase Sg Ablat => vede + ("lt" + a) ; + NCase Sg Allat => vede + "lle" ; + NCase Sg Abess => vede + ("tt" + a) ; + + NCase Pl Nom => vede + "t" ; + NCase Pl Gen => vesien ; + NCase Pl Part => vesia ; + NCase Pl Transl => vesii + "ksi" ; + NCase Pl Ess => vetii + ("n" + a) ; + NCase Pl Iness => vesii + ("ss" + a) ; + NCase Pl Elat => vesii + ("st" + a) ; + NCase Pl Illat => vesiin ; + NCase Pl Adess => vesii + ("ll" + a) ; + NCase Pl Ablat => vesii + ("lt" + a) ; + NCase Pl Allat => vesii + "lle" ; + NCase Pl Abess => vesii + ("tt" + a) ; + + NComit => vetii + "ne" ; + NInstruct => vesii + "n" ; + + NPossNom => vete ; + NPossGenPl => Predef.tk 1 vesien ; + NPossTransl Sg => vede + "kse" ; + NPossTransl Pl => vesii + "kse" ; + NPossIllat Sg => Predef.tk 1 veteen ; + NPossIllat Pl => Predef.tk 1 vesiin + } + } ; + +-- A user-friendly variant takes existing forms and infers the vowel harmony. + + mkNoun : (_,_,_,_,_,_,_,_,_,_ : Str) -> CommonNoun = + \talo,talon,talona,taloa,taloon,taloina,taloissa,talojen,taloja,taloihin -> + nhn (mkSubst (ifTok Str (Predef.dp 1 talona) "a" "a" "ä") + talo (Predef.tk 1 talon) (Predef.tk 2 talona) taloa taloon + (Predef.tk 2 taloina) (Predef.tk 3 taloissa) talojen taloja taloihin) ; + +-- Regular heuristics. + +{- + regNounH : Str -> NounH = \vesi -> + 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 ; + ve = init ves ; + in + 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) + } + } + } ; + + reg2NounH : (savi,savia : Str) -> NounH = \savi,savia -> + let + savit = regNounH savi ; + ia = Predef.dp 2 savia ; + i = init ia ; + a = last ia ; + o = last savi ; + savin = weakGrade savi + "n" ; + in + case of { + <"i","ia"> => sArpi savi ; + <"i","iä"> => sSylki savi ; + <"i","ta"> | <"i","tä"> => sTohtori (savi + a) ; + <"o","ta"> | <"ö","tä"> => sRadio savi ; + <"a","ta"> | <"ä","tä"> => sPeruna savi ; + <"a","ia"> | <"a","ja"> => sKukko savi savin savia ; + _ => savit + } ; +-} + +-- Here some useful special cases; more will be given in $paradigms.Fin.gf$. +-- +-- Nouns with partitive "a"/"ä" ; +-- to account for grade and vowel alternation, three forms are usually enough +-- Examples: "talo", "kukko", "huippu", "koira", "kukka", "syylä",... + + sKukko : (_,_,_ : Str) -> NounH = \kukko,kukon,kukkoja -> + let { + o = Predef.dp 1 kukko ; + a = Predef.dp 1 kukkoja ; + kukkoj = Predef.tk 1 kukkoja ; + i = Predef.dp 1 kukkoj ; + ifi = ifTok Str i "i" ; + kukkoi = ifi kukkoj (Predef.tk 1 kukkoj) ; + e = Predef.dp 1 kukkoi ; + kukoi = Predef.tk 2 kukon + Predef.dp 1 kukkoi + } + in + mkSubst a + kukko + (Predef.tk 1 kukon) + kukko + (kukko + a) + (kukko + o + "n") + (kukkoi + ifi "" "i") + (kukoi + ifi "" "i") + (ifTok Str e "e" (Predef.tk 1 kukkoi + "ien") (kukkoi + ifi "en" "jen")) + kukkoja + (kukkoi + ifi "in" "ihin") ; + + sLukko : Str -> NounH = \lukko -> + let + o = last lukko ; + lukk = init lukko ; + a = getHarmony o ; + lukkoja = case o of { + "a" => lukk + if_then_Str (pbool2bool (Predef.occurs "ou" lukk)) "ia" "oja" ; + "ä" => lukk + "iä" ; + _ => lukko + "j" + a + } + in + sKukko lukko (weakGrade lukko + "n") lukkoja ; + +-- The special case with no alternations. + + sTalo : Str -> NounH = sLukko ; + + sBaari : Str -> NounH = \baaria -> + let + baari = Predef.tk 1 baaria ; + baar = Predef.tk 1 baari ; + a = getHarmony (Predef.dp 1 baaria) + in + sKukko baari (weakGrade baari + "n") (baar + ("ej" + a)) ; + + sKorpi : (_,_,_ : Str) -> NounH = \korpi,korven,korpena -> + let + a = Predef.dp 1 korpena ; + korpe = Predef.tk 2 korpena ; + korp = init korpi ; + korpea = case last korp of { + "r" | "l" | "n" => korp + "t" + a ; + _ => korpe + a + } ; + korve = Predef.tk 1 korven ; + korvi = Predef.tk 1 korve + "i" ; + korpien = case last korp of { + "r" | "l" | "n" => korp + "ten" ; + _ => korpi + "en" + } ; + in + mkSubst a + korpi + korve + korpe + korpea + (korpe + "en") + korpi + korvi + korpien + (korpi + a) + (korpi + "in") ; + + sArpi : Str -> NounH = \arpi -> + sKorpi arpi (init (weakGrade arpi) + "en") (init arpi + "ena") ; + sSylki : Str -> NounH = \sylki -> + sKorpi sylki (init (weakGrade sylki) + "en") (init sylki + "enä") ; + + sKoira : Str -> NounH = \koira -> + let a = getHarmony (last koira) in + sKukko koira (koira + "n") (init koira + "i" + a) ; + +-- Loan words ending in consonants are actually similar to words like +-- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached +-- to the singular nominative. + + sLinux : Str -> NounH = \linuxia -> + let { + linux = Predef.tk 2 linuxia ; + a = getHarmony (Predef.dp 1 linuxia) ; + linuxi = linux + "i" + } in + mkSubst a + linux + linuxi + linuxi + (linuxi + a) + (linuxi + "in") + (linux + "ei") + (linux + "ei") + (linux + "ien") + (linux + "ej" + a) + (linux + "eihin") ; + +-- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "rytinä". + + sPeruna : Str -> NounH = \peruna -> + let { + a = Predef.dp 1 peruna ; + perun = Predef.tk 1 peruna ; + perunoi = perun + (ifTok Str a "a" "o" "ö" + "i") + } + in + mkSubst a + peruna + peruna + peruna + (peruna + a) + (peruna + a + "n") + perunoi + perunoi + (perunoi + "den") + (perunoi + ("t" + a)) + (perunoi + "hin") ; + + sTohtori : Str -> NounH = \tohtoria -> + let + a = last tohtoria ; + tohtori = init tohtoria ; + tohtorei = init tohtori + "ei" ; + in + mkSubst a + tohtori + tohtori + tohtori + tohtoria + (tohtori + "in") + tohtorei + tohtorei + (tohtorei + "den") + (tohtorei + "t" + a) + (tohtorei + "hin") ; + + sRadio : Str -> NounH = \radio -> + let + o = last radio ; + a = getHarmony o ; + radioi = radio + "i" ; + in + mkSubst a + radio + radio + radio + (radio + "t" + a) + (radio + o + "n") + radioi + radioi + (radioi + "den") + (radioi + "t" + a) + (radioi + "hin") ; + +-- Surpraisingly, making the test for the partitive, this not only covers +-- "rae", "perhe", "savuke", but also "rengas", "lyhyt" (except $Sg Illat$), etc. + + sRae : (_,_ : Str) -> NounH = \rae,rakeena -> + let { + a = Predef.dp 1 rakeena ; + rakee = Predef.tk 2 rakeena ; + rakei = Predef.tk 1 rakee + "i" ; + raet = rae + (ifTok Str (Predef.dp 1 rae) "e" "t" []) + } + in + mkSubst a + rae + rakee + rakee + (raet + ("t" + a)) + (rakee + "seen") + rakei + rakei + (rakei + "den") + (rakei + ("t" + a)) + (rakei + "siin") ; + + sSusi : (_,_,_ : Str) -> NounH = \susi,suden,sutena -> + let + a = Predef.dp 1 sutena ; + sude = Predef.tk 1 suden ; + sute = Predef.tk 2 sutena ; + sutt = Predef.tk 1 sute + "t" + in + mkSubst a + susi + sude + sute + (sutt + a) + (sute + "en") + susi + susi + (sutt + "en") --- var susi + "en" bad with suuri + (susi + a) + (susi + "in") ; + + sPuu : Str -> NounH = \puu -> + let { + u = Predef.dp 1 puu ; + a = getHarmony u ; + pu = Predef.tk 1 puu ; + pui = pu + "i" + } + in + mkSubst a + puu + puu + puu + (puu + ("t" + a)) + (puu + ("h" + u + "n")) + pui + pui + (pui + "den") + (pui + ("t" + a)) + (pui + "hin") ; + + sSuo : Str -> NounH = \suo -> + let { + o = Predef.dp 1 suo ; + a = getHarmony o ; + soi = Predef.tk 2 suo + (o + "i") + } + in + mkSubst a + suo + suo + suo + (suo + ("t" + a)) + (suo + ("h" + o + "n")) + soi + soi + (soi + "den") + (soi + ("t" + a)) + (soi + "hin") ; + +-- Here in fact it is handy to use the partitive form as the only stem. + + sNainen : Str -> NounH = \naista -> + let { + nainen = Predef.tk 3 naista + "nen" ; + nais = Predef.tk 2 naista ; + naise = nais + "e" ; + naisi = nais + "i" ; + a = Predef.dp 1 naista + } + in + mkSubst a + nainen + naise + naise + (nais + ("t" + a)) + (nais + "een") + naisi + naisi + (nais + "ten") + (nais + ("i" + a)) + (nais + "iin") ; + +-- The following covers: "tilaus", "kaulin", "paimen", "laidun", "sammal", +-- "kyynel" (excep $Sg Iness$ for the last two?). + + sTilaus : (_,_ : Str) -> NounH = \tilaus, tilauksena -> + let { + tilauks = Predef.tk 3 tilauksena ; + tilaukse = tilauks + "e" ; + tilauksi = tilauks + "i" ; + a = Predef.dp 1 tilauksena + } + in + mkSubst a + tilaus + tilaukse + tilaukse + (tilaus + ("t" + a)) + (tilauks + "een") + tilauksi + tilauksi + (tilaus + "ten") + (tilauks + ("i" + a)) + (tilauks + "iin") ; + +-- Some words have the three grades ("rakkaus","rakkauden","rakkautena"), which +-- are however derivable from the stem. + + sRakkaus : Str -> NounH = \rakkaus -> + let { + rakkau = Predef.tk 1 rakkaus ; + rakkaut = rakkau + "t" ; + rakkaute = rakkau + "te" ; + rakkaude = rakkau + "de" ; + rakkauksi = rakkau + "ksi" ; + u = Predef.dp 1 rakkau ; + a = ifTok Str u "u" "a" "ä" + } + in + mkSubst a + rakkaus + rakkaude + rakkaute + (rakkaut + ("t" + a)) + (rakkaut + "een") + rakkauksi + rakkauksi + (rakkauksi + "en") + (rakkauksi + a) + (rakkauksi + "in") ; + +-- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris". + + sNauris : (_ : Str) -> NounH = \naurista -> + let { + a = Predef.dp 1 naurista ; + nauris = Predef.tk 2 naurista ; + nauri = Predef.tk 3 naurista ; + i = Predef.dp 1 nauri ; + naurii = nauri + i ; + naurei = nauri + "i" + } + in + mkSubst a + nauris + naurii + naurii + (nauris + ("t" + a)) + (naurii + "seen") + naurei + naurei + (naurei + "den") + (naurei + ("t" + a)) + (naurei + "siin") ; + +-- Words of the form "siitin", "avain", "höyhen" (w or wo grade alternation). + + sLiitin : Str -> Str -> NounH = \liitin,liittimen -> + let + liittime = init liittimen ; + liitti = Predef.tk 2 liittime ; + m = last (init liittime) ; + liittimi = liitti + m + "i" ; + a = vowelHarmony liitin ; + in + mkSubst a + liitin + liittime + liittime + (liitin + "t" + a) + (liittime + "en") + (liittimi) + (liittimi) + (liittimi + "en") + (liittimi + a) + (liittimi + "in") ; + +-- The following covers adjectives like "kapea", "leveä". + + sKapea : (_ : Str) -> NounH = \kapea -> + let + a = last kapea ; + kape = init kapea ; + kapei = kape + "i" + in + mkSubst a + kapea + kapea + kapea + (kapea + a) + (kapea + a+"n") + kapei + kapei + (kapei + "den") + (kapei + ("t" + a)) + (kapei + "siin") ; + +-- The following two are used for adjective comparison. + + sSuurempi : Str -> NounH = \suurempaa -> + let { + a = Predef.dp 1 suurempaa ; + suure = Predef.tk 4 suurempaa ; + suurempi = suure + "mpi" ; + suurempa = suure + ("mp" + a) ; + suuremm = suure + "mm" + } + in + mkSubst a + suurempi + (suuremm + a) + suurempa + (suurempa + a) + (suurempa + (a + "n")) + suurempi + (suuremm + "i") + (suurempi + "en") + (suurempi + a) + (suurempi + "in") ; + + sSuurin : Str -> NounH = \suurinta -> + let { + a = Predef.dp 1 suurinta ; + suuri = Predef.tk 3 suurinta ; + suurin = suuri + "n" ; + suurimma = suuri + ("mm" + a) ; + suurimpa = suuri + ("mp" + a) ; + suurimpi = suuri + "mpi" ; + suurimmi = suuri + "mmi" + } + in + mkSubst a + suurin + suurimma + suurimpa + (suurin + ("t" + a)) + (suurimpa + (a + "n")) + suurimpi + suurimmi + (suurimpi + "en") + (suurimpi + a) + (suurimpi + "in") ; + +-- This auxiliary resolves vowel harmony from a given letter. + +getHarmony : Str -> Str = \u -> case u of { + "a"|"o"|"u" => "a" ; + _ => "ä" + } ; + +-- This function inspects the whole word. + +vowelHarmony : Str -> Str = \liitin -> + if_then_Str (pbool2bool (Predef.occurs "aou" liitin)) "a" "ä" ; + +-- The following function defines how grade alternation works if it is active. +-- In general, *whether there is* grade alternation must be given in the lexicon +-- (cf. "auto - auton" not "audon"; "vihje - vihjeen" not "vihkeen"). + + weakGrade : Str -> Str = \kukko -> + let + ku = Predef.tk 3 kukko ; + kko = Predef.dp 3 kukko ; + o = last kukko + in + case kko of { + "kk" + _ => ku + "k" + o ; + "pp" + _ => ku + "p" + o ; + "tt" + _ => ku + "t" + o ; + "nk" + _ => ku + "ng" + o ; + "nt" + _ => ku + "nn" + o ; + "mp" + _ => ku + "mm" + o ; + "rt" + _ => ku + "rr" + o ; + "lt" + _ => ku + "ll" + o ; + "lk" + ("i" | "e") => ku + "lj" + o ; + "rk" + ("i" | "e") => ku + "rj" + o ; + "lk" + _ => ku + "l" + o ; + "rk" + _ => ku + "r" + o ; + ("hk" | "tk") + _ => kukko ; -- *tahko-tahon, *pitkä-pitkän + "s" + ("k" | "p" | "t") + _ => kukko ; -- *lasku-lasvun, *raspi-rasvin, *lastu-lasdun + x + "ku" => ku + x + "vu" ; + x + "k" + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") => ku + x + o ; + x + "p" + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") => ku + x + "v" + o ; + x + "t" + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") => ku + x + "d" + o ; + _ => kukko + } ; + +--- This is only used to analyse nouns "rae", "hake", etc. + + strongGrade : Str -> Str = \hake -> + let + ha = Predef.tk 2 hake ; + e = last hake ; + hak = init hake ; + hd = Predef.dp 2 hak + in + case hd of { + "ng" => ha + "k" ; + "nn" => ha + "t" ; + "mm" => ha + "p" ; + "rr" | "ll" => ha + "t" ; + "hj" | "lj" => ha + "k" ; -- pohje/lahje impossible + "hk" | "sk" | "sp" | "st" => hak ; + _ + "k" => ha + "kk" ; + _ + "p" => ha + "pp" ; + _ + "t" => ha + "tt" ; + _ + "d" => ha + "t" ; + _ + ("a" | "ä") => hak + "k" ; -- säe, tae + _ + "v" => ha + "p" ; -- rove/hyve impossible + _ => hak + } + e ; + +--3 Proper names +-- +-- Proper names are similar to common nouns in the singular. + + ProperName = {s : Case => Str} ; + + mkProperName : CommonNoun -> ProperName = \jussi -> + {s = \\c => jussi.s ! NCase Sg c} ; + +-- An ending given to a symbol cannot really be decided +-- independently. The string $a$ gives the vowel harmony. +-- Only some South-West dialects have the generally valid +-- Illative form. + + caseEnding : Str -> Case -> Str = \a,c -> case c of { + Nom => [] ; + Gen => "n" ; + Part => a ; --- + Transl => "ksi" ; + Ess => "n" + a ; + Iness => "ss" + a ; + Elat => "st" + a ; + Illat => "sse" ; --- + Adess => "ll" + a ; + Ablat => "lt" + a ; + Allat => "lle" ; + Abess => "tt" + a + } ; + + symbProperName : Str -> ProperName = \x -> + {s = table { + Nom => x ; + c => glue x (":" + caseEnding "a" c) + } + } ; + +--2 Pronouns +-- +-- Here we define personal and relative pronouns. + + mkPronoun : (_,_,_,_,_ : Str) -> Number -> Person -> + {s : NPForm => Str ; a : Agr} = + \mina, minun, minua, minuna, minuun, n, p -> + let { + minu = Predef.tk 2 minuna ; + a = Predef.dp 1 minuna + } in + {s = table { + NPCase Nom => mina ; + NPCase Gen => minun ; + NPCase Part => minua ; + NPCase Transl => minu + "ksi" ; + NPCase Ess => minuna ; + NPCase Iness => minu + ("ss" + a) ; + NPCase Elat => minu + ("st" + a) ; + NPCase Illat => minuun ; + NPCase Adess => minu + ("ll" + a) ; + NPCase Ablat => minu + ("lt" + a) ; + NPCase Allat => minu + "lle" ; + NPCase Abess => minu + ("tt" + a) ; + NPAccNom | NPAccGen => Predef.tk 1 minun + "t" + } ; + a = {n = n ; p = p} + } ; + + pronMina = mkPronoun "minä" "minun" "minua" "minuna" "minuun" Sg P1 ; + pronSina = mkPronoun "sinä" "sinun" "sinua" "sinuna" "sinuun" Sg P2 ; + pronHan = mkPronoun "hän" "hänen" "häntä" "hänenä" "häneen" Sg P3 ; + pronMe = mkPronoun "me" "meidän" "meitä" "meinä" "meihin" Pl P1 ; + pronTe = mkPronoun "te" "teidän" "teitä" "teinä" "teihin" Pl P2 ; + pronHe = mkPronoun "he" "heidän" "heitä" "heinä" "heihin" Pl P3 ; + pronNe = mkPronoun "ne" "niiden" "niitä" "niinä" "niihin" Pl P3 ; + + pronTama = mkPronoun "tämä" "tämän" "tätä" "tänä" "tähän" Sg P3 ; + pronNama = mkPronoun "nämä" "näiden" "näitä" "näinä" "näihin" Pl P3 ; + pronTuo = mkPronoun "tuo" "tuon" "tuota" "tuona" "tuohon" Sg P3 ; + pronNuo = mkPronoun "nuo" "noiden" "noita" "noina" "noihin" Pl P3 ; + +-- The non-human pronoun "se" ('it') is even more irregular, +-- Its accusative cases do not +-- have a special form with "t", but have the normal genitive/nominative variation. +-- We use the type $ProperName$ for "se", because of the accusative but also +-- because the person and number are as for proper names. + + pronSe : ProperName = { + s = table { + Nom => "se" ; + Gen => "sen" ; + Part => "sitä" ; + Transl => "siksi" ; + Ess => "sinä" ; + Iness => "siinä" ; + Elat => "siitä" ; + Illat => "siihen" ; + Adess => "sillä" ; + Ablat => "siltä" ; + Allat => "sille" ; + Abess => "sittä" + } ; + } ; + +-- The possessive suffixes will be needed in syntax. It will show up +-- as a separate word ("auto &+ ni"), which needs unlexing. Unlexing also +-- has to fix the vowel harmony in cases like "äiti &+ nsä". + + suff : Str -> Str = \ni -> ni ; + + possSuffix : Number => Person => Str = \\n,p => + suff (case of { + => "ni" ; + => "si" ; + => "nsa" ; + => "mme" ; + => "nne" ; + => "nsa" + } ) ; + +-- The relative pronoun, "joka", is inflected in case and number, +-- like common nouns, but it does not take possessive suffixes. +-- The inflextion shows a surprising similarity with "suo". + + relPron : {s : Number => Case => Str} = + let {jo = nhn (sSuo "jo")} in {s = + table { + Sg => table { + Nom => "joka" ; + Gen => "jonka" ; + c => jo.s ! NCase Sg c + } ; + Pl => table { + Nom => "jotka" ; + c => "j" + (jo.s ! NCase Pl c) + } + } + } ; + + mikaInt : Number => Case => Str = + let { + mi = nhn (sSuo "mi") + } in + table { + Sg => table { + Nom => "mikä" ; + Gen => "minkä" ; + c => mi.s ! NCase Sg c + } ; + Pl => table { + Nom => "mitkä" ; + Gen => "mittenkä" ; + c => mi.s ! NCase Sg c + } + } ; + + kukaInt : Number => Case => Str = + let { + ku = nhn (sRae "kuka" "kenenä") ; + ket = nhn (sRae "kuka" "keinä")} in + table { + Sg => table { + Nom => "kuka" ; + Part => "ketä" ; + Illat => "keneen" ; + c => ku.s ! NCase Sg c + } ; + Pl => table { + Nom => "ketkä" ; + Illat => "keihin" ; + c => ket.s ! NCase Pl c + } + } ; + + mikaanPron : Number => Case => Str = \\n,c => + case of { + => "mikään" ; + <_,Part> => "mitään" ; + => "minkään" ; + => "mitkään" ; + => "mittenkään" ; + <_,Ess> => "minään" ; + <_,Iness> => "missään" ; + <_,Elat> => "mistään" ; + <_,Adess> => "millään" ; + <_,Ablat> => "miltään" ; + _ => mikaInt ! n ! c + "kään" + } ; + + kukaanPron : Number => Case => Str = + table { + Sg => table { + Nom => "kukaan" ; + Part => "ketään" ; + Ess => "kenään" ; + Iness => "kessään" ; + Elat => "kestään" ; + Illat => "kehenkään" ; + Adess => "kellään" ; + Ablat => "keltään" ; + c => kukaInt ! Sg ! c + "kään" + } ; + Pl => table { + Nom => "ketkään" ; + Part => "keitään" ; + Ess => "keinään" ; + Iness => "keissään" ; + Elat => "keistään" ; + Adess => "keillään" ; + Ablat => "keiltään" ; + c => kukaInt ! Pl ! c + "kään" + } + } ; + + jokuPron : Number => Case => Str = + let + ku = nhn (sPuu "ku") ; + kui = nhn (sPuu "kuu") + in + table { + Sg => table { + Nom => "joku" ; + Gen => "jonkun" ; + c => relPron.s ! Sg ! c + ku.s ! NCase Sg c + } ; + Pl => table { + Nom => "jotkut" ; + c => relPron.s ! Pl ! c + kui.s ! NCase Pl c + } + } ; + + jokinPron : Number => Case => Str = + table { + Sg => table { + Nom => "jokin" ; + Gen => "jonkin" ; + c => relPron.s ! Sg ! c + "kin" + } ; + Pl => table { + Nom => "jotkin" ; + c => relPron.s ! Pl ! c + "kin" + } + } ; + +moniPron : Case => Str = caseTable Sg (nhn (sSusi "moni" "monen" "monena")) ; + +caseTable : Number -> CommonNoun -> Case => Str = \n,cn -> + \\c => cn.s ! NCase n c ; + + +--2 Adjectives +-- +-- To form an adjective, it is usually enough to give a noun declension: the +-- adverbial form is regular. + + Adj : Type = {s : AForm => Str} ; + + noun2adj : CommonNoun -> Adj = noun2adjComp True ; + + noun2adjComp : Bool -> CommonNoun -> Adj = \isPos,tuore -> + let + tuoreesti = Predef.tk 1 (tuore.s ! NCase Sg Gen) + "sti" ; + tuoreemmin = Predef.tk 2 (tuore.s ! NCase Sg Gen) + "in" + in {s = table { + AN f => tuore.s ! f ; + AAdv => if_then_Str isPos tuoreesti tuoreemmin + } + } ; + +-- For the comparison of adjectives, three noun declensions +-- are needed in the worst case. + + mkAdjective : (_,_,_ : Adj) -> Adjective = \hyva,parempi,paras -> + {s = table { + Posit => hyva.s ; + Compar => parempi.s ; + Superl => paras.s + } + } ; + +-- However, it is usually enough to give the positive declension and +-- the characteristic forms of comparative and superlative. + + regAdjective : CommonNoun -> Str -> Str -> Adjective = \kiva, kivempaa, kivinta -> + mkAdjective + (noun2adj kiva) + (noun2adjComp False (nhn (sSuurempi kivempaa))) + (noun2adjComp False (nhn (sSuurin kivinta))) ; + + +--3 Verbs +-- +-- The present, past, conditional. and infinitive stems, acc. to Koskenniemi. +-- Unfortunately not enough (without complicated processes). +-- We moreover give grade alternation forms as arguments, since it does not +-- happen automatically. +--- A problem remains with the verb "seistä", where the infinitive +--- stem has vowel harmony "ä" but the others "a", thus "seisoivat" but "seiskää". + + + mkVerb : (_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Verb = + \tulla,tulee,tulen,tulevat,tulkaa,tullaan,tuli,tulin,tulisi,tullut,tultu,tullun -> + v2v (mkVerbH + tulla tulee tulen tulevat tulkaa tullaan tuli tulin tulisi tullut tultu tullun + ) ; + + v2v : VerbH -> Verb = \vh -> + let + tulla = vh.tulla ; + tulee = vh.tulee ; + tulen = vh.tulen ; + tulevat = vh.tulevat ; + tulkaa = vh.tulkaa ; + tullaan = vh.tullaan ; + tuli = vh.tuli ; + tulin = vh.tulin ; + tulisi = vh.tulisi ; + tullut = vh.tullut ; + tultu = vh.tultu ; + tultu = vh.tultu ; + tullun = vh.tullun ; + tuje = init tulen ; + tuji = init tulin ; + a = Predef.dp 1 tulkaa ; + tulko = Predef.tk 2 tulkaa + (ifTok Str a "a" "o" "ö") ; + o = last tulko ; + tulleena = Predef.tk 2 tullut + ("een" + a) ; + tulleen = (noun2adj (nhn (sRae tullut tulleena))).s ; + tullun = (noun2adj (nhn (sKukko tultu tullun (tultu + ("j"+a))))).s ; + tulema = tuje + "m" + a ; + vat = "v" + a + "t" + in + {s = table { + Inf => tulla ; + Presn Sg P1 => tuje + "n" ; + Presn Sg P2 => tuje + "t" ; + Presn Sg P3 => tulee ; + Presn Pl P1 => tuje + "mme" ; + Presn Pl P2 => tuje + "tte" ; + Presn Pl P3 => tulevat ; + Impf Sg P1 => tuji + "n" ; + Impf Sg P2 => tuji + "t" ; + Impf Sg P3 => tuli ; + Impf Pl P1 => tuji + "mme" ; + Impf Pl P2 => tuji + "tte" ; + Impf Pl P3 => tuli + vat ; + Condit Sg P1 => tulisi + "n" ; + Condit Sg P2 => tulisi + "t" ; + Condit Sg P3 => tulisi ; + Condit Pl P1 => tulisi + "mme" ; + Condit Pl P2 => tulisi + "tte" ; + Condit Pl P3 => tulisi + vat ; + Imper Sg => tuje ; + Imper Pl => tulkaa ; + ImperP3 Sg => tulko + o + "n" ; + ImperP3 Pl => tulko + o + "t" ; + ImperP1Pl => tulkaa + "mme" ; + ImpNegPl => tulko ; + Pass True => tullaan ; + Pass False => Predef.tk 2 tullaan ; + PastPartAct n => tulleen ! n ; + PastPartPass n => tullun ! n ; + Inf3Iness => tulema + "ss" + a ; + Inf3Elat => tulema + "st" + a ; + Inf3Illat => tulema + a + "n" ; + Inf3Adess => tulema + "ll" + a ; + Inf3Abess => tulema + "tt" + a + } + } ; + + VerbH : Type = { + tulla,tulee,tulen,tulevat,tulkaa,tullaan,tuli,tulin,tulisi,tullut,tultu,tullun + : Str + } ; + + mkVerbH : (_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> VerbH = + \tulla,tulee,tulen,tulevat,tulkaa,tullaan,tuli,tulin,tulisi,tullut,tultu,tullun -> + {tulla = tulla ; + tulee = tulee ; + tulen = tulen ; + tulevat = tulevat ; + tulkaa = tulkaa ; + tullaan = tullaan ; + tuli = tuli ; + tulin = tulin ; + tulisi = tulisi ; + tullut = tullut ; + tultu = tultu ; + tullun = tullun + } ; + + regVerbH : Str -> VerbH = \soutaa -> + let + taa = Predef.dp 3 soutaa ; + juo = Predef.tk 2 soutaa ; + souda = weakGrade (init soutaa) ; + soudan = juo + "en" ; + o = Predef.dp 1 juo ; + a = last soutaa ; + u = ifTok Str a "a" "u" "y" ; + joi = Predef.tk 2 juo + (o + "i") + in + case taa of { + "it" + _ => vHarkita soutaa ; + ("st" | "nn" | "rr" | "ll") + _ => vJuosta soutaa soudan (juo + o+u+"t") (juo + "t"+u) ; + _ + ("aa" | "ää") => vOttaa soutaa (souda + "n") ; + ("o" | "u" | "y" | "ö") + ("da" | "dä") => vJuoda soutaa joi ; + ("ata" | "ätä") => vOsata soutaa ; + _ => vHukkua soutaa souda + } ; + + reg2VerbH : (soutaa,souti : Str) -> VerbH = \soutaa,souti -> + let + soudat = regVerbH soutaa ; + soudan = weakGrade (init soutaa) + "n" ; + soudin = weakGrade souti + "n" ; + souden = init souti + "en" ; + juo = Predef.tk 2 soutaa ; + o = Predef.dp 1 juo ; + u = ifTok Str (last soutaa) "a" "u" "y" ; + taa = Predef.dp 3 soutaa ; + in + case taa of { + "taa" | "tää" => vHuoltaa soutaa soudan souti soudin ; + "ata" | "ätä" => vPalkata soutaa souti ; + "sta" | "stä" => vJuosta soutaa souden (juo + o+u+"t") (juo + "t"+u) ; + _ => soudat + } ; + + reg3VerbH : (_,_,_ : Str) -> VerbH = \soutaa,soudan,souti -> + let + taa = Predef.dp 3 soutaa ; + souda = init soudan ; + juo = Predef.tk 2 soutaa ; + o = last juo ; + a = last taa ; + u = ifTok Str a "a" "u" "y" ; + soudin = weakGrade 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 + } ; + +-- For "harppoa", "hukkua", "löytyä", with grade alternation. + + vHukkua : (_,_ : Str) -> VerbH = \hukkua,huku -> + let { + a = Predef.dp 1 hukkua ; + hukku = Predef.tk 1 hukkua ; + u = Predef.dp 1 huku ; + i = case u of { + "e" | "i" => [] ; + _ => u + } ; + y = case a of { + "a" => "u" ; + _ => "y" + } ; + hukkui = init hukku + i + "i" ; + hukui = init huku + i + "i" ; + } in + mkVerbH + hukkua + (hukku + u) + (huku + "n") + (hukku + "v" + a + "t") + (hukku + (("k" + a) + a)) + (huku + ((("t" + a) + a) + "n")) + (hukkui) + (hukui + "n") + (hukkui + "si") + (hukku + "n" + y + "t") + (huku + "tt" + y) + (huku + "t" + y + "t") ; + +-- For cases with or without alternation: "sanoa", "valua", "kysyä". + + vSanoa : Str -> VerbH = \sanoa -> + vHukkua sanoa (Predef.tk 1 sanoa) ; +---- vHukkua sanoa (weakGrade (Predef.tk 1 sanoa)) ; +---- The gfr file becomes 6* bigger if this change is done + +-- For "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää". + + vHuoltaa : (_,_,_,_ : Str) -> VerbH = \ottaa,otan,otti,otin -> + let { + a = Predef.dp 1 ottaa ; + aa = a + a ; + u = case a of {"a" => "u" ; _ => "y"} ; + ota = Predef.tk 1 otan ; + otta = Predef.tk 1 ottaa ; + ote = Predef.tk 1 ota + "e" + } in + mkVerbH + ottaa + ottaa + otan + (otta + "v" + a + "t") + (otta + "k" + aa) + (ote + "t" + aa + "n") + otti + otin + (otta + "isi") + (otta + "n" + u + "t") + (ote + "tt" + u) + (ote + "t" + u + "n") ; + +-- For cases where grade alternation is not affected by the imperfect "i". + + vOttaa : (_,_ : Str) -> VerbH = \ottaa,otan -> + let + i = "i" ; --- wrong rule if_then_Str (pbool2bool (Predef.occurs "ou" ottaa)) "i" "oi" + in + vHuoltaa ottaa otan (Predef.tk 2 ottaa + i) (Predef.tk 2 otan + i + "n") ; + +-- For "poistaa", "ryystää". + + vPoistaa : Str -> VerbH = \poistaa -> + vOttaa poistaa ((Predef.tk 1 poistaa + "n")) ; + + +-- For "osata", "lisätä"; grade alternation is unpredictable, as seen +-- from "pelätä-pelkäsi" vs. "palata-palasi" + + + vOsata : Str -> VerbH = \osata -> + vPalkata osata (Predef.tk 2 osata + "si") ; + + vPalkata : Str -> Str -> VerbH = \palkata,palkkasi -> + let + a = Predef.dp 1 palkata ; + palka = Predef.tk 2 palkata ; + palkka = Predef.tk 2 palkkasi ; + u = case a of {"a" => "u" ; _ => "y"} + in + mkVerbH + palkata + (palkka + a) + (palkka + (a + "n")) + (palkka + (((a + "v") + a) + "t")) + (palka + ((("t" + "k") + a) + a)) + (palkata + (a + "n")) + (palkka + "si") + (palkka + "sin") + (palkka + "isi") + (palka + "nn" + u + "t") + (palka + "tt" + u) + (palka + "t" + u + "n") ; + + vPudota : Str -> Str -> VerbH = \pudota, putosi -> + let + a = Predef.dp 1 pudota ; + pudo = Predef.tk 2 pudota ; + puto = Predef.tk 2 putosi ; + putoa = puto + a ; + u = case a of {"a" => "u" ; _ => "y"} + in + mkVerbH + pudota + (putoa + a) + (putoa + "n") + (putoa + "v" + a + "t") + (pudo + "tk" + a + a) + (pudota + a + "n") + (puto + "si") + (puto + "sin") + (puto + a + "isi") + (pudo + "nn" + u + "t") + (pudo + "tt" + u) + (pudo + "t" + u + "n") ; + + vHarkita : Str -> VerbH = \harkita -> + let + a = Predef.dp 1 harkita ; + harki = Predef.tk 2 harkita ; + harkitse = harki + "tse" ; + harkitsi = harki + "tsi" ; + u = case a of {"a" => "u" ; _ => "y"} + in + mkVerbH + harkita + (harkitse + "e") + (harkitse + "n") + (harkitse + "v" + a + "t") + (harki + "tk"+ a + a) + (harkita + a + "n") + (harkitsi) + (harkitsi + "n") + (harkitsi + "si") + (harki + "nn" + u + "t") + (harki + "tt" + u) + (harki + "t" + u + "n") ; + + +----- tulla,tulee,tulen,tulevat,tulkaa,tullaan,tuli,tulin,tulisi,tullut,tultu,tullun + +-- For "juosta", "piestä", "nousta", "rangaista", "kävellä", "surra", "panna". + + vJuosta : (_,_,_,_ : Str) -> VerbH = \juosta,juoksen,juossut,juostu -> + let + a = Predef.dp 1 juosta ; + t = last (init juosta) ; + juokse = Predef.tk 1 juoksen ; + juoksi = Predef.tk 2 juoksen + "i" ; + juos = Predef.tk 2 juosta ; + juostun = ifTok Str t "t" (juostu + "n") (init juossut + "n") ; + in + mkVerbH + juosta + (juokse + "e") + juoksen + (juokse + (("v" + a) + "t")) + (juos + (("k" + a) + a)) + (juosta + (a + "n")) + juoksi + (juoksi + "n") + (juoksi + "si") + juossut + juostu + juostun ; + +-- For "juoda", "syödä", "viedä", "naida", "saada". + + vJuoda : (_,_ : Str) -> VerbH = \juoda, joi -> + let + a = Predef.dp 1 juoda ; + juo = Predef.tk 2 juoda ; + u = case a of {"a" => "u" ; _ => "y"} + in + mkVerbH + juoda + juo + (juo + "n") + (juo + (("v" + a) + "t")) + (juo + (("k" + a) + a)) + (juoda + (a + "n")) + joi + (joi + "n") + (joi + "si") + (juo + "n" + u + "t") + (juo + "t" + u) + (juo + "d" + u + "n") ; + + verbOlla : Verb = + mkVerb + "olla" "on" "olen" "ovat" "olkaa" "ollaan" + "oli" "olin" "olisi" "ollut" "oltu" "ollun" ; + +-- The negating operator "ei" is actually a verb, which has present +-- active indicative and imperative forms, but no infinitive. + + verbEi : Verb = + let ei = + mkVerb + "ei" "ei" "en" "eivät" "älkää" + "ei" "e" "en" "e" "ei" "ei" "ei" + in + {s = table { + Imper Sg => "älä" ; +-- Impf n p | Condit n p => ei.s ! Presn n p ; + Impf n p => ei.s ! Presn n p ; + Condit n p => ei.s ! Presn n p ; + v => ei.s ! v + } + } ; + +--2 Some structural words + + kuinConj = "kuin" ; + + conjEtta = "että" ; + advSiten = "siten" ; + + + kaikkiPron : Number -> Case => Str = \n -> + let {kaiket = caseTable n (nhn (sKorpi "kaikki" "kaiken" "kaikkena"))} in + table { + Nom => "kaikki" ; + c => kaiket ! c + } ; + + stopPunct = "." ; + commaPunct = "," ; + questPunct = "?" ; + exclPunct = "!" ; + + koPart = suff "ko" ; + +-- For $NumeralsFin$. + + param NumPlace = NumIndep | NumAttr ; + +oper + yksiN = nhn (mkSubst "ä" "yksi" "yhde" "yhte" "yhtä" "yhteen" "yksi" "yksi" + "yksien" "yksiä" "yksiin") ; + kymmenenN = nhn (mkSubst "ä" "kymmenen" "kymmene" "kymmene" "kymmentä" + "kymmeneen" "kymmeni" "kymmeni" "kymmenien" "kymmeniä" + "kymmeniin") ; + sataN = nhn (sLukko "sata") ; + + tuhatN = nhn (mkSubst "a" "tuhat" "tuhanne" "tuhante" "tuhatta" "tuhanteen" + "tuhansi" "tuhansi" "tuhansien" "tuhansia" "tuhansiin") ; + + kymmentaN = {s = table { + NCase Sg Nom => "kymmentä" ; + c => kymmenenN.s ! c + } + } ; + + sataaN = {s = table { + Sg => sataN.s ; + Pl => table { + NCase Sg Nom => "sataa" ; + c => sataN.s ! c + } + } + } ; + tuhattaN = {s = table { + Sg => tuhatN.s ; + Pl => table { + NCase Sg Nom => "tuhatta" ; + c => tuhatN.s ! c + } + } + } ; +} ; + + + diff --git a/lib/resource-1.0/finnish/NounFin.gf b/lib/resource-1.0/finnish/NounFin.gf new file mode 100644 index 000000000..f8580120a --- /dev/null +++ b/lib/resource-1.0/finnish/NounFin.gf @@ -0,0 +1,71 @@ +concrete NounFin of Noun = CatFin ** open ResFin, Prelude in { + + flags optimize=all_subs ; + + lin + DetCN det cn = { + s = \\c => det.s ++ cn.s ! det.n ! c ; + a = agrP3 det.n + } ; + UsePN pn = pn ** {a = agrP3 Sg} ; + UsePron p = p ; + + PredetNP pred np = { + s = \\c => pred.s ++ np.s ! c ; + a = np.a + } ; + + DetSg quant ord = { + s = quant.s ++ ord.s ; + n = Sg + } ; + + DetPl quant num ord = { + s = quant.s ++ num.s ++ ord.s ; + n = Pl + } ; + + SgQuant quant = {s = quant.s ! Sg} ; + PlQuant quant = {s = quant.s ! Pl} ; + + PossPron p = {s = \\_ => p.s ! Gen} ; + + NoNum, NoOrd = {s = []} ; + + NumInt n = n ; + OrdInt n = {s = n.s ++ "th"} ; --- + + NumNumeral numeral = {s = numeral.s ! NCard} ; + OrdNumeral numeral = {s = numeral.s ! NOrd} ; + + AdNum adn num = {s = adn.s ++ num.s} ; + + OrdSuperl a = {s = a.s ! AAdj Superl} ; + + DefArt = {s = \\_ => artDef} ; + + IndefArt = { + s = table { + Sg => artIndef ; + Pl => [] + } + } ; + + MassDet = {s = [] ; n = Sg} ; + + UseN n = n ; + UseN2 n = n ; + UseN3 n = n ; + + ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ; + ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ; + + AdjCN ap cn = { + s = \\n,c => preOrPost ap.isPre (ap.s ! agrP3 n) (cn.s ! n ! c) + } ; + RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ; + AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ; + + SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ; + +} diff --git a/lib/resource-1.0/finnish/NumeralFin.gf b/lib/resource-1.0/finnish/NumeralFin.gf new file mode 100644 index 000000000..7df555918 --- /dev/null +++ b/lib/resource-1.0/finnish/NumeralFin.gf @@ -0,0 +1,44 @@ +concrete NumeralFin of Numeral = CatFin ** open ResFin in { + +lincat + Digit = {s : DForm => CardOrd => Str} ; + Sub10 = {s : DForm => CardOrd => Str ; n : Number} ; + Sub100 = {s : CardOrd => Str ; n : Number} ; + Sub1000 = {s : CardOrd => Str ; n : Number} ; + Sub1000000 = {s : CardOrd => Str ; n : Number} ; + +lin num x = x ; +lin n2 = let two = mkNum "two" "twelve" "twenty" "second" in + {s = \\f,c => case of { + => "twelfth" ; + _ => two.s ! f ! c + } + } ; + +lin n3 = mkNum "three" "thirteen" "thirty" "third" ; +lin n4 = mkNum "four" "fourteen" "forty" "fourth" ; +lin n5 = mkNum "five" "fifteen" "fifty" "fifth" ; +lin n6 = regNum "six" ; +lin n7 = regNum "seven" ; +lin n8 = mkNum "eight" "eighteen" "eighty" "eighth" ; +lin n9 = regNum "nine" ; + +lin pot01 = mkNum "one" "eleven" "ten" "first" ** {n = Sg} ; +lin pot0 d = d ** {n = Pl} ; +lin pot110 = regCardOrd "ten" ** {n = Pl} ; +lin pot111 = regCardOrd "eleven" ** {n = Pl} ; +lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ; +lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ; +lin pot1 d = {s = d.s ! ten} ** {n = Pl} ; +lin pot1plus d e = { + s = \\c => d.s ! ten ! NCard ++ "-" ++ e.s ! unit ! c ; n = Pl} ; +lin pot1as2 n = n ; +lin pot2 d = {s = \\c => d.s ! unit ! NCard ++ mkCard c "hundred"} ** {n = Pl} ; +lin pot2plus d e = { + s = \\c => d.s ! unit ! NCard ++ "hundred" ++ "and" ++ e.s ! c ; n = Pl} ; +lin pot2as3 n = n ; +lin pot3 n = { + s = \\c => n.s ! NCard ++ mkCard c "thousand" ; n = Pl} ; +lin pot3plus n m = { + s = \\c => n.s ! NCard ++ "thousand" ++ m.s ! c ; n = Pl} ; +} diff --git a/lib/resource-1.0/finnish/ParadigmsFin.gf b/lib/resource-1.0/finnish/ParadigmsFin.gf new file mode 100644 index 000000000..432e303c0 --- /dev/null +++ b/lib/resource-1.0/finnish/ParadigmsFin.gf @@ -0,0 +1,573 @@ +--# -path=.:../abstract:../../prelude + +--1 Finnish Lexical Paradigms +-- +-- Aarne Ranta 2003--2005 +-- +-- This is an API to the user of the resource grammar +-- for adding lexical items. It gives functions for forming +-- expressions of open categories: nouns, adjectives, verbs. +-- +-- Closed categories (determiners, pronouns, conjunctions) are +-- accessed through the resource syntax API, $Structural.gf$. +-- +-- The main difference with $MorphoFin.gf$ is that the types +-- referred to are compiled resource grammar types. We have moreover +-- had the design principle of always having existing forms, rather +-- than stems, as string arguments of the paradigms. +-- +-- The structure of functions for each word class $C$ is the following: +-- first we give a handful of patterns that aim to cover all +-- regular cases. Then we give a worst-case function $mkC$, which serves as an +-- escape to construct the most irregular words of type $C$. +-- However, this function should only seldom be needed: we have a +-- separate module $IrregularFin$, which covers all irregularly inflected +-- words. +-- +-- The following modules are presupposed: + +resource ParadigmsFin = open + (Predef=Predef), + Prelude, + MorphoFin, + CatFin + in { + +-- flags optimize=values ; + flags optimize=noexpand ; + +--2 Parameters +-- +-- To abstract over gender, number, and (some) case names, +-- we define the following identifiers. The application programmer +-- should always use these constants instead of their definitions +-- in $TypesInf$. + +oper + Number : Type ; + + singular : Number ; + plural : Number ; + + Case : Type ; + nominative : Case ; + genitive : Case ; + partitive : Case ; + translative : Case ; + inessive : Case ; + elative : Case ; + illative : Case ; + adessive : Case ; + ablative : Case ; + allative : Case ; + +-- The following type is used for defining *rection*, i.e. complements +-- of many-place verbs and adjective. A complement can be defined by +-- just a case, or a pre/postposition and a case. + + PPosition : Type ; + + prepP : Case -> Str -> PPosition ; + postpP : Case -> Str -> PPosition ; + caseP : Case -> PPosition ; + accusative : PPosition ; + +--2 Nouns + +-- The worst case gives ten forms and the semantic gender. +-- In practice just a couple of forms are needed, to define the different +-- stems, vowel alternation, and vowel harmony. + +oper + mkN : (talo, talon, talona, taloa, taloon, + taloina,taloissa,talojen,taloja,taloihin : Str) -> N ; + +-- The regular noun heuristic takes just one form (singular +-- nominative) and analyses it to pick the correct paradigm. +-- It does automatic grade alternation, and is hence not usable +-- for words like "auto" (whose genitive would become "audon"). + + regN : (talo : Str) -> N ; + +-- If $regN$ does not give the correct result, one can try and give +-- two or three forms as follows. Examples of the use of these +-- functions are given in $BasicFin$. Most notably, $reg2N$ is used +-- for nouns like "kivi - kiviä", which would otherwise become like +-- "rivi - rivejä". $regN3$ is used e.g. for +-- "sydän - sydämen - sydämiä", which would otherwise become +-- "sydän - sytämen". + + reg2N : (savi,savia : Str) -> N ; + reg3N : (vesi,veden,vesiä : Str) -> N ; + +-- Some nouns have an unexpected singular partitive, e.g. "meri", "lumi". + + sgpartN : (meri : N) -> (merta : Str) -> N ; + nMeri : (meri : Str) -> N ; + +-- The rest of the noun paradigms are mostly covered by the three +-- heuristics. +-- +-- Nouns with partitive "a"/"ä" are a large group. +-- To determine for grade and vowel alternation, three forms are usually needed: +-- singular nominative and genitive, and plural partitive. +-- Examples: "talo", "kukko", "huippu", "koira", "kukka", "syylä", "särki"... + + nKukko : (kukko,kukon,kukkoja : Str) -> N ; + +-- For convenience, we define 1-argument paradigms as producing the +-- nonhuman gender; the following function changes this: + + humanN : N -> N ; + +-- A special case are nouns with no alternations: +-- the vowel harmony is inferred from the last letter, +-- which must be one of "o", "u", "ö", "y". + + nTalo : (talo : Str) -> N ; + +-- Another special case are nouns where the last two consonants +-- undergo regular weak-grade alternation: +-- "kukko - kukon", "rutto - ruton", "hyppy - hypyn", "sampo - sammon", +-- "kunto - kunnon", "sisältö - sisällön", . + + nLukko : (lukko : Str) -> N ; + +-- "arpi - arven", "sappi - sapen", "kampi - kammen";"sylki - syljen" + + nArpi : (arpi : Str) -> N ; + nSylki : (sylki : Str) -> N ; + +-- Foreign words ending in consonants are actually similar to words like +-- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached +-- to the singular nominative. Examples: "linux", "savett", "screen". +-- The singular partitive form is used to get the vowel harmony. (N.B. more than +-- 1-syllabic words ending in "n" would have variant plural genitive and +-- partitive forms, like "sultanien"/"sultaneiden", which are not covered.) + + nLinux : (linuxia : Str) -> N ; + +-- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "tavara", +-- "rytinä". + + nPeruna : (peruna : Str) -> N ; + +-- The following paradigm covers both nouns ending in an aspirated "e", such as +-- "rae", "perhe", "savuke", and also many ones ending in a consonant +-- ("rengas", "kätkyt"). The singular nominative and essive are given. + + nRae : (rae, rakeena : Str) -> N ; + +-- The following covers nouns with partitive "ta"/"tä", such as +-- "susi", "vesi", "pieni". To get all stems and the vowel harmony, it takes +-- the singular nominative, genitive, and essive. + + nSusi : (susi,suden,sutta : Str) -> N ; + +-- Nouns ending with a long vowel, such as "puu", "pää", "pii", "leikkuu", +-- are inflected according to the following. + + nPuu : (puu : Str) -> N ; + +-- One-syllable diphthong nouns, such as "suo", "tie", "työ", are inflected by +-- the following. + + nSuo : (suo : Str) -> N ; + +-- Many adjectives but also nouns have the nominative ending "nen" which in other +-- cases becomes "s": "nainen", "ihminen", "keltainen". +-- To capture the vowel harmony, we use the partitive form as the argument. + + nNainen : (naista : Str) -> N ; + +-- The following covers some nouns ending with a consonant, e.g. +-- "tilaus", "kaulin", "paimen", "laidun". + + nTilaus : (tilaus,tilauksena : Str) -> N ; + +-- Special case: + + nKulaus : (kulaus : Str) -> N ; + +-- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris". +-- The partitive form is taken to get the vowel harmony. + + nNauris : (naurista : Str) -> N ; + +-- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen", +-- have only their last part inflected. + + nComp : 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 ; + + mkN3 : N -> Case -> Case -> N3 ; + +-- Proper names can be formed by using declensions for nouns. +-- The plural forms are filtered away by the compiler. + + mkPN : N -> PN ; + + +--2 Adjectives + +-- Non-comparison one-place adjectives are just like nouns. + + mkA : N -> A ; + +-- Two-place adjectives need a case for the second argument. + + mkA2 : A -> PPosition -> 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 +-- enough (except for the superlative "paras" of "hyvä"). + + mkADeg : (kiva : N) -> (kivempaa,kivinta : Str) -> A ; + +-- The regular adjectives are based on $regN$ in the positive. + + regADeg : (punainen : Str) -> A ; + + +--2 Verbs +-- +-- The grammar does not cover the potential mood and some nominal +-- forms. One way to see the coverage is to linearize a verb to +-- a table. +-- The worst case needs twelve forms, as shown in the following. + + mkV : (tulla,tulee,tulen,tulevat,tulkaa,tullaan, + tuli,tulin,tulisi,tullut,tultu,tullun : Str) -> V ; + +-- The following heuristics cover more and more verbs. + + regV : (soutaa : Str) -> V ; + reg2V : (soutaa,souti : Str) -> V ; + reg3V : (soutaa,soudan,souti : Str) -> V ; + +-- The rest of the paradigms are special cases mostly covered by the heuristics. +-- A simple special case is the one with just one stem and without grade alternation. + + vValua : (valua : Str) -> V ; + +-- With two forms, the following function covers a variety of verbs, such as +-- "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää". + + vKattaa : (kattaa, katan : Str) -> V ; + +-- When grade alternation is not present, just a one-form special case is needed +-- ("poistaa", "ryystää"). + + vOstaa : (ostaa : Str) -> V ; + +-- The following covers +-- "juosta", "piestä", "nousta", "rangaista", "kävellä", "surra", "panna". + + vNousta : (nousta, nousen : Str) -> V ; + +-- This is for one-syllable diphthong verbs like "juoda", "syödä". + + vTuoda : (tuoda : Str) -> V ; + +-- All the patterns above have $nominative$ as subject case. +-- If another case is wanted, use the following. + + caseV : Case -> V -> V ; + +-- The verbs "be" and the negative auxiliary are special. + + vOlla : V ; + vEi : V ; + +-- Two-place verbs need a case, and can have a pre- or postposition. + + mkV2 : V -> PPosition -> V2 ; + +-- If the complement needs just a case, the following special function can be used. + + caseV2 : V -> Case -> V2 ; + +-- Verbs with a direct (accusative) object +-- are special, since their complement case is finally decided in syntax. +-- But this is taken care of by $ClauseFin$. + + dirV2 : V -> V2 ; + + +--3 Three-place verbs +-- +-- 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 + + +--3 Other complement patterns +-- +-- Verbs and adjectives can take complements such as sentences, +-- questions, verb phrases, and adjectives. + + mkV0 : V -> V0 ; + mkVS : V -> VS ; + mkV2S : V -> Str -> V2S ; + mkVV : V -> VV ; + mkV2V : V -> Str -> Str -> V2V ; + mkVA : V -> VA ; + mkV2A : V -> Str -> V2A ; + mkVQ : V -> VQ ; + mkV2Q : V -> Str -> V2Q ; + + mkAS : A -> AS ; + mkA2S : A -> Str -> A2S ; + mkAV : A -> AV ; + mkA2V : A -> Str -> A2V ; + +-- Notice: categories $V2S, V2V, V2A, 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 ; + AS, A2S, AV, A2V : Type ; + +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. +--. + + Case = MorphoFin.Case ; + Number = MorphoFin.Number ; + + singular = Sg ; + plural = Pl ; + + nominative = Nom ; + genitive = Gen ; + partitive = Part ; + translative = Transl ; + inessive = Iness ; + elative = Elat ; + illative = Illat ; + adessive = Adess ; + ablative = Ablat ; + allative = Allat ; + + 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} ; + + 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 ; + ve = init ves ; + 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) + } + } + } + ) ** {lock_N = <>} ; + + reg2N : (savi,savia : Str) -> N = \savi,savia -> + ---- nhn (reg2NounH savi savia) + let + savit = regN savi ; + ia = Predef.dp 2 savia ; + i = init ia ; + a = last ia ; + o = last savi ; + savin = weakGrade savi + "n" ; + in + case 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) ; + _ => 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ä) + in + case si of { + "us" | "ys" => + ifTok CommonNoun (Predef.dp 3 veden) "den" + (nhn (sRakkaus vesi)) + (nhn (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))) ; + "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 = <>} ; + + nKukko = \a,b,c -> nhn (sKukko a b c) ** {lock_N = <>} ; + + nLukko = \a -> nhn (sLukko a) ** {lock_N = <>} ; + nTalo = \a -> nhn (sTalo a) ** {lock_N = <>} ; + nArpi = \a -> nhn (sArpi a) ** {lock_N = <>} ; + nSylki = \a -> nhn (sSylki a) ** {lock_N = <>} ; + nLinux = \a -> nhn (sLinux a) ** {lock_N = <>} ; + nPeruna = \a -> nhn (sPeruna a) ** {lock_N = <>} ; + nRae = \a,b -> nhn (sRae a b) ** {lock_N = <>} ; + nSusi = \a,b,c -> nhn (sSusi a b c) ** {lock_N = <>} ; + nPuu = \a -> nhn (sPuu a) ** {lock_N = <>} ; + nSuo = \a -> nhn (sSuo a) ** {lock_N = <>} ; + nNainen = \a -> nhn (sNainen a) ** {lock_N = <>} ; + nTilaus = \a,b -> nhn (sTilaus a b) ** {lock_N = <>} ; + nKulaus = \a -> nTilaus a (init a + "ksen" + getHarmony (last + (init a))) ; + nNauris = \a -> nhn (sNauris a) ** {lock_N = <>} ; + sgpartN noun part = { + s = table { + NCase Sg Part => part ; + c => noun.s ! c + } ; + g = noun.g ; + lock_N = noun.lock_N + } ; + nMeri meri = + let a = vowelHarmony meri in + sgpartN (reg2N meri (meri + a)) (init meri + "ta") ; + + 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 ; + 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 = <>} ; + mkADeg x kivempi kivin = + let + a = last (x.s ! ((NCase Sg Part))) ; ---- gives "kivinta" + kivempaa = init kivempi + a + a ; + kivinta = kivin + "t" + a + in + regAdjective x kivempaa kivinta ** {lock_A = <>} ; + + regADeg suuri = + let suur = regN suuri in + mkADeg + suur + (init (suur.s ! NCase Sg Gen) + "mpi") + (init (suur.s ! NCase Pl Ess)) ; + + mkV a b c d e f g h i j k l = mkVerb a b c d e f g h i j k l ** + {sc = NPCase Nom ; lock_V = <>} ; + + regV soutaa = v2v (regVerbH soutaa) ** {sc = NPCase Nom ; lock_V = <>} ; + + reg2V : (soutaa,souti : Str) -> V = \soutaa,souti -> + v2v (reg2VerbH soutaa souti) ** {sc = NPCase Nom ; lock_V = <>} ; + + reg3V soutaa soudan souti = + v2v (reg3VerbH soutaa soudan souti) ** {sc = NPCase Nom ; lock_V = <>} ; + + vValua v = v2v (vSanoa v) ** {sc = NPCase Nom ; lock_V = <>} ; + vKattaa v u = v2v (vOttaa v u) ** {sc = NPCase Nom ; lock_V = <>} ; + vOstaa v = v2v (vPoistaa v) ** {sc = NPCase Nom ; lock_V = <>} ; + vNousta v u = v2v (vJuosta v u [] []) ** {sc = NPCase Nom ; lock_V = <>} ; ----- + vTuoda v = v2v (vJuoda v []) ** {sc = NPCase Nom ; lock_V = <>} ; ----- + caseV c v = {s = v.s ; sc = NPCase c ; lock_V = <>} ; + + vOlla = verbOlla ** {sc = NPCase Nom ; lock_V = <>} ; + vEi = verbEi ** {sc = NPCase Nom ; lock_V = <>} ; + + vHuoltaa : (_,_,_,_ : Str) -> Verb = \ottaa,otan,otti,otin -> + 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 = <>} ; + + 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) ; + dirdirV3 v = dirV3 v allative ; + + + mkVS v = v ** {lock_VS = <>} ; + mkVV v = v ** {c2 = "to" ; lock_VV = <>} ; + mkVQ v = v ** {lock_VQ = <>} ; + + V0 : Type = V ; + V2S, V2V, V2Q, V2A : 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 = <>} ; + 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 = <>} ; +-} + + +} ; diff --git a/lib/resource-1.0/finnish/ParamFin.gf b/lib/resource-1.0/finnish/ParamFin.gf new file mode 100644 index 000000000..dc4157c8b --- /dev/null +++ b/lib/resource-1.0/finnish/ParamFin.gf @@ -0,0 +1,95 @@ +--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 + } ; + +} diff --git a/lib/resource-1.0/finnish/PhraseFin.gf b/lib/resource-1.0/finnish/PhraseFin.gf new file mode 100644 index 000000000..35420e2eb --- /dev/null +++ b/lib/resource-1.0/finnish/PhraseFin.gf @@ -0,0 +1,23 @@ +concrete PhraseFin of Phrase = CatFin ** open ResFin in { + + lin + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + UttS s = s ; + UttQS qs = {s = qs.s ! QDir} ; + UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ; + UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ; + + UttIP ip = {s = ip.s ! Nom} ; --- Acc also + UttIAdv iadv = iadv ; + UttNP np = {s = np.s ! Acc} ; + UttVP vp = {s = "to" ++ infVP vp (agrP3 Sg)} ; + UttAdv adv = adv ; + + NoPConj = {s = []} ; + PConjConj conj = conj ; + + NoVoc = {s = []} ; + VocNP np = {s = "," ++ np.s ! Nom} ; + +} diff --git a/lib/resource-1.0/finnish/QuestionFin.gf b/lib/resource-1.0/finnish/QuestionFin.gf new file mode 100644 index 000000000..d6abf2f5b --- /dev/null +++ b/lib/resource-1.0/finnish/QuestionFin.gf @@ -0,0 +1,54 @@ +concrete QuestionFin of Question = CatFin ** open ResFin in { + + flags optimize=all_subs ; + + lin + + QuestCl cl = { + s = \\t,a,p => + let cls = cl.s ! t ! a ! p + in table { + QDir => cls ! OQuest ; + QIndir => "if" ++ cls ! ODir + } ---- "whether" in ExtFin + } ; + + QuestVP qp vp = + let cl = mkClause (qp.s ! Nom) {n = qp.n ; p = P3} vp + in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ; + + QuestSlash ip slash = { + s = \\t,a,p => + let + cls = slash.s ! t ! a ! p ; + who = slash.c2 ++ ip.s ! Acc --- stranding in ExtFin + in table { + QDir => who ++ cls ! OQuest ; + QIndir => who ++ cls ! ODir + } + } ; + + QuestIAdv iadv cl = { + s = \\t,a,p => + let + cls = cl.s ! t ! a ! p ; + why = iadv.s + in table { + QDir => why ++ cls ! OQuest ; + QIndir => why ++ cls ! ODir + } + } ; + + PrepIP p ip = {s = p.s ++ ip.s ! Nom} ; + + AdvIP ip adv = { + s = \\c => ip.s ! c ++ adv.s ; + n = ip.n + } ; + + IDetCN idet num ord cn = { + s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ; + n = idet.n + } ; + +} diff --git a/lib/resource-1.0/finnish/RelativeFin.gf b/lib/resource-1.0/finnish/RelativeFin.gf new file mode 100644 index 000000000..2781896cb --- /dev/null +++ b/lib/resource-1.0/finnish/RelativeFin.gf @@ -0,0 +1,34 @@ +concrete RelativeFin of Relative = CatFin ** open ResFin in { + + flags optimize=all_subs ; + + lin + + RelCl cl = { + s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir + } ; + + RelVP rp vp = { + s = \\t,ant,b,ag => + let + agr = case rp.a of { + RNoAg => ag ; + RAg a => a + } ; + cl = mkClause (rp.s ! Nom) agr vp + in + cl.s ! t ! ant ! b ! ODir + } ; + + RelSlash rp slash = { + s = \\t,a,p,_ => slash.c2 ++ rp.s ! Acc ++ slash.s ! t ! a ! p ! ODir + } ; + + FunRP p np rp = { + s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ; + a = RAg np.a + } ; + + IdRP = mkIP "which" "which" "whose" Sg ** {a = RNoAg} ; + +} diff --git a/lib/resource-1.0/finnish/ResFin.gf b/lib/resource-1.0/finnish/ResFin.gf new file mode 100644 index 000000000..9cb4f23bb --- /dev/null +++ b/lib/resource-1.0/finnish/ResFin.gf @@ -0,0 +1,175 @@ +--# -path=.:../abstract:../common:../../prelude + +--1 Finnish auxiliary operations. + +-- This module contains operations that are needed to make the +-- resource syntax work. To define everything that is needed to +-- implement $Test$, it moreover contains regular lexical +-- patterns needed for $Lex$. + +resource ResFin = ParamFin ** open Prelude in { + + flags optimize=all ; + + oper + + Compl : Type = {s : Str ; c : NPForm} ; + +-- For $Verb$. + + Verb : Type = { + s : VForm => Str + } ; + + + VP : Type = { + s : Tense => Anteriority => Polarity => Agr => {fin, inf : Str} ; + s2 : Agr => Str + } ; + + predV : Verb -> VP = \verb -> { + s = \\t,ant,b,agr => {fin = verb.s ! Presn agr.n agr.p ; inf = []} ; + s2 = \\_ => [] + } ; +{- + let + inf = verb.s ! VInf ; + fin = presVerb verb agr ; + past = verb.s ! VPast ; + part = verb.s ! VPPart ; + vf : Str -> Str -> {fin, inf : Str} = \x,y -> + {fin = x ; inf = y} ; + in + case of { + => vf fin [] ; + => vf (does agr) inf ; + => vf (doesnt agr) inf ; + => vf (have agr) part ; + => vf (havent agr) part ; + => vf past [] ; + => vf "did" inf ; + => vf "didn't" inf ; + => vf "had" part ; + => vf "hadn't" part ; + => vf "will" inf ; + => vf "won't" inf ; + => vf "will" ("have" ++ part) ; + => vf "won't" ("have" ++ part) ; + => vf "would" inf ; + => vf "wouldn't" inf ; + => vf "would" ("have" ++ part) ; + => vf "wouldn't" ("have" ++ part) + } ; + s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] + } ; + + + insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> { + s = vp.s ; + s2 = \\a => vp.s2 ! a ++ obj ! a + } ; + +--- This is not functional. + + insertAdV : Str -> VP -> VP = \adv,vp -> { + s = vp.s ; + s2 = vp.s2 + } ; + + presVerb : {s : VForm => Str} -> Agr -> Str = \verb -> + agrVerb (verb.s ! VPres) (verb.s ! VInf) ; + + infVP : VP -> Agr -> Str = \vp,a -> + (vp.s ! Fut ! Simul ! Neg ! ODir ! a).inf ++ vp.s2 ! a ; + + agrVerb : Str -> Str -> Agr -> Str = \has,have,agr -> + case agr of { + {n = Sg ; p = P3} => has ; + _ => have + } ; + + have = agrVerb "has" "have" ; + havent = agrVerb "hasn't" "haven't" ; + does = agrVerb "does" "do" ; + doesnt = agrVerb "doesn't" "don't" ; + + Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ; + + auxBe : Aux = { + pres = \\b,a => case of { + => "am" ; + => ["am not"] ; --- am not I + _ => agrVerb (posneg b "is") (posneg b "are") a + } ; + past = \\b,a => case a of { + {n = Sg ; p = P1|P3} => (posneg b "was") ; + _ => (posneg b "were") + } ; + inf = "be" ; + ppart = "been" + } ; + + posneg : Polarity -> Str -> Str = \p,s -> case p of { + Pos => s ; + Neg => s + "n't" + } ; + + conjThat : Str = "that" ; + + reflPron : Agr => Str = table { + {n = Sg ; p = P1} => "myself" ; + {n = Sg ; p = P2} => "yourself" ; + {n = Sg ; p = P3} => "itself" ; ---- + {n = Pl ; p = P1} => "ourselves" ; + {n = Pl ; p = P2} => "yourselves" ; + {n = Pl ; p = P3} => "themselves" + } ; +-} +-- For $Sentence$. + + Clause : Type = { + s : Tense => Anteriority => Polarity => SType => Str + } ; + +{- + mkClause : Str -> Agr -> VP -> Clause = + \subj,agr,vp -> { + s = \\t,a,b,o => + let + verb = vp.s ! t ! a ! b ! o ! agr ; + compl = vp.s2 ! agr + in + case o of { + ODir => subj ++ verb.fin ++ verb.inf ++ compl ; + OQuest => verb.fin ++ subj ++ verb.inf ++ compl + } + } ; + + +-- For $Numeral$. + + mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} = + \two, twelve, twenty, second -> + {s = table { + unit => table {NCard => two ; NOrd => second} ; + teen => \\c => mkCard c twelve ; + ten => \\c => mkCard c twenty + } + } ; + + regNum : Str -> {s : DForm => CardOrd => Str} = + \six -> mkNum six (six + "teen") (six + "ty") (regOrd six) ; + + regCardOrd : Str -> {s : CardOrd => Str} = \ten -> + {s = table {NCard => ten ; NOrd => regOrd ten}} ; + + mkCard : CardOrd -> Str -> Str = \c,ten -> + (regCardOrd ten).s ! c ; + + regOrd : Str -> Str = \ten -> + case last ten of { + "y" => init ten + "ieth" ; + _ => ten + "th" + } ; +-} +} diff --git a/lib/resource-1.0/finnish/SentenceFin.gf b/lib/resource-1.0/finnish/SentenceFin.gf new file mode 100644 index 000000000..ff4110f93 --- /dev/null +++ b/lib/resource-1.0/finnish/SentenceFin.gf @@ -0,0 +1,46 @@ +concrete SentenceFin of Sentence = CatFin ** open ResFin in { + + flags optimize=all_subs ; + + lin + + PredVP np vp = mkClause (np.s ! Nom) np.a vp ; + + PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; + + ImpVP vp = { + s = \\pol,n => + let + agr = {n = n ; p = P2} ; + verb = infVP vp agr ; + dont = case pol of { + Neg => "don't" ; + _ => [] + } + in + dont ++ verb + } ; + + SlashV2 np v2 = + mkClause (np.s ! Nom) np.a (predV v2) ** {c2 = v2.c2} ; + + SlashVVV2 np vv v2 = + mkClause (np.s ! Nom) np.a (insertObj (\\_ => "to" ++ v2.s ! VInf) (predV vv)) ** + {c2 = v2.c2} ; + + AdvSlash slash adv = { + s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; + c2 = slash.c2 + } ; + + SlashPrep cl prep = cl ** {c2 = prep.s} ; + + EmbedS s = {s = conjThat ++ s.s} ; + EmbedQS qs = {s = qs.s ! QIndir} ; + EmbedVP vp = {s = "to" ++ infVP vp (agrP3 Sg)} ; --- agr + + UseCl t a p cl = {s = t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! ODir} ; + UseQCl t a p cl = {s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q} ; + UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ; + +} diff --git a/lib/resource-1.0/finnish/StructuralFin.gf b/lib/resource-1.0/finnish/StructuralFin.gf new file mode 100644 index 000000000..885124092 --- /dev/null +++ b/lib/resource-1.0/finnish/StructuralFin.gf @@ -0,0 +1,106 @@ +concrete StructuralFin of Structural = CatFin ** + open MorphoFin, Prelude in { + + flags optimize=all ; + + lin + above_Prep = ss "above" ; + after_Prep = ss "after" ; + all_Predet = ss "all" ; + almost_AdA, almost_AdN = ss "almost" ; + although_Subj = ss "although" ; + always_AdV = ss "always" ; + and_Conj = ss "and" ** {n = Pl} ; + because_Subj = ss "because" ; + before_Prep = ss "before" ; + behind_Prep = ss "behind" ; + between_Prep = ss "between" ; + both7and_DConj = sd2 "both" "and" ** {n = Pl} ; + but_PConj = ss "but" ; + by8agent_Prep = ss "by" ; + by8means_Prep = ss "by" ; + can8know_VV = verbPart (mkVerbIrreg "know" "knew" "known") "how"** {c2 = "to"} ;--- + can_VV = verbGen "manage" ** {c2 = "to"} ; --- + during_Prep = ss "during" ; + either7or_DConj = sd2 "either" "or" ** {n = Sg} ; + everybody_NP = regNP "everybody" Sg ; + every_Det = mkDeterminer Sg "every" ; + everything_NP = regNP "everything" Sg ; + everywhere_Adv = ss "everywhere" ; + first_Ord = ss "first" ; + from_Prep = ss "from" ; + he_Pron = mkNP "he" "him" "his" Sg P3 ; + here_Adv = ss "here" ; + here7to_Adv = ss ["to here"] ; + here7from_Adv = ss ["from here"] ; + how_IAdv = ss "how" ; + how8many_IDet = mkDeterminer Pl ["how many"] ; + if_Subj = ss "if" ; + in8front_Prep = ss ["in front of"] ; + i_Pron = mkNP "I" "me" "my" Sg P1 ; + in_Prep = ss "in" ; + it_Pron = mkNP "it" "it" "its" Sg P3 ; + less_CAdv = ss "less" ; + many_Det = mkDeterminer Pl "many" ; + more_CAdv = ss "more" ; + most_Predet = ss "most" ; + much_Det = mkDeterminer Sg "much" ; + must_VV = mkVerb4 "have" "has" "had" "had" ** {c2 = "to"} ; --- + no_Phr = ss "no" ; + on_Prep = ss "on" ; + one_Quant = mkDeterminer Sg "one" ; + only_Predet = ss "only" ; + or_Conj = ss "or" ** {n = Sg} ; + otherwise_PConj = ss "otherwise" ; + part_Prep = ss "of" ; + please_Voc = ss "please" ; + possess_Prep = ss "of" ; + quite_Adv = ss "quite" ; + she_Pron = mkNP "she" "her" "her" Sg P3 ; + so_AdA = ss "so" ; + somebody_NP = regNP "somebody" Sg ; + someSg_Det = mkDeterminer Sg "some" ; + somePl_Det = mkDeterminer Pl "some" ; + something_NP = regNP "something" Sg ; + somewhere_Adv = ss "somewhere" ; + that_Quant = mkQuant "that" "those" ; + that_NP = regNP "that" Sg ; + there_Adv = ss "there" ; + there7to_Adv = ss "there" ; + there7from_Adv = ss ["from there"] ; + therefore_PConj = ss "therefore" ; + they_Pron = mkNP "they" "them" "their" Pl P3 ; + this_Quant = mkQuant "this" "these" ; + this_NP = regNP "this" Sg ; + those_NP = regNP "those" Pl ; + through_Prep = ss "through" ; + too_AdA = ss "too" ; + to_Prep = ss "to" ; + under_Prep = ss "under" ; + very_AdA = ss "very" ; + want_VV = verbGen "want" ** {c2 = "to"} ; + we_Pron = mkNP "we" "us" "our" Pl P1 ; + whatPl_IP = mkIP "what" "what" "what's" Sg ; + whatSg_IP = mkIP "what" "what" "what's" Sg ; + when_IAdv = ss "when" ; + when_Subj = ss "when" ; + where_IAdv = ss "where" ; + whichPl_IDet = mkDeterminer Pl ["which"] ; + whichSg_IDet = mkDeterminer Sg ["which"] ; + whoSg_IP = mkIP "who" "whom" "whose" Sg ; + whoPl_IP = mkIP "who" "whom" "whose" Pl ; + why_IAdv = ss "why" ; + without_Prep = ss "without" ; + with_Prep = ss "with" ; + yes_Phr = ss "yes" ; + youSg_Pron = mkNP "you" "you" "your" Sg P2 ; + youPl_Pron = mkNP "you" "you" "your" Pl P2 ; + youPol_Pron = mkNP "you" "you" "your" Sg P2 ; + +oper + mkQuant : Str -> Str -> {s : Number => Str} = \x,y -> { + s = table Number [x ; y] + } ; + +} + diff --git a/lib/resource-1.0/finnish/VerbFin.gf b/lib/resource-1.0/finnish/VerbFin.gf new file mode 100644 index 000000000..432f7bf1c --- /dev/null +++ b/lib/resource-1.0/finnish/VerbFin.gf @@ -0,0 +1,37 @@ +concrete VerbFin of Verb = CatFin ** open ResFin in { + + flags optimize=all_subs ; + + lin + UseV = predV ; + ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! Acc) (predV v) ; + ComplV3 v np np2 = + insertObj (\\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc) (predV v) ; + + ComplVV v vp = insertObj (\\a => v.c2 ++ infVP vp a) (predV v) ; + ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ; + ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ; + + ComplVA v ap = insertObj (ap.s) (predV v) ; + ComplV2A v np ap = + insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ; + + UseComp comp = insertObj comp.s (predAux auxBe) ; + + AdvVP vp adv = insertObj (\\_ => adv.s) vp ; + +--- This rule destroys parsing... +---- AdVVP adv vp = insertAdV adv.s vp ; + + ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ; + + PassV2 v = insertObj (\\_ => v.s ! VPPart) (predAux auxBe) ; + + UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no "to" + + CompAP ap = ap ; + CompNP np = {s = \\_ => np.s ! Acc} ; + CompAdv a = {s = \\_ => a.s} ; + + +}