diff --git a/lib/src/maltese/AdjectiveMlt.gf b/lib/src/maltese/AdjectiveMlt.gf index f3bc51e16..ea7d4145c 100644 --- a/lib/src/maltese/AdjectiveMlt.gf +++ b/lib/src/maltese/AdjectiveMlt.gf @@ -6,6 +6,44 @@ concrete AdjectiveMlt of Adjective = CatMlt ** open ResMlt, Prelude in { --- AP + lin + + -- A -> AP + PositA a = { + s = \\gn => a.s ! (APosit gn) ; + isPre = True -- TO CHECK + } ; + + -- A -> NP -> AP + ComparA a np = { + s = \\gn => case a.hasComp of { + True => a.s ! ACompar ; + _ => compMore ++ a.s ! (APosit gn) + } + ++ conjThan ++ np.s ! Nom ; + isPre = False -- TO CHECK + } ; + + -- A -> AP + UseComparA a = { + s = \\gn => case a.hasComp of { + True => a.s ! ACompar ; + _ => compMore ++ a.s ! (APosit gn) + } ; + isPre = False -- TO CHECK + } ; + + -- Ord -> AP + -- AdjOrd ord = { + -- s = \\_ => ord.s ! Nom ; + -- isPre = True + -- } ; + + oper + -- TODO: Don't know where these should go + compMore : Str = "iktar" | "iżjed" ; + compLess : Str = "inqas" ; + conjThan : Str = "minn" ; + } diff --git a/lib/src/maltese/CatMlt.gf b/lib/src/maltese/CatMlt.gf index 5c3930171..f68c2b4cd 100644 --- a/lib/src/maltese/CatMlt.gf +++ b/lib/src/maltese/CatMlt.gf @@ -4,63 +4,115 @@ -- John J. Camilleri, 2012 -- Licensed under LGPL ---concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude, ParamX in { +{- +All code in comments was copied from CatEng.gf and may need to be corrected for Maltese. +The same overall structure should be maintained. +-} + concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude in { - flags optimize=all_subs ; - + flags + optimize=all_subs ; lincat --- S = {s : Str} ; --- Cl = {s : ResMlt.Tense => Bool => Str} ; --- NP = ResMlt.NP ; -- {s : Case => {clit,obj : Str ; isClit : Bool} ; a : Agr} ; --- VP = ResMlt.VP ; -- {v : Verb ; clit : Str ; clitAgr : ClitAgr ; obj : Agr => Str} ; --- AP = {s : Gender => Number => Str ; isPre : Bool} ; --- CN = ResMlt.Noun ; -- {s : Number => Str ; g : Gender} ; --- Det = {s : Gender => Case => Str ; n : Number} ; - N = ResMlt.Noun ; - N2 = ResMlt.Noun ; - N3 = ResMlt.Noun ; - A = ResMlt.Adj ; - V = ResMlt.Verb ; --- V2 = ResMlt.Verb ** {c : Case} ; --- AdA = {s : Str} ; --- Pol = {s : Str ; b : Bool} ; --- Tense = {s : Str ; t : ResMlt.Tense} ; --- Conj = {s : Str ; n : Number} ; +-- Tensed/Untensed - -- Cardinal or ordinal in WORDS (not digits) + -- S = {s : Str} ; + -- QS = {s : QForm => Str} ; + -- RS = {s : Agr => Str ; c : NPCase} ; -- c for it clefts + -- SSlash = {s : Str ; c2 : Str} ; + +-- Sentence + + -- Cl = {s : ResMlt.Tense => Anteriority => Polarity => Order => Str} ; + -- ClSlash = { + -- s : ResMlt.Tense => Anteriority => Polarity => Order => Str ; + -- c2 : Str + -- } ; + -- Imp = {s : Polarity => ImpForm => Str} ; + +-- Question + + -- QCl = {s : ResMlt.Tense => Anteriority => Polarity => QForm => Str} ; + -- IP = {s : NPCase => Str ; n : Number} ; + -- IComp = {s : Str} ; + -- IDet = {s : Str ; n : Number} ; + -- IQuant = {s : Number => Str} ; + +-- Relative + + -- RCl = { + -- s : ResMlt.Tense => Anteriority => Polarity => Agr => Str ; + -- c : NPCase + -- } ; + -- RP = {s : RCase => Str ; a : RAgr} ; + +-- Verb + + -- VP = ResMlt.VP ; + -- VPSlash = ResMlt.VP ** {c2 : Str} ; + -- Comp = {s : Agr => Str} ; + +-- Adjective + +-- AP = {s : Agr => Str ; isPre : Bool} ; + AP = {s : GenNum => Str ; isPre : Bool} ; + +-- Noun + + CN = Noun ; + NP = {s : NPCase => Str ; a : Agr} ; + -- Pron = {s : NPCase => Str ; sp : Case => Str ; a : Agr} ; + Det = {s : Str ; n : Num_Number ; hasNum : Bool} ; + -- Det = {s : Str ; sp : NPCase => Str ; n : Number ; hasNum : Bool} ; + -- Predet = {s : Str} ; + -- Ord = { s : Case => Str } ; + Num = {s : Num_Case => Str ; n : Num_Number ; hasCard : Bool} ; + -- Card = {s : Case => Str ; n : Number} ; + -- Quant = {s : Bool => Number => Str ; sp : Bool => Number => NPCase => Str} ; + Quant = {s : Bool => Num_Number => Str} ; + +-- Numeral + + -- Cardinal or ordinal in WORDS (not digits) [JJC] Numeral = { s : CardOrd => Num_Case => Str ; n : Num_Number } ; - -- Cardinal or ordinal in DIGITS (not words) + -- Cardinal or ordinal in DIGITS (not words) [JJC] Digits = { s : Str ; -- No need for CardOrd, i.e. no 1st, 2nd etc in Maltese n : Num_Number ; tail : DTail }; -{- --- These below are just examples, I believe they came form Italian. - S = {s : Str} ; - Cl = {s : ResMlt.Tense => Bool => Str} ; - NP = {s : Case => {clit,obj : Str ; isClit : Bool} ; a : Agr} ; - VP = {v : Verb ; clit : Str ; clitAgr : ClitAgr ; obj : Agr => Str} ; - AP = {s : Gender => Number => Str ; isPre : Bool} ; - CN = {s : Number => Str ; g : Gender} ; - Det = {s : Gender => Case => Str ; n : Number} ; - N = {s : Number => Str ; g : Gender} ; - N2 = {s : Number => Str ; g : Gender} ; - A = {s : Number => Str ; isPre : Bool} ; - V = ResMlt.Verb ; - V2 = ResMlt.Verb ** {c : Case} ; - AdA = {s : Str} ; - Pol = {s : Str ; b : Bool} ; - Tense = {s : Str ; t : ResMlt.Tense} ; - Conj = {s : Str ; n : Number} ; --} + +-- Structural + +-- Conj = {s1,s2 : Str ; n : Number} ; +-- ---b Conj = {s : Str ; n : Number} ; +-- ---b DConj = {s1,s2 : Str ; n : Number} ; +-- Subj = {s : Str} ; + Prep = {s : Str} ; + +-- Open lexical classes, e.g. Lexicon + + V, VS, VQ, VA = Verb ; -- = {s : VForm => Str} ; + V2, V2A, V2Q, V2S = Verb ** {c2 : Str} ; + V3 = Verb ** {c2, c3 : Str} ; + -- VV = {s : VVForm => Str ; typ : VVType} ; + -- V2V = Verb ** {c2,c3 : Str ; typ : VVType} ; + + -- [JJC] + A = Adjective ** {hasComp : Bool} ; -- Does the adjective have a comparative form (e.g. ISBAĦ)? +-- A2 = Adjective ** {c2 : Str} ; + + -- [JJC] + N, N3 = Noun ; + N2 = Noun ** {c2 : Str} ; + -- N3 = Noun ** {c2,c3 : Str} ; + PN = ProperNoun ; } diff --git a/lib/src/maltese/IdiomMlt.gf b/lib/src/maltese/IdiomMlt.gf index 49112a287..cea14275d 100644 --- a/lib/src/maltese/IdiomMlt.gf +++ b/lib/src/maltese/IdiomMlt.gf @@ -6,9 +6,5 @@ concrete IdiomMlt of Idiom = CatMlt ** open Prelude, ResMlt in { --- Cl --- QCl --- VP --- Utt } diff --git a/lib/src/maltese/LexiconMlt.gf b/lib/src/maltese/LexiconMlt.gf index eb8e867c9..5deef72ff 100644 --- a/lib/src/maltese/LexiconMlt.gf +++ b/lib/src/maltese/LexiconMlt.gf @@ -7,390 +7,357 @@ --# -path=.:../abstract:../common:../prelude concrete LexiconMlt of Lexicon = CatMlt ** - --open ParadigmsMlt, ResMlt, Prelude in { - open ParadigmsMlt, IrregMlt, ResMlt in { + open Prelude, ParadigmsMlt, IrregMlt in { - flags optimize=values ; coding=utf8 ; + flags + optimize=values ; + coding=utf8 ; lin - - {- ===== My Verbs ===== -} - - {- - cut_V2 = mkVerb "qata'" "aqta'" "aqtgħu" ; - write_V2 = mkVerb "kiteb" ; - break_V2 = mkVerb "kiser" ; - find_V2 = mkVerb "sab" ; - throw_V2 = mkVerb "tefa'" ; - hear_V2 = mkVerb "sama'" "isma'" "isimgħu" ; - fear_V2 = mkVerb "beża'" ; - pray_V = mkVerb "talab" "itlob" "itolbu" ; - understand_V2 = mkVerb "fehem" ; - pull_V2 = mkVerb "ġibed" ; - walk_V = mkVerb "mexa'" ; - -} - -- die_V = mkVerb "miet" ; - die_V = mkVerb "qarmeċ" ; - - - {- ===== My Nouns ===== -} - - --airplane_N = mkNoun "ajruplan" Masc ; - airplane_N = mkNoun "ajruplan" ; - --apple_N = mkNoun "tuffieħa" Fem ; - apple_N = mkNounColl "tuffieħ" ; - - bench_N = mkNoun "bank" "bankijiet" ; - - - - {- ===== Required by RGL ===== -} - - -- add_V3 -- alas_Interj -- already_Adv - animal_N = mkNoun "annimal" ; + animal_N = mkN "annimal" ; -- answer_V2S - apartment_N = mkNoun "appartament" ; - art_N = mkNounNoPlural "arti" Fem ; --- ashes_N = mkNoun "rmied" ; + apartment_N = mkN "appartament" ; + art_N = mkNNoPlural "arti" feminine ; +-- ashes_N = mkN "rmied" ; -- ask_V2Q - baby_N = mkNoun "tarbija" "trabi" ; - back_N = mkNoun "dahar" "dhur" ; --- bad_A - bank_N = mkNoun "bank" "bankijiet" ; -- BANEK is for lotto booths! - bark_N = mkNoun "qoxra" "qoxriet" ; --- beautiful_A + baby_N = mkN "tarbija" "trabi" ; + back_N = mkN "dahar" "dhur" ; -- pronSuffix + bad_A = brokenA "ħażin" "hżiena" "agħar" ; + bank_N = mkN "bank" "bankijiet" ; -- BANEK is for lotto booths! + bark_N = mkN "qoxra" "qoxriet" ; + beautiful_A = brokenA "sabiħ" "sbieħ" "isbaħ" ; -- become_VA - beer_N = mkNoun "birra" "birer" ; + beer_N = mkN "birra" "birer" ; -- beg_V2V - belly_N = mkNoun "żaqq" "żquq" ; --- big_A - bike_N = mkNoun "rota" ; - bird_N = mkNoun "għasfur" "għasafar" ; -- what about GĦASFURA? + belly_N = mkN "żaqq" "żquq" ; -- pronSuffix + big_A = brokenA "kbir" "kbar" "ikbar" ; + bike_N = mkN "rota" ; + bird_N = mkN "għasfur" "għasafar" ; -- what about GĦASFURA? -- bite_V2 --- black_A - blood_N = mkNoun [] "demm" [] "dmija" [] ; + black_A = mkA "iswed" "sewda" "suwed" ; + blood_N = mkN [] "demm" [] "dmija" [] ; -- pronSuffix -- blow_V --- blue_A - boat_N = mkNoun "dgħajsa" "dgħajjes" ; - bone_N = mkNounColl "għadam" ; - book_N = mkNoun "ktieb" "kotba" ; - boot_N = mkNoun "żarbun" "żraben" ; -- what about ŻARBUNA? - boss_N = mkNoun "mgħallem" "mgħallmin" ; - boy_N = mkNoun "tifel" "tfal" ; - bread_N = mkNounColl "ħobż" ; + blue_A = sameA "blu" ; + boat_N = mkN "dgħajsa" "dgħajjes" ; + bone_N = mkNColl "għadam" ; + book_N = mkN "ktieb" "kotba" ; + boot_N = mkN "żarbun" "żraben" ; -- what about ŻARBUNA? + boss_N = mkN "mgħallem" "mgħallmin" ; + boy_N = mkN "tifel" "tfal" ; + bread_N = mkNColl "ħobż" ; -- break_V2 - breast_N = mkNoun "sider" "sdur" ; -- also ISDRA + breast_N = mkN "sider" "sdur" ; -- also ISDRA -- pronSuffix -- breathe_V --- broad_A - brother_N2 = mkNoun "ħu" "aħwa" ; --- brown_A + broad_A = mkA "wiesgħa" "wiesgħa" "wiesgħin" ; + brother_N2 = mkN2 (mkN "ħu" "aħwa") (mkPrep "ta'") ; -- pronSuffix + brown_A = sameA "kannella" ; -- burn_V - butter_N = mkNoun [] "butir" [] "butirijiet" [] ; + butter_N = mkN [] "butir" [] "butirijiet" [] ; -- buy_V2 - camera_N = mkNoun "kamera" "kameras" ; - cap_N = mkNoun "beritta" ; - car_N = mkNoun "karozza" ; - carpet_N = mkNoun "tapit" ; -- TAPITI or TWAPET ? - cat_N = mkNoun "qattus" "qtates" ; -- what about QATTUSA ? - ceiling_N = mkNoun "saqaf" "soqfa"; - chair_N = mkNoun "siġġu" "siġġijiet" ; - cheese_N = mkNounColl "ġobon" ; --- child_N = mkNoun "tfajjel" ; -- Not an easy one... - church_N = mkNoun "knisja" "knejjes" ; - city_N = mkNoun "belt" "bliet" Fem ; --- clean_A --- clever_A + camera_N = mkN "kamera" "kameras" ; + cap_N = mkN "beritta" ; + car_N = mkN "karozza" ; + carpet_N = mkN "tapit" ; -- TAPITI or TWAPET ? + cat_N = mkN "qattus" "qtates" ; -- what about QATTUSA ? + ceiling_N = mkN "saqaf" "soqfa"; + chair_N = mkN "siġġu" "siġġijiet" ; + cheese_N = mkNColl "ġobon" ; +-- child_N = mkN "tfajjel" ; -- Not an easy one... + church_N = mkN "knisja" "knejjes" ; + city_N = mkN "belt" "bliet" feminine ; -- pronSuffix + clean_A = brokenA "nadif" "nodfa" ; + clever_A = regA "bravu" ; -- close_V2 - cloud_N = mkNounColl "sħab" ; - coat_N = mkNoun "kowt" "kowtijiet" ; --- cold_A + cloud_N = mkNColl "sħab" ; + coat_N = mkN "kowt" "kowtijiet" ; + cold_A = mkA "kiesaħ" "kiesħa" "kesħin" ; -- come_V - computer_N = mkNoun "kompjuter" "kompjuters" ; --- correct_A + computer_N = mkN "kompjuter" "kompjuters" ; + correct_A = regA "korrett" ; -- count_V2 - country_N = mkNoun "pajjiż" ; - cousin_N = mkNoun "kuġin" ; - cow_N = mkNoun "baqra" "baqar" "baqartejn" [] [] ; + country_N = mkN "pajjiż" ; -- pronSuffix + cousin_N = mkN "kuġin" ; -- pronSuffix + cow_N = mkN "baqra" "baqar" "baqartejn" [] [] ; -- cut_V2 - day_N = mkNoun "ġurnata" "ġranet" ; + day_N = mkN "ġurnata" "ġranet" ; -- dig_V --- dirty_A - distance_N3 = mkNoun "distanza" ; + dirty_A = regA "maħmuġ" ; + distance_N3 = mkN "distanza" ; -- do_V2 - doctor_N = mkNoun "tabib" "tobba" ; -- what about TABIBA ? - dog_N = mkNoun "kelb" "klieb" ; - door_N = mkNoun "bieb" "bibien" ; -- what about BIEBA ? + doctor_N = mkN "tabib" "tobba" ; -- what about TABIBA ? + dog_N = mkN "kelb" "klieb" ; + door_N = mkN "bieb" "bibien" ; -- what about BIEBA ? -- drink_V2 --- dry_A --- dull_A - dust_N = mkNounColl "trab" ; -- not sure but sounds right - ear_N = mkNounDual "widna" ; - earth_N = mkNoun "art" "artijiet" Fem ; + dry_A = regA "niexef" ; + dull_A = sameA "tad-dwejjaq" ; + dust_N = mkNColl "trab" ; -- not sure but sounds right + ear_N = mkNDual "widna" ; -- pronSuffix + earth_N = mkN "art" "artijiet" feminine ; -- easy_A2V -- eat_V2 - egg_N = mkNounColl "bajd" ; --- empty_A - enemy_N = mkNoun "għadu" "għedewwa" ; - eye_N = mkNounWorst "għajn" [] "għajnejn" "għajnejn" "għejun" Fem ; - factory_N = mkNoun "fabbrika" ; + egg_N = mkNColl "bajd" ; + empty_A = mkA "vojt" "vojta" "vojta" ; + enemy_N = mkN "għadu" "għedewwa" ; + eye_N = mk5N "għajn" [] "għajnejn" "għajnejn" "għejun" feminine ; -- pronSuffix + factory_N = mkN "fabbrika" ; -- fall_V -- far_Adv - fat_N = mkNounColl "xaħam" ; - father_N2 = mkNoun "missier" "missierijiet" ; + fat_N = mkNColl "xaħam" ; + father_N2 = mkN2 (mkN "missier" "missierijiet") (mkPrep "ta'") ; -- pronSuffix -- fear_V2 -- fear_VS - feather_N = mkNounColl "rix" ; + feather_N = mkNColl "rix" ; -- fight_V2 -- find_V2 - fingernail_N = mkNoun "difer" [] "difrejn" "dwiefer" [] ; - fire_N = mkNoun "nar" "nirien" ; - fish_N = mkNounColl "ħut" ; + fingernail_N = mkN "difer" [] "difrejn" "dwiefer" [] ; -- pronSuffix + fire_N = mkN "nar" "nirien" ; + fish_N = mkNColl "ħut" ; -- float_V - earth_N = mkNoun "art" "artijiet" Fem ; + earth_N = mkN "art" "artijiet" feminine ; -- flow_V - flower_N = mkNoun "fjura" ; + flower_N = mkN "fjura" ; -- fly_V - fog_N = mkNoun [] "ċpar" [] [] [] ; - foot_N = mkNounWorst "sieq" [] "saqajn" "saqajn" [] Fem ; - forest_N = mkNoun "foresta" ; -- also MASĠAR + fog_N = mkN [] "ċpar" [] [] [] ; + foot_N = mk5N "sieq" [] "saqajn" "saqajn" [] feminine ; -- pronSuffix + forest_N = mkN "foresta" ; -- also MASĠAR -- forget_V2 -- freeze_V - fridge_N = mkNoun "friġġ" "friġġijiet" ; - friend_N = mkNoun "ħabib" "ħbieb" ; - fruit_N = mkNounColl "frott" ; --- full_A + fridge_N = mkN "friġġ" "friġġijiet" ; + friend_N = mkN "ħabib" "ħbieb" ; -- pronSuffix + fruit_N = mkNColl "frott" ; + full_A = regA "mimli" ; -- fun_AV - garden_N = mkNoun "ġnien" "ġonna" ; - girl_N = mkNoun "tifla" "tfal" ; + garden_N = mkN "ġnien" "ġonna" ; + girl_N = mkN "tifla" "tfal" ; -- give_V3 - glove_N = mkNoun "ingwanta" ; + glove_N = mkN "ingwanta" ; -- go_V - gold_N = mkNoun [] "deheb" [] "dehbijiet" [] ; --- good_A - grammar_N = mkNoun "grammatika" ; - grass_N = mkNounWorst "ħaxixa" "ħaxix" [] [] "ħxejjex" Masc ; -- Dict says ĦAXIX = n.koll.m.s., f. -a, pl.ind. ĦXEJJEX --- green_A - guts_N = mkNoun "musrana" [] [] "musraniet" "msaren" ; - hair_N = mkNoun "xagħar" [] [] "xagħariet" "xgħur" ; - hand_N = mkNounWorst "id" [] "idejn" "idejn" [] Fem ; - harbour_N = mkNoun "port" "portijiet" ; - hat_N = mkNoun "kappell" "kpiepel" ; + gold_N = mkN [] "deheb" [] "dehbijiet" [] ; + good_A = mkA "tajjeb" "tajba" "tajbin" ; + grammar_N = mkN "grammatika" ; + grass_N = mk5N "ħaxixa" "ħaxix" [] [] "ħxejjex" masculine ; -- Dict says ĦAXIX = n.koll.m.s., f. -a, pl.ind. ĦXEJJEX + green_A = mkA "aħdar" "ħadra" "ħodor" ; + guts_N = mkN "musrana" [] [] "musraniet" "msaren" ; -- pronSuffix + hair_N = mkN "xagħar" [] [] "xagħariet" "xgħur" ; -- pronSuffix + hand_N = mk5N "id" [] "idejn" "idejn" [] feminine ; -- pronSuffix + harbour_N = mkN "port" "portijiet" ; + hat_N = mkN "kappell" "kpiepel" ; -- hate_V2 - head_N = mkNoun "ras" "rjus" Fem ; + head_N = mkN "ras" "rjus" feminine ; -- pronSuffix -- hear_V2 - heart_N = mkNoun "qalb" "qlub" Fem ; --- heavy_A - hill_N = mkNoun "għolja" "għoljiet" ; + heart_N = mkN "qalb" "qlub" feminine ; -- pronSuffix + heavy_A = brokenA "tqil" "tqal" "itqal" ; + hill_N = mkN "għolja" "għoljiet" ; -- hit_V2 -- hold_V2 -- hope_VS - horn_N = mkNoun "ħorn" "ħornijiet" ; - horse_N = mkNoun "żiemel" "żwiemel" ; --- hot_A - house_N = mkNoun "dar" "djar" Fem ; + horn_N = mkN "ħorn" "ħornijiet" ; + horse_N = mkN "żiemel" "żwiemel" ; + hot_A = brokenA "sħun" "sħan" ; + house_N = mkN "dar" "djar" feminine ; -- hunt_V2 - husband_N = mkNoun "raġel" "rġiel" ; - ice_N = mkNoun "silġ" "silġiet" ; --- important_A - industry_N = mkNoun "industrija" ; - iron_N = mkNounWorst "ħadida" "ħadid" [] "ħadidiet" "ħdejjed" Masc ; + husband_N = mkN "raġel" "rġiel" ; -- pronSuffix ŻEWĠI + ice_N = mkN "silġ" "silġiet" ; + important_A = sameA "importanti" ; + industry_N = mkN "industrija" ; + iron_N = mk5N "ħadida" "ħadid" [] "ħadidiet" "ħdejjed" masculine ; -- john_PN -- jump_V -- kill_V2 - king_N = mkNoun "re" "rejjiet" ; - knee_N = mkNoun "rkoppa" [] "rkopptejn" "rkoppiet" [] ; -- TODO use mkNounDual + king_N = mkN "re" "rejjiet" ; + knee_N = mkN "rkoppa" [] "rkopptejn" "rkoppiet" [] ; -- TODO use mkNDual -- pronSuffix -- know_V2 -- know_VQ -- know_VS - lake_N = mkNoun "għadira" "għadajjar" ; - lamp_N = mkNoun "lampa" ; - language_N = mkNoun "lingwa" ; -- lsien? + lake_N = mkN "għadira" "għadajjar" ; + lamp_N = mkN "lampa" ; + language_N = mkN "lingwa" ; -- lsien? -- laugh_V - leaf_N = mkNoun "werqa" "weraq" "werqtejn" "werqiet" [] ; + leaf_N = mkN "werqa" "weraq" "werqtejn" "werqiet" [] ; -- learn_V2 - leather_N = mkNoun "ġilda" "ġild" [] "ġildiet" "ġlud" ; -- mkNounColl "ġild" ; + leather_N = mkN "ġilda" "ġild" [] "ġildiet" "ġlud" ; -- mkNColl "ġild" ; -- leave_V2 -- left_Ord - leg_N = mkNoun "riġel" [] "riġlejn" [] [] ; -- sieq? + leg_N = mkN "riġel" [] "riġlejn" [] [] ; -- sieq? -- pronSuffix -- lie_V -- like_V2 -- listen_V2 -- live_V - liver_N = mkNoun "fwied" [] [] [] "ifdwa" ; --- long_A + liver_N = mkN "fwied" [] [] [] "ifdwa" ; -- pronSuffix + long_A = brokenA "twil" "twal" "itwal" ; -- lose_V2 - louse_N = mkNoun "qamla" "qamliet" ; - love_N = mkNoun "mħabba" "mħabbiet" ; -- hmmm + louse_N = mkN "qamla" "qamliet" ; + love_N = mkN "mħabba" "mħabbiet" ; -- hmmm -- love_V2 - man_N = mkNoun "raġel" "rġiel" ; + man_N = mkN "raġel" "rġiel" ; -- married_A2 - meat_N = mkNoun "laħam" [] [] "laħmiet" "laħmijiet" ; - milk_N = mkNoun [] "ħalib" [] "ħalibijiet" "ħlejjeb" ; - moon_N = mkNoun "qamar" "oqmra" ; -- qmura? - mother_N2 = mkNoun "omm" "ommijiet" Fem ; - mountain_N = mkNoun "muntanja" ; - mouth_N = mkNoun "ħalq" "ħluq" ; - music_N = mkNoun "musika" ; -- plural? - name_N = mkNoun "isem" "ismijiet" ; --- narrow_A --- near_A - neck_N = mkNoun "għonq" "għenuq" ; --- new_A - newspaper_N = mkNoun "gazzetta" ; - night_N = mkNoun "lejl" "ljieli" ; - nose_N = mkNoun "mnieħer" "mniħrijiet" ; + meat_N = mkN "laħam" [] [] "laħmiet" "laħmijiet" ; + milk_N = mkN [] "ħalib" [] "ħalibijiet" "ħlejjeb" ; + moon_N = mkN "qamar" "oqmra" ; -- qmura? + mother_N2 = mkN2 (mkN "omm" "ommijiet" feminine) (mkPrep "ta'") ; -- pronSuffix + mountain_N = mkN "muntanja" ; + mouth_N = mkN "ħalq" "ħluq" ; -- pronSuffix + music_N = mkN "musika" ; -- plural? + name_N = mkN "isem" "ismijiet" ; -- pronSuffix + narrow_A = mkA "dejjaq" "dejqa" "dojoq" "idjaq" ; + near_A = regA "viċin" ; + neck_N = mkN "għonq" "għenuq" ; -- pronSuffix + new_A = brokenA "ġdid" "ġodda" ; + newspaper_N = mkN "gazzetta" ; + night_N = mkN "lejl" "ljieli" ; + nose_N = mkN "mnieħer" "mniħrijiet" ; -- pronSuffix -- now_Adv - number_N = mkNoun "numru" ; - oil_N = mkNoun "żejt" "żjut" ; --- old_A + number_N = mkN "numru" ; + oil_N = mkN "żejt" "żjut" ; + old_A = brokenA "qadim" "qodma" "eqdem" ; -- open_V2 -- paint_V2A - paper_N = mkNoun "karta" ; + paper_N = mkN "karta" ; -- paris_PN - peace_N = mkNoun "paċi" "paċijiet" Fem ; - pen_N = mkNoun "pinna" "pinen" ; - person_N = mkNounWorst [] "persuna" [] "persuni" [] Masc ; - planet_N = mkNoun "pjaneta" ; - plastic_N = mkNounNoPlural "plastik" ; + peace_N = mkN "paċi" "paċijiet" feminine ; + pen_N = mkN "pinna" "pinen" ; + person_N = mk5N [] "persuna" [] "persuni" [] masculine ; + planet_N = mkN "pjaneta" ; + plastic_N = mkNNoPlural "plastik" ; -- play_V -- play_V2 - policeman_N = mkNounNoPlural "pulizija" ; - priest_N = mkNoun "qassis" "qassisin" ; + policeman_N = mkNNoPlural "pulizija" ; + priest_N = mkN "qassis" "qassisin" ; -- probable_AS -- pull_V2 -- push_V2 -- put_V2 - queen_N = mkNoun "reġina" "rġejjen" ; - question_N = mkNoun "mistoqsija" "mistoqsijiet" ; -- domanda? - radio_N = mkNoun "radju" "radjijiet" ; - rain_N = mkNounNoPlural "xita" ; + queen_N = mkN "reġina" "rġejjen" ; + question_N = mkN "mistoqsija" "mistoqsijiet" ; -- domanda? + radio_N = mkN "radju" "radjijiet" ; + rain_N = mkNNoPlural "xita" ; -- rain_V0 -- read_V2 --- ready_A - reason_N = mkNoun "raġun" "raġunijiet" ; --- red_A - religion_N = mkNoun "reliġjon" "reliġjonijiet" ; - restaurant_N = mkNoun "restorant" ; + ready_A = regA "lest" ; + reason_N = mkN "raġun" "raġunijiet" ; + red_A = mkA "aħmar" "ħamra" "ħomor" ; + religion_N = mkN "reliġjon" "reliġjonijiet" ; + restaurant_N = mkN "restorant" ; -- right_Ord - river_N = mkNoun "xmara" "xmajjar" ; - road_N = mkNounWorst "triq" [] [] "triqat" "toroq" Fem ; - rock_N = mkNoun "blata" "blat" [] "blatiet" "blajjiet" ; -- in dictionary BLAT and BLATA are separate! - roof_N = mkNoun "saqaf" "soqfa" ; - root_N = mkNoun "qħerq" "qħeruq" ; - rope_N = mkNoun "ħabel" "ħbula" ; --- rotten_A --- round_A + river_N = mkN "xmara" "xmajjar" ; + road_N = mk5N "triq" [] [] "triqat" "toroq" feminine ; + rock_N = mkN "blata" "blat" [] "blatiet" "blajjiet" ; -- in dictionary BLAT and BLATA are separate! + roof_N = mkN "saqaf" "soqfa" ; + root_N = mkN "qħerq" "qħeruq" ; + rope_N = mkN "ħabel" "ħbula" ; + rotten_A = mkA "mħassar" "mħassra" "mħassrin" ; + round_A = regA "tond" ; -- rub_V2 - rubber_N = mkNoun "gomma" "gomom" ; - rule_N = mkNoun "regola" ; + rubber_N = mkN "gomma" "gomom" ; + rule_N = mkN "regola" ; -- run_V - salt_N = mkNoun "melħ" "melħiet" ; - sand_N = mkNoun "ramla" "ramel" [] "ramliet" "rmiel" ; + salt_N = mkN "melħ" "melħiet" ; + sand_N = mkN "ramla" "ramel" [] "ramliet" "rmiel" ; -- say_VS - school_N = mkNoun "skola" "skejjel" ; - science_N = mkNoun "xjenza" ; + school_N = mkN "skola" "skejjel" ; + science_N = mkN "xjenza" ; -- scratch_V2 - sea_N = mkNoun "baħar" [] "baħrejn" "ibħra" [] ; + sea_N = mkN "baħar" [] "baħrejn" "ibħra" [] ; -- see_V2 - seed_N = mkNoun "żerriegħa" "żerrigħat" ; + seed_N = mkN "żerriegħa" "żerrigħat" ; -- seek_V2 -- sell_V3 -- send_V3 -- sew_V --- sharp_A - sheep_N = mkNoun "nagħġa" "nagħaġ" [] "nagħġiet" [] ; - ship_N = mkNoun "vapur" ; - shirt_N = mkNoun "qmis" "qomos" Fem ; - shoe_N = mkNoun "żarbun" "żraben" ; - shop_N = mkNoun "ħanut" "ħwienet" ; --- short_A - silver_N = mkNoun "fidda" "fided" ; + sharp_A = mkA "jaqta" "taqta" "jaqtgħu" ; -- TODO: apostrophe? + sheep_N = mkN "nagħġa" "nagħaġ" [] "nagħġiet" [] ; + ship_N = mkN "vapur" ; + shirt_N = mkN "qmis" "qomos" feminine ; + shoe_N = mkN "żarbun" "żraben" ; + shop_N = mkN "ħanut" "ħwienet" ; + short_A = brokenA "qasir" "qosra" "iqsar" ; + silver_N = mkN "fidda" "fided" ; -- sing_V - sister_N = mkNoun "oħt" "aħwa" Fem ; + sister_N = mkN "oħt" "aħwa" feminine ; -- pronSuffix -- sit_V - skin_N = mkNoun "ġilda" "ġildiet" ; - sky_N = mkNoun "sema" "smewwiet" Masc ; + skin_N = mkN "ġilda" "ġildiet" ; + sky_N = mkN "sema" "smewwiet" masculine ; -- sleep_V --- small_A + small_A = brokenA "zgħir" "zgħar" "iżgħar" ; -- smell_V - smoke_N = mkNoun "duħħan" "dħaħen" ; --- smooth_A - snake_N = mkNoun "serp" "sriep" ; - snow_N = mkNoun [] "borra" [] [] [] ; - sock_N = mkNoun "kalzetta" ; - song_N = mkNoun "kanzunetta" ; + smoke_N = mkN "duħħan" "dħaħen" ; + smooth_A = regA "lixx" ; + snake_N = mkN "serp" "sriep" ; + snow_N = mkN [] "borra" [] [] [] ; + sock_N = mkN "kalzetta" ; + song_N = mkN "kanzunetta" ; -- speak_V2 -- spit_V -- split_V2 -- squeeze_V2 -- stab_V2 -- stand_V - star_N = mkNoun "stilla" "stilel" ; - steel_N = mkNounNoPlural "azzar" ; - stick_N = mkNoun "lasta" ; - stone_N = mkNoun "ġebla" "ġebel" [] "ġebliet" "ġbiel" ; + star_N = mkN "stilla" "stilel" ; + steel_N = mkNNoPlural "azzar" ; + stick_N = mkN "lasta" ; + stone_N = mkN "ġebla" "ġebel" [] "ġebliet" "ġbiel" ; -- stop_V - stove_N = mkNoun "kuker" "kukers" ; -- fuklar? --- straight_A - student_N = mkNoun "student" ; --- stupid_A + stove_N = mkN "kuker" "kukers" ; -- fuklar? + straight_A = regA "dritt" ; + student_N = mkN "student" ; + stupid_A = mkA "iblah" "belha" "boloh" ; -- these are really nouns... -- suck_V2 - sun_N = mkNoun "xemx" "xmux" Fem ; + sun_N = mkN "xemx" "xmux" feminine ; -- swell_V -- swim_V -- switch8off_V2 -- switch8on_V2 - table_N = mkNoun "mejda" "mwejjed" ; - tail_N = mkNoun "denb" "dnieb" ; + table_N = mkN "mejda" "mwejjed" ; + tail_N = mkN "denb" "dnieb" ; -- pronSuffix -- talk_V3 -- teach_V2 - teacher_N = mkNoun "għalliem" "għalliema" ; -- għalliema ? - television_N = mkNoun "televixin" "televixins" ; --- thick_A --- thin_A + teacher_N = mkN "għalliem" "għalliema" ; -- għalliema ? + television_N = mkN "televixin" "televixins" ; + thick_A = mkA "oħxon" "ħoxna" "ħoxnin" "eħxen" ; + thin_A = brokenA "irqiq" "irqaq" "irqaq" ; -- think_V -- throw_V2 -- tie_V2 -- today_Adv - tongue_N = mkNoun "lsien" "ilsna" ; - tooth_N = mkNoun "sinna" [] [] "sinniet" "snien" ; -- darsa? - train_N = mkNoun "ferrovija" ; + tongue_N = mkN "lsien" "ilsna" ; -- pronSuffix + tooth_N = mkN "sinna" [] [] "sinniet" "snien" ; -- darsa? -- pronSuffix + train_N = mkN "ferrovija" ; -- travel_V - tree_N = mkNoun "siġra" "siġar" [] "siġriet" [] ; + tree_N = mkN "siġra" "siġar" [] "siġriet" [] ; -- turn_V --- ugly_A --- uncertain_A + ugly_A = mkA "ikrah" "kerha" "koroh" ; -- ikreh? + uncertain_A = regA "inċert" ; -- understand_V2 - university_N = mkNoun "università" "universitàjiet" ; - village_N = mkNoun "raħal" "rħula" ; -- villaġġ ? + university_N = mkN "università" "universitàjiet" ; + village_N = mkN "raħal" "rħula" ; -- villaġġ ? -- pronSuffix -- vomit_V -- wait_V2 -- walk_V - war_N = mkNoun "gwerra" "gwerrer" ; --- warm_A + war_N = mkN "gwerra" "gwerrer" ; + warm_A = hot_A ; -- wash_V2 -- watch_V2 - water_N = mkNoun "ilma" "ilmijiet" Masc ; --- wet_A --- white_A --- wide_A - wife_N = mkNoun "mara" "nisa" ; + water_N = mkN "ilma" "ilmijiet" masculine ; + wet_A = mkA "imxarrab" "imxarrba" "imxarrbin" ; + white_A = mkA "abjad" "bajda" "bojod" ; + wide_A = broad_A ; + wife_N = mkN "mara" "nisa" ; -- pronSuffix MARTI -- win_V2 - wind_N = mkNoun "riħ" [] [] "rjieħ" "rjiħat" ; - window_N = mkNoun "tieqa" "twieqi" ; - wine_N = mkNoun [] "nbid" [] [] "nbejjed" ; - wing_N = mkNoun "ġewnaħ" "ġwienaħ" ; + wind_N = mkN "riħ" [] [] "rjieħ" "rjiħat" ; + window_N = mkN "tieqa" "twieqi" ; + wine_N = mkN [] "nbid" [] [] "nbejjed" ; + wing_N = mkN "ġewnaħ" "ġwienaħ" ; -- wipe_V2 - woman_N = mkNoun "mara" "nisa" ; + woman_N = mkN "mara" "nisa" ; -- wonder_VQ - wood_N = mkNoun "injam" "injamiet" ; - worm_N = mkNoun "dudu" "dud" [] "dudiet" "dwied" ; -- duda + wood_N = mkN "injam" "injamiet" ; + worm_N = mkN "dudu" "dud" [] "dudiet" "dwied" ; -- duda -- write_V2 - year_N = mkNoun "sena" [] "sentejn" "snin" [] ; --- yellow_A --- young_A + year_N = mkN "sena" [] "sentejn" "snin" [] ; -- pronSuffix SNINI (only plural though!) + yellow_A = mkA "isfar" "safra" "sofor" ; + young_A = small_A ; } ; diff --git a/lib/src/maltese/NounMlt.gf b/lib/src/maltese/NounMlt.gf index 08a210d2c..ae22b94fc 100644 --- a/lib/src/maltese/NounMlt.gf +++ b/lib/src/maltese/NounMlt.gf @@ -5,7 +5,49 @@ -- Licensed under LGPL concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in { - flags optimize=noexpand ; + + flags + optimize=noexpand ; + + lin + -- Det -> CN -> NP + DetCN det cn = { + s = \\c => det.s ++ cn.s ! numnum2nounnum det.n ! NRegular ; + a = case (numnum2nounnum det.n) of { + Singular _ => AgP3Sg cn.g ; + _ => AgP3Pl + } + -- s = \\c => det.s ++ cn.s ! det.n ! npcase2case c ; + -- a = agrgP3 det.n cn.g + } ; + + -- Quant -> Num -> Det + DetQuant quant num = { + s = quant.s ! num.hasCard ! num.n ++ num.s ! NumNominative; + -- sp = \\c => case num.hasCard of { + -- False => quant.sp ! num.hasCard ! num.n ! c ++ num.s ! Nom ; + -- True => quant.sp ! num.hasCard ! num.n ! npNom ++ num.s ! npcase2case c + -- } ; + n = num.n ; + hasNum = num.hasCard + } ; + + -- Quant + DefArt = { + s = \\hasCard,n => artDef ; + -- sp = \\hasCard,n => case of { + -- => table { NCase Gen => "its"; _ => "it" } ; + -- => table { NCase Nom => "they"; NPAcc => "them"; NCase Gen => "theirs" } ; + -- _ => \\c => artDef + -- } + } ; + + -- Num + NumSg = {s = \\c => []; n = Num_Sg ; hasCard = False} ; + NumPl = {s = \\c => []; n = Num_Pl ; hasCard = False} ; + + UseN n = n ; + UseN2 n = n ; -- Card -- CN diff --git a/lib/src/maltese/NumeralMlt.gf b/lib/src/maltese/NumeralMlt.gf index 5bc12d1f8..ad163bdba 100644 --- a/lib/src/maltese/NumeralMlt.gf +++ b/lib/src/maltese/NumeralMlt.gf @@ -79,18 +79,18 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt -- adjectival, eg ŻEWĠ -- teen, eg TNAX -- ten, eg GĦOXRIN - -- number, eg NumDual + -- number, eg Num_Dl --mkNum : Str -> Str -> Str -> Str -> Str -> Str -> Str -> Num_Number -> Form1 = \unit,ordunit,adjectival,teen,ten,hundred,thousand,num -> { mkNum : Str -> Str -> Str -> Str -> Str -> Num_Number -> Form1 = \unit,ordunit,adjectival,teen,ten,num -> let hundred = case num of { - NumSg => "mija" ; - NumDual => "mitejn" ; + Num_Sg => "mija" ; + Num_Dl => "mitejn" ; _ => adjectival } ; thousand = case num of { - NumSg => "wieħed" ; - NumDual => "elfejn" ; + Num_Sg => "wieħed" ; + Num_Dl => "elfejn" ; _ => case adjectival of { _ + "'" => (init adjectival) + "t" ; -- eg SEBA' -> SEBAT _ + "t" => adjectival ; -- eg SITT -> SITT @@ -104,7 +104,7 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt NumNominative => unit ; -- eg TNEJN NumAdjectival => adjectival -- eg ŻEWĠ } ; - NOrd => \\numcase => definiteArticle ++ ordunit -- eg IT-TIENI + NOrd => \\numcase => artDef ++ ordunit -- eg IT-TIENI } ; Teen => table { NCard => table { @@ -112,35 +112,35 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt NumAdjectival => teen + "-il" -- eg TNAX-IL } ; NOrd => table { - NumNominative => definiteArticle ++ teen ; -- eg IT-TNAX - NumAdjectival => definiteArticle ++ (teen + "-il") -- eg IT-TNAX-IL + NumNominative => artDef ++ teen ; -- eg IT-TNAX + NumAdjectival => artDef ++ (teen + "-il") -- eg IT-TNAX-IL } } ; Ten => table { NCard => \\numcase => ten ; -- eg TLETIN - NOrd => \\numcase => definiteArticle ++ ten -- eg IT-TLETIN + NOrd => \\numcase => artDef ++ ten -- eg IT-TLETIN } ; Hund => table { NCard => case num of { - NumSg => table { + Num_Sg => table { NumNominative => "mija" ; -- ie MIJA NumAdjectival => "mitt" -- ie MITT suldat } ; - NumDual => \\numcase => hundred ; -- ie MITEJN + Num_Dl => \\numcase => hundred ; -- ie MITEJN _ => table { NumNominative => hundred ++ "mija" ; -- eg MIJA, SEBA' MIJA NumAdjectival => hundred ++ "mitt" -- eg MITT, SEBA' MITT suldat } } ; NOrd => case num of { - NumSg => table { - NumNominative => definiteArticle ++ "mija" ; -- ie IL-MIJA - NumAdjectival => definiteArticle ++ "mitt" -- ie IL-MITT suldat + Num_Sg => table { + NumNominative => artDef ++ "mija" ; -- ie IL-MIJA + NumAdjectival => artDef ++ "mitt" -- ie IL-MITT suldat } ; - NumDual => \\numcase => definiteArticle ++ hundred ; -- ie IL-MITEJN, IL-MITEJN suldat + Num_Dl => \\numcase => artDef ++ hundred ; -- ie IL-MITEJN, IL-MITEJN suldat _ => table { - NumNominative => definiteArticle ++ hundred ++ "mija" ; -- eg IS-SEBA' MIJA - NumAdjectival => definiteArticle ++ hundred ++ "mitt" -- eg IS-SEBA' MITT suldat + NumNominative => artDef ++ hundred ++ "mija" ; -- eg IS-SEBA' MIJA + NumAdjectival => artDef ++ hundred ++ "mitt" -- eg IS-SEBA' MITT suldat } } } @@ -152,14 +152,14 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt lin -- Unit Ord.Unit Adjectival Teen Ten Number - n2 = mkNum "tnejn" "tieni" "żewġ" "tnax" "għoxrin" NumDual ; - n3 = mkNum "tlieta" "tielet" "tlett" "tlettax" "tletin" NumPl ; -- TODO tlett / tliet ? - n4 = mkNum "erbgħa" "raba'" "erba'" "erbatax" "erbgħin" NumPl ; - n5 = mkNum "ħamsa" "ħames" "ħames" "ħmistax" "ħamsin" NumPl ; - n6 = mkNum "sitta" "sitt" "sitt" "sittax" "sittin" NumPl ; - n7 = mkNum "sebgħa" "seba'" "seba'" "sbatax" "sebgħin" NumPl ; - n8 = mkNum "tmienja" "tmin" "tmin" "tmintax" "tmenin" NumPl ; - n9 = mkNum "disgħa" "disa'" "disa'" "dsatax" "disgħin" NumPl ; + n2 = mkNum "tnejn" "tieni" "żewġ" "tnax" "għoxrin" Num_Dl ; + n3 = mkNum "tlieta" "tielet" "tlett" "tlettax" "tletin" Num_Pl ; -- TODO tlett / tliet ? + n4 = mkNum "erbgħa" "raba'" "erba'" "erbatax" "erbgħin" Num_Pl ; + n5 = mkNum "ħamsa" "ħames" "ħames" "ħmistax" "ħamsin" Num_Pl ; + n6 = mkNum "sitta" "sitt" "sitt" "sittax" "sittin" Num_Pl ; + n7 = mkNum "sebgħa" "seba'" "seba'" "sbatax" "sebgħin" Num_Pl ; + n8 = mkNum "tmienja" "tmin" "tmin" "tmintax" "tmenin" Num_Pl ; + n9 = mkNum "disgħa" "disa'" "disa'" "dsatax" "disgħin" Num_Pl ; oper -- Helper functions for below @@ -173,7 +173,7 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt } ; --thou = card ; thou = { s = card ; treatAs = form } ; - n = NumPl ; + n = Num_Pl ; f = form ; } ; @@ -186,13 +186,13 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt } ; --NOrd => \\numcase => addDefiniteArticle ord NOrd => table { - NumNominative => definiteArticle ++ ord ; - NumAdjectival => definiteArticle ++ adj + NumNominative => artDef ++ ord ; + NumAdjectival => artDef ++ adj } } ; --thou = thousand ; thou = { s = thousand ; treatAs = form } ; - n = NumPl ; + n = Num_Pl ; f = form ; } ; @@ -206,7 +206,7 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt } ; treatAs = form ; } ; - n = NumPl ; + n = Num_Pl ; f = form ; } ; @@ -219,10 +219,10 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt -- Sub10 ; 1 -- Unit Ord.Unit Adjectival Teen Ten Number - pot01 = mkNum "wieħed" "ewwel" "wieħed" [] [] NumSg ; + pot01 = mkNum "wieħed" "ewwel" "wieħed" [] [] Num_Sg ; -- Digit -> Sub10 ; d * 1 - pot0 d = d ** {n = case d.n of { NumDual => NumDual ; _ => NumPl } } ; + pot0 d = d ** {n = case d.n of { Num_Dl => Num_Dl ; _ => Num_Pl } } ; -- Sub100 ; 10, 11 -- Cardinal Ordinal Adjectival Thousand Form @@ -241,7 +241,7 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt NCard => "għaxart" ; NOrd => addDefiniteArticle "għaxart" } ; - n = NumPl ; + n = Num_Pl ; f = Ten ; } ; -} @@ -273,7 +273,7 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt let unit = (n.s ! Unit ! NCard ! NumNominative) in mkForm2 (unit ++ "u" ++ (d.s ! Ten ! NCard ! NumNominative)) - (definiteArticle ++ unit ++ "u" ++ (d.s ! Ten ! NCard ! NumNominative)) + (artDef ++ unit ++ "u" ++ (d.s ! Ten ! NCard ! NumNominative)) Ten ; @@ -285,13 +285,13 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt s = m.s ! Hund ; thou = { s = case m.n of { - NumSg => "mitt" ; -- Special case for "mitt elf" - NumDual => "mitejn" ; -- Special case for "mitejn elf" + Num_Sg => "mitt" ; -- Special case for "mitt elf" + Num_Dl => "mitejn" ; -- Special case for "mitejn elf" _ => m.thou.s } ; treatAs = Hund ; } ; - n = NumPl ; + n = Num_Pl ; f = Hund ; } ; @@ -306,18 +306,18 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt NumAdjectival => hund ++ "u" ++ n.s ! NCard ! NumAdjectival } ; NOrd => table { - NumNominative => definiteArticle ++ hund ++ "u" ++ n.s ! NCard ! NumNominative ; - NumAdjectival => definiteArticle ++ hund ++ "u" ++ n.s ! NCard ! NumAdjectival + NumNominative => artDef ++ hund ++ "u" ++ n.s ! NCard ! NumNominative ; + NumAdjectival => artDef ++ hund ++ "u" ++ n.s ! NCard ! NumAdjectival } } ; thou = { s = hund ++ "u" ++ n.thou.s ; treatAs = case n.n of { - NumSg => Ten ; -- specific case for mija u wiehed elf + Num_Sg => Ten ; -- specific case for mija u wiehed elf _ => n.f -- eg So that "106,000" is treated as "6,000" } ; } ; - n = NumPl ; + n = Num_Pl ; f = Hund ; } ; @@ -328,18 +328,18 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt pot3 m = { s = case of { - => numTable "elf" ; -- 1 * 1000 - => numTable "elfejn" ; -- 2 * 2000 - => numTable m.thou.s "elef" ; -- 3-10 * 1000 - => numTable m.thou.s "elf" -- 11+ * 1000 + => numTable "elf" ; -- 1 * 1000 + => numTable "elfejn" ; -- 2 * 2000 + => numTable m.thou.s "elef" ; -- 3-10 * 1000 + => numTable m.thou.s "elf" -- 11+ * 1000 } ; {- case m.f of { Unit => numTable m.thou "elef" ; -- _ => case m.n of { - NumSg => numTable "elf" ; -- - NumDual => numTable "elfejn" ; -- - NumPl => numTable m.thou "elf" -- + Num_Sg => numTable "elf" ; -- + Num_Dl => numTable "elfejn" ; -- + Num_Pl => numTable m.thou "elf" -- } } ; -} @@ -347,7 +347,7 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt s = m.thou.s ; treatAs = m.f ; } ; - n = NumPl ; + n = Num_Pl ; f = Hund ; -- NOT IMPORTANT } ; @@ -361,15 +361,15 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt } in case of { - => numTable "elf" ukemm ; - => numTable "elfejn" ukemm ; - => numTable (m.thou.s ++ "elef") ukemm ; - => numTable (m.thou.s ++ "elf") ukemm + => numTable "elf" ukemm ; + => numTable "elfejn" ukemm ; + => numTable (m.thou.s ++ "elef") ukemm ; + => numTable (m.thou.s ++ "elf") ukemm } ; {- - NumSg => elf2 "elf" ukemm ; - NumDual => elf2 "elfejn" ukemm ; - NumPl => case m.f of { + Num_Sg => elf2 "elf" ukemm ; + Num_Dl => elf2 "elfejn" ukemm ; + Num_Pl => case m.f of { Unit => elf2 m.thou ("elef" ++ ukemm) ; _ => elf2 m.thou ("elf" ++ ukemm) } @@ -378,7 +378,7 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt s = m.thou.s ; treatAs = m.f ; } ; - n = NumPl ; + n = Num_Pl ; f = Hund ; -- NOT IMPORTANT } ; @@ -388,12 +388,12 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt numTable : Str -> (CardOrd => Num_Case => Str) = \thou -> table { NCard => \\numcase => thou ; - NOrd => \\numcase => definiteArticle ++ thou + NOrd => \\numcase => artDef ++ thou } ; numTable : Str -> Str -> (CardOrd => Num_Case => Str) = \thou,attach -> table { NCard => \\numcase => thou ++ attach ; - NOrd => \\numcase => definiteArticle ++ thou ++ attach + NOrd => \\numcase => artDef ++ thou ++ attach } ; numTable : Str -> (Num_Case => Str) -> (CardOrd => Num_Case => Str) = \thou,attach -> table { @@ -402,8 +402,8 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt NumAdjectival => thou ++ (attach ! NumAdjectival) } ; NOrd => table { - NumNominative => definiteArticle ++ thou ++ (attach ! NumNominative) ; - NumAdjectival => definiteArticle ++ thou ++ (attach ! NumAdjectival) + NumNominative => artDef ++ thou ++ (attach ! NumNominative) ; + NumAdjectival => artDef ++ thou ++ (attach ! NumAdjectival) } } ; @@ -447,7 +447,7 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt mkDig : Dig = overload { mkDig : Str -> Dig = \digit -> lin Dig { s = digit ; - n = NumPl + n = Num_Pl } ; mkDig : Str -> Num_Number -> Dig = \digit,num -> lin Dig { s = digit ; @@ -468,8 +468,8 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt lin D_0 = mkDig "0" ; - D_1 = mkDig "1" NumSg ; - D_2 = mkDig "2" NumDual ; + D_1 = mkDig "1" Num_Sg ; + D_2 = mkDig "2" Num_Dl ; D_3 = mkDig "3" ; D_4 = mkDig "4" ; D_5 = mkDig "5" ; @@ -484,7 +484,7 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt -- Create Digits from combining Dig with Digits IIDig d i = { s = d.s ++ (commaIf i.tail) ++ i.s ; - n = NumPl ; + n = Num_Pl ; tail = inc i.tail } ; diff --git a/lib/src/maltese/OrthoMlt.gf b/lib/src/maltese/OrthoMlt.gf deleted file mode 100644 index f414ce9da..000000000 --- a/lib/src/maltese/OrthoMlt.gf +++ /dev/null @@ -1,9 +0,0 @@ --- Maltese Resource Grammar Library --- John J. Camilleri, 2012 --- Licensed under LGPL - -resource OrthoMlt = open Prelude, Predef in { - flags coding=utf8 ; - - -} diff --git a/lib/src/maltese/ParadigmsMlt.gf b/lib/src/maltese/ParadigmsMlt.gf index 4741b878d..ac3472f26 100644 --- a/lib/src/maltese/ParadigmsMlt.gf +++ b/lib/src/maltese/ParadigmsMlt.gf @@ -10,14 +10,27 @@ resource ParadigmsMlt = open Predef, Prelude, MorphoMlt, - OrthoMlt,(ResMlt=ResMlt), + ResMlt, CatMlt in { - flags optimize=noexpand ; coding=utf8 ; + flags + optimize=noexpand ; + coding=utf8 ; oper + {- ===== Parameters ===== -} + + -- Abstraction over gender names + Gender : Type ; + masculine : Gender ; --% + feminine : Gender ; --% + + Gender = ResMlt.Gender ; + masculine = Masc ; + feminine = Fem ; + {- ===== Noun Paradigms ===== -} -- Helper function for inferring noun plural from singulative @@ -32,7 +45,7 @@ resource ParadigmsMlt = open } ; -- Helper function for inferring noun gender from singulative - -- Refer Maltese (Descriptive Grammars) pg190 + -- Refer {MDG} pg190 inferNounGender : Str -> Gender = \sing -> case sing of { _ + "aġni" => Fem ; @@ -51,40 +64,40 @@ resource ParadigmsMlt = open -- Overloaded function for building a noun -- Return: Noun - mkNoun : Noun = overload { + mkN : N = overload { -- Take the singular and infer gender & plural. -- Assume no special plural forms. -- Params: -- Singular, eg AJRUPLAN - mkNoun : Str -> Noun = \sing -> + mkN : Str -> N = \sing -> let plural = inferNounPlural sing ; gender = inferNounGender sing ; in - mkNounWorst sing [] [] plural [] gender ; + mk5N sing [] [] plural [] gender ; -- Take an explicit gender. -- Assume no special plural forms. -- Params: -- Singular, eg AJRUPLAN -- Gender - mkNoun : Str -> Gender -> Noun = \sing,gender -> + mkN : Str -> Gender -> N = \sing,gender -> let plural = inferNounPlural sing ; in - mkNounWorst sing [] [] plural [] gender ; + mk5N sing [] [] plural [] gender ; -- Take the singular, plural. Infer gender. -- Assume no special plural forms. -- Params: -- Singular, eg KTIEB -- Plural, eg KOTBA - mkNoun : Str -> Str -> Noun = \sing,plural -> + mkN : Str -> Str -> N = \sing,plural -> let gender = inferNounGender sing ; in - mkNounWorst sing [] [] plural [] gender ; + mk5N sing [] [] plural [] gender ; -- Take the singular, plural and gender. -- Assume no special plural forms. @@ -92,8 +105,8 @@ resource ParadigmsMlt = open -- Singular, eg KTIEB -- Plural, eg KOTBA -- Gender - mkNoun : Str -> Str -> Gender -> Noun = \sing,plural,gender -> - mkNounWorst sing [] [] plural [] gender ; + mkN : Str -> Str -> Gender -> N = \sing,plural,gender -> + mk5N sing [] [] plural [] gender ; -- Takes all 5 forms, inferring gender @@ -103,36 +116,36 @@ resource ParadigmsMlt = open -- Double, eg KOXXTEJN -- Determinate Plural, eg KOXXIET -- Indeterminate Plural - mkNoun : Str -> Str -> Str -> Str -> Str -> Noun = \sing,coll,dual,det,ind -> + mkN : Str -> Str -> Str -> Str -> Str -> N = \sing,coll,dual,det,ind -> let gender = if_then_else (Gender) (isNil sing) (inferNounGender coll) (inferNounGender sing) ; in - mkNounWorst sing coll dual det ind gender ; + mk5N sing coll dual det ind gender ; - } ; --end of mkNoun overload + } ; --end of mkN overload -- Take the singular and infer gender. -- No other plural forms. -- Params: -- Singular, eg ARTI - mkNounNoPlural : Noun = overload { + mkNNoPlural : N = overload { - mkNounNoPlural : Str -> Noun = \sing -> + mkNNoPlural : Str -> N = \sing -> let gender = inferNounGender sing ; - in mkNounWorst sing [] [] [] [] gender + in mk5N sing [] [] [] [] gender ; - mkNounNoPlural : Str -> Gender -> Noun = \sing,gender -> - mkNounWorst sing [] [] [] [] gender + mkNNoPlural : Str -> Gender -> N = \sing,gender -> + mk5N sing [] [] [] [] gender ; - } ; --end of mkNounNoPlural overload + } ; --end of mkNNoPlural overload -- Take the singular and infer dual, plural & gender -- Params: -- Singular, eg AJRUPLAN - mkNounDual : Str -> Noun = \sing -> + mkNDual : Str -> N = \sing -> let dual : Str = case sing of { _ + ("għ"|"'") => sing + "ajn" ; @@ -142,13 +155,13 @@ resource ParadigmsMlt = open plural = inferNounPlural sing ; gender = inferNounGender sing ; in - mkNounWorst sing [] dual plural [] gender ; + mk5N sing [] dual plural [] gender ; -- Take the collective, and infer singulative, determinate plural, and gender. -- Params: -- Collective Plural, eg TUFFIEĦ - mkNounColl : Str -> Noun = \coll -> + mkNColl : Str -> N = \coll -> let stem : Str = case coll of { -- This can only apply when there are 2 syllables in the word @@ -166,28 +179,19 @@ resource ParadigmsMlt = open -- gender = inferNounGender sing ; gender = Masc ; -- Collective noun is always treated as Masculine in - mkNounWorst sing coll [] det [] gender ; + mk5N sing coll [] det [] gender ; - - -- Worst case - -- Takes all forms and a gender - -- Params: - -- Singulative, eg KOXXA - -- Collective, eg KOXXOX - -- Double, eg KOXXTEJN - -- Determinate Plural, eg KOXXIET - -- Indeterminate Plural - -- Gender - mkNounWorst : Str -> Str -> Str -> Str -> Str -> Gender -> Noun = \sing,coll,dual,det,ind,gen -> { - s = table { - Singular Singulative => sing ; - Singular Collective => coll ; - Dual => dual ; - Plural Determinate => det ; - Plural Indeterminate => ind - } ; - g = gen ; - } ; + -- Build a noun using 5 forms, and a gender + mk5N : (_,_,_,_,_ : Str) -> Gender -> N ; + mk5N = \sing,coll,dual,det,ind,gen -> +-- lin N (mkNoun sing coll dual det ind gen) ; + lin N (mkNoun + (nullSuffixTable sing) + (nullSuffixTable coll) + (nullSuffixTable dual) + (nullSuffixTable det) + (nullSuffixTable ind) + gen) ; {- -- Correctly abbreviate definite prepositions and join with noun @@ -252,172 +256,240 @@ resource ParadigmsMlt = open }); + mkN2 = overload { + mkN2 : N -> Prep -> N2 = prepN2 ; + mkN2 : N -> Str -> N2 = \n,s -> prepN2 n (mkPrep s); +-- mkN2 : Str -> Str -> N2 = \n,s -> prepN2 (regN n) (mkPrep s); + mkN2 : N -> N2 = \n -> prepN2 n (mkPrep "ta'") ; +-- mkN2 : Str -> N2 = \s -> prepN2 (regN s) (mkPrep "ta'") + } ; + + prepN2 : N -> Prep -> N2 ; + prepN2 = \n,p -> lin N2 (n ** {c2 = p.s}) ; + + mkPrep : Str -> Prep ; -- e.g. "in front of" + noPrep : Prep ; -- no preposition + + mkPrep p = lin Prep (ss p) ; + noPrep = mkPrep [] ; + + {- ========== Verb paradigms ========== -} -- Takes a verb as a string and returns the VType and root/pattern. -- Used in smart paradigm below and elsewhere. -- Params: "Mamma" (Perf Per3 Sg Masc) as string (eg KITEB or ĦAREĠ) - -- Return: Record with v:VType, r:Root, p:Pattern - classifyVerb : Str -> { t:VType ; r:Root ; p:Pattern } = \mamma -> case mamma of { - -- Quad - K@#Consonant + v1@#Vowel + T@#Consonant + B@#Consonant + v2@#Vowel + L@#Consonant => { t=Quad ; r={ K=K ; T=T ; B=B ; L=L } ; p={ v1=v1 ; v2=v2 } } ; + classifyVerb : Str -> { c:VClass ; r:Root ; p:Pattern } = \mamma -> case mamma of { - -- Hollow - K@#Consonant + v1@"a" + B@#Consonant => { t=Hollow ; r={ K=K ; T="w" ; B=B ; L=[] } ; p={ v1=v1 ; v2="" } } ; - K@#Consonant + v1@"ie" + B@#Consonant => { t=Hollow ; r={ K=K ; T="j" ; B=B ; L=[] } ; p={ v1=v1 ; v2="" } } ; + -- Defective, BELA' + c1@#Consonant + v1@#Vowel + c2@#Consonant + v2@#Vowel + c3@( "għ" | "'" ) => + { c=Weak Defective ; r=(mkRoot c1 c2 "għ") ; p=(mkPattern v1 v2) } ; - -- Double - K@#Consonant + v1@#Vowel + T@#Consonant + B@#Consonant => { t=Double ; r={ K=K ; T=T ; B="j" ; L=[] } ; p={ v1=v1 ; v2="" } } ; + -- Weak Final, MEXA + c1@#Consonant + v1@#Vowel + c2@#Consonant + v2@#Vowel => + { c=Weak WeakFinal ; r=(mkRoot c1 c2 "j") ; p=(mkPattern v1 v2) } ; - -- Weak - K@#Consonant + v1@#Vowel + T@#Consonant + v2@#Vowel => { t=Weak ; r={ K=K ; T=T ; B="j" ; L=[] } ; p={ v1=v1 ; v2=v2 } } ; + -- Hollow, SAB + --- TODO determining of middle radical is not right, e.g. SAB = S-J-B + c1@#Consonant + v1@"a" + c3@#Consonant => + { c=Weak Hollow ; r=(mkRoot c1 "w" c3) ; p=(mkPattern v1) } ; + c1@#Consonant + v1@"ie" + c3@#Consonant => + { c=Weak Hollow ; r=(mkRoot c1 "j" c3) ; p=(mkPattern v1) } ; - -- Defective - K@#Consonant + v1@#Vowel + T@#Consonant + v2@#Vowel + B@( "għ" | "'" ) => { t=Defective ; r={ K=K ; T=T ; B="għ" ; L=[] } ; p={ v1=v1 ; v2=v2 } } ; + -- Weak Assimilative, WAQAF + c1@#WeakCons + v1@#Vowel + c2@#Consonant + v2@#Vowel + c3@#Consonant => + { c=Weak Assimilative ; r=(mkRoot c1 c2 c3) ; p=(mkPattern v1 v2) } ; - -- Strong - K@#Consonant + v1@#Vowel + T@#Consonant + v2@#Vowel + B@(#Consonant | "ġ") => { t=Strong ; r={ K=K ; T=T ; B=B ; L=[] } ; p={ v1=v1 ; v2=v2 } } ; + -- Strong Reduplicative, ĦABB + c1@#Consonant + v1@#Vowel + c2@#Consonant + c3@#Consonant => + { c=Strong Reduplicative ; r=(mkRoot c1 c2 c3) ; p=(mkPattern v1) } ; - -- Error :( - _ => Predef.error ( "Unable to parse verb" ) + -- Strong LiquidMedial, ŻELAQ + c1@#Consonant + v1@#Vowel + c2@(#LiquidCons | "għ") + v2@#Vowel + c3@#Consonant => + { c=Strong LiquidMedial ; r=(mkRoot c1 c2 c3) ; p=(mkPattern v1 v2) } ; + + -- Strong Regular, QATEL + c1@#Consonant + v1@#Vowel + c2@#Consonant + v2@#Vowel + c3@#Consonant => + { c=Strong Regular ; r=(mkRoot c1 c2 c3) ; p=(mkPattern v1 v2) } ; + + -- Strong Quad, QAĊĊAT + c1@#Consonant + v1@#Vowel + c2@#Consonant + c3@#Consonant + v2@#Vowel + c4@#Consonant => + { c=Strong Quad ; r=(mkRoot c1 c2 c3 c4) ; p=(mkPattern v1 v2) } ; + + -- Weak-Final Quad, PINĠA + c1@#Consonant + v1@#Vowel + c2@#Consonant + c3@#Consonant + v2@#Vowel => + { c=Weak QuadWeakFinal ; r=(mkRoot c1 c2 c3 "j") ; p=(mkPattern v1 v2) } ; + + -- Assume it is a loan verb + _ => { c=Loan ; r=mkRoot ; p=mkPattern } } ; - -- Smart paradigm for building a Verb, by calling correct corresponding mkXXX functions - -- Return: Verb - mkVerb : Verb = overload { + -- Smart paradigm for building a verb + mkV : V = overload { -- Tries to do everything just from the mamma of the verb - -- Params: - -- "Mamma" (Perf Per3 Sg Masc) as string (eg KITEB or ĦAREĠ) - mkVerb : Str -> Verb = \mamma -> + -- Params: mamma + mkV : Str -> V = \mamma -> let - class = classifyVerb mamma + class = classifyVerb mamma ; in - case class.t of { - Strong => mkStrong class.r class.p ; - Defective => mkDefective class.r class.p ; - Weak => Predef.error ( "WEAK" ) ; - Hollow => Predef.error ( "HOLLOW" ) ; - Double => Predef.error ( "DOUBLE" ) ; - Quad => mkQuad class.r class.p - } ; + case class.c of { + Strong Regular => strongV class.r class.p ; + Strong LiquidMedial => liquidMedialV class.r class.p ; + Strong Reduplicative=> reduplicativeV class.r class.p ; + Weak Assimilative => assimilativeV class.r class.p ; + Weak Hollow => hollowV class.r class.p ; + Weak WeakFinal => weakFinalV class.r class.p ; + Weak Defective => defectiveV class.r class.p ; + Strong Quad => quadV class.r class.p ; + Weak QuadWeakFinal => quadWeakV class.r class.p ; + Loan => loanV mamma +-- _ => Predef.error("Unimplemented") + } ; - -- Same as above but also takes an Imperative of the word for when it behaves less predictably - -- Params: - -- "Mamma" (Perf Per3 Sg Masc) as string (eg KITEB or ĦAREĠ ) - -- Imperative Singular as a string (eg IKTEB or OĦROĠ ) - -- Imperative Plural as a string (eg IKTBU or OĦORĠU ) - mkVerb : Str -> Str -> Str -> Verb = \mamma,imp_sg,imp_pl -> + -- Takes an explicit root, when it is not obvious from the mamma + -- Params: mamma, root + mkV : Str -> Root -> V = \mamma,root -> let - class = classifyVerb mamma + class = classifyVerb mamma ; in - case class.t of { - Strong => { - s = table { - VPerf pgn => ( conjStrongPerf class.r class.p ) ! pgn ; - VImpf pgn => ( conjStrongImpf imp_sg imp_pl ) ! pgn ; - VImp n => table { Sg => imp_sg ; Pl => imp_pl } ! n - } ; - o = Semitic ; - t = Strong ; + case class.c of { + Strong Regular => strongV root class.p ; + Strong LiquidMedial => liquidMedialV root class.p ; + Strong Reduplicative=> reduplicativeV root class.p ; + Weak Assimilative => assimilativeV root class.p ; + Weak Hollow => hollowV root class.p ; + Weak WeakFinal => weakFinalV root class.p ; + Weak Defective => defectiveV root class.p ; + Strong Quad => quadV root class.p ; + Weak QuadWeakFinal => quadWeakV root class.p ; + Loan => loanV mamma +-- _ => Predef.error("Unimplemented") + } ; + + -- Takes takes an Imperative of the word for when it behaves less predictably + -- Params: mamma, imperative P2Sg + mkV : Str -> Str -> V = \mamma,imp_sg -> + let + class = classifyVerb mamma ; + imp_pl = case class.c of { + Strong Regular => (take 3 imp_sg) + class.r.C3 + "u" ; -- IFTAĦ > IFTĦU + Strong LiquidMedial => (take 2 imp_sg) + (charAt 3 imp_sg) + class.r.C2 + class.r.C3 + "u" ; -- OĦROĠ > OĦORĠU + Strong Reduplicative=> imp_sg + "u" ; -- ŻOMM > ŻOMMU + Weak Assimilative => (take 2 imp_sg) + class.r.C3 + "u" ; -- ASAL > ASLU + Weak Hollow => imp_sg + "u" ; -- SIR > SIRU + Weak WeakFinal => (take 3 imp_sg) + "u" ; -- IMXI > IMXU + Weak Defective => (take 2 imp_sg) + "i" + class.r.C2 + "għu" ; -- ISMA' > ISIMGĦU + Strong Quad => (take 4 imp_sg) + class.r.C4 + "u" ; -- ĦARBAT > ĦARBTU + Weak QuadWeakFinal => case (dp 1 imp_sg) of { + "a" => imp_sg + "w" ; -- KANTA > KANTAW + "i" => (tk 1 imp_sg) + "u" ; -- SERVI > SERVU + _ => Predef.error("Unaccounted case FH4748J") + } ; + Loan => imp_sg + "w" -- IPPARKJA > IPPARKJAW } ; - Defective => { - s = table { - VPerf pgn => ( conjDefectivePerf class.r class.p ) ! pgn ; - VImpf pgn => ( conjDefectiveImpf imp_sg imp_pl ) ! pgn ; - VImp n => table { Sg => imp_sg ; Pl => imp_pl } ! n + in lin V { + s = table { + VPerf agr => case class.c of { + Strong Regular => (conjStrongPerf class.r class.p) ! agr ; + Strong LiquidMedial => (conjLiquidMedialPerf class.r class.p) ! agr ; + Strong Reduplicative => (conjReduplicativePerf class.r class.p) ! agr ; + Weak Assimilative => (conjAssimilativePerf class.r class.p) ! agr ; + Weak Hollow => (conjHollowPerf class.r class.p) ! agr ; + Weak WeakFinal => (conjWeakFinalPerf class.r class.p) ! agr ; + Weak Defective => (conjDefectivePerf class.r class.p) ! agr ; + Strong Quad => (conjQuadPerf class.r class.p) ! agr ; + Weak QuadWeakFinal => (conjQuadWeakPerf imp_sg) ! agr ; + Loan => (loanV mamma imp_sg).s ! VPerf agr } ; - o = Semitic ; - t = Defective ; + VImpf agr => case class.c of { + Strong Regular => (conjStrongImpf imp_sg imp_pl) ! agr ; + Strong LiquidMedial => (conjLiquidMedialImpf imp_sg imp_pl) ! agr ; + Strong Reduplicative => (conjReduplicativeImpf imp_sg imp_pl) ! agr ; + Weak Assimilative => (conjAssimilativeImpf imp_sg imp_pl) ! agr ; + Weak Hollow => (conjHollowImpf imp_sg imp_pl) ! agr ; + Weak WeakFinal => (conjWeakFinalImpf imp_sg imp_pl) ! agr ; + Weak Defective => (conjDefectiveImpf imp_sg imp_pl) ! agr ; + Strong Quad => (conjQuadImpf imp_sg imp_pl) ! agr ; + Weak QuadWeakFinal => (conjQuadWeakImpf imp_sg imp_pl) ! agr ; + Loan => (loanV mamma imp_sg).s ! VImpf agr + } ; + VImp n => table { Sg => imp_sg ; Pl => imp_pl } ! n } ; - Weak => Predef.error ( "WEAK" ) ; - Hollow => Predef.error ( "HOLLOW" ) ; - Double => Predef.error ( "DOUBLE" ) ; - Quad => { - s = table { - VPerf pgn => ( conjQuadPerf class.r class.p ) ! pgn ; - VImpf pgn => ( conjQuadImpf imp_sg imp_pl ) ! pgn ; - VImp n => table { Sg => imp_sg ; Pl => imp_pl } ! n - } ; - o = Semitic ; - t = Quad ; - } - } ; + c = class.c ; + } ; - } ; --end of mkVerb overload + } ; --end of mkV overload + -- Conjugate imperfect tense from imperative by adding initial letters + -- Ninu, Toninu, Jaħasra, Toninu; Ninu, Toninu, Jaħasra + conjGenericImpf : Str -> Str -> (Agr => Str) = \imp_sg,imp_pl -> + table { + AgP1 Sg => "n" + imp_sg ; -- Jiena NIŻLOQ + AgP2 Sg => "t" + imp_sg ; -- Inti TIŻLOQ + AgP3Sg Masc => "j" + imp_sg ; -- Huwa JIŻLOQ + AgP3Sg Fem => "t" + imp_sg ; -- Hija TIŻLOQ + AgP1 Pl => "n" + imp_pl ; -- Aħna NIŻOLQU + AgP2 Pl => "t" + imp_pl ; -- Intom TIŻOLQU + AgP3Pl => "j" + imp_pl -- Huma JIŻOLQU + } ; - {- ===== STRONG VERB ===== -} + {- ----- Strong Verb ----- -} - -- Strong verb, eg ĦAREĠ (Ħ-R-Ġ) - -- Make a verb by calling generate functions for each tense + -- Regular strong verb ("sħiħ"), eg KITEB -- Params: Root, Pattern - -- Return: Verb - mkStrong : Root -> Pattern -> Verb = \r,p -> + strongV : Root -> Pattern -> V = \r,p -> let imp = conjStrongImp r p ; - in { + in lin V { s = table { - VPerf pgn => ( conjStrongPerf r p ) ! pgn ; - VImpf pgn => ( conjStrongImpf (imp ! Sg) (imp ! Pl) ) ! pgn ; + VPerf agr => ( conjStrongPerf r p ) ! agr ; + VImpf agr => ( conjStrongImpf (imp ! Sg) (imp ! Pl) ) ! agr ; VImp n => imp ! n } ; - t = Strong ; - o = Semitic + c = Strong Regular ; } ; -- Conjugate entire verb in PERFECT tense -- Params: Root, Pattern - -- Return: Lookup table of Agr against Str - conjStrongPerf : Root -> Pattern -> ( Agr => Str ) = \root,p -> + conjStrongPerf : Root -> Pattern -> (Agr => Str) = \root,p -> let - stem_12 = root.K + root.T + (case p.v2 of {"e" => "i" ; _ => p.v2 }) + root.B ; - stem_3 = root.K + p.v1 + root.T + root.B ; + ktib = root.C1 + root.C2 + (case p.V2 of {"e" => "i" ; _ => p.V2 }) + root.C3 ; + kitb = root.C1 + p.V1 + root.C2 + root.C3 ; in table { - Per1 Sg => stem_12 + "t" ; -- Jiena KTIBT - Per2 Sg => stem_12 + "t" ; -- Inti KTIBT - Per3Sg Masc => root.K + p.v1 + root.T + p.v2 + root.B ; -- Huwa KITEB - Per3Sg Fem => stem_3 + (case p.v2 of {"o" => "o" ; _ => "e"}) + "t" ; -- Hija KITBET - Per1 Pl => stem_12 + "na" ; -- Aħna KTIBNA - Per2 Pl => stem_12 + "tu" ; -- Intom KTIBTU - Per3Pl => stem_3 + "u" -- Huma KITBU + AgP1 Sg => ktib + "t" ; -- Jiena KTIBT + AgP2 Sg => ktib + "t" ; -- Inti KTIBT + AgP3Sg Masc => root.C1 + p.V1 + root.C2 + p.V2 + root.C3 ; -- Huwa KITEB + AgP3Sg Fem => kitb + (case p.V2 of {"o" => "o" ; _ => "e"}) + "t" ; -- Hija KITBET + AgP1 Pl => ktib + "na" ; -- Aħna KTIBNA + AgP2 Pl => ktib + "tu" ; -- Intom KTIBTU + AgP3Pl => kitb + "u" -- Huma KITBU } ; -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE -- Params: Imperative Singular (eg IKTEB), Imperative Plural (eg IKTBU) - -- Return: Lookup table of Agr against Str - conjStrongImpf : Str -> Str -> ( Agr => Str ) = \stem_sg,stem_pl -> - table { - Per1 Sg => "n" + stem_sg ; -- Jiena NIKTEB - Per2 Sg => "t" + stem_sg ; -- Inti TIKTEB - Per3Sg Masc => "j" + stem_sg ; -- Huwa JIKTEB - Per3Sg Fem => "t" + stem_sg ; -- Hija TIKTEB - Per1 Pl => "n" + stem_pl ; -- Aħna NIKTBU - Per2 Pl => "t" + stem_pl ; -- Intom TIKTBU - Per3Pl => "j" + stem_pl -- Huma JIKTBU - } ; + conjStrongImpf = conjGenericImpf ; -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns -- Params: Root, Pattern - -- Return: Lookup table of Number against Str - conjStrongImp : Root -> Pattern -> ( Person_Number => Str ) = \root,p -> + conjStrongImp : Root -> Pattern -> (Number => Str) = \root,p -> let - stem_sg = case (p.v1 + p.v2) of { - "aa" => "i" + root.K + root.T + "o" + root.B ; - "ae" => "o" + root.K + root.T + "o" + root.B ; - "ee" => "i" + root.K + root.T + "e" + root.B ; - "ea" => "i" + root.K + root.T + "a" + root.B ; - "ie" => "i" + root.K + root.T + "e" + root.B ; - "oo" => "o" + root.K + root.T + "o" + root.B + stem_sg = case (p.V1 + p.V2) of { + "aa" => "o" + root.C1 + root.C2 + "o" + root.C3 ; -- RABAT > ORBOT + "ae" => "a" + root.C1 + root.C2 + "e" + root.C3 ; -- GĦAMEL > AGĦMEL + "ee" => "i" + root.C1 + root.C2 + "e" + root.C3 ; -- FEHEM > IFHEM + "ea" => "i" + root.C1 + root.C2 + "a" + root.C3 ; -- FETAĦ > IFTAĦ + "ie" => "i" + root.C1 + root.C2 + "e" + root.C3 ; -- KITEB > IKTEB + "oo" => "o" + root.C1 + root.C2 + "o" + root.C3 -- GĦOĠOB > OGĦĠOB } ; - stem_pl = case (p.v1 + p.v2) of { - "aa" => "i" + root.K + "o" + root.T + root.B ; - "ae" => "o" + root.K + "o" + root.T + root.B ; - "ee" => "i" + root.K + "e" + root.T + root.B ; - "ea" => "i" + root.K + "i" + root.T + root.B ; - "ie" => "i" + root.K + "e" + root.T + root.B ; - "oo" => "o" + root.K + "o" + root.T + root.B + stem_pl = case (p.V1 + p.V2) of { + "aa" => "o" + root.C1 + root.C2 + root.C3 ; -- RABAT > ORBTU + "ae" => "a" + root.C1 + root.C2 + root.C3 ; -- GĦAMEL > AGĦMLU + "ee" => "i" + root.C1 + root.C2 + root.C3 ; -- FEHEM > IFHMU + "ea" => "i" + root.C1 + root.C2 + root.C3 ; -- FETAĦ > IFTĦU + "ie" => "i" + root.C1 + root.C2 + root.C3 ; -- KITEB > IKTBU + "oo" => "o" + root.C1 + root.C2 + root.C3 -- GĦOĠOB > OGĦĠBU } ; in table { @@ -425,137 +497,649 @@ resource ParadigmsMlt = open Pl => stem_pl + "u" -- Intom: IKTBU } ; + {- ----- Liquid-Medial Verb ----- -} - {- ===== DEFECTIVE VERB ===== -} - - -- Defective verb, eg SAMA' (S-M-GĦ) - -- Make a verb by calling generate functions for each tense + -- Liquid-medial strong verb, eg ŻELAQ -- Params: Root, Pattern - -- Return: Verb - mkDefective : Root -> Pattern -> Verb = \r,p -> + liquidMedialV : Root -> Pattern -> V = \r,p -> let - imp = conjDefectiveImp r p ; - in { + imp = conjLiquidMedialImp r p ; + in lin V { s = table { - VPerf pgn => ( conjDefectivePerf r p ) ! pgn ; - VImpf pgn => ( conjDefectiveImpf (imp ! Sg) (imp ! Pl) ) ! pgn ; + VPerf agr => ( conjLiquidMedialPerf r p ) ! agr ; + VImpf agr => ( conjLiquidMedialImpf (imp ! Sg) (imp ! Pl) ) ! agr ; VImp n => imp ! n } ; - t = Defective ; - o = Semitic + c = Strong LiquidMedial ; } ; -- Conjugate entire verb in PERFECT tense -- Params: Root, Pattern - -- Return: Lookup table of Agr against Str - conjDefectivePerf : Root -> Pattern -> ( Agr => Str ) = \root,p -> + conjLiquidMedialPerf : Root -> Pattern -> (Agr => Str) = \root,p -> let - stem_12 = root.K + root.T + (case p.v2 of {"e" => "i" ; _ => p.v2 }) + "j" ; -- "AGĦ" -> "AJ" - stem_3 = root.K + p.v1 + root.T + root.B ; + zlaq = root.C1 + root.C2 + (case p.V2 of {"e" => "i" ; _ => p.V2 }) + root.C3 ; + zelq = root.C1 + p.V1 + root.C2 + root.C3 ; in table { - Per1 Sg => stem_12 + "t" ; -- Jiena QLAJT - Per2 Sg => stem_12 + "t" ; -- Inti QLAJT - Per3Sg Masc => root.K + p.v1 + root.T + p.v2 + "'" ; -- Huwa QALA' - Per3Sg Fem => stem_3 + (case p.v2 of {"o" => "o" ; _ => "e"}) + "t" ; -- Hija QALGĦET - Per1 Pl => stem_12 + "na" ; -- Aħna QLAJNA - Per2 Pl => stem_12 + "tu" ; -- Intom QLAJTU - Per3Pl => stem_3 + "u" -- Huma QALGĦU + AgP1 Sg => zlaq + "t" ; -- Jiena ŻLAQT + AgP2 Sg => zlaq + "t" ; -- Inti ŻLAQT + AgP3Sg Masc => root.C1 + p.V1 + root.C2 + p.V2 + root.C3 ; -- Huwa ŻELAQ + AgP3Sg Fem => zelq + (case p.V2 of {"o" => "o" ; _ => "e"}) + "t" ; -- Hija ŻELQET + AgP1 Pl => zlaq + "na" ; -- Aħna ŻLAQNA + AgP2 Pl => zlaq + "tu" ; -- Intom ŻLAQTU + AgP3Pl => zelq + "u" -- Huma ŻELQU + } ; + + -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE + -- Params: Imperative Singular (eg IŻLOQ), Imperative Plural (eg IŻOLQU) + conjLiquidMedialImpf = conjGenericImpf ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjLiquidMedialImp : Root -> Pattern -> (Number => Str) = \root,p -> + let + stem_sg = case (p.V1 + p.V2) of { + "aa" => "i" + root.C1 + root.C2 + "o" + root.C3 ; -- TALAB > ITLOB + "ae" => "o" + root.C1 + root.C2 + "o" + root.C3 ; -- ĦAREĠ > OĦROĠ + "ee" => "e" + root.C1 + root.C2 + "e" + root.C3 ; -- ĦELES > EĦLES + "ea" => "i" + root.C1 + root.C2 + "o" + root.C3 ; -- ŻELAQ > IŻLOQ + "ie" => "i" + root.C1 + root.C2 + "e" + root.C3 ; -- DILEK > IDLEK + "oo" => "i" + root.C1 + root.C2 + "o" + root.C3 -- XOROB > IXROB + } ; + stem_pl = case (p.V1 + p.V2) of { + "aa" => "i" + root.C1 + "o" + root.C2 + root.C3 ; -- TALAB > ITOLBU + "ae" => "o" + root.C1 + "o" + root.C2 + root.C3 ; -- ĦAREĠ > OĦORĠU + "ee" => "e" + root.C1 + "i" + root.C2 + root.C3 ; -- ĦELES > EĦILSU + "ea" => "i" + root.C1 + "o" + root.C2 + root.C3 ; -- ŻELAQ > IŻOLQU + "ie" => "i" + root.C1 + "i" + root.C2 + root.C3 ; -- DILEK > IDILKU + "oo" => "i" + root.C1 + "o" + root.C2 + root.C3 -- XOROB > IXORBU + } ; + in + table { + Sg => stem_sg ; -- Inti: IŻLOQ + Pl => stem_pl + "u" -- Intom: IŻOLQU + } ; + + {- ----- Reduplicative Verb ----- -} + + -- Reduplicative strong verb ("trux"), eg ĦABB + -- Params: Root, Pattern + reduplicativeV : Root -> Pattern -> V = \r,p -> + let + imp = conjReduplicativeImp r p ; + in lin V { + s = table { + VPerf agr => ( conjReduplicativePerf r p ) ! agr ; + VImpf agr => ( conjReduplicativeImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! n + } ; + c = Strong Reduplicative ; + } ; + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjReduplicativePerf : Root -> Pattern -> (Agr => Str) = \root,p -> + let + habb = root.C1 + p.V1 + root.C2 + root.C3 ; + in + table { + AgP1 Sg => habb + "ejt" ; -- Jiena ĦABBEJT + AgP2 Sg => habb + "ejt" ; -- Inti ĦABBEJT + AgP3Sg Masc => habb ; -- Huwa ĦABB + AgP3Sg Fem => habb + "et" ; -- Hija ĦABBET + AgP1 Pl => habb + "ejna" ; -- Aħna ĦABBEJNA + AgP2 Pl => habb + "ejtu" ; -- Intom ĦABBEJTU + AgP3Pl => habb + "ew" -- Huma ĦABBU/ĦABBEW } ; -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE -- Params: Imperative Singular (eg IKTEB), Imperative Plural (eg IKTBU) - -- Return: Lookup table of Agr against Str - conjDefectiveImpf : Str -> Str -> ( Agr => Str ) = \stem_sg,stem_pl -> - table { - Per1 Sg => "n" + stem_sg ; -- Jiena NIKTEB - Per2 Sg => "t" + stem_sg ; -- Inti TIKTEB - Per3Sg Masc => "j" + stem_sg ; -- Huwa JIKTEB - Per3Sg Fem => "t" + stem_sg ; -- Hija TIKTEB - Per1 Pl => "n" + stem_pl ; -- Aħna NIKTBU - Per2 Pl => "t" + stem_pl ; -- Intom TIKTBU - Per3Pl => "j" + stem_pl -- Huma JIKTBU - } ; + conjReduplicativeImpf = conjGenericImpf ; -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns -- Params: Root, Pattern - -- Return: Lookup table of Number against Str - conjDefectiveImp : Root -> Pattern -> ( Person_Number => Str ) = \root,p -> + conjReduplicativeImp : Root -> Pattern -> (Number => Str) = \root,p -> let - v1 = case p.v1 of { "e" => "i" ; _ => p.v1 } ; - v_pl = case p.v1 of { "a" => "i" ; _ => "" } ; -- some verbs require "i" insertion in middle (eg AQILGĦU) + stem_sg = case p.V1 of { + "e" => root.C1 + p.V1 + root.C2 + root.C3 ; -- BEXX > BEXX (?) + _ => root.C1 + "o" + root.C2 + root.C3 -- ĦABB > ĦOBB + } ; in table { - Sg => v1 + root.K + root.T + p.v2 + "'" ; -- Inti: AQLA' / IBŻA' - Pl => v1 + root.K + v_pl + root.T + root.B + "u" -- Intom: AQILGĦU / IBŻGĦU + Sg => stem_sg ; -- Inti: ĦOBB + Pl => stem_sg + "u" -- Intom: ĦOBBU } ; - {- ===== QUADRILITERAL VERB ===== -} + {- ----- Assimilative Verb ----- -} - -- Make a Quad verb, eg QARMEĊ (Q-R-M-Ċ) - -- Make a verb by calling generate functions for each tense + -- Assimilative weak verb, eg WASAL -- Params: Root, Pattern - -- Return: Verb - mkQuad : Root -> Pattern -> Verb = \r,p -> + assimilativeV : Root -> Pattern -> V = \r,p -> let - imp = conjQuadImp r p ; - in { + imp = conjAssimilativeImp r p ; + in lin V { s = table { - VPerf pgn => ( conjQuadPerf r p ) ! pgn ; - VImpf pgn => ( conjQuadImpf (imp ! Sg) (imp ! Pl) ) ! pgn ; + VPerf agr => ( conjAssimilativePerf r p ) ! agr ; + VImpf agr => ( conjAssimilativeImpf (imp ! Sg) (imp ! Pl) ) ! agr ; VImp n => imp ! n } ; - t = Quad ; - o = Semitic ; + c = Weak Assimilative ; } ; -- Conjugate entire verb in PERFECT tense -- Params: Root, Pattern - -- Return: Lookup table of Agr against Str - conjQuadPerf : Root -> Pattern -> ( Agr => Str ) = \root,p -> + conjAssimilativePerf : Root -> Pattern -> (Agr => Str) = \root,p -> let - stem_12 = root.K + p.v1 + root.T + root.B + (case p.v2 of {"e" => "i" ; _ => p.v2 }) + root.L ; - stem_3 = root.K + p.v1 + root.T + root.B + root.L ; + wasal = root.C1 + p.V1 + root.C2 + p.V2 + root.C3 ; + wasl = root.C1 + p.V1 + root.C2 + root.C3 ; in table { - Per1 Sg => stem_12 + "t" ; -- Jiena DARDART - Per2 Sg => stem_12 + "t" ; -- Inti DARDART - Per3Sg Masc => root.K + p.v1 + root.T + root.B + p.v2 + root.L ; -- Huwa DARDAR - Per3Sg Fem => stem_3 + (case p.v2 of {"o" => "o" ; _ => "e"}) + "t" ; -- Hija DARDRET - Per1 Pl => stem_12 + "na" ; -- Aħna DARDARNA - Per2 Pl => stem_12 + "tu" ; -- Intom DARDARTU - Per3Pl => stem_3 + "u" -- Huma DARDRU + AgP1 Sg => wasal + "t" ; -- Jiena WASALT + AgP2 Sg => wasal + "t" ; -- Inti WASALT + AgP3Sg Masc => wasal ; -- Huwa WASAL + AgP3Sg Fem => wasl + "et" ; -- Hija WASLET + AgP1 Pl => wasal + "na" ; -- Aħna WASALNA + AgP2 Pl => wasal + "tu" ; -- Intom WASALTU + AgP3Pl => wasl + "u" -- Huma WASLU } ; -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE - -- Params: Imperative Singular (eg ____), Imperative Plural (eg ___) - -- Return: Lookup table of Agr against Str - conjQuadImpf : Str -> Str -> ( Agr => Str ) = \stem_sg,stem_pl -> - let - prefix_dbl:Str = case stem_sg of { - X@( "d" | "t" ) + _ => "i" + X ; - _ => "t" - } ; - in - table { - Per1 Sg => "in" + stem_sg ; -- Jiena INDARDAR - Per2 Sg => prefix_dbl + stem_sg ; -- Inti IDDARDAR - Per3Sg Masc => "i" + stem_sg ; -- Huwa IDARDAR - Per3Sg Fem => prefix_dbl + stem_sg ; -- Hija IDDARDAR - Per1 Pl => "in" + stem_pl ; -- Aħna INDARDRU - Per2 Pl => prefix_dbl + stem_pl ; -- Intom IDDARDRU - Per3Pl => "i" + stem_pl -- Huma IDARDRU - } ; + -- Params: Imperative Singular (eg ASAL), Imperative Plural (eg ASLU) + conjAssimilativeImpf = conjGenericImpf ; -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns -- Params: Root, Pattern - -- Return: Lookup table of Number against Str - conjQuadImp : Root -> Pattern -> ( Person_Number => Str ) = \root,p -> + conjAssimilativeImp : Root -> Pattern -> (Number => Str) = \root,p -> table { - Sg => root.K + p.v1 + root.T + root.B + p.v2 + root.L ; -- Inti: DARDAR - Pl => root.K + p.v1 + root.T + root.B + root.L + "u" -- Intom: DARDRU + Sg => p.V1 + root.C2 + p.V2 + root.C3 ; -- Inti: ASAL + Pl => p.V1 + root.C2 + root.C3 + "u" -- Intom: ASLU + } ; + + {- ----- Hollow Verb ----- -} + + -- Hollow weak verb, eg SAR (S-J-R) + -- Params: Root, Pattern + hollowV : Root -> Pattern -> V = \r,p -> + let + imp = conjHollowImp r p ; + in lin V { + s = table { + VPerf agr => ( conjHollowPerf r p ) ! agr ; + VImpf agr => ( conjHollowImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! n + } ; + c = Weak Hollow ; + } ; + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + -- Refer: http://blog.johnjcamilleri.com/2012/07/vowel-patterns-maltese-hollow-verb/ + conjHollowPerf : Root -> Pattern -> (Agr => Str) = \root,p -> + let + sar = root.C1 + p.V1 + root.C3 ; + sir = case p.V1 + root.C2 of { + "aw" => root.C1 + "o" + root.C3 ; -- DAM, FAR, SAQ (most common case) + _ => root.C1 + "i" + root.C3 + } + in + table { + AgP1 Sg => sir + "t" ; -- Jiena SIRT + AgP2 Sg => sir + "t" ; -- Inti SIRT + AgP3Sg Masc => sar ; -- Huwa SAR + AgP3Sg Fem => sar + "et" ; -- Hija SARET + AgP1 Pl => sir + "na" ; -- Aħna SIRNA + AgP2 Pl => sir + "tu" ; -- Intom SIRTU + AgP3Pl => sar + "u" -- Huma SARU + } ; + + -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE + -- Params: Imperative Singular (eg IMXI), Imperative Plural (eg IMXU) + conjHollowImpf : Str -> Str -> (Agr => Str) = \imp_sg,imp_pl -> + let + d = take 1 imp_sg ; + in + case d of { + --- Basing the reduplication based on first letter alone is pure speculation. Seems fine though. + #ImpfDoublingCons => table { + AgP1 Sg => "in" + imp_sg ; -- Jiena INDUM + AgP2 Sg => "i" + d + imp_sg ; -- Inti IDDUM + AgP3Sg Masc => "i" + imp_sg ; -- Huwa IDUM + AgP3Sg Fem => "i" + d + imp_sg ; -- Hija IDDUM + AgP1 Pl => "in" + imp_pl ; -- Aħna INDUMU + AgP2 Pl => "i" + d + imp_pl ; -- Intom IDDUMU + AgP3Pl => "i" + imp_pl -- Huma IDUMU + } ; + _ => table { + AgP1 Sg => "in" + imp_sg ; -- Jiena INĦIT + AgP2 Sg => "t" + imp_sg ; -- Inti TĦIT + AgP3Sg Masc => "i" + imp_sg ; -- Huwa IĦIT + AgP3Sg Fem => "t" + imp_sg ; -- Hija TĦIT + AgP1 Pl => "in" + imp_pl ; -- Aħna INĦITU + AgP2 Pl => "t" + imp_pl ; -- Intom TĦITU + AgP3Pl => "i" + imp_pl -- Huma IĦITU + } + } ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + -- Refer: http://blog.johnjcamilleri.com/2012/07/vowel-patterns-maltese-hollow-verb/ + conjHollowImp : Root -> Pattern -> (Number => Str) = \root,p -> + let + sir = case p.V1 + root.C2 of { + "aw" => root.C1 + "u" + root.C3 ; -- DAM, FAR, SAQ (most common case) + "aj" => root.C1 + "i" + root.C3 ; -- ĠAB, SAB, TAR + "iej" => root.C1 + "i" + root.C3 ; -- FIEQ, RIED, ŻIED + "iew" => root.C1 + "u" + root.C3 ; -- MIET + _ => Predef.error("Unhandled case in hollow verb. G390KDJ") + } + in + table { + Sg => sir ; -- Inti: SIR + Pl => sir + "u" -- Intom: SIRU + } ; + + {- ----- Weak-Final Verb ----- -} + + -- Weak-Final verb, eg MEXA (M-X-J) + weakFinalV : Root -> Pattern -> V = \r,p -> + let + imp = conjWeakFinalImp r p ; + in lin V { + s = table { + VPerf agr => ( conjWeakFinalPerf r p ) ! agr ; + VImpf agr => ( conjWeakFinalImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! n + } ; + c = Weak WeakFinal ; + } ; + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjWeakFinalPerf : Root -> Pattern -> (Agr => Str) = \root,p -> + let + mxej : Str = case root.C1 of { + #LiquidCons => "i" + root.C1 + root.C2 + p.V1 + root.C3 ; + _ => root.C1 + root.C2 + p.V1 + root.C3 + } ; + in + table { + --- i tal-leħen needs to be added here! + AgP1 Sg => mxej + "t" ; -- Jiena IMXEJT + AgP2 Sg => mxej + "t" ; -- Inti IMXEJT + AgP3Sg Masc => root.C1 + p.V1 + root.C2 + p.V2 ; -- Huwa MEXA + AgP3Sg Fem => root.C1 + root.C2 + "iet" ; -- Hija IMXIET + AgP1 Pl => mxej + "na" ; -- Aħna IMXEJNA + AgP2 Pl => mxej + "tu" ; -- Intom IMXEJTU + AgP3Pl => root.C1 + root.C2 + "ew" -- Huma IMXEW + } ; + + -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE + -- Params: Imperative Singular (eg IMXI), Imperative Plural (eg IMXU) + conjWeakFinalImpf = conjGenericImpf ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjWeakFinalImp : Root -> Pattern -> (Number => Str) = \root,p -> + table { + Sg => "i" + root.C1 + root.C2 + "i" ; -- Inti: IMXI + Pl => "i" + root.C1 + root.C2 + "u" -- Intom: IMXU + } ; + + {- ----- Defective Verb ----- -} + + -- Defective verb, eg QALA' (Q-L-GĦ) + -- Make a verb by calling generate functions for each tense + -- Params: Root, Pattern + defectiveV : Root -> Pattern -> V = \r,p -> + let + imp = conjDefectiveImp r p ; + in lin V { + s = table { + VPerf agr => ( conjDefectivePerf r p ) ! agr ; + VImpf agr => ( conjDefectiveImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! n + } ; + c = Weak Defective ; + } ; + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjDefectivePerf : Root -> Pattern -> ( Agr => Str ) = \root,p -> + let + qlaj = root.C1 + root.C2 + (case p.V2 of {"e" => "i" ; _ => p.V2 }) + "j" ; + qalgh = root.C1 + p.V1 + root.C2 + root.C3 ; + in + table { + AgP1 Sg => qlaj + "t" ; -- Jiena QLAJT + AgP2 Sg => qlaj + "t" ; -- Inti QLAJT + AgP3Sg Masc => root.C1 + p.V1 + root.C2 + p.V2 + "'" ; -- Huwa QALA' + AgP3Sg Fem => qalgh + (case p.V2 of {"o" => "o" ; _ => "e"}) + "t" ; -- Hija QALGĦET + AgP1 Pl => qlaj + "na" ; -- Aħna QLAJNA + AgP2 Pl => qlaj + "tu" ; -- Intom QLAJTU + AgP3Pl => qalgh + "u" -- Huma QALGĦU + } ; + + -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE + -- Params: Imperative Singular (eg IKTEB), Imperative Plural (eg IKTBU) + conjDefectiveImpf = conjGenericImpf ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjDefectiveImp : Root -> Pattern -> ( Number => Str ) = \root,p -> + let + v1 = case p.V1 of { "e" => "i" ; _ => p.V1 } ; + v_pl : Str = case root.C2 of { #LiquidCons => "i" ; _ => "" } ; -- some verbs require "i" insertion in middle (eg AQILGĦU) + in + table { + Sg => v1 + root.C1 + root.C2 + p.V2 + "'" ; -- Inti: AQLA' / IBŻA' + Pl => v1 + root.C1 + v_pl + root.C2 + root.C3 + "u" -- Intom: AQILGĦU / IBŻGĦU + } ; + + {- ----- Quadriliteral Verb (Strong) ----- -} + + -- Make a Quad verb, eg DENDEL (D-L-D-L) + -- Params: Root, Pattern + quadV : Root -> Pattern -> V = \r,p -> + let + imp = conjQuadImp r p ; + in lin V { + s = table { + VPerf agr => ( conjQuadPerf r p ) ! agr ; + VImpf agr => ( conjQuadImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! n + } ; + c = Strong Quad ; + } ; + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjQuadPerf : Root -> Pattern -> (Agr => Str) = \root,p -> + let + dendil = root.C1 + p.V1 + root.C2 + root.C3 + (case p.V2 of {"e" => "i" ; _ => p.V2 }) + root.C4 ; + dendl = root.C1 + p.V1 + root.C2 + root.C3 + root.C4 ; + in + table { + AgP1 Sg => dendil + "t" ; -- Jiena DENDILT + AgP2 Sg => dendil + "t" ; -- Inti DENDILT + AgP3Sg Masc => root.C1 + p.V1 + root.C2 + root.C3 + p.V2 + root.C4 ; -- Huwa DENDIL + AgP3Sg Fem => dendl + (case p.V2 of {"o" => "o" ; _ => "e"}) + "t" ; -- Hija DENDLET + AgP1 Pl => dendil + "na" ; -- Aħna DENDILNA + AgP2 Pl => dendil + "tu" ; -- Intom DENDILTU + AgP3Pl => dendl + "u" -- Huma DENDLU + } ; + + -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE + -- Params: Imperative Singular (eg DENDEL), Imperative Plural (eg DENDLU) + conjQuadImpf : Str -> Str -> (Agr => Str) = \imp_sg,imp_pl -> + let + prefix_dbl:Str = case imp_sg of { + X@( "d" | "t" ) + _ => "i" + X ; + _ => "t" + } ; + in + table { + AgP1 Sg => "in" + imp_sg ; -- Jiena INDENDEL + AgP2 Sg => prefix_dbl + imp_sg ; -- Inti IDDENDEL + AgP3Sg Masc => "i" + imp_sg ; -- Huwa IDENDEL + AgP3Sg Fem => prefix_dbl + imp_sg ; -- Hija IDDENDEL + AgP1 Pl => "in" + imp_pl ; -- Aħna INDENDLU + AgP2 Pl => prefix_dbl + imp_pl ; -- Intom IDDENDLU + AgP3Pl => "i" + imp_pl -- Huma IDENDLU + } ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjQuadImp : Root -> Pattern -> (Number => Str) = \root,p -> + table { + Sg => root.C1 + p.V1 + root.C2 + root.C3 + p.V2 + root.C4 ; -- Inti: DENDEL + Pl => root.C1 + p.V1 + root.C2 + root.C3 + root.C4 + "u" -- Intom: DENDLU + } ; + + {- ----- Quadriliteral Verb (Weak Final) ----- -} + + -- Make a weak-final Quad verb, eg SERVA (S-R-V-J) + -- Params: Root, Pattern + quadWeakV : Root -> Pattern -> V = \r,p -> + let + imp = conjQuadWeakImp r p ; + in lin V { + s = table { + VPerf agr => ( conjQuadWeakPerf r p ) ! agr ; + VImpf agr => ( conjQuadWeakImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! n + } ; + c = Weak QuadWeakFinal ; + } ; + + -- Conjugate entire verb in PERFECT tense + conjQuadWeakPerf : (Agr => Str) = overload { + + -- Params: Root, Pattern + conjQuadWeakPerf : Root -> Pattern -> (Agr => Str) = \root,p -> + let + --- this is known to fail for KANTA, but that seems like a less common case + serve = root.C1 + p.V1 + root.C2 + root.C3 + "e" ; + in + table { + AgP1 Sg => serve + "jt" ; -- Jiena SERVEJT + AgP2 Sg => serve + "jt" ; -- Inti SERVEJT + AgP3Sg Masc => root.C1 + p.V1 + root.C2 + root.C3 + p.V2 ; -- Huwa SERVA + AgP3Sg Fem => root.C1 + p.V1 + root.C2 + root.C3 + "iet" ; -- Hija SERVIET + AgP1 Pl => serve + "jna" ; -- Aħna SERVEJNA + AgP2 Pl => serve + "jtu" ; -- Intom SERVEJTU + AgP3Pl => serve + "w" -- Huma SERVEW + } ; + + -- This case exists for KANTA, and presumably any other Italian -are verbs. + -- Params: Stem + conjQuadWeakPerf : Str -> (Agr => Str) = \kanta -> + table { + AgP1 Sg => kanta + "jt" ; -- Jiena KANTAJT + AgP2 Sg => kanta + "jt" ; -- Inti KANTAJT + AgP3Sg Masc => kanta ; -- Huwa KANTA + AgP3Sg Fem => kanta + "t" ; -- Hija KANTAT + AgP1 Pl => kanta + "jna" ; -- Aħna KANTAJNA + AgP2 Pl => kanta + "jtu" ; -- Intom KANTAJTU + AgP3Pl => kanta + "w" -- Huma KANTAW + } ; + + } ; + + -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE + -- Params: Imperative Singular (eg SERVI), Imperative Plural (eg SERVU) + conjQuadWeakImpf : Str -> Str -> (Agr => Str) = \imp_sg,imp_pl -> + let + prefix_dbl:Str = case imp_sg of { + X@( "d" | "t" | "s" ) + _ => "i" + X ; + _ => "t" + } ; + in + table { + AgP1 Sg => "in" + imp_sg ; -- Jiena INSERVI + AgP2 Sg => prefix_dbl + imp_sg ; -- Inti ISSERVI + AgP3Sg Masc => "i" + imp_sg ; -- Huwa ISERVI + AgP3Sg Fem => prefix_dbl + imp_sg ; -- Hija ISSERVI + AgP1 Pl => "in" + imp_pl ; -- Aħna INSERVU + AgP2 Pl => prefix_dbl + imp_pl ; -- Intom ISSERVU + AgP3Pl => "i" + imp_pl -- Huma ISERVU + } ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjQuadWeakImp : Root -> Pattern -> (Number => Str) = \root,p -> + table { + --- this is known to fail for KANTA, but that seems like a less common case + Sg => root.C1 + p.V1 + root.C2 + root.C3 + "i" ; -- Inti: SERVI + Pl => root.C1 + p.V1 + root.C2 + root.C3 + "u" -- Intom: SERVU } ; + {- ----- Non-semitic verbs ----- -} + + loanV : V = overload { + + -- Loan verb: Italian integrated -ARE, eg KANTA + -- Follows Maltese weak verb class 2 {MDG pg249,379} + -- Params: mamma + loanV : Str -> V = \kanta -> + let + kantaw = kanta + "w" ; + in lin V { + s = table { + VPerf agr => table { + AgP1 Sg => kanta + "jt" ; -- Jiena KANTAJT + AgP2 Sg => kanta + "jt" ; -- Inti KANTAJT + AgP3Sg Masc => kanta ; -- Huwa KANTA + AgP3Sg Fem => kanta + "t" ; -- Hija KANTAT + AgP1 Pl => kanta + "jna" ; -- Aħna KANTAJNA + AgP2 Pl => kanta + "jtu" ; -- Intom KANTAJTU + AgP3Pl => kanta + "w" -- Huma KANTAW + } ! agr ; + VImpf agr => table { + AgP1 Sg => "n" + kanta ; -- Jiena NKANTA + AgP2 Sg => "t" + kanta ; -- Inti TKANTA + AgP3Sg Masc => "j" + kanta ; -- Huwa JKANTA + AgP3Sg Fem => "t" + kanta ; -- Hija TKANTA + AgP1 Pl => "n" + kantaw ; -- Aħna NKANTAW + AgP2 Pl => "t" + kantaw ; -- Intom TKANTAW + AgP3Pl => "j" + kantaw -- Huma JKANTAW + } ! agr ; + VImp n => table { + Sg => kanta ; -- Inti: KANTA + Pl => kantaw -- Intom: KANTAW + } ! n + } ; + c = Loan ; + } ; + + -- Loan verb: Italian integrated -ERE/-IRE, eg VINĊA + -- Follows Maltese weak verb class 1 {MDG pg249,379} + -- Params: mamma, imperative P2Sg + loanV : Str -> Str -> V = \vinca,vinci -> + let + vinc = tk 1 vinca ; + vincu = vinc + "u" ; + in lin V { + s = table { + VPerf agr => table { + AgP1 Sg => vinc + "ejt" ; -- Jiena VINĊEJT + AgP2 Sg => vinc + "ejt" ; -- Inti VINĊEJT + AgP3Sg Masc => vinca ; -- Huwa VINĊA + AgP3Sg Fem => vinc + "iet" ; -- Hija VINĊIET + AgP1 Pl => vinc + "ejna" ; -- Aħna VINĊEJNA + AgP2 Pl => vinc + "ejtu" ; -- Intom VINĊEJTU + AgP3Pl => vinc + "ew" -- Huma VINĊEJTU + } ! agr ; + VImpf agr => table { + AgP1 Sg => "in" + vinci ; -- Jiena INVINĊI + AgP2 Sg => "t" + vinci ; -- Inti TVINĊI + AgP3Sg Masc => "j" + vinci ; -- Huwa JVINĊI + AgP3Sg Fem => "t" + vinci ; -- Hija TVINĊI + AgP1 Pl => "n" + vincu ; -- Aħna INVINĊU + AgP2 Pl => "t" + vincu ; -- Intom TVINĊU + AgP3Pl => "j" + vincu -- Huma JVINĊU + } ! agr ; + VImp n => table { + Sg => vinci ; -- Inti: VINĊI + Pl => vincu -- Intom: VINĊU + } ! n + } ; + c = Loan ; + } ; + + } ; + + + {- ===== Adjective Paradigms ===== -} + + -- Overloaded function for building an adjective + -- Return: Adjective + mkA : A = overload { + + -- Same form for gender and number; no comparative form. + -- Params: + -- Adjective, eg BLU + mkA : Str -> A = sameA ; + + -- Infer feminine from masculine; no comparative form. + -- Params: + -- Masculine, eg SABIĦ + -- Plural, eg SBIEĦ + mkA : Str -> Str -> A = brokenA ; + + -- Infer feminine from masculine; no comparative form. + -- Params: + -- Masculine, eg SABIĦ + -- Feminine, eg SABIĦA + -- Plural, eg SBIEĦ + mkA : Str -> Str -> Str -> A = mk3A ; + + -- Take all forms. + -- Params: + -- Masculine, eg SABIĦ + -- Feminine, eg SABIĦA + -- Plural, eg SBIEĦ + -- Comparative, eg ISBAĦ + mkA : Str -> Str -> Str -> Str -> A = mk4A ; + + } ; + + -- Regular adjective with predictable feminine and plural forms + regA : Str -> A ; + regA masc = + let + fem = determineAdjFem masc ; + plural = determineAdjPlural fem + in + mk3A masc fem plural ; + + -- Adjective with same forms for masculine, feminine and plural. + sameA : Str -> A ; + sameA a = mk3A a a a ; + + -- Adjective with predictable feminine but broken plural + brokenA = overload { + + -- without comparative form + brokenA : Str -> Str -> A = \masc,plural -> + let + fem = determineAdjFem masc + in + mk3A masc fem plural ; + + -- with comparative form + brokenA : Str -> Str -> Str -> A = \masc,plural,compar -> + let + fem = determineAdjFem masc + in + mk4A masc fem plural compar ; + + } ; + + -- Build an adjective noun using all 3 forms, when it has no comparative form + mk3A : (_,_,_ : Str) -> A ; + mk3A = \masc,fem,plural -> + lin A (mkAdjective masc fem plural []) ** {hasComp = False} ; + + -- Build an adjective noun using all 4 forms (superlative is trivial) + mk4A : (_,_,_,_ : Str) -> A ; + mk4A = \masc,fem,plural,compar -> + lin A (mkAdjective masc fem plural compar) ** {hasComp = True} ; + + -- Determine femininine form of adjective from masculine + determineAdjFem : Str -> Str ; + determineAdjFem masc = case masc of { + _ + "ef" => (tk 2 masc) + "fa" ; -- NIEXEF + _ + "u" => (init masc) + "a" ; -- BRAVU + _ + "i" => masc + "ja" ; -- MIMLI + _ => masc + "a" -- VOJT + } ; + + -- Determine plural form of adjective from feminine + determineAdjPlural : Str -> Str ; + determineAdjPlural fem = case fem of { + _ + ("f"|"j"|"ġ") + "a" => (init fem) + "in" ; -- NIEXFA, MIMLIJA, MAĦMUĠA + _ => (init fem) + "i" -- BRAVA + } ; } diff --git a/lib/src/maltese/ResMlt.gf b/lib/src/maltese/ResMlt.gf index 6c80028d5..de0c2d857 100644 --- a/lib/src/maltese/ResMlt.gf +++ b/lib/src/maltese/ResMlt.gf @@ -6,32 +6,31 @@ --# -path=.:../abstract:../common:../prelude -{- - Verb types summary: - =================== - - Strong verb: none of radicals are semi-vowels eg ĦAREĠ (Ħ-R-Ġ) - - Defective verb: third radical is semivowel GĦ eg QATA' (Q-T-GĦ) - - Weak verb: third radical is semivowel J eg MEXA (M-X-J) - - Hollow verb: long A or IE btw radicals 1 & 3 eg QAL (Q-W-L) or SAB (S-J-B) - - Double/Geminated verb: radicals 2 & 3 identical eg ĦABB (Ħ-B-B) - - Quadriliteral verb: 4 radicals eg QARMEĊ (Q-R-M-Ċ) --} - - -resource ResMlt = PatternsMlt ** open Prelude in { +resource ResMlt = ParamX - [Tense] ** open Prelude, Predef in { flags coding=utf8 ; param - -- Used in the NumeralMlt module + Gender = Masc | Fem ; + + NPCase = Nom | Gen ; + + {- Numerals -} + CardOrd = NCard | NOrd ; - DTail = T1 | T2 | T3 ; -- This is already defined in ParamX... + Num_Number = - NumSg - | NumDual - | NumPl + Num_Sg + | Num_Dl + | Num_Pl ; + + -- oper + -- Num_Number : Type = { n : Number ; isDual : Bool } ; + + param + DForm = Unit -- 0..10 | Teen -- 11-19 @@ -41,32 +40,11 @@ resource ResMlt = PatternsMlt ** open Prelude in { --| Thou -- 1000+ ; Num_Case = - NumNominative - | NumAdjectival ; + NumNominative -- TNEJN, ĦAMSA, TNAX, MIJA + | NumAdjectival ; -- ŻEWĠ, ĦAMES, TNAX-IL, MITT + {- Nouns -} -{- - Note: NNQ = Non-numerically quantifiable - - Nouns can have the following forms: - o Singular - - Singulative (1, >10) - - Collective (NNQ) - o Dual (2) - o Plural - - Determinate (2-10) - - Indeterminate (NNQ) - - Sound - - Broken - - Plural of Plural - - Typical combinations thereof (* marks base form): - - Singulative, no plural! - - Singulative*, Plural - - Singulative* (1), Dual (2), Plural (>2) - - Singulative (1, >10), Collective* (NNQ), Determinate Plural (2-10) - - Singulative, Collective*, Determinate Plural, Indeterminate Plural -> very few nouns have these 4 forms --} Noun_Sg_Type = Singulative -- eg ĦUTA | Collective -- eg ĦUT @@ -81,17 +59,13 @@ resource ResMlt = PatternsMlt ** open Prelude in { | Plural Noun_Pl_Type -- eg ĦUTIET / ĦWIET ; -{- - Noun_PluralType = - Sound -- External (affix), eg FERGĦA -> FERGĦAT - | Broken -- Internal, eg FERGĦA -> FRIEGĦI - | Irregular -- eg MARA -> NISA - | PluralOfPlural -- eg TARF -> TRUF -> TRUFIJIET - | Foreign -- eg KARTI, PRATTIĊI, TELEVIXINS - ; --} + NForm = + NRegular -- WIĊĊ + | NPronSuffix Agr ; -- WIĊĊU - Gender = Masc | Fem ; + {- Other... -} + + GenNum = GSg Gender | GPl ; -- masc/fem/plural, e.g. adjective inflection Animacy = Animate @@ -101,167 +75,194 @@ resource ResMlt = PatternsMlt ** open Prelude in { Definiteness = Definite -- eg IL-KARTA. In this context same as Determinate | Indefinite -- eg KARTA - ; + ; -{- - -- CASE AS DEFINED BY GRAMMATIKA MALTIJA, p132 - -- Noun cases - Case = - Nominative -- referent as subject, eg IT-TARBIJA ... - | Genitive -- referent as possessor, eg ... TAT-TARBIJA - | Accusative -- referent as direct object - | Dative -- referent as indirect object, eg ... LIT-TARBIJA - | Ablative -- referent as instrument, cause, location, source or time, eg ... MINN TARBIJA - | Vocative -- referent being adressed, eg AA TARBIJA (lol) - ; --} -{- - -- CASE AS DEFINED BY ME - -- Noun cases (note my examples include DEFINITE ARTICLE) - -- Commented lines mean that noun iflection is unchanged, not that the case does not occur in Maltese! - Case = --- Absessive -- lack or absence of referent (MINGĦAJR) --- | Ablative -- referent as instrument, cause, location, source or time --- | Absolutive -- subject of intransitive or object of transitive verb (in ergative-absolutive languages) --- | Accusative -- referent as direct object (in nominative-accusative languages) --- | Allative -- motion towards referent (LEJN) --- | Additive -- synonym of Allative (above) - Benefactive -- referent as recipient, eg GĦAT-TARBIJA. cf Dative. --- | Causative -- referent as the cause of a situation (MINĦABBA) - | Comitative -- with, eg MAT-TARBIJA - | Dative -- referent as indirect object, eg LIT-TARBIJA. cf Benefactive. --- | Delative -- motion downward from referent - | Elative -- motion away from referent, eg MIT-TARBIJA - | Equative -- likeness or identity, eg BĦAT-TARBIJA --- | Ergative -- subject of transitive verb (in ergative-absolutive languages) --- | Essive -- temporary state / while / in capacity of (BĦALA) - | Genitive -- referent as possessor, eg TAT-TARBIJA --- | Illative -- motion into / towards referent, eg SAT-TARBIJA. cf Allative. - | Inessive -- within referent, eg ĠOT-TARBIJA, FIT-TARBIJA - | Instrumental -- referent as instrument, eg BIT-TARBIJA. cf Ablative. - | Lative -- motion up to referent, eg SAT-TARBIJA --- | Locative -- location at referent - | Nominative -- referent as subject, eg IT-TARBIJA --- | Partitive -- partial nature of referent --- | Prolative -- motion along / beside referent --- | Superessive -- on / upon (FUQ) --- | Translative -- referent noun or adjective as result of process of change --- | Vocative -- referent being adressed, eg AA TARBIJA (lol) - ; --} -- Person = P1 | P2 | P3 ; -- State = Def | Indef | Const ; -- Mood = Ind | Cnj | Jus ; -- Voice = Act | Pas ; - Origin = - Semitic - | Romance - | English - ; + -- Order = Verbal | Nominal ; - -- Just for my own use - -- Mamma = Per3 Sg Masc ; - - -- Shortcut type - -- GenNum = gn Gender Number2 ; - - - Person_Number = Sg | Pl ; - -- Agreement features Agr = - Per1 Person_Number -- Jiena, Aħna - | Per2 Person_Number -- Inti, Intom - | Per3Sg Gender -- Huwa, Hija - | Per3Pl -- Huma + AgP1 Number -- Jiena, Aħna + | AgP2 Number -- Inti, Intom + | AgP3Sg Gender -- Huwa, Hija + | AgP3Pl -- Huma ; + -- Agr : Type = {g : Gender ; n : Number ; p : Person} ; + -- Ag : Gender -> Number -> Person -> Agr = \g,n,p -> {g = g ; n = n ; p = p} ; + -- agrP1 : Number -> Agr = \n -> Ag {} n P1 ; + -- agrP3 : Gender -> Number -> Agr = \g,n -> Ag g n P3 ; + -- Possible tenses - Tense = - Perf -- Perfect tense, eg SERAQ - | Impf -- Imperfect tense, eg JISRAQ - | Imp -- Imperative, eg ISRAQ + -- Tense = + -- Perf -- Perfect tense, eg SERAQ + -- | Impf -- Imperfect tense, eg JISRAQ + -- | Imp -- Imperative, eg ISRAQ -- | PresPart -- Present Particible. Intransitive and 'motion' verbs only, eg NIEŻEL -- | PastPart -- Past Particible. Both verbal & adjectival function, eg MISRUQ -- | VerbalNoun -- Verbal Noun, eg SERQ - ; + -- ; -- Possible verb forms (tense + person) VForm = VPerf Agr -- Perfect tense in all pronoun cases | VImpf Agr -- Imperfect tense in all pronoun cases - | VImp Person_Number -- Imperative is always Per2, Sg & Pl + | VImp Number -- Imperative is always P2, Sg & Pl -- | VPresPart GenNum -- Present Particible for Gender/Number -- | VPastPart GenNum -- Past Particible for Gender/Number -- | VVerbalNoun -- Verbal Noun ; - -- Possible verb types - VType = - Strong -- Strong verb: none of radicals are semi-vowels eg ĦAREĠ (Ħ-R-Ġ) - | Defective -- Defective verb: third radical is semivowel GĦ eg QATA' (Q-T-GĦ) - | Weak -- Weak verb: third radicl is semivowel J eg MEXA (M-X-J) - | Hollow -- Hollow verb: long A or IE btw radicals 1 & 3 eg QAL (Q-W-L) or SAB (S-J-B) - | Double -- Double/Geminated verb: radicals 2 & 3 identical eg ĦABB (Ħ-B-B) - | Quad -- Quadliteral verb eg KARKAR (K-R-K-R), MAQDAR (M-Q-D-R), LEMBEB (L-M-B-B) + VDerivedForm = + FormI + | FormII + | FormIII + | FormIV + | FormV + | FormVI + | FormVII + | FormVIII + | FormXI + | FormX + ; + + -- Verb classification + VClass = + Strong VStrongClass + | Weak VWeakClass + | Loan --- temporary + -- | Romance + -- | English + ; + + VStrongClass = + Regular + | LiquidMedial + | Reduplicative + | Quad + ; + + VWeakClass = + Assimilative + | Hollow + | WeakFinal + | Defective + | QuadWeakFinal + ; + + -- VQuadClass = + -- BiradicalBase + -- | RepeatedC3 + -- | RepeatedC1 + -- | AdditionalC4 + -- ; + + VRomanceClass = + Integrated + | NonIntegrated + ; + + -- Inflection of verbs for pronominal suffixes + VSuffixForm = + VNone -- eg FTAĦT + | VDir Agr -- eg FTAĦTU + | VInd Agr -- eg FTAĦTLU + | VDirInd Agr Agr -- eg FTAĦTHULU + ; + + -- For Adjectives + AForm = +-- AF Degree GenNum + APosit GenNum + | ACompar + | ASuperl ; oper -- Roots & Patterns - Pattern : Type = {v1, v2 : Str} ; -- vowel1, vowel2 + Pattern : Type = {V1, V2 : Str} ; -- Root3 : Type = {K, T, B : Str} ; -- Root4 : Type = Root3 ** {L : Str} ; - Root : Type = {K, T, B, L : Str} ; + Root : Type = {C1, C2, C3, C4 : Str} ; - -- Some classes. I need to include "c" because currently "ċ" gets downgraded to "c" in input :/ - Consonant : pattern Str = #( "b" | "c" | "ċ" | "d" | "f" | "ġ" | "g" | "għ" | "ħ" | "h" | "j" | "k" | "l" | "m" | "n" | "p" | "q" | "r" | "s" | "t" | "v" | "w" | "x" | "ż" | "z" ); - CoronalConsonant : pattern Str = #( "c" | "ċ" | "d" | "n" | "r" | "s" | "t" | "x" | "ż" | "z" ); -- "konsonanti xemxin" + mkRoot : Root = overload { + mkRoot : Root = + { C1=[] ; C2=[] ; C3=[] ; C4=[] } ; + mkRoot : Str -> Root = \root -> + let root = toLower root in + case (charAt 1 root) of { + "-" => { C1=(charAt 0 root) ; C2=(charAt 2 root) ; C3=(charAt 4 root) ; C4=(charAt 6 root) } ; -- "k-t-b" + _ => { C1=(charAt 0 root) ; C2=(charAt 1 root) ; C3=(charAt 2 root) ; C4=(charAt 3 root) } -- "ktb" + } ; + mkRoot : Str -> Str -> Str -> Root = \c1,c2,c3 -> + { C1=c1 ; C2=c2 ; C3=c3 ; C4=[] } ; + mkRoot : Str -> Str -> Str -> Str -> Root = \c1,c2,c3,c4 -> + { C1=c1 ; C2=c2 ; C3=c3 ; C4=c4 } ; + } ; + + mkPattern : Pattern = overload { + mkPattern : Pattern = + { V1=[] ; V2=[] } ; + mkPattern : Str -> Pattern = \v1 -> + { V1=v1 ; V2=[] } ; + mkPattern : Str -> Str -> Pattern = \v1,v2 -> + { V1=v1 ; V2=v2 } ; + } ; + + -- Some character classes + Consonant : pattern Str = #( "b" | "ċ" | "d" | "f" | "ġ" | "g" | "għ" | "ħ" | "h" | "j" | "k" | "l" | "m" | "n" | "p" | "q" | "r" | "s" | "t" | "v" | "w" | "x" | "ż" | "z" ); + CoronalCons : pattern Str = #( "ċ" | "d" | "n" | "r" | "s" | "t" | "x" | "ż" | "z" ); -- "konsonanti xemxin" + ImpfDoublingCons : pattern Str = #( "d" | "ġ" | "s" | "t" | "ż" ); -- require doubling in imperfect, eg (inti) IDDUM, IĠĠOR, ISSIB, ITTIR, IŻŻID. --- only used in hollow paradigm (?) LiquidCons : pattern Str = #( "l" | "m" | "n" | "r" | "għ" ); + WeakCons : pattern Str = #( "j" | "w" ); Vowel : pattern Str = #( "a" | "e" | "i" | "o" | "u" ); Digraph : pattern Str = #( "ie" ); SemiVowel : pattern Str = #( "għ" | "j" ); {- ===== Type declarations ===== -} - -- VP = { - -- v : Verb ; - -- clit : Str ; - -- clitAgr : ClitAgr ; - -- obj : Agr => Str - -- } ; - - -- NP = { - -- s : Case => {clit,obj : Str ; isClit : Bool} ; - -- a : Agr - -- } ; - -{- Noun : Type = { - s : Number5 => Str ; - g : Gender ; - } ; --} - Noun : Type = { - s : Noun_Number => Str ; + s : Noun_Number => NForm => Str ; g : Gender ; +-- anim : Animacy ; -- is the noun animate? e.g. TABIB } ; - Adj : Type = { - s : Gender => Person_Number => Str ; - -- isPre : Bool ; + ProperNoun : Type = { + s : Str ; + g : Gender ; } ; Verb : Type = { - s : VForm => Str ; -- Give me the form (tense, person etc) and I'll give you the string - t : VType ; -- Inherent - Strong/Hollow etc - o : Origin ; -- Inherent - a verb of Semitic or Romance origins? + s : VForm => Str ; +-- s : VForm => VSuffixForm => Str ; + c : VClass ; } ; + Adjective : Type = { + s : AForm => Str ; + } ; + + {- ===== Conversions ===== -} + + numnum2nounnum : Num_Number -> Noun_Number = \n -> + case n of { + Num_Sg => Singular Singulative ; + _ => Plural Determinate + } ; + {- ===== Useful helper functions ===== -} + -- Get the character at the specific index (0-based). + -- Negative indexes behave as 0 (first character). Out of range indexes return the empty string. + charAt : Int -> Str -> Str ; + charAt i s = take 1 (drop i s) ; + addDefinitePreposition : Str -> Str -> Str = \prep,n -> (getDefinitePreposition prep n) ++ n ; addDefiniteArticle = addDefinitePreposition "il" ; getDefiniteArticle = getDefinitePreposition "il" ; @@ -288,12 +289,14 @@ resource ResMlt = PatternsMlt ** open Prelude in { "il" => "l" + "-" ; _ => prep + "-" }; - K@#CoronalConsonant + _ => prepStem + K + "-" ; -- IĊ-ĊISK + K@#CoronalCons + _ => prepStem + K + "-" ; -- IĊ-ĊISK #Consonant + _ => prep + "-" ; -- IL-QADDIS _ => [] -- ? } ; - definiteArticle : Str = + artIndef = [] ; + + artDef : Str = pre { "il-" ; "l-" / strs { "a" ; "e" ; "i" ; "o" ; "u" ; "h" ; "għ" } ; @@ -308,4 +311,113 @@ resource ResMlt = PatternsMlt ** open Prelude in { "iz-" / strs { "z" } } ; + {- ===== Worst-case functions ===== -} + + -- Noun: Takes all forms and a gender + -- Params: + -- Singulative, eg KOXXA + -- Collective, eg KOXXOX + -- Double, eg KOXXTEJN + -- Determinate Plural, eg KOXXIET + -- Indeterminate Plural + -- Gender +-- mkNoun : (_,_,_,_,_ : NForm => Str) -> Gender -> Noun = \sing,coll,dual,det,ind,gen -> { +-- s = table { +-- Singular Singulative => sing ; +-- Singular Collective => coll ; +-- Dual => dual ; +-- Plural Determinate => det ; +-- Plural Indeterminate => ind +-- } ; +-- g = gen ; +-- -- anim = Inanimate ; +-- } ; + + -- Make a noun animate + animateNoun : Noun -> Noun ; + animateNoun = \n -> n ** {anim = Animate} ; + + -- Build an empty pronominal suffix table + nullSuffixTable : Str -> (NForm => Str) ; + nullSuffixTable = \s -> table { + NRegular => s ; + NPronSuffix _ => [] + } ; + + -- Build a noun's pronominal suffix table + mkSuffixTable : (NForm => Str) = overload { + + mkSuffixTable : (_ : Str) -> (NForm => Str) = \wicc -> + table { + NRegular => wicc ; + NPronSuffix (AgP1 Sg) => wicc + "i" ; + NPronSuffix (AgP2 Sg) => wicc + "ek" ; + NPronSuffix (AgP3Sg Masc) => wicc + "u" ; + NPronSuffix (AgP3Sg Fem) => wicc + "ha" ; + NPronSuffix (AgP1 Pl) => wicc + "na" ; + NPronSuffix (AgP2 Pl) => wicc + "kom" ; + NPronSuffix (AgP3Pl) => wicc + "hom" + } ; + + mkSuffixTable : (_,_,_,_,_,_,_,_ : Str) -> (NForm => Str) = \isem,ismi,ismek,ismu,isimha,isimna,isimkom,isimhom -> + table { + NRegular => isem ; + NPronSuffix (AgP1 Sg) => ismi ; + NPronSuffix (AgP2 Sg) => ismek ; + NPronSuffix (AgP3Sg Masc) => ismu ; + NPronSuffix (AgP3Sg Fem) => isimha ; + NPronSuffix (AgP1 Pl) => isimna ; + NPronSuffix (AgP2 Pl) => isimkom ; + NPronSuffix (AgP3Pl) => isimhom + } ; + + } ; + + -- mkNoun = overload { + + -- mkNoun : (_,_,_,_,_ : Str) -> Gender -> Noun = \sing,coll,dual,det,ind,gen -> { + -- s = table { + -- Singular Singulative => (nullSuffixTable sing) ; + -- Singular Collective => (nullSuffixTable coll) ; + -- Dual => (nullSuffixTable dual) ; + -- Plural Determinate => (nullSuffixTable det) ; + -- Plural Indeterminate => (nullSuffixTable ind) + -- } ; + -- g = gen ; + -- -- anim = Inanimate ; + -- } ; + + mkNoun : (_,_,_,_,_ : NForm => Str) -> Gender -> Noun = \sing,coll,dual,det,ind,gen -> { + s = table { + Singular Singulative => sing ; + Singular Collective => coll ; + Dual => dual ; + Plural Determinate => det ; + Plural Indeterminate => ind + } ; + g = gen ; + -- anim = Inanimate ; + } ; + + -- } ; + + -- Adjective: Takes all forms (except superlative) + -- Params: + -- Masculine, eg SABIĦ + -- Feminine, eg SABIĦA + -- Plural, eg SBIEĦ + -- Comparative, eg ISBAĦ + mkAdjective : (_,_,_,_ : Str) -> Adjective = \masc,fem,plural,compar -> { + s = table { + APosit gn => case gn of { + GSg Masc => masc ; + GSg Fem => fem ; + GPl => plural + } ; + ACompar => compar ; + ASuperl => addDefiniteArticle compar + } ; + } ; + } + diff --git a/lib/src/maltese/StructuralMlt.gf b/lib/src/maltese/StructuralMlt.gf index f367f2283..65eea68e8 100644 --- a/lib/src/maltese/StructuralMlt.gf +++ b/lib/src/maltese/StructuralMlt.gf @@ -7,6 +7,10 @@ concrete StructuralMlt of Structural = CatMlt ** open MorphoMlt, ResMlt, ParadigmsMlt, Prelude in { - flags optimize=all ; coding=utf8 ; + flags + optimize=all ; + coding=utf8 ; + + lin language_title_Utt = ss "Malti" ; }