From c084e1b0400f937575a447fc7d72b44685137082 Mon Sep 17 00:00:00 2001 From: "john.j.camilleri" Date: Tue, 23 Oct 2012 09:41:00 +0000 Subject: [PATCH] Maltese: finished morphology for derived verbs Of course it's never really finished. There's more cases I should write treebanks for and test, but I think the coverage is good enough and the implementation for the verbs is solid enough that only minor fixes may arise. There's also the issue of verb participles, but I'll come back to those when I am looked more closely at the syntax. --- lib/src/maltese/AdjectiveMlt.gf | 1 + lib/src/maltese/IrregMlt.gf | 17 +- lib/src/maltese/LexiconMlt.gf | 4 +- lib/src/maltese/MorphoMlt.gf | 1754 ++++++++++++++++++++++++++++++- lib/src/maltese/ParadigmsMlt.gf | 1420 +++++++++++++------------ lib/src/maltese/ResMlt.gf | 380 ++++--- 6 files changed, 2777 insertions(+), 799 deletions(-) diff --git a/lib/src/maltese/AdjectiveMlt.gf b/lib/src/maltese/AdjectiveMlt.gf index ea7d4145c..12df75a4a 100644 --- a/lib/src/maltese/AdjectiveMlt.gf +++ b/lib/src/maltese/AdjectiveMlt.gf @@ -5,6 +5,7 @@ -- Licensed under LGPL concrete AdjectiveMlt of Adjective = CatMlt ** open ResMlt, Prelude in { + flags coding=utf8 ; lin diff --git a/lib/src/maltese/IrregMlt.gf b/lib/src/maltese/IrregMlt.gf index 587a63e8c..7132a98e6 100644 --- a/lib/src/maltese/IrregMlt.gf +++ b/lib/src/maltese/IrregMlt.gf @@ -8,6 +8,21 @@ concrete IrregMlt of IrregMltAbs = CatMlt ** open ParadigmsMlt in { - +{- + Known irregular verbs in Maltese: + - ĦA + - TA + - RA + - MAR + - ĠIE + - QAL + - KIEL + - KELLU + - IDDA + - EMMEN + - IŻŻA + - JAF + - KIEN +-} } diff --git a/lib/src/maltese/LexiconMlt.gf b/lib/src/maltese/LexiconMlt.gf index 5deef72ff..d204bd5eb 100644 --- a/lib/src/maltese/LexiconMlt.gf +++ b/lib/src/maltese/LexiconMlt.gf @@ -317,7 +317,7 @@ concrete LexiconMlt of Lexicon = CatMlt ** 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" ; + thin_A = brokenA "rqiq" "rqaq" "rqaq" ; -- think_V -- throw_V2 -- tie_V2 @@ -341,7 +341,7 @@ concrete LexiconMlt of Lexicon = CatMlt ** -- wash_V2 -- watch_V2 water_N = mkN "ilma" "ilmijiet" masculine ; - wet_A = mkA "imxarrab" "imxarrba" "imxarrbin" ; + wet_A = mkA "mxarrab" "mxarrba" "mxarrbin" ; white_A = mkA "abjad" "bajda" "bojod" ; wide_A = broad_A ; wife_N = mkN "mara" "nisa" ; -- pronSuffix MARTI diff --git a/lib/src/maltese/MorphoMlt.gf b/lib/src/maltese/MorphoMlt.gf index 530aaa5b7..423fd137d 100644 --- a/lib/src/maltese/MorphoMlt.gf +++ b/lib/src/maltese/MorphoMlt.gf @@ -1,10 +1,1760 @@ --- MorphoMlt.gf: morphology +-- MorphoMlt.gf: scary morphology operations which need their own elbow space -- -- Maltese Resource Grammar Library -- John J. Camilleri, 2012 -- Licensed under LGPL resource MorphoMlt = ResMlt ** open Prelude in { - flags optimize=all ; coding=utf8 ; + + flags optimize=noexpand ; coding=utf8 ; + + oper + + -- Build polarity table for verbs + verbPolarityTable : VerbInfo -> (VForm => VSuffixForm => Str) -> (VForm => VSuffixForm => Polarity => Str) = \info,tbl -> + \\vf,sfxf => --- maybe the VForm needs to be used in the cases below + let + s = tbl ! vf ! sfxf ; + -- First some pre-processing of stem + s2 : Str = case of { + <{form=FormIII}, (w@#C)+"ie"+(g@#C)+"e"+(b)> => w+(info.patt2.V1)+g+(info.patt2.V2)+b ; -- WIEĠEB > WIĠIB- + <{form=FormIII}, (n@#C)+(w@#C)+"ie"+(g@#C)+"e"+(b)> => n+w+(info.patt2.V1)+g+(info.patt2.V2)+b ; -- NWIEĠEB > NWIĠIB- + <{form=FormIII}, (q@#C)+"ie"+(ghdek)> => q+(info.patt2.V1)+ghdek ; -- QIEGĦDEK > QEGĦDEK- + <{form=FormIII}, (n@#C)+(q@#C)+"ie"+(ghdek)> => n+q+(info.patt2.V1)+ghdek ; -- NQIEGĦDEK > NQEGĦDEK- + _ => s + } ; + in table { + Pos => s ; + Neg => + case of { + <_, ""> => [] ; + + -- Standard Fem DO + IO endings + <_, x+"hieli"> => x+"hilix" ; + <_, x+"hielek"> => x+"hilekx" ; + <_, x+"hielu"> => x+"hilux" ; + <_, x+"hielha"> => x+"hilhiex" ; + <_, x+"hielna"> => x+"hilniex" ; + <_, x+"hielkom"> => x+"hilkomx" ; + <_, x+"hielhom"> => x+"hilhomx" ; + + <_, _+"xx"> => s2 ; -- BEXX > BEXX + <_, aqta+"'"> => aqta+"x" ; -- AQTA' > AQTAX + + <_, z+"ie"+d+"et"> => z+"i"+d+"itx" ; -- ŻIEDET > ŻIDITX + + <_, ftahth+"ie"+lh+"a"> => ftahth+"i"+lh+"iex" ; -- FTAĦTHIELHA > FTAĦTHILHIEX + <_, ftahtuh+"ie"+li> => case isMonoSyl s2 of { + True => s2 + "x" ; -- MIET > MIETX + _ => ftahtuh+"i"+li+"x" -- FTAĦTUHIELI > FTAĦTUHILIX + } ; + + <_, ktibtl+"ek"> => ktibtl+"ekx" ; -- KTIBTLEK > KTIBTLEKXb + <_, xamm+"ew"> => xamm+"ewx" ; -- XAMMEW > XAMMEWX + + <_, x + "a"> => case of { + <_ + "a", VPerf (AgP3Sg Masc), VSuffixNone> => x + "ax" ; -- KANTA > KANTAX + <_ + "a", VImpf _, VSuffixNone> => x + "ax" ; -- KANTA > KANTAX + <_ + "a", VImp _, VSuffixNone> => x + "ax" ; -- KANTA > KANTAX + _ => x + "iex" -- FTAĦNA > FTAĦNIEX + } ; + <_, ki+t@#C+"e"+b@#C> => ki+t+"i"+b+"x" ; -- KITEB > KITIBX + _ => s2 + "x" -- KTIBT > KTIBTX + } + } ; + + -- Build table of pronominal suffixes for verbs + verbPronSuffixTable : VerbInfo -> (VForm => Str) -> (VForm => VSuffixForm => Str) = \info,tbl -> + table { + VPerf agr => verbPerfPronSuffixTable info ( \\a => tbl ! VPerf a ) ! agr ; + VImpf agr => verbImpfPronSuffixTable info ( \\a => tbl ! VImpf a ) ! agr ; + VImp num => verbImpPronSuffixTable info ( \\n => tbl ! VImp n ) ! num + } ; + + -- Build table of pronominal suffixes: Perfective tense + -- Params: verb info, imperative table, perfective table + verbPerfPronSuffixTable : VerbInfo -> (Agr => Str) -> (Agr => VSuffixForm => Str) = \info,tbl -> + table { + AgP1 Sg => -- Jiena FTAĦT + let + ftaht = tbl ! AgP1 Sg ; + in + table { + VSuffixNone => ftaht ; + VSuffixDir agr => + case agr of { + AgP1 Sg => [] ; + AgP2 Sg => ftaht + "ek" ; -- Jiena FTAĦTEK + AgP3Sg Masc=> ftaht + "u" ; -- Jiena FTAĦTU + AgP3Sg Fem => ftaht + "ha" ; -- Jiena FTAĦTHA + AgP1 Pl => [] ; + AgP2 Pl => ftaht + "kom" ; -- Jiena FTAĦTKOM + AgP3Pl => ftaht + "hom" -- Jiena FTAĦTHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => [] ; + AgP2 Sg => ftaht + "lek" ; -- Jiena FTAĦTLEK + AgP3Sg Masc=> ftaht + "lu" ; -- Jiena FTAĦTLU + AgP3Sg Fem => ftaht + "ilha" ; -- Jiena FTAĦTILHA + AgP1 Pl => [] ; + AgP2 Pl => ftaht + "ilkom" ; -- Jiena FTAĦTILKOM + AgP3Pl => ftaht + "ilhom" -- Jiena FTAĦTILHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP1 Sg) do ftaht) ! agr + } ; + AgP2 Sg => -- Inti FTAĦT + let + ftaht = tbl ! AgP2 Sg ; + in + table { + VSuffixNone => ftaht ; + VSuffixDir agr => + case agr of { + AgP1 Sg => ftaht + "ni" ; -- Inti FTAĦTNI + AgP2 Sg => [] ; + AgP3Sg Masc=> ftaht + "u" ; -- Inti FTAĦTU + AgP3Sg Fem => ftaht + "ha" ; -- Inti FTAĦTHA + AgP1 Pl => ftaht + "na" ; -- Inti FTAĦTNA + AgP2 Pl => [] ; + AgP3Pl => ftaht + "hom" -- Inti FTAĦTHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => ftaht + "li" ; -- Inti FTAĦTLI + AgP2 Sg => [] ; + AgP3Sg Masc=> ftaht + "lu" ; -- Inti FTAĦTLU + AgP3Sg Fem => ftaht + "ilha" ; -- Inti FTAĦTILHA + AgP1 Pl => ftaht + "ilna" ; -- Inti FTAĦTILNA + AgP2 Pl => [] ; + AgP3Pl => ftaht + "ilhom" -- Inti FTAĦTILHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP2 Sg) do ftaht) ! agr + } ; + AgP3Sg Masc => -- Huwa FETAĦ + let + mamma = tbl ! AgP3Sg Masc ; + fetah : Str = case of { + <_, x + "'"> => x + "għ" ; -- QATA' > QATAGĦ + <{imp = _ + "a"}, _> => mamma ; -- KANTA > KANTA (i.e. Italian -are) + <_, serv + "a"> => serv + "ie" ; -- SERVA > SERVIE (i.e. Italian -ere/-ire) + <{form = FormIII}, w@#Consonant + "ie" + geb> => w + (info.patt2.V1) + info.root.C2 + "i" + info.root.C3 ; -- WIEĠEB > WIĠIB + <_, x + y@#Consonant + "e" + z@#Consonant> => x + y + "i" + z ; -- KITEB > KITIB + _ => mamma -- FETAĦ + } ; + -- fetah : Str = case (tbl ! AgP3Sg Masc) of { + -- x + "'" => x + "għ" ; -- QATA' > QATAGĦ + -- x + "a" => x + "ie" ; -- SERVA > SERVIE + -- x + "e" + y@#Consonant => x + "i" + y ; -- KITEB > KITIB + -- x => x -- FETAĦ + -- } ; + feth : Str = case of { + => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C2 ; -- BEXX + => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 ; -- QAJM + => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C2 ; -- NEĦĦ + => pfx_T info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 + info.root.C4 ; -- TĦARBT + => pfx_T info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 ; -- SSERV + => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C2 + info.root.C3 ; -- ĦABB + => mamma ; -- info.root.C1 + info.root.C2 + info.patt.V1 + info.root.C3 ; -- ĦDAR + => case info.imp of { + staghg + e@#V + b@#C => staghg + b ; -- STAGĦĠB, STĦARRĠ + _ => info.imp -- STQARR + } ; + -- => "st" + info.patt.V1 + info.root.C1 + info.root.C2 + info.root.C3 ; -- STAGĦĠB + <_, Weak Hollow> => info.root.C1 + info.patt.V1 + info.root.C3 ; -- SAB + <_, Weak Lacking> => info.root.C1 + info.patt.V1 + info.root.C2 ; -- MEX + <_, Quad QStrong> => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 + info.root.C4 ; + <_, Loan> => dropSfx 1 mamma ; -- ŻVILUPP + _ => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 + } ; + p2sg_dir_ek : Str = case of { + <_ + "a", _> => "ak" ; -- Huwa KANTAK + <_, _ + "a"> => "iek" ; -- Huwa SERVIEK + _ => "ek" -- Huwa FETĦEK + } ; + p3sg_dir_u : Str = case of { + <_ + "a", _> => "ah" ; -- Huwa KANTAH + <_, _ + "a"> => "ieh" ; -- Huwa SERVIEH + _ => "u" -- Huwa FETĦU + } ; + in + table { + VSuffixNone => tbl ! AgP3Sg Masc ; + VSuffixDir agr => + case agr of { + AgP1 Sg => sfx fetah "ni" ; -- Huwa FETAĦNI (n.b. KENN+NI) + AgP2 Sg => feth + p2sg_dir_ek ; + AgP3Sg Masc=> feth + p3sg_dir_u ; + AgP3Sg Fem => fetah + "ha" ; -- Huwa FETAĦHA + AgP1 Pl => sfx fetah "na" ; -- Huwa FETAĦNA (n.b. KENN+NA) + AgP2 Pl => sfx fetah "kom" ; -- Huwa FETAĦKOM (n.b. ĦAKK+KOM) + AgP3Pl => fetah + "hom" -- Huwa FETAĦHOM + } ; + VSuffixInd agr => + let + fethi : Str = case info.imp of { + _ + "a'" => feth + "a" ; -- QATTA' > QATTGĦALNA --- very specific + _ + "a" => feth + "a" ; -- KANTA- + _ + "i" => feth + "ie" ; -- SERVIE- + _ => (ie2_ info.patt2.V1 feth) + "i" + } ; + in + case agr of { + AgP1 Sg => sfx fetah "li" ; -- Huwa FETAĦLI (n.b. ĦALL+LI) + AgP2 Sg => sfx fetah "lek" ; -- Huwa FETAĦLEK (n.b. ĦALL+LEK) + AgP3Sg Masc=> sfx fetah "lu" ; -- Huwa FETAĦLU (n.b. ĦALL+LU) + AgP3Sg Fem => fethi + "lha" ; -- Huwa FETĦILHA + AgP1 Pl => fethi + "lna" ; -- Huwa FETĦILNA + AgP2 Pl => fethi + "lkom" ; -- Huwa FETĦILKOM + AgP3Pl => fethi + "lhom" -- Huwa FETĦILHOM + } ; + VSuffixDirInd do agr => case info.imp of { + _ + "i" => (verbDirIndSuffixTable (AgP3Sg Masc) do (feth+"i")) ! agr ; -- SERVI- + _ => (verbDirIndSuffixTable (AgP3Sg Masc) do (ie2i fetah)) ! agr + } + } ; + AgP3Sg Fem => -- Hija FETĦET + let + fethet = tbl ! AgP3Sg Fem ; + fethit : Str = case fethet of { + q@#C+ "ie" + #C + #C + _ => q+(info.patt2.V1)+info.root.C2+info.root.C3+"it" ; -- WIEĠBET > WIĠBIT + _ + "għet" => (dropSfx 2 fethet) + "at" ; -- QATTGĦET > QATTGĦATNI... --- very specific + _ + "iet" => fethet ; -- SERVIET + feth + "et" => (ie2i feth) + "it" ; + _ => fethet -- QRAT, ŻVILUPPAT... + } ; + in + table { + VSuffixNone => tbl ! AgP3Sg Fem ; + VSuffixDir agr => + case agr of { + AgP1 Sg => fethit + "ni" ; -- Hija FETĦITNI + AgP2 Sg => fethit + "ek" ; -- Hija FETĦITEK + AgP3Sg Masc=> fethit + "u" ; -- Hija FETĦITU + AgP3Sg Fem => fethit + "ha" ; -- Hija FETĦITHA + AgP1 Pl => fethit + "na" ; -- Hija FETĦITNA + AgP2 Pl => fethit + "kom" ; -- Hija FETĦITKOM + AgP3Pl => fethit + "hom" -- Hija FETĦITHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => fethit + "li" ; -- Hija FETĦITLI + AgP2 Sg => fethit + "lek" ; -- Hija FETĦITLEK + AgP3Sg Masc=> fethit + "lu" ; -- Hija FETĦITLU + AgP3Sg Fem => (ie2i fethit) + "ilha" ; -- Hija FETĦITILHA + AgP1 Pl => (ie2i fethit) + "ilna" ; -- Hija FETĦITILNA + AgP2 Pl => (ie2i fethit) + "ilkom" ; -- Hija FETĦITILKOM + AgP3Pl => (ie2i fethit) + "ilhom" -- Hija FETĦITILHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP3Sg Fem) do (ie2i fethit)) ! agr + } ; + AgP1 Pl => -- Aħna FTAĦNA + let + ftahna = tbl ! AgP1 Pl ; + ftahn = dropSfx 1 ftahna ; + in + table { + VSuffixNone => ftahna ; + VSuffixDir agr => + case agr of { + AgP1 Sg => [] ; + AgP2 Sg => ftahn + "iek" ; -- Aħna FTAĦNIEK + AgP3Sg Masc=> ftahn + "ieh" ; -- Aħna FTAĦNIEH + AgP3Sg Fem => ftahn + "ieha" ; -- Aħna FTAĦNIEHA + AgP1 Pl => [] ; + AgP2 Pl => ftahn + "iekom" ; -- Aħna FTAĦNIEKOM + AgP3Pl => ftahn + "iehom" -- Aħna FTAĦNIEHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => [] ; + AgP2 Sg => ftahn + "ielek" ; -- Aħna FTAĦNIELEK + AgP3Sg Masc=> ftahn + "ielu" ; -- Aħna FTAĦNIELU + AgP3Sg Fem => ftahn + "ielha" ; -- Aħna FTAĦNIELHA + AgP1 Pl => [] ; + AgP2 Pl => ftahn + "ielkom" ; -- Aħna FTAĦNIELKOM + AgP3Pl => ftahn + "ielhom" -- Aħna FTAĦNIELHOM + } ; + VSuffixDirInd (GSg Masc) agr => (verbDirIndSuffixTable (AgP1 Pl) (GSg Masc) (ftahn+"i")) ! agr ; + VSuffixDirInd (GSg Fem) agr => (verbDirIndSuffixTable (AgP1 Pl) (GSg Fem) (ftahn+"i")) ! agr ; + VSuffixDirInd (GPl) agr => (verbDirIndSuffixTable (AgP1 Pl) (GPl) (ftahn+"i")) ! agr + } ; + AgP2 Pl => -- Intom FTAĦTU + let + ftahtu = tbl ! AgP2 Pl ; + in + table { + VSuffixNone => ftahtu ; + VSuffixDir agr => + case agr of { + AgP1 Sg => ftahtu + "ni" ; -- Intom FTAĦTUNI + AgP2 Sg => [] ; + AgP3Sg Masc=> ftahtu + "h" ; -- Intom FTAĦTUH + AgP3Sg Fem => ftahtu + "ha" ; -- Intom FTAĦTUHA + AgP1 Pl => ftahtu + "na" ; -- Intom FTAĦTUNA + AgP2 Pl => [] ; + AgP3Pl => ftahtu + "hom" -- Intom FTAĦTUHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => ftahtu + "li" ; -- Intom FTAĦTULI + AgP2 Sg => [] ; + AgP3Sg Masc=> ftahtu + "lu" ; -- Intom FTAĦTULU + AgP3Sg Fem => ftahtu + "lha" ; -- Intom FTAĦTULHA + AgP1 Pl => ftahtu + "lna" ; -- Intom FTAĦTULNA + AgP2 Pl => [] ; + AgP3Pl => ftahtu + "lhom" -- Intom FTAĦTULHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP2 Pl) do ftahtu) ! agr + } ; + AgP3Pl => -- Huma FETĦU + let + fethu = ie2_ (info.patt2.V1) (tbl ! AgP3Pl) ; + in + table { + VSuffixNone => tbl ! AgP3Pl ; + VSuffixDir agr => + case agr of { + AgP1 Sg => fethu + "ni" ; -- Huma FETĦUNI + AgP2 Sg => fethu + "k" ; -- Huma FETĦUK + AgP3Sg Masc=> fethu + "h" ; -- Huma FETĦUH + AgP3Sg Fem => fethu + "ha" ; -- Huma FETĦUHA + AgP1 Pl => fethu + "na" ; -- Huma FETĦUNA + AgP2 Pl => fethu + "kom" ; -- Huma FETĦUKOM + AgP3Pl => fethu + "hom" -- Huma FETĦUHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => fethu + "li" ; -- Huma FETĦULI + AgP2 Sg => fethu + "lek" ; -- Huma FETĦULEK + AgP3Sg Masc=> fethu + "lu" ; -- Huma FETĦULU + AgP3Sg Fem => fethu + "lha" ; -- Huma FETĦULHA + AgP1 Pl => fethu + "lna" ; -- Huma FETĦULNA + AgP2 Pl => fethu + "lkom" ; -- Huma FETĦULKOM + AgP3Pl => fethu + "lhom" -- Huma FETĦULHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP3Pl) do fethu) ! agr + } + } ; -- end of verbPerfPronSuffixTable + +-- ======================================================================== + + -- Used in both Imp & Impf functions + verbImpStem : VerbInfo -> Str -> Str = \info,iftah -> + let + vowels : Pattern = extractPattern info.imp ; +-- iftah : Str = info.imp ; --- is there no way to avoid the iftah parameter? + in + case of { + => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C2 ; -- BEXX + => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 ; -- QAJM + => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C2 ; -- NEĦĦ + => pfx_T info.root.C1 + vowels.V1 + info.root.C2 + info.root.C3 + info.root.C4 ; -- -TĦARBT + => pfx_T info.root.C1 + vowels.V1 + info.root.C2 + info.root.C3 ; -- -TKANT + => info.root.C1 + vowels.V1 + info.root.C2 + info.root.C2 + info.root.C3 ; -- -ĦABBT + => info.root.C1 + vowels.V1 + info.root.C2 + info.root.C3 ; -- -ĦARS + => info.root.C1 + vowels.V1 + info.root.C2 + info.root.C3 ; -- -WIEĠB + <_, Strong LiquidMedial> => case info.root.C1 of { + "għ" => vowels.V1 + info.root.C1 + info.root.C2 + info.root.C3 ; -- -AGĦML + _ => vowels.V1 + info.root.C1 + vowels.V2 + info.root.C2 + info.root.C3 -- -OĦORĠ + } ; + <_, Strong Geminated> => iftah ; -- -ĦOBB + <_, Weak Assimilative> => (ie2i vowels.V1) + info.root.C2 + info.root.C3 ; -- -ASL (WASAL) + <_, Weak Hollow> => info.root.C1 + vowels.V1 + info.root.C3 ; -- -SIB + <_, Weak Lacking> => vowels.V1 + info.root.C1 + info.root.C2 ; -- -IMX + <_, Quad QStrong> => info.root.C1 + vowels.V1 + info.root.C2 + info.root.C3 + info.root.C4 ; -- -ĦARBT + <_, Quad QWeak> => info.root.C1 + vowels.V1 + info.root.C2 + info.root.C3 ; -- -SERV, -KANT + <_, Loan> => dropSfx 1 iftah ; -- -ŻVILUPP + _ => vowels.V1 + info.root.C1 + info.root.C2 + info.root.C3 + } ; + +-- ------------------------------------------------------------------------ + + -- Build table of pronominal suffixes + -- Imperfective tense + verbImpfPronSuffixTable : VerbInfo -> (Agr => Str) -> (Agr => VSuffixForm => Str) = \info,tbl -> + let + vowels : Pattern = extractPattern info.imp ; + p2sg_dir_ek : Str = case info.class of { + Strong LiquidMedial => case vowels.V2 of { + "o" => "ok" ; -- Jiena NOĦORĠ-OK + _ => "ek" -- Jiena NIDILK-EK + }; + Strong Geminated => case vowels.V1 of { + "o" => "ok" ; -- Jiena NXOMM-OK + _ => "ek" -- Jiena NBEXX-EK + }; + Weak Defective => "ak" ; -- Jiena NQATTGĦAK + Weak Lacking => case vowels.V1 of { + "a" => "ak" ; -- Jiena NAQR-AK + _ => "ik" -- Jiena NIMX-IK + } ; + Quad QWeak => case vowels.V2 of { + "a" => "ak" ; -- Huwa KANTAK + _ => "ik" -- Huwa SERVIK + } ; + Loan => case info.imp of { + _ + "ixxi" => "ik" ; -- Huwa SSUĠĠERIXXIK + _ => "ak" -- Huwa ŻVILUPPAK + } ; + _ => "ek" -- Jiena NIFTĦ-EK + } ; + p2sg_ind_lek : Str = case info.class of { + Strong LiquidMedial => case vowels.V2 of { + "o" => "lok" ; -- Jiena NOĦROĠ-LOK + _ => "lek" -- Jiena NIDLIK-LEK + }; + Strong Geminated => case vowels.V1 of { + "o" => "lok" ; -- Jiena NXOMM-LOK + _ => "lek" -- Jiena NBEXX-LEK + }; + _ => "lek" + } ; + p3sg_dir_u : Str = case info.imp of { + _ + "a" => "ah" ; -- Huwa KANTAH + _ + "i" => "ih" ; -- Huwa SERVIH + _ => "u" -- Huwa FETĦU + } ; + + -- This stem is prefixed with n/t/j/t/n/t/j + iftah : Str = case dropPfx 1 (tbl ! AgP1 Sg) of { + "ie"+qaf => "i"+qaf ; -- -IEQAF > -IQAF + w+"ie"+g+"e"+b => w+(info.patt2.V1)+g+"i"+b ; -- -WIEĠEB > -WIĠIB --- IorE? + aqta+"'" => aqta+"għ" ; -- -AQTA' > -AQTAGĦ + ik+t@#Consonant+"e"+b@#Consonant => ik+t+"i"+b ; -- -IKTEB > -IKTIB --- potentially slow + iftah => iftah -- -IFTAĦ + } ; + ifth : Str = case of { + => "i" + verbImpStem info iftah ; + => "i" + info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 ; -- -INĦASL + => "i" + info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 ; -- -INTEFAQ + => "i" + info.root.C1 + info.root.C2 + info.patt.V1 + info.root.C3 ; -- -IĦDAR + => case info.imp of { + staghg + e@#V + b@#C => "i" + staghg + b ; -- -ISTAGĦĠB, -ISTĦARRĠ + _ => "i" + info.imp -- ISTQARR + } ; + -- => "ist" + info.patt.V1 + info.root.C1 + info.root.C2 + info.root.C3 ; -- -ISTAGĦĠEB + _ => verbImpStem info iftah + } ; + in + table { + AgP1 Sg => -- Jiena NIFTAĦ + let + niftah = pfx_N iftah ; + nifth = pfx_N ifth ; + in + table { + VSuffixNone => tbl ! AgP1 Sg ; + VSuffixDir agr => + case agr of { + AgP1 Sg => [] ; + AgP2 Sg => nifth + p2sg_dir_ek ; -- Jiena NIFTĦEK + AgP3Sg Masc=> nifth + p3sg_dir_u ; -- Jiena NIFTĦU + AgP3Sg Fem => niftah + "ha" ; -- Jiena NIFTAĦHA + AgP1 Pl => [] ; + AgP2 Pl => sfx niftah "kom" ; -- Jiena NIFTAĦKOM (n.b. NĦOKK+KOM) + AgP3Pl => niftah + "hom" -- Jiena NIFTAĦHOM + } ; + VSuffixInd agr => + let + nifthi = case of { + => nifth + "a" ; -- NAQTGĦA- + => nifth + "a" ; -- NAQRA- + => tbl ! AgP1 Sg ; -- NKANTA-, NSERVI- + => nifth + (takeSfx 1 niftah) ; -- NISSUĠĠERIXXI-, NIŻVILUPPA- + _ => nifth + "i" -- NIFTĦI- + } ; + in + case agr of { + AgP1 Sg => [] ; + AgP2 Sg => sfx niftah p2sg_ind_lek ; -- Jiena NIFTAĦLEK (n.b. NĦOLL+LEK) + AgP3Sg Masc=> sfx niftah "lu" ; -- Jiena NIFTAĦLU (n.b. NĦOLL+LU) + AgP3Sg Fem => nifthi + "lha" ; -- Jiena NIFTĦILHA + AgP1 Pl => [] ; + AgP2 Pl => nifthi + "lkom" ; -- Jiena NIFTĦILKOM + AgP3Pl => nifthi + "lhom" -- Jiena NIFTĦILHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP1 Sg) do niftah) ! agr + } ; + AgP2 Sg => -- Inti TIFTAĦ + let + tiftah = pfx_T iftah ; + tifth = pfx_T ifth ; + in + table { + VSuffixNone => tbl ! AgP2 Sg ; + VSuffixDir agr => + case agr of { + AgP1 Sg => sfx tiftah "ni" ; -- Inti TIFTAĦNI (n.b. TKENN+NI) + AgP2 Sg => [] ; + AgP3Sg Masc=> tifth + p3sg_dir_u ; -- Inti TIFTĦU + AgP3Sg Fem => tiftah + "ha" ; -- Inti TIFTAĦHA + AgP1 Pl => sfx tiftah "na" ; -- Inti TIFTAĦNA (n.b. TKENN+NA) + AgP2 Pl => [] ; + AgP3Pl => tiftah + "hom" -- Inti TIFTAĦHOM + } ; + VSuffixInd agr => + let + tifthi = case of { + <{form=FormIII}, "ie"> => (ie2_ info.patt2.V1 tifth) + "i" ; -- TWIĠIB- + <{class=Weak Defective}, _> => tifth + "a" ; -- TAQTGĦA- + <{class=Weak Lacking}, "a"> => tifth + "a" ; -- TAQRA- + <{class=Quad QWeak}, _> => tbl ! AgP2 Sg ; -- TKANTA-, SSERVI- + <{class=Loan}, _> => tifth + (takeSfx 1 tiftah) ; -- TISSUĠĠERIXXI-, TIŻVILUPPA- + _ => tifth + "i" -- TIFTĦI- + } ; + in + case agr of { + AgP1 Sg => sfx tiftah "li" ; -- Inti TIFTAĦLI (n.b. TĦOLL+LI) + AgP2 Sg => [] ; + AgP3Sg Masc=> sfx tiftah "lu" ; -- Inti TIFTAĦLU (n.b. TĦOLL+LU) + AgP3Sg Fem => tifthi + "lha" ; -- Inti TIFTĦILHA + AgP1 Pl => tifthi + "lna" ; -- Inti TIFTĦILNA + AgP2 Pl => [] ; + AgP3Pl => tifthi + "lhom" -- Inti TIFTĦILHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP2 Sg) do tiftah) ! agr + } ; + AgP3Sg Masc => -- Huwa JIFTAĦ + let + jiftah = pfx_J iftah ; + jifth = pfx_J ifth ; + in + table { + VSuffixNone => tbl ! AgP3Sg Masc ; + VSuffixDir agr => + case agr of { + AgP1 Sg => sfx jiftah "ni" ; -- Huwa JIFTAĦNI (n.b. JKENN+NI) + AgP2 Sg => jifth + p2sg_dir_ek ; -- Huwa JIFTĦEK + AgP3Sg Masc=> jifth + p3sg_dir_u ; -- Huwa JIFTĦU + AgP3Sg Fem => jiftah + "ha" ; -- Huwa JIFTAĦHA + AgP1 Pl => sfx jiftah "na" ; -- Huwa JIFTAĦNA (n.b. JKENN+NA) + AgP2 Pl => sfx jiftah "kom" ; -- Huwa JIFTAĦKOM (n.b. JĦOKK+KOM) + AgP3Pl => jiftah + "hom" -- Huwa JIFTAĦHOM + } ; + VSuffixInd agr => + let + jifthi = case of { + <{form=FormIII}, "ie"> => (ie2_ info.patt2.V1 jifth) + "i" ; -- JWIĠIB- + <{class=Weak Defective}, _> => jifth + "a" ; -- JAQTGĦA- + <{class=Weak Lacking}, "a"> => jifth + "a" ; -- JAQRA- + <{class=Quad QWeak}, _> => tbl ! AgP3Sg Masc ; -- JKANTA-, SSERVI- + <{class=Loan}, _> => jifth + (takeSfx 1 jiftah) ; -- JISSUĠĠERIXXI-, JIŻVILUPPA- + _ => jifth + "i" -- JIFTĦI- + } ; + in + case agr of { + AgP1 Sg => sfx jiftah "li" ; -- Huwa JIFTAĦLI (n.b. JĦOLL+LI) + AgP2 Sg => sfx jiftah p2sg_ind_lek ; -- Huwa JIFTAĦLEK (n.b. JĦOLL+LEK) + AgP3Sg Masc=> sfx jiftah "lu" ; -- Huwa JIFTAĦLU (n.b. JĦOLL+LU) + AgP3Sg Fem => jifthi + "lha" ; -- Huwa JIFTĦILHA + AgP1 Pl => jifthi + "lna" ; -- Huwa JIFTĦILNA + AgP2 Pl => jifthi + "lkom" ; -- Huwa JIFTĦILKOM + AgP3Pl => jifthi + "lhom" -- Huwa JIFTĦILHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP3Sg Masc) do jiftah) ! agr + } ; + AgP3Sg Fem => -- Hija TIFTAĦ + let + tiftah = pfx_T iftah ; + tifth = pfx_T ifth ; + in + table { + VSuffixNone => tbl ! AgP3Sg Fem ; + VSuffixDir agr => + case agr of { + AgP1 Sg => sfx tiftah "ni" ; -- Hija TIFTAĦNI (n.b. TKENN+NI) + AgP2 Sg => tifth + p2sg_dir_ek ; -- Hija TIFTĦEK + AgP3Sg Masc=> tifth + p3sg_dir_u ; -- Hija TIFTĦU + AgP3Sg Fem => tiftah + "ha" ; -- Hija TIFTAĦHA + AgP1 Pl => sfx tiftah "na" ; -- Hija TIFTAĦNA (n.b. TKENN+NA) + AgP2 Pl => sfx tiftah "kom" ; -- Hija TIFTAĦKOM (n.b. TĦOKK+KOM) + AgP3Pl => tiftah + "hom" -- Hija TIFTAĦHOM + } ; + VSuffixInd agr => + let + tifthi = case of { + <{form=FormIII}, "ie"> => (ie2_ info.patt2.V1 tifth) + "i" ; -- TWIĠIB- + <{class=Weak Defective}, _> => tifth + "a" ; -- TAQTGĦA- + <{class=Weak Lacking}, "a"> => tifth + "a" ; -- TAQRA- + <{class=Quad QWeak}, _> => tbl ! AgP3Sg Fem ; -- TKANTA-, SSERVI- + <{class=Loan}, _> => tifth + (takeSfx 1 tiftah) ; -- TISSUĠĠERIXXI-, TIŻVILUPPA- + _ => tifth + "i" -- TIFTĦI- + } ; + in + case agr of { + AgP1 Sg => sfx tiftah "li" ; -- Hija TIFTAĦLI (n.b. TĦOLL+LI) + AgP2 Sg => sfx tiftah p2sg_ind_lek ; -- Hija TIFTAĦLEK (n.b. TĦOLL+LEK) + AgP3Sg Masc=> sfx tiftah "lu" ; -- Hija TIFTAĦLU (n.b. TĦOLL+LU) + AgP3Sg Fem => tifthi + "lha" ; -- Hija TIFTĦILHA + AgP1 Pl => tifthi + "lna" ; -- Hija TIFTĦILNA + AgP2 Pl => tifthi + "lkom" ; -- Hija TIFTĦILKOM + AgP3Pl => tifthi + "lhom" -- Hija TIFTĦILHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP3Sg Fem) do tiftah) ! agr + } ; + AgP1 Pl => -- Aħna NIFTĦU + let + nifthu = ie2_ info.patt2.V1 (tbl ! AgP1 Pl) ; + in + table { + VSuffixNone => tbl ! AgP1 Pl ; + VSuffixDir agr => + case agr of { + AgP1 Sg => [] ; + AgP2 Sg => nifthu + "k" ; -- Aħna NIFTĦUK + AgP3Sg Masc=> nifthu + "h" ; -- Aħna NIFTĦUH + AgP3Sg Fem => nifthu + "ha" ; -- Aħna NIFTĦUHA + AgP1 Pl => [] ; + AgP2 Pl => nifthu + "kom" ; -- Aħna NIFTĦUKOM + AgP3Pl => nifthu + "hom" -- Aħna NIFTĦUHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => [] ; + AgP2 Sg => nifthu + "lek" ; -- Aħna NIFTĦULEK + AgP3Sg Masc=> nifthu + "lu" ; -- Aħna NIFTĦULU + AgP3Sg Fem => nifthu + "lha" ; -- Aħna NIFTĦULHA + AgP1 Pl => [] ; + AgP2 Pl => nifthu + "lkom" ; -- Aħna NIFTĦULKOM + AgP3Pl => nifthu + "lhom" -- Aħna NIFTĦULHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP1 Pl) do nifthu) ! agr + } ; + AgP2 Pl => -- Intom TIFTĦU + let + tifthu = ie2_ info.patt2.V1 (tbl ! AgP2 Pl) ; + in + table { + VSuffixNone => tbl ! AgP2 Pl ; + VSuffixDir agr => + case agr of { + AgP1 Sg => tifthu + "ni" ; -- Intom TIFTĦUNI + AgP2 Sg => [] ; + AgP3Sg Masc=> tifthu + "h" ; -- Intom TIFTĦUH + AgP3Sg Fem => tifthu + "ha" ; -- Intom TIFTĦUHA + AgP1 Pl => tifthu + "na" ; -- Intom TIFTĦUNA + AgP2 Pl => [] ; + AgP3Pl => tifthu + "hom" -- Intom TIFTĦUHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => tifthu + "li" ; -- Intom TIFTĦULI + AgP2 Sg => [] ; + AgP3Sg Masc=> tifthu + "lu" ; -- Intom TIFTĦULU + AgP3Sg Fem => tifthu + "lha" ; -- Intom TIFTĦULHA + AgP1 Pl => tifthu + "lna" ; -- Intom TIFTĦULNA + AgP2 Pl => [] ; + AgP3Pl => tifthu + "lhom" -- Intom TIFTĦULHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP2 Pl) do tifthu) ! agr + } ; + AgP3Pl => -- Huma JIFTĦU + let + jifthu = ie2_ info.patt2.V1 (tbl ! AgP3Pl) ; + in + table { + VSuffixNone => tbl ! AgP3Pl ; + VSuffixDir agr => + case agr of { + AgP1 Sg => jifthu + "ni" ; -- Huma JIFTĦUNI + AgP2 Sg => jifthu + "k" ; -- Huma JIFTĦUK + AgP3Sg Masc=> jifthu + "h" ; -- Huma JIFTĦUH + AgP3Sg Fem => jifthu + "ha" ; -- Huma JIFTĦUHA + AgP1 Pl => jifthu + "na" ; -- Huma JIFTĦUNA + AgP2 Pl => jifthu + "kom" ; -- Huma JIFTĦUKOM + AgP3Pl => jifthu + "hom" -- Huma JIFTĦUHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => jifthu + "li" ; -- Huma JIFTĦULI + AgP2 Sg => jifthu + "lek" ; -- Huma JIFTĦULEK + AgP3Sg Masc=> jifthu + "lu" ; -- Huma JIFTĦULU + AgP3Sg Fem => jifthu + "lha" ; -- Huma JIFTĦULHA + AgP1 Pl => jifthu + "lna" ; -- Huma JIFTĦULNA + AgP2 Pl => jifthu + "lkom" ; -- Huma JIFTĦULKOM + AgP3Pl => jifthu + "lhom" -- Huma JIFTĦULHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP3Pl) do jifthu) ! agr + } + } ; -- end of verbImpfPronSuffixTable + +-- ======================================================================== + + verbImpPronSuffixTable : VerbInfo -> (Number => Str) -> (Number => VSuffixForm => Str) = \info,tbl -> + table { + Sg => -- Inti IFTAĦ + let + vowels = extractPattern (tbl ! Sg) ; + iftah : Str = case (tbl ! Sg) of { + w+"ie"+g+"e"+b => w+(info.patt2.V1)+g+"i"+b ; -- -WIEĠEB > -WIĠIB --- IorE? + "ie"+qaf=> "i"+qaf ; -- IEQAF > IQAF + aqta+"'" => aqta+"għ" ; -- AQTA' > AQTAGĦ + ik+t@#Consonant+"e"+b@#Consonant => ik+t+"i"+b ; -- IKTEB > IKTIB --- potentially slow + x => x -- IFTAĦ + } ; + ifth : Str = case info.form of { + FormVII => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 ; -- NĦASL + FormVIII => info.root.C1 + info.patt.V1 + info.root.C2 + info.root.C3 ; -- NTEFAQ + FormIX => info.root.C1 + info.root.C2 + info.patt.V1 + info.root.C3 ; -- ĦDAR + FormX => case info.imp of { + staghg + e@#V + b@#C => staghg + b ; -- STAGĦĠB, STĦARRĠ + _ => info.imp -- STQARR + } ; + -- FormX => "st" + info.patt.V1 + info.root.C1 + info.root.C2 + info.root.C3 ; -- STAGĦĠEB + _ => verbImpStem info iftah + } ; + p3sg_dir_u : Str = case info.imp of { + _ + "a" => "ah" ; -- KANTAH + _ + "i" => "ih" ; -- SERVIH + _ => "u" -- IFTĦU + } ; + in + table { + VSuffixNone => (tbl ! Sg) ; + VSuffixDir agr => + case agr of { + AgP1 Sg => sfx iftah "ni" ; -- Inti IFTAĦNI (n.b. KENN+NI) + AgP2 Sg => [] ; + AgP3Sg Masc=> ifth + p3sg_dir_u ; -- Inti IFTĦU + AgP3Sg Fem => iftah + "ha" ; -- Inti IFTAĦHA + AgP1 Pl => sfx iftah "na" ; -- Inti IFTAĦNA (n.b. KENN+NA) + AgP2 Pl => [] ; + AgP3Pl => iftah + "hom" -- Inti IFTAĦHOM + } ; + VSuffixInd agr => + let + ifthi : Str = case of { + => ie2_ (info.patt2.V1) ifth + "i" ; -- ĦARSI- + => ifth + "i" ; + <_, Strong LiquidMedial> => case info.root.C1 of { + "għ" => ifth + "i" ; -- AGĦMLI- + _ => (tbl!Sg) + "i" -- OĦROĠI- + } ; + <_, Weak Defective> => ifth + "a" ; -- AQTGĦA- + <_, Weak Lacking> => case vowels.V1 of { + "a" => ifth + "a" ; -- AQRA- + _ => ifth + "i" -- IMXI- + } ; + <_, Quad QStrong> => case info.form of { + FormII => pfx_T info.root.C1 + vowels.V1 + info.root.C2 + info.root.C3 + info.root.C4 + "i" ; -- TĦARBTI- + _ => info.root.C1 + vowels.V1 + info.root.C2 + info.root.C3 + info.root.C4 + "i" -- ĦARBTI- + } ; + <_, Quad QWeak> => tbl ! Sg ; -- KANTA-, SERVI- + <_, Loan> => tbl ! Sg ; -- ŻVILUPPA- + _ => ifth + "i" -- IFTĦI- + } ; + in + case agr of { + AgP1 Sg => sfx iftah "li" ; -- Inti IFTAĦLI (n.b. ĦOLL+LI) + AgP2 Sg => [] ; + AgP3Sg Masc=> sfx iftah "lu" ; -- Inti IFTAĦLU (n.b. ĦOLL+LU) + AgP3Sg Fem => ifthi + "lha" ; -- Inti IFTĦILHA + AgP1 Pl => ifthi + "lna" ; -- Inti IFTĦILNA + AgP2 Pl => [] ; + AgP3Pl => ifthi + "lhom" -- Inti IFTĦILHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP2 Sg) do iftah) ! agr + } ; + Pl => -- Intom IFTĦU + let + ifthu = ie2_ info.patt2.V1 (tbl ! Pl) ; + in + table { + VSuffixNone => tbl ! Pl ; + VSuffixDir agr => + case agr of { + AgP1 Sg => ifthu + "ni" ; -- Inti IFTĦUNI + AgP2 Sg => [] ; + AgP3Sg Masc=> ifthu + "h" ; -- Inti IFTĦUH + AgP3Sg Fem => ifthu + "ha" ; -- Inti IFTĦUHA + AgP1 Pl => ifthu + "na" ; -- Inti IFTĦUNA + AgP2 Pl => [] ; + AgP3Pl => ifthu + "hom" -- Inti IFTĦUHOM + } ; + VSuffixInd agr => + case agr of { + AgP1 Sg => ifthu + "li" ; -- Inti IFTĦULI + AgP2 Sg => [] ; + AgP3Sg Masc=> ifthu + "lu" ; -- Inti IFTĦULU + AgP3Sg Fem => ifthu + "lha" ; -- Inti IFTĦULHA + AgP1 Pl => ifthu + "lna" ; -- Inti IFTĦULNA + AgP2 Pl => [] ; + AgP3Pl => ifthu + "lhom" -- Inti IFTĦULHOM + } ; + VSuffixDirInd do agr => (verbDirIndSuffixTable (AgP2 Pl) do ifthu) ! agr + } + } ; + + + {- ~~~ General use verb operations ~~~ -} + + verbDirIndSuffixTable : Agr -> GenNum -> Str -> (Agr => Str) = \subj,do,ftaht -> + case do of { + GSg Masc => table { + AgP1 Sg => case subj of { + AgP1 _ => [] ; + _ => ftaht + "huli" + } ; + AgP2 Sg => case subj of { + AgP2 _ => [] ; + _ => ftaht + "hulek" + } ; + AgP3Sg Masc=> ftaht + "hulu" ; + AgP3Sg Fem => ftaht + "hulha" ; + AgP1 Pl => case subj of { + AgP1 _ => [] ; + _ => ftaht + "hulna" + } ; + AgP2 Pl => case subj of { + AgP2 _ => [] ; + _ => ftaht + "hulkom" + } ; + AgP3Pl => ftaht + "hulhom" -- Jiena FTAĦTHULHOM + } ; + GSg Fem => table { + AgP1 Sg => case subj of { + AgP1 _ => [] ; + _ => ftaht + "hieli" + } ; + AgP2 Sg => case subj of { + AgP2 _ => [] ; + _ => ftaht + "hielek" + } ; + AgP3Sg Masc=> ftaht + "hielu" ; -- Jiena FTAĦTHIELU + AgP3Sg Fem => ftaht + "hielha" ; -- Jiena FTAĦTHIELHA + AgP1 Pl => case subj of { + AgP1 _ => [] ; + _ => ftaht + "hielna" + } ; + AgP2 Pl => case subj of { + AgP2 _ => [] ; + _ => ftaht + "hielkom" + } ; + AgP3Pl => ftaht + "hielhom" -- Jiena FTAĦTHIELHOM + } ; + GPl => table { + AgP1 Sg => case subj of { + AgP1 _ => [] ; + _ => ftaht + "homli" + } ; + AgP2 Sg => case subj of { + AgP2 _ => [] ; + _ => ftaht + "homlok" + } ; + AgP3Sg Masc=> ftaht + "homlu" ; -- Jiena FTAĦTHOMLU + AgP3Sg Fem => ftaht + "homlha" ; -- Jiena FTAĦTOMHLA + AgP1 Pl => case subj of { + AgP1 _ => [] ; + _ => ftaht + "homlna" + } ; + AgP2 Pl => case subj of { + AgP2 _ => [] ; + _ => ftaht + "homlkom" + } ; + AgP3Pl => ftaht + "homlhom" -- Jiena FTAĦTHOMLHOM + } + } ; + + + -- Conugate 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 => pfx_N imp_sg ; -- Jiena NIŻLOQ + AgP2 Sg => pfx_T imp_sg ; -- Inti TIŻLOQ + AgP3Sg Masc=> pfx_J imp_sg ; -- Huwa JIŻLOQ + AgP3Sg Fem => pfx_T imp_sg ; -- Hija TIŻLOQ + AgP1 Pl => pfx_N imp_pl ; -- Aħna NIŻOLQU + AgP2 Pl => pfx_T imp_pl ; -- Intom TIŻOLQU + AgP3Pl => pfx_J imp_pl -- Huma JIŻOLQU + } ; + + -- -- Derive imperative plural from singular + -- impPlFromSg : Root -> Pattern -> Str -> VClass -> Str = \root,patt,imp_sg,class -> + -- case class of { + -- Strong Regular => (takePfx 3 imp_sg) + root.C3 + "u" ; -- IFTAĦ > IFTĦU + -- Strong LiquidMedial => (takePfx 2 imp_sg) + (charAt 3 imp_sg) + root.C2 + root.C3 + "u" ; -- OĦROĠ > OĦORĠU + -- Strong Geminated=> imp_sg + "u" ; -- ŻOMM > ŻOMMU + -- Weak Assimilative => (takePfx 2 imp_sg) + root.C3 + "u" ; -- ASAL > ASLU + -- Weak Hollow => imp_sg + "u" ; -- SIR > SIRU + -- Weak Lacking => (takePfx 3 imp_sg) + "u" ; -- IMXI > IMXU + -- Weak Defective => (takePfx 2 imp_sg) + "i" + root.C2 + "għu" ; -- ISMA' > ISIMGĦU + -- Quad QStrong => (takePfx 4 imp_sg) + root.C4 + "u" ; -- ĦARBAT > ĦARBTU + -- Quad QWeak _ARE => imp_sg + "w" ; -- KANTA > KANTAW + -- Quad QWeak _ => (dropSfx 1 imp_sg) + "u" ; -- SERVI > SERVU + -- Loan => case imp_sg of { + -- _ + "ixxi" => (dropSfx 1 imp_sg) + "u" ; -- IDDIŻUBIDIXXI > IDDIŻUBIDIXXU + -- _ => imp_sg + "w" -- IPPARKJA > IPPARKJAW + -- } + -- } ; + + + {- ~~~ Strong Verb ~~~ -} + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjStrongPerf : Root -> Pattern -> (Agr => Str) = \root,p -> + let + 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 { + 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) + conjStrongImpf = conjGenericImpf ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjStrongImp : Root -> Pattern -> (Number => Str) = \root,patt -> + let + vwls = vowelChangesStrong patt ; + in + table { + Sg => (vwls!Sg).V1 + root.C1 + root.C2 + (vwls!Sg).V2 + root.C3 ; -- Inti: IKTEB + Pl => (vwls!Pl).V1 + root.C1 + root.C2 + root.C3 + "u" -- Intom: IKTBU + } ; + + -- Vowel changes for imperative + vowelChangesStrong : Pattern -> (Number => Pattern) = \patt -> + table { + Sg => case of { + <"a","a"> => mkPattern "o" "o" ; -- RABAT > ORBOT (but: ITLOB, ILGĦAB, AĦBAT) + <"a","e"> => mkPattern "a" "e" ; -- GĦAMEL > AGĦMEL + <"e","e"> => mkPattern "i" "e" ; -- FEHEM > IFHEM + <"e","a"> => mkPattern "i" "a" ; -- FETAĦ > IFTAĦ + <"i","e"> => mkPattern "i" "e" ; -- KITEB > IKTEB + <"o","o"> => mkPattern "o" "o" -- GĦOĠOB > OGĦĠOB + }; + Pl => case of { + <"a","a"> => mkPattern "o" ; -- RABAT > ORBTU + <"a","e"> => mkPattern "a" ; -- GĦAMEL > AGĦMLU + <"e","e"> => mkPattern "i" ; -- FEHEM > IFHMU + <"e","a"> => mkPattern "i" ; -- FETAĦ > IFTĦU + <"i","e"> => mkPattern "i" ; -- KITEB > IKTBU + <"o","o"> => mkPattern "o" -- GĦOĠOB > OGĦĠBU + } + } ; + + {- ~~~ Liquid-Medial Verb ~~~ -} + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjLiquidMedialPerf : Root -> Pattern -> (Agr => Str) = \root,patt -> + let + zlaq : Str = case root.C1 of { + "għ" => root.C1 + patt.V1 + root.C2 + (case patt.V2 of {"e" => "i" ; _ => patt.V2 }) + root.C3 ; -- GĦAMIL- + _ => root.C1 + root.C2 + (case patt.V2 of {"e" => "i" ; _ => patt.V2 }) + root.C3 -- ŻLAQ- + } ; + zelq = root.C1 + patt.V1 + root.C2 + root.C3 ; + in + table { + AgP1 Sg => zlaq + "t" ; -- Jiena ŻLAQT + AgP2 Sg => zlaq + "t" ; -- Inti ŻLAQT + AgP3Sg Masc=> root.C1 + patt.V1 + root.C2 + patt.V2 + root.C3 ; -- Huwa ŻELAQ + AgP3Sg Fem => zelq + (case patt.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,patt -> + let + vwls = vowelChangesLiquidMedial patt ; + in + table { + Sg => (vwls!Sg).V1 + root.C1 + root.C2 + (vwls!Sg).V2 + root.C3 ; -- Inti: IŻLOQ + Pl => (vwls!Pl).V1 + root.C1 + (vwls!Pl).V2 + root.C2 + root.C3 + "u" -- Intom: IŻOLQU + } ; + + -- Vowel changes for imperative + vowelChangesLiquidMedial : Pattern -> (Number => Pattern) = \patt -> + table { + Sg => case of { + <"a","a"> => mkPattern "i" "o" ; -- TALAB > ITLOB + <"a","e"> => mkPattern "o" "o" ; -- ĦAREĠ > OĦROĠ + <"e","e"> => mkPattern "e" "e" ; -- ĦELES > EĦLES + <"e","a"> => mkPattern "i" "o" ; -- ŻELAQ > IŻLOQ + <"i","e"> => mkPattern "i" "e" ; -- DILEK > IDLEK + <"o","o"> => mkPattern "i" "o" -- XOROB > IXROB + }; + Pl => case of { + <"a","a"> => mkPattern "i" "o" ; -- TALAB > ITOLBU + <"a","e"> => mkPattern "o" "o" ; -- ĦAREĠ > OĦORĠU + <"e","e"> => mkPattern "e" "i" ; -- ĦELES > EĦILSU + <"e","a"> => mkPattern "i" "o" ; -- ŻELAQ > IŻOLQU + <"i","e"> => mkPattern "i" "i" ; -- DILEK > IDILKU + <"o","o"> => mkPattern "i" "o" -- XOROB > IXORBU + } + } ; + + {- ~~~ Geminated Verb ~~~ -} + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjGeminatedPerf : Root -> Pattern -> (Agr => Str) = \root,patt -> + let + habb = root.C1 + patt.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) + conjGeminatedImpf = conjGenericImpf ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjGeminatedImp : Root -> Pattern -> (Number => Str) = \root,patt -> + let + vwls = vowelChangesGeminated patt ; + stem_sg = root.C1 + (vwls!Sg).V1 + root.C2 + root.C3 ; + in + table { + Sg => stem_sg ; -- Inti: ĦOBB + Pl => stem_sg + "u" -- Intom: ĦOBBU + } ; + + -- Vowel changes for imperative + vowelChangesGeminated : Pattern -> (Number => Pattern) = \patt -> + \\n => case patt.V1 of { + "e" => mkPattern "e" ; -- BEXX > BEXX (?) + _ => mkPattern "o" -- ĦABB > ĦOBB + } ; + + + {- ~~~ Assimilative Verb ~~~ -} + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjAssimilativePerf : Root -> Pattern -> (Agr => Str) = \root,patt -> + let + wasal = root.C1 + patt.V1 + root.C2 + patt.V2 + root.C3 ; + wasl = root.C1 + patt.V1 + root.C2 + root.C3 ; + in + table { + 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 ASAL), Imperative Plural (eg ASLU) + conjAssimilativeImpf = conjGenericImpf ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjAssimilativeImp : Root -> Pattern -> (Number => Str) = \root,patt -> + table { + Sg => patt.V1 + root.C2 + patt.V2 + root.C3 ; -- Inti: ASAL + Pl => patt.V1 + root.C2 + root.C3 + "u" -- Intom: ASLU + } ; + + {- ~~~ Hollow Verb ~~~ -} + + -- 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,patt -> + let + sar = root.C1 + patt.V1 + root.C3 ; + sir = case of { + <"a","w"> => 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 DUM), Imperative Plural (eg DUMU) + conjHollowImpf : Str -> Str -> (Agr => Str) = \imp_sg,imp_pl -> + table { + AgP1 Sg => pfx_N imp_sg ; -- Jiena NDUM / MMUR + AgP2 Sg => pfx_T imp_sg ; -- Inti DDUM / TMUR + AgP3Sg Masc=> pfx_J imp_sg ; -- Huwa JDUM / JMUR + AgP3Sg Fem => pfx_T imp_sg ; -- Hija DDUM / TMUR + AgP1 Pl => pfx_N imp_pl ; -- Aħna NDUMU / MMORRU + AgP2 Pl => pfx_T imp_pl ; -- Intom DDUMU / TMORRU + AgP3Pl => pfx_J imp_pl -- Huma JDUMU / JMORRU + } ; + + -- 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,patt -> + let + sir = case of { + <"a","w"> => root.C1 + "u" + root.C3 ; -- DAM, FAR, SAQ (most common case) + <"a","j"> => root.C1 + "i" + root.C3 ; -- ĠAB, SAB, TAR + <"ie","j"> => root.C1 + "i" + root.C3 ; -- FIEQ, RIED, ŻIED + <"ie","w"> => 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 + } ; + + {- ~~~ Lacking Verb ~~~ -} + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjLackingPerf : Root -> Pattern -> (Agr => Str) = \root,patt -> + let + mxej = root.C1 + root.C2 + patt.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 + patt.V1 + root.C2 + patt.V2 ; -- Huwa MEXA + AgP3Sg Fem => case patt.V1 of { + "a" => root.C1 + root.C2 + "at" ; -- Hija QRAT + _ => root.C1 + root.C2 + "iet" -- Hija MXIET + } ; + AgP1 Pl => mxej + "na" ; -- Aħna IMXEJNA + AgP2 Pl => mxej + "tu" ; -- Intom IMXEJTU + AgP3Pl => case patt.V1 of { + "a" => root.C1 + root.C2 + "aw" ; -- Huma QRAW + _ => 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) + conjLackingImpf = conjGenericImpf ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjLackingImp : Root -> Pattern -> (Number => Str) = \root,patt -> + table { + Sg => "i" + root.C1 + root.C2 + "i" ; -- Inti: IMXI + Pl => "i" + root.C1 + root.C2 + "u" -- Intom: IMXU + } ; + + {- ~~~ Defective Verb ~~~ -} + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjDefectivePerf : Root -> Pattern -> ( Agr => Str ) = \root,patt -> + let + qlaj = root.C1 + root.C2 + (case patt.V2 of {"e" => "i" ; _ => patt.V2 }) + "j" ; + qalgh = root.C1 + patt.V1 + root.C2 + root.C3 ; + in + table { + AgP1 Sg => qlaj + "t" ; -- Jiena QLAJT + AgP2 Sg => qlaj + "t" ; -- Inti QLAJT + AgP3Sg Masc=> root.C1 + patt.V1 + root.C2 + patt.V2 + "'" ; -- Huwa QALA' + AgP3Sg Fem => qalgh + (case patt.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,patt -> + let + v1 = case patt.V1 of { "e" => "i" ; _ => patt.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 + patt.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) ~~~ -} + + -- Conjugate entire verb in PERFECT tense + -- Params: Root, Pattern + conjQuadPerf : Root -> Pattern -> (Agr => Str) = \root,patt -> + let + dendil = root.C1 + patt.V1 + root.C2 + root.C3 + (case patt.V2 of {"e" => "i" ; _ => patt.V2 }) + root.C4 ; + dendl = root.C1 + patt.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 + patt.V1 + root.C2 + root.C3 + patt.V2 + root.C4 ; -- Huwa DENDIL + AgP3Sg Fem => dendl + (case patt.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 -> + table { + AgP1 Sg => pfx_N imp_sg ; -- Jiena NDENDEL + AgP2 Sg => pfx_T imp_sg ; -- Inti DDENDEL + AgP3Sg Masc=> pfx_J imp_sg ; -- Huwa JDENDEL + AgP3Sg Fem => pfx_T imp_sg ; -- Hija DDENDEL + AgP1 Pl => pfx_N imp_pl ; -- Aħna NDENDLU + AgP2 Pl => pfx_T imp_pl ; -- Intom DDENDLU + AgP3Pl => pfx_J imp_pl -- Huma JDENDLU + } ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjQuadImp : Root -> Pattern -> (Number => Str) = \root,patt -> + table { + Sg => root.C1 + patt.V1 + root.C2 + root.C3 + patt.V2 + root.C4 ; -- Inti: DENDEL + Pl => root.C1 + patt.V1 + root.C2 + root.C3 + root.C4 + "u" -- Intom: DENDLU + } ; + + {- ~~~ Quadriliteral Verb (Weak Final) ~~~ -} + + -- Conjugate entire verb in PERFECT tense + -- Params: Stem + conjQuadWeakPerf : Root -> Pattern -> Str -> (Agr => Str) = \root,patt,imp_sg -> + case takeSfx 1 imp_sg of { + "a" => -- KANTA + let + kanta = imp_sg ; + in + 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 + } ; + _ => -- SERVI + let + serve = root.C1 + patt.V1 + root.C2 + root.C3 + "e" ; + in + table { + AgP1 Sg => serve + "jt" ; -- Jiena SERVEJT + AgP2 Sg => serve + "jt" ; -- Inti SERVEJT + AgP3Sg Masc=> root.C1 + patt.V1 + root.C2 + root.C3 + patt.V2 ; -- Huwa SERVA + AgP3Sg Fem => root.C1 + patt.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 + } + } ; + + -- 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 -> + table { + AgP1 Sg => pfx_N imp_sg ; -- Jiena NSERVI + AgP2 Sg => pfx_T imp_sg ; -- Inti SSERVI + AgP3Sg Masc=> pfx_J imp_sg ; -- Huwa JSERVI + AgP3Sg Fem => pfx_T imp_sg ; -- Hija SSERVI + AgP1 Pl => pfx_N imp_pl ; -- Aħna NSERVU + AgP2 Pl => pfx_T imp_pl ; -- Intom SSERVU + AgP3Pl => pfx_J imp_pl -- Huma JSERVU + } ; + + -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns + -- Params: Root, Pattern + conjQuadWeakImp : Root -> Pattern -> (Number => Str) = \root,patt -> + table { + --- this is known to fail for KANTA, but that seems like a less common case + Sg => root.C1 + patt.V1 + root.C2 + root.C3 + "i" ; -- Inti: SERVI + Pl => root.C1 + patt.V1 + root.C2 + root.C3 + "u" -- Intom: SERVU + } ; + + + {- ~~~ Non-semitic verbs ~~~ -} + + -- Conjugate entire verb in PERFECTIVE tense + -- Params: mamma + conjLoanPerf : Str -> (Agr => Str) = \mamma -> + case mamma of { + _ + "ixxa" => + let + issugger = dropSfx 4 mamma ; + in + table { + AgP1 Sg => issugger + "ejt" ; -- Jiena ISSUĠĠEREJT + AgP2 Sg => issugger + "ejt" ; -- Inti ISSUĠĠEREJT + AgP3Sg Masc=> mamma ; -- Huwa ISSUĠĠERIXXA + AgP3Sg Fem => issugger + "iet" ; -- Hija ISSUĠĠERIET + AgP1 Pl => issugger + "ejna" ; -- Aħna ISSUĠĠEREJNA + AgP2 Pl => issugger + "ejtu" ; -- Intom ISSUĠĠEREJTU + AgP3Pl => issugger + "ew" -- Huma ISSUĠĠEREW + } ; + _ => + let + ipparkja = mamma ; + in + table { + AgP1 Sg => ipparkja + "jt" ; -- Jiena IPPARKJAJT + AgP2 Sg => ipparkja + "jt" ; -- Inti IPPARKJAJT + AgP3Sg Masc=> ipparkja ; -- Huwa IPPARKJA + AgP3Sg Fem => ipparkja + "t" ; -- Hija IPPARKJAT + AgP1 Pl => ipparkja + "jna" ; -- Aħna IPPARKJAJNA + AgP2 Pl => ipparkja + "jtu" ; -- Intom IPPARKJAJTU + AgP3Pl => ipparkja + "w" -- Huma IPPARKJAW + } + } ; + + -- Conjugate entire verb in IMPERFECT, given the IMPERATIVE + -- Params: Imperative Singular (eg IPPARKJA), Imperative Plural (eg IPPARKJAW) + conjLoanImpf : Str -> Str -> (Agr => Str) = \imp_sg,imp_pl -> + let + euphonicVowel : Str = case takePfx 1 imp_sg of { + #Consonant => "i" ; -- STABILIXXA > NISTABILIXXA + _ => [] + } ; + in + table { + AgP1 Sg => "n" + euphonicVowel + imp_sg ; -- Jiena NIPPARKJA + AgP2 Sg => "t" + euphonicVowel + imp_sg ; -- Inti TIPPARKJA + AgP3Sg Masc=> "j" + euphonicVowel + imp_sg ; -- Huwa JIPPARKJA + AgP3Sg Fem => "t" + euphonicVowel + imp_sg ; -- Hija TIPPARKJA + AgP1 Pl => "n" + euphonicVowel + imp_pl ; -- Aħna NIPPARKJAW + AgP2 Pl => "t" + euphonicVowel + imp_pl ; -- Intom TIPPARKJAW + AgP3Pl => "j" + euphonicVowel + imp_pl -- Huma JIPPARKJAW + } ; + + -- Conjugate entire verb in IMPERATIVE tense + -- Params: Root, Pattern + conjLoanImp : Str -> (Number => Str) = \mamma -> + table { + Sg => case mamma of { + _ + "ixxa" => (dropSfx 1 mamma) + "i" ; -- STABILIXXA > STABILIXXI + _ => mamma -- IPPARKJA > IPPARKJA + } ; + Pl => case mamma of { + _ + "ixxa" => (dropSfx 1 mamma) + "u" ; -- STABILIXXA > STABILIXXU + _ => mamma + "w" -- IPPARKJA > IPPARKJAW + } + } ; + + {- ~~~ Form II verbs ~~~ -} + + conjFormII : VerbInfo -> (VForm => VSuffixForm => Polarity => Str) = \i -> + let + mamma : Str = case i.class of { + Weak Defective => i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C2 + i.patt.V2 + "'" ; -- QATTA' + Weak Lacking => i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C2 + i.patt.V2 ; -- NEĦĦA + _ => i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C2 + i.patt.V2 + i.root.C3 -- WAQQAF + } ; + nehhi : Str = case i.class of { + Weak Lacking => i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C2 + "i" ; -- NEĦĦI + _ => mamma -- WAQQAF + } ; + bexxix : Str = case of { + => i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C2 + i.patt.V2 + "j" ; -- QATTAJ + <_,"e","a"> => i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C2 + "e" + i.root.C3 ; -- NEĦĦEJ + <_,_,"e"> => i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C2 + "i" + i.root.C3 ; + _ => nehhi -- no change + } ; + waqqf : Str = case i.class of { + Weak Hollow => i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C3 ; -- QAJM + Weak Lacking => i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C2 ; -- NEĦĦ + _ => sfx (i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C2) i.root.C3 + } ; + waqqfu : Str = waqqf + "u" ; + perf : Agr => Str = table { + AgP1 Sg => bexxix + "t" ; + AgP2 Sg => bexxix + "t" ; + AgP3Sg Masc => mamma ; + AgP3Sg Fem => case of { + <"e","a"> => waqqf + "iet" ; -- NEĦĦIET + _ => waqqf + "et" + } ; + AgP1 Pl => bexxix + "na" ; + AgP2 Pl => bexxix + "tu" ; + AgP3Pl => case of { + <"e","a"> => waqqf + "ew" ; -- NEĦĦEW + _ => waqqf + "u" + } + } ; + impf : Agr => Str = table { + AgP1 Sg => pfx_N nehhi ; + AgP2 Sg => pfx_T nehhi ; + AgP3Sg Masc => pfx_J nehhi ; + AgP3Sg Fem => pfx_T nehhi ; + AgP1 Pl => pfx_N waqqfu ; + AgP2 Pl => pfx_T waqqfu ; + AgP3Pl => pfx_J waqqfu + } ; + imp : Number => Str = table { + Sg => nehhi ; + Pl => waqqfu + } ; + tbl : VForm => Str = table { + VPerf agr => perf ! agr ; + VImpf agr => impf ! agr ; + VImp num => imp ! num + } ; + info : VerbInfo = mkVerbInfo i.class FormII i.root i.patt (imp ! Sg) ; + sfxTbl : (VForm => VSuffixForm => Str) = verbPronSuffixTable info tbl ; + polSfxTbl : (VForm => VSuffixForm => Polarity => Str) = verbPolarityTable info sfxTbl ; + in + polSfxTbl ; + + conjFormII_quad : VerbInfo -> (VForm => VSuffixForm => Polarity => Str) = \i -> + let + vowels = extractPattern i.imp ; + mamma : Str = case i.class of { + Quad QWeak => pfx_T i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C3 + i.patt.V2 ; -- SSERVA + _ => pfx_T i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C3 + i.patt.V2 + i.root.C4 -- T-ĦARBAT + } ; + tharb : Str = case i.class of { + _ => pfx_T i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C3 + } ; + tharbt : Str = case i.class of { + Quad QWeak => pfx_T i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C3 ; -- SSERV + _ => pfx_T i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C3 + i.root.C4 + } ; + perf : Agr => Str = + let + tharbat : Str = case of { + => pfx_T i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C3 + "e" + i.root.C4 ; -- SSERVEJ + => pfx_T i.root.C1 + i.patt.V1 + i.root.C2 + i.root.C3 + "a" + i.root.C4 ; -- TKANTAJ + _ => mamma + } ; + tharbtu : Str = case of { + => tharb + "ew" ; -- SSERVEW + => tharb + "aw" ; -- TKANTAW + _ => tharbt + "u" + } ; + in + table { + AgP1 Sg => tharbat + "t" ; + AgP2 Sg => tharbat + "t" ; + AgP3Sg Masc => mamma ; + AgP3Sg Fem => case of { + => tharb + "iet" ; -- SSERVIET + => tharb + "at" ; -- TKANTAT + _ => tharbt + "et" + } ; + AgP1 Pl => tharbat + "na" ; + AgP2 Pl => tharbat + "tu" ; + AgP3Pl => tharbtu + -- AgP3Pl => case of { + -- => tharb + "ew" ; -- SSERVEW + -- => tharb + "aw" ; -- TKANTAW + -- _ => tharbt + "u" + -- } + } ; + impf : Agr => Str = + let + tharbat : Str = case of { + => tharb + "i" ; -- SSERVI + -- => tharb + "at" ; -- TKANTA + _ => mamma + } ; + tharbtu : Str = case of { + -- => tharb + "ew" ; -- SSERVEW + => tharb + "aw" ; -- TKANTAW + _ => tharbt + "u" + } ; + in + table { + AgP1 Sg => "ni" + tharbat ; + AgP2 Sg => "ti" + tharbat ; + AgP3Sg Masc => "ji" + tharbat ; + AgP3Sg Fem => "ti" + tharbat ; + AgP1 Pl => "ni" + tharbtu ; + AgP2 Pl => "ti" + tharbtu ; + AgP3Pl => "ji" + tharbtu + } ; + imp : Number => Str = + let + tharbtu : Str = case of { + -- => tharb + "ew" ; -- SSERVEW + => tharb + "aw" ; -- TKANTAW + _ => tharbt + "u" + } ; + in + table { + Sg => i.imp ; + Pl => tharbtu + } ; + tbl : VForm => Str = table { + VPerf agr => perf ! agr ; + VImpf agr => impf ! agr ; + VImp num => imp ! num + } ; + info : VerbInfo = mkVerbInfo i.class FormII i.root i.patt (imp ! Sg) ; + sfxTbl : (VForm => VSuffixForm => Str) = verbPronSuffixTable info tbl ; + polSfxTbl : (VForm => VSuffixForm => Polarity => Str) = verbPolarityTable info sfxTbl ; + in + polSfxTbl ; + + {- ~~~ Form III verbs ~~~ -} + + conjFormIII : VerbInfo -> (VForm => VSuffixForm => Polarity => Str) = \i -> + let + wiegeb : Str = i.root.C1 + i.patt.V1 + i.root.C2 + i.patt.V2 + i.root.C3 ; + wegib : Str = case of { + <"ie","e"> => i.root.C1 + "e" + i.root.C2 + "i" + i.root.C3 ; + => i.root.C1 + v1 + i.root.C2 + "i" + i.root.C3 ; + _ => wiegeb -- no change + } ; + wiegb : Str = sfx (i.root.C1 + i.patt.V1 + i.root.C2) i.root.C3 ; + wiegbu : Str = wiegb + "u" ; + perf : Agr => Str = table { + AgP1 Sg => wegib + "t" ; + AgP2 Sg => wegib + "t" ; + AgP3Sg Masc => wiegeb ; + AgP3Sg Fem => wiegb + "et" ; + AgP1 Pl => wegib + "na" ; + AgP2 Pl => wegib + "tu" ; + AgP3Pl => wiegbu + } ; + impf : Agr => Str = table { + AgP1 Sg => pfx_N wiegeb ; + AgP2 Sg => pfx_T wiegeb ; + AgP3Sg Masc => pfx_J wiegeb ; + AgP3Sg Fem => pfx_T wiegeb ; + AgP1 Pl => pfx_N wiegbu ; + AgP2 Pl => pfx_T wiegbu ; + AgP3Pl => pfx_J wiegbu + } ; + imp : Number => Str = table { + Sg => wiegeb ; + Pl => wiegbu + } ; + tbl : VForm => Str = table { + VPerf agr => perf ! agr ; + VImpf agr => impf ! agr ; + VImp num => imp ! num + } ; + info : VerbInfo = updateVerbInfo i FormIII wiegeb ; + sfxTbl : (VForm => VSuffixForm => Str) = verbPronSuffixTable info tbl ; + polSfxTbl : (VForm => VSuffixForm => Polarity => Str) = verbPolarityTable info sfxTbl ; + in + polSfxTbl ; + + {- ~~~ Form VII and VIII verbs ~~~ -} + + -- C1 contains the entire initial consonant cluster, e.g. NTR in NTRIFES + conjFormVII : VerbInfo -> Str -> (VForm => VSuffixForm => Polarity => Str) = \i,C1 -> + let + nhasel : Str = case i.class of { + Weak Hollow => C1 + i.patt.V1 + i.root.C3 ; + Weak Lacking => C1 + i.patt.V1 + i.root.C2 + i.patt.V2 ; + Weak Defective => C1 + i.patt.V1 + i.root.C2 + i.patt.V2 + "'" ; + _ => C1 + i.patt.V1 + i.root.C2 + i.patt.V2 + i.root.C3 + } ; + v1 : Str = case i.patt.V1 of { "ie" => "e" ; v => v } ; + v2 : Str = case i.patt.V2 of { "e" => "i" ; v => v } ; + -- nhsil : Str = case of { + -- => C1 + i.root.C2 + v2 + i.root.C3 ; + -- => C1 + v1 + i.root.C2 + v2 + i.root.C3 ; + -- => C1 + v1 + i.root.C3 ; + -- => C1 + i.root.C2 + v1 + i.root.C3 ; + -- _ => C1 + v1 + i.root.C2 + v2 + i.root.C3 + -- } ; + nhsil : Str = case i.class of { + Strong Regular => C1 + i.root.C2 + v2 + i.root.C3 ; + Strong LiquidMedial => C1 + v1 + i.root.C2 + v2 + i.root.C3 ; + Strong Geminated => C1 + v1 + i.root.C2 + i.root.C3 + "ej" ; -- MTEDDEJ- + Weak Hollow => C1 + v1 + i.root.C3 ; + Weak Lacking => C1 + i.root.C2 + v1 + i.root.C3 ; + Weak Defective => C1 + i.root.C2 + v1 + "j" ; + _ => C1 + v1 + i.root.C2 + v2 + i.root.C3 + } ; + nhasl : Str = case i.class of { + Weak Hollow => C1 + i.patt.V1 + i.root.C3 ; + Weak Lacking => C1 + i.root.C2 ; + _ => sfx (C1 + i.patt.V1 + i.root.C2) i.root.C3 + } ; + nhaslu : Str = case i.class of { + Weak Lacking => nhasl + "ew" ; + _ => nhasl + "u" + } ; + perf : Agr => Str = table { + AgP1 Sg => nhsil + "t" ; + AgP2 Sg => nhsil + "t" ; + AgP3Sg Masc => nhasel ; + AgP3Sg Fem => case i.class of { + Weak Lacking => nhasl + "iet" ; + _ => nhasl + "et" + } ; + AgP1 Pl => nhsil + "na" ; + AgP2 Pl => nhsil + "tu" ; + AgP3Pl => nhaslu + } ; + impf : Agr => Str = table { + AgP1 Sg => "ni" + nhasel ; + AgP2 Sg => "ti" + nhasel ; + AgP3Sg Masc => "ji" + nhasel ; + AgP3Sg Fem => "ti" + nhasel ; + AgP1 Pl => "ni" + nhaslu ; + AgP2 Pl => "ti" + nhaslu ; + AgP3Pl => "ji" + nhaslu + } ; + imp : Number => Str = table { + Sg => nhasel ; + Pl => nhaslu + } ; + tbl : VForm => Str = table { + VPerf agr => perf ! agr ; + VImpf agr => impf ! agr ; + VImp num => imp ! num + } ; + fakeinfo : VerbInfo = updateVerbInfo i (mkRoot C1 i.root.C2 i.root.C3) ; + sfxTbl : (VForm => VSuffixForm => Str) = verbPronSuffixTable fakeinfo tbl ; + polSfxTbl : (VForm => VSuffixForm => Polarity => Str) = verbPolarityTable fakeinfo sfxTbl ; + in + polSfxTbl ; + + {- ~~~ Form IX verbs ~~~ -} + + conjFormIX : VerbInfo -> (VForm => VSuffixForm => Polarity => Str) = \i -> + let + sfar = i.imp ; + sfaru = sfar + "u" ; + perf : Agr => Str = table { + AgP1 Sg => sfar + "t" ; + AgP2 Sg => sfar + "t" ; + AgP3Sg Masc => sfar ; + AgP3Sg Fem => sfar + "et" ; + AgP1 Pl => sfar + "na" ; + AgP2 Pl => sfar + "tu" ; + AgP3Pl => sfaru + } ; + impf : Agr => Str = table { + AgP1 Sg => "ni" + sfar ; + AgP2 Sg => "ti" + sfar ; + AgP3Sg Masc => "ji" + sfar ; + AgP3Sg Fem => "ti" + sfar ; + AgP1 Pl => "ni" + sfaru ; + AgP2 Pl => "ti" + sfaru ; + AgP3Pl => "ji" + sfaru + } ; + imp : Number => Str = table { + Sg => sfar ; + Pl => sfaru + } ; + tbl : VForm => Str = table { + VPerf agr => perf ! agr ; + VImpf agr => impf ! agr ; + VImp num => imp ! num + } ; + sfxTbl : (VForm => VSuffixForm => Str) = verbPronSuffixTable i tbl ; + polSfxTbl : (VForm => VSuffixForm => Polarity => Str) = verbPolarityTable i sfxTbl ; + in + polSfxTbl ; + + {- ~~~ Form X verbs ~~~ -} + + conjFormX : VerbInfo -> (VForm => VSuffixForm => Polarity => Str) = \i -> + let + mamma : Str = i.imp ; --- is it naughty to pass the mamma as imp? + perf : Agr => Str = case mamma of { + -- STAĦBA + stahb + v@#Vowel => + let + stahba : Str = mamma ; + in + table { + AgP1 Sg => stahb + "ejt" ; + AgP2 Sg => stahb + "ejt" ; + AgP3Sg Masc => mamma ; + AgP3Sg Fem => stahb + "et" ; + AgP1 Pl => stahb + "ejna" ; + AgP2 Pl => stahb + "ejtu" ; + AgP3Pl => stahb + "ew" + } ; + -- STKENN + _ + #Consonant + #Consonant => + let + stkenn : Str = mamma ; + in + table { + AgP1 Sg => stkenn + "ejt" ; + AgP2 Sg => stkenn + "ejt" ; + AgP3Sg Masc => stkenn ; + AgP3Sg Fem => stkenn + "et" ; + AgP1 Pl => stkenn + "ejna" ; + AgP2 Pl => stkenn + "ejtu" ; + AgP3Pl => stkenn + "ew" + } ; + -- STĦARREĠ + _ => + let + stharrig : Str = case mamma of { + stharr + "e" + g@#Consonant => stharr+"i"+g ; + stenbah => stenbah + } ; + stharrg : Str = case mamma of { + _ + "għ" + #Vowel + #Consonant => mamma ; + stharr + #Vowel + g@#Consonant => stharr+g ; + x => x --- unknown case + } ; + in + table { + AgP1 Sg => stharrig + "t" ; + AgP2 Sg => stharrig + "t" ; + AgP3Sg Masc => mamma ; + AgP3Sg Fem => stharrg + "et" ; + AgP1 Pl => stharrig + "na" ; + AgP2 Pl => stharrig + "tu" ; + AgP3Pl => stharrg + "u" + } + } ; + impf : Agr => Str = table { + AgP1 Sg => "ni" + mamma ; + AgP2 Sg => "ti" + mamma ; + AgP3Sg Masc => "ji" + mamma ; + AgP3Sg Fem => "ti" + mamma ; + AgP1 Pl => "ni" + (perf!AgP3Pl) ; + AgP2 Pl => "ti" + (perf!AgP3Pl) ; + AgP3Pl => "ji" + (perf!AgP3Pl) + } ; + imp : Number => Str = table { + Sg => (perf!AgP3Sg Masc) ; + Pl => (perf!AgP3Pl) + } ; + tbl : VForm => Str = table { + VPerf agr => perf ! agr ; + VImpf agr => impf ! agr ; + VImp num => imp ! num + } ; + sfxTbl : (VForm => VSuffixForm => Str) = verbPronSuffixTable i tbl ; + polSfxTbl : (VForm => VSuffixForm => Polarity => Str) = verbPolarityTable i sfxTbl ; + in + polSfxTbl ; } diff --git a/lib/src/maltese/ParadigmsMlt.gf b/lib/src/maltese/ParadigmsMlt.gf index ac3472f26..8123f837b 100644 --- a/lib/src/maltese/ParadigmsMlt.gf +++ b/lib/src/maltese/ParadigmsMlt.gf @@ -45,7 +45,7 @@ resource ParadigmsMlt = open } ; -- Helper function for inferring noun gender from singulative - -- Refer {MDG} pg190 + -- Refer {MDG pg190} inferNounGender : Str -> Gender = \sing -> case sing of { _ + "aġni" => Fem ; @@ -62,8 +62,7 @@ resource ParadigmsMlt = open } ; - -- Overloaded function for building a noun - -- Return: Noun + -- Smart paradigm for building a noun mkN : N = overload { -- Take the singular and infer gender & plural. @@ -165,11 +164,10 @@ resource ParadigmsMlt = open let stem : Str = case coll of { -- This can only apply when there are 2 syllables in the word - _ + #Vowel + #Consonant + #Vowel + K@#Consonant => tk 2 coll + K ; -- eg GĦADAM -> GĦADM- + _ + #Vowel + #Consonant + #Vowel + K@#Consonant => dropSfx 2 coll + K ; -- eg GĦADAM -> GĦADM- _ => coll } ; - ------- sing : Str = case stem of { _ => stem + "a" } ; @@ -202,15 +200,15 @@ resource ParadigmsMlt = open let -- Remove either 1 or 2 l's prepStem : Str = case prep of { - _ + "ll" => tk 2 prep ; - _ + "l" => tk 1 prep ; + _ + "ll" => dropSfx 2 prep ; + _ + "l" => dropSfx 1 prep ; _ => prep -- this should never happen, I don't think } in case noun of { ("s"|#LiquidCons) + #Consonant + _ => prep + "-i" + noun ; ("għ" | #Vowel) + _ => case prep of { - ("fil"|"bil") => (take 1 prep) + "l-" + noun ; + ("fil"|"bil") => (takePfx 1 prep) + "l-" + noun ; _ => prep + "-" + noun }; K@#CoronalConsonant + _ => prepStem + K + "-" + noun ; @@ -224,8 +222,8 @@ resource ParadigmsMlt = open -- noun abbrevPrepositionIndef : Str -> Str -> Str = \prep,noun -> let - initPrepLetter = take 1 prep ; - initNounLetter = take 1 noun + initPrepLetter = takePfx 1 prep ; + initNounLetter = takePfx 1 noun in if_then_Str (isNil noun) [] ( case prep of { @@ -274,55 +272,156 @@ resource ParadigmsMlt = open noPrep = mkPrep [] ; - {- ========== Verb paradigms ========== -} + {- ===== Verb paradigms ===== -} +{- + -- Takes a verb as a string determined derived form + -- Params: "Mamma" (Perf Per3 Sg Masc) as string (eg KITEB or ĦAREĠ) + classifyDerivedVerb : Str -> Root -> Pattern -> VDerivedForm = \mamma,root,patt -> + case mamma of { + -- Form I + --- form III verbs with long A's will get incorrectly classified as I, e.g. ĦÂRES : impossible to detect! + c1@#Consonant + v1@#Vowel + c2@#Consonant + v2@#Vowel + c3@#Consonant => FormI ; -- FETAĦ + + -- Form II + -- c2 and c3 are equal + c1@#Consonant + v1@#Vowel + c2@#Consonant + c3@#Consonant + v2@#Vowel + c4@#Consonant => -- FETTAĦ + if_then_else VDerivedForm (pbool2bool (eqStr c2 c3)) FormII FormUnknown ; + + -- Form III + -- v1 is long --- anything with v1==a would have already been caught above + c1@#Consonant + v1@("a"|"ie") + c2@#Consonant + v2@#Vowel + c3@#Consonant => + case of { +-- <"a","a"> => FormI ; -- no vowel change; ĦAREĠ +-- <"a",_> => FormIII ; -- ĦARES > ĦÂRES --- impossible to detect! + <"ie","ie"> => FormI ; -- no vowel change; MIET + _ => FormIII -- QAGĦAD > QIEGĦED + } ; + + -- Form IV + "wera" => FormIV ; + "għama" => FormIV ; + "għana" => FormIV ; + + -- Form V + -- c0 is T, OR c0 and c1 are equal + -- c2 and c3 are equal + "t" + c1@#Consonant + v1@#Vowel + c2@#Consonant + c3@#Consonant + v2@#Vowel + c4@#Consonant => -- TWAQQAF + if_then_else VDerivedForm (pbool2bool (eqStr c2 c3)) FormV FormUnknown ; + c0@#DoublingConsT + c1@#DoublingConsT + v1@#Vowel + c2@#Consonant + c3@#Consonant + v2@#Vowel + c4@#Consonant => -- SARRAF + if_then_else + VDerivedForm + (andB (pbool2bool (eqStr c0 c1)) (pbool2bool (eqStr c2 c3))) + FormV FormUnknown ; + + -- Form VI + -- c0 is T, OR c0 and c1 are equal + -- v1 is long + "t" + c1@#Consonant + v1@("a"|"ie") + c2@#Consonant + v2@#Vowel + c3@#Consonant => FormVI ; -- TQIEGĦED + c0@#DoublingConsT + c1@#DoublingConsT + v1@("a"|"ie") + c2@#Consonant + v2@#Vowel + c3@#Consonant => -- ĠĠIELED + if_then_else VDerivedForm (pbool2bool (eqStr c0 c1)) FormVI FormUnknown ; + + -- Form VII + -- c0 is N, OR c0 is NT, OR c0 is N-T + "n" + c1@#Consonant + v1@#Vowel + c2@#Consonant + v2@#Vowel + c3@#Consonant => FormVII ; -- NĦASEL + "nt" + c1@#Consonant + _ => FormVII ; -- NTQAL + "nt" + c1@#Vowel + _ => case root.C1 of { + "n" => FormVIII ; -- NTESA (N-S-J) + _ => FormVII -- NTIŻEN (W-Ż-N) + } ; + "nst" + _ => FormVII ; -- NSTAB + "nxt" + _ => FormVII ; -- NXTAMM + + -- Form VIII + -- c2 is T + c1@#Consonant + "t" + v1@#Vowel + c3@#Consonant + _ => + case of { + <"s", "s"> => FormVIII ; -- STABAT (S-B-T) + <"s", _> => FormX ; -- STAĦBA (Ħ-B-A) + _ => FormVIII -- MTEDD, XTEĦET + } ; + + -- Form IX + c1@#Consonant + c2@#Consonant + v1@("a"|"ie") + c3@#Consonant => FormIX ; -- SFAR, BLIEH + + -- Form X + "st" + v1@#Vowel + c2@#Consonant + c2@#Consonant + _ => FormX ; -- STAGĦĠEB, STAQSA + + -- boqq + _ => FormUnknown + } ; +-} -- 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Ġ) - classifyVerb : Str -> { c:VClass ; r:Root ; p:Pattern } = \mamma -> case mamma of { + classifyVerb : Str -> VerbInfo = \mamma -> + case mamma of { - -- Defective, BELA' - c1@#Consonant + v1@#Vowel + c2@#Consonant + v2@#Vowel + c3@( "għ" | "'" ) => - { c=Weak Defective ; r=(mkRoot c1 c2 "għ") ; p=(mkPattern v1 v2) } ; + -- Defective, BELA' + c1@#Consonant + v1@#Vowel + c2@#Consonant + v2@#Vowel + c3@( "għ" | "'" ) => + mkVerbInfo (Weak Defective) FormI (mkRoot c1 c2 "għ") (mkPattern 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) } ; + -- Lacking, MEXA + c1@#Consonant + v1@#Vowel + c2@#Consonant + v2@#Vowel => + mkVerbInfo (Weak Lacking) FormI (mkRoot c1 c2 "j") (mkPattern v1 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) } ; + -- Hollow, SAB + -- --- determining of middle radical is not right, e.g. SAB = S-J-B + c1@#Consonant + v1@"a" + c3@#Consonant => + mkVerbInfo (Weak Hollow) FormI (mkRoot c1 "w" c3) (mkPattern v1) ; + c1@#Consonant + v1@"ie" + c3@#Consonant => + mkVerbInfo (Weak Hollow) FormI (mkRoot c1 "j" c3) (mkPattern v1) ; - -- 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) } ; + -- Weak Assimilative, WAQAF + c1@#WeakCons + v1@#Vowel + c2@#Consonant + v2@#Vowel + c3@#Consonant => + mkVerbInfo (Weak Assimilative) FormI (mkRoot c1 c2 c3) (mkPattern v1 v2) ; - -- Strong Reduplicative, ĦABB - c1@#Consonant + v1@#Vowel + c2@#Consonant + c3@#Consonant => - { c=Strong Reduplicative ; r=(mkRoot c1 c2 c3) ; p=(mkPattern v1) } ; + -- Strong Geminated, ĦABB --- no checking that c2 and c3 are actually equal + c1@#Consonant + v1@#Vowel + c2@#Consonant + c3@#Consonant => + mkVerbInfo (Strong Geminated) FormI (mkRoot c1 c2 c3) (mkPattern v1) ; - -- 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 LiquidMedial, ŻELAQ + c1@#Consonant + v1@#Vowel + c2@(#LiquidCons | "għ") + v2@#Vowel + c3@#Consonant => + mkVerbInfo (Strong LiquidMedial) FormI (mkRoot c1 c2 c3) (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 Regular, QATEL + c1@#Consonant + v1@#Vowel + c2@#Consonant + v2@#Vowel + c3@#Consonant => + mkVerbInfo (Strong Regular) FormI (mkRoot c1 c2 c3) (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) } ; + -- Strong Quad, QAĊĊAT + c1@#Consonant + v1@#Vowel + c2@#Consonant + c3@#Consonant + v2@#Vowel + c4@#Consonant => + mkVerbInfo (Quad QStrong) FormI (mkRoot c1 c2 c3 c4) (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) } ; + -- Weak-Final Quad, PINĠA + c1@#Consonant + v1@#Vowel + c2@#Consonant + c3@#Consonant + v2@#Vowel => + mkVerbInfo (Quad QWeak) FormI (mkRoot c1 c2 c3 "j") (mkPattern v1 v2) ; - -- Assume it is a loan verb - _ => { c=Loan ; r=mkRoot ; p=mkPattern } - } ; + -- Assume it is a loan verb + _ => mkVerbInfo Loan FormUnknown + } ; + + -- Return the class for a given root + classifyRoot : Root -> VClass = \r -> + case of { + <#WeakCons, #Consonant, #Consonant, ""> => Weak Assimilative ; + <#Consonant, #WeakCons, #Consonant, ""> => Weak Hollow ; + <#Consonant, #Consonant, #WeakCons, ""> => Weak Lacking ; + <#Consonant, #Consonant, "għ", ""> => Weak Defective ; + <#Consonant, c2@#Consonant, c3@#Consonant, ""> => + if_then_else VClass (pbool2bool (eqStr c2 c3)) + (Strong Geminated) + (case c2 of { + #LiquidCons => Strong LiquidMedial ; + _ => Strong Regular + }) ; + <#Consonant, #Consonant, #Consonant, #WeakCons> => Quad QWeak ; + <#Consonant, #Consonant, #Consonant, #Consonant> => Quad QStrong ; + _ => Predef.error("Cannot classify root: "++r.C1++"-"++r.C2++"-"++r.C3++"-"++r.C4) --- this should never happen + } ; + + -- Just get the non-suffixed forms of a verb, for quick testing + plainVerbTable : V -> (VForm => Str) = \v -> + \\tense => v.s ! tense ! VSuffixNone ! Pos ; -- Smart paradigm for building a verb mkV : V = overload { @@ -331,729 +430,700 @@ resource ParadigmsMlt = open -- Params: mamma mkV : Str -> V = \mamma -> let - class = classifyVerb mamma ; + info = classifyVerb mamma ; in - 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 ; + case info.class of { + Strong Regular => strongV info.root info.patt ; + Strong LiquidMedial => liquidMedialV info.root info.patt ; + Strong Geminated => geminatedV info.root info.patt ; + Weak Assimilative => assimilativeV info.root info.patt ; + Weak Hollow => hollowV info.root info.patt ; + Weak Lacking => lackingV info.root info.patt ; + Weak Defective => defectiveV info.root info.patt ; + Quad QStrong => quadV info.root info.patt ; + Quad QWeak => quadWeakV info.root info.patt ; Loan => loanV mamma --- _ => Predef.error("Unimplemented") } ; -- 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 ; + info = classifyVerb mamma ; in - 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 ; + case info.class of { + Strong Regular => strongV root info.patt ; + Strong LiquidMedial => liquidMedialV root info.patt ; + Strong Geminated => geminatedV root info.patt ; + Weak Assimilative => assimilativeV root info.patt ; + Weak Hollow => hollowV root info.patt ; + Weak Lacking => lackingV root info.patt ; + Weak Defective => defectiveV root info.patt ; + Quad QStrong => quadV root info.patt ; + Quad QWeak => quadWeakV root info.patt ; 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 + info = classifyVerb mamma ; + in + case info.class of { + Strong Regular => strongV info.root info.patt imp_sg ; + Strong LiquidMedial => liquidMedialV info.root info.patt imp_sg ; + Strong Geminated => geminatedV info.root info.patt imp_sg ; + Weak Assimilative => assimilativeV info.root info.patt imp_sg ; + Weak Hollow => hollowV info.root info.patt imp_sg ; + Weak Lacking => lackingV info.root info.patt imp_sg ; + Weak Defective => defectiveV info.root info.patt imp_sg ; + Quad QStrong => quadV info.root info.patt imp_sg ; + Quad QWeak => quadWeakV info.root info.patt imp_sg ; + Loan => loanV mamma + } ; + + -- Params: mamma, root, imperative P2Sg + -- mkV : Str -> Root -> Str -> V = \mamma,root,imp_sg -> + -- let + -- info = classifyVerb mamma ; + -- in + -- case info.class of { + -- Strong Regular => strongV root info.patt imp_sg ; + -- Strong LiquidMedial => liquidMedialV root info.patt imp_sg ; + -- Strong Geminated => geminatedV root info.patt imp_sg ; + -- Weak Assimilative => assimilativeV root info.patt imp_sg ; + -- Weak Hollow => hollowV root info.patt imp_sg ; + -- Weak Lacking => lackingV root info.patt imp_sg ; + -- Weak Defective => defectiveV root info.patt imp_sg ; + -- Quad QStrong => quadV root info.patt imp_sg ; + -- Quad QWeak => quadWeakV root info.patt imp_sg ; + -- Loan => loanV mamma + -- } ; + + -- All forms! :S + -- mkV (Strong Regular) (FormI) (mkRoot "k-t-b") (mkPattern "i" "e") "ktibt" "ktibt" "kiteb" "kitbet" "ktibna" "ktibtu" "kitbu" "nikteb" "tikteb" "jikteb" "tikteb" "niktbu" "tiktbu" "jiktbu" "ikteb" "iktbu" + mkV : VClass -> VDerivedForm -> Root -> Pattern -> (_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> V = + \class, form, root, patt, + perfP1Sg, perfP2Sg, perfP3SgMasc, perfP3SgFem, perfP1Pl, perfP2Pl, perfP3Pl, + impfP1Sg, impfP2Sg, impfP3SgMasc, impfP3SgFem, impfP1Pl, impfP2Pl, impfP3Pl, + impSg, impPl -> + let + tbl : (VForm => Str) = table { + VPerf (AgP1 Sg) => perfP1Sg ; + VPerf (AgP2 Sg) => perfP2Sg ; + VPerf (AgP3Sg Masc) => perfP3SgMasc ; + VPerf (AgP3Sg Fem) => perfP3SgFem ; + VPerf (AgP1 Pl) => perfP1Pl ; + VPerf (AgP2 Pl) => perfP2Pl ; + VPerf (AgP3Pl) => perfP3Pl ; + VImpf (AgP1 Sg) => impfP1Sg ; + VImpf (AgP2 Sg) => impfP2Sg ; + VImpf (AgP3Sg Masc) => impfP3SgMasc ; + VImpf (AgP3Sg Fem) => impfP3SgFem ; + VImpf (AgP1 Pl) => impfP1Pl ; + VImpf (AgP2 Pl) => impfP2Pl ; + VImpf (AgP3Pl) => impfP3Pl ; + VImp (Pl) => impSg ; + VImp (Sg) => impPl } ; - 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 - } ; - 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 - } ; - c = class.c ; + info : VerbInfo = mkVerbInfo class form root patt impSg ; + in lin V { + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; } ; } ; --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 + -- Some shortcut function names (haven't decided on naming yet) + mkV_II : Str -> V = \s -> derivedV_II s ; + mkV_III : Str -> V = \s -> derivedV_III s ; + mkV_V : Str -> V = \s -> derivedV_V s ; + mkV_VI : Str -> V = \s -> derivedV_VI s ; + mkV_VII : Str -> Str -> V = \s,t -> derivedV_VII s t ; + mkV_VIII : Str -> V = \s -> derivedV_VIII s ; + mkV_IX : Str -> V = \s -> derivedV_IX s ; + mkV_X : Str -> Str -> V = \s,t -> derivedV_X s t ; + derivedV_I : Str -> V = mkV ; + + -- Make a Form II verb. Accepts both Tri & Quad roots, then delegates. + -- e.g.: derivedV_II "waqqaf" + derivedV_II : V = overload { + derivedV_II : Str -> V = \mammaII -> + case mammaII of { + -- Quad Form II +-- "t" + #Consonant + _ => derivedV_QuadII mammaII root4 ; -- TFIXKEL +-- #DoublingConsT + #DoublingConsT + _ => derivedV_QuadII mammaII root4 ; -- DDARDAR + #Consonant + #Consonant + _ => derivedV_QuadII mammaII root4 where { + mammaI4 : Str = dropPfx 1 mammaII ; + root4 : Root = (classifyVerb mammaI4).root ; + } ; -- DDARDAR + + -- Tri Form II + _ => derivedV_TriII mammaII root3 where { + mammaI3 : Str = delCharAt 3 mammaII ; --- this works because the only verb with a duplicated GĦ is ŻAGĦGĦAR (make smaller) + root3 : Root = (classifyVerb mammaI3).root ; + } + } ; + derivedV_II : Str -> Root -> V = \mammaII, root -> + case root.C4 of { + "" => derivedV_TriII mammaII root ; + _ => derivedV_QuadII mammaII root + } ; + derivedV_II : Str -> Str -> Root -> V = \mammaII, imp, root -> + case root.C4 of { + "" => derivedV_TriII mammaII root ; + _ => derivedV_QuadII mammaII imp root + } ; } ; - {- ----- Strong Verb ----- -} + -- Make a Tri-Consonantal Form II verb + derivedV_TriII : Str -> Root -> V = \mammaII, root -> + let + class : VClass = classifyRoot root ; + patt : Pattern = extractPattern mammaII ; + imp : Str = case mammaII of { + nehh + "a" => nehh + "i" ; --- maybe too generic? + _ => mammaII --- assumption: mamma II is also imperative + } ; + newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ; + in lin V { + s = conjFormII newinfo ; + i = newinfo ; + } ; + + -- Make a Quadri-Consonantal Form II verb + derivedV_QuadII : V = overload { + derivedV_QuadII : Str -> Root -> V = \mammaII, root -> + let + class : VClass = classifyRoot root ; + patt : Pattern = extractPattern mammaII ; + imp : Str = mammaII ; --- assumption: mamma II is also imperative + newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ; + in lin V { + s = conjFormII_quad newinfo ; + i = newinfo ; + } ; + derivedV_QuadII : Str -> Str -> Root -> V = \mammaII, imp, root -> + let + class : VClass = classifyRoot root ; + patt : Pattern = extractPattern mammaII ; + newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ; + in lin V { + s = conjFormII_quad newinfo ; + i = newinfo ; + } ; + } ; + + -- Make a Form III verb + -- e.g.: derivedV_III "qiegħed" +-- derivedV_III : V = overload { + derivedV_III : Str -> V = \mammaIII -> + let + info : VerbInfo = classifyVerb (ie2i mammaIII) ; + vowels : Pattern = extractPattern mammaIII ; + vowels2 : Pattern = case of { -- see {GO pg93} + <{C2="għ"},{V1="ie";V2="e"}> => mkPattern "e" "i" ; -- QIEGĦED > QEGĦIDKOM + <_,{V1="ie";V2="e"}> => mkPattern "i" "i" ; -- WIEĠEB > WIĠIBKOM + _ => vowels + } ; + newinfo : VerbInfo = mkVerbInfo info.class FormIII info.root vowels vowels2 mammaIII ; --- assumption: mamma III is also imperative + in lin V { + s = conjFormIII newinfo ; + i = newinfo ; + } ; +-- } ; + + -- No point having a paradigm for Form IV + -- derivedV_IV + + -- Make a Form V verb + -- e.g.: derivedV_V "twaqqaf" +-- derivedV_V : V = overload { + derivedV_V : Str -> V = \mammaV -> + let + -- use the Form II conjugation, just prefixing a T + mammaII : Str = dropPfx 1 mammaV ; -- WAQQAF + vII : V = derivedV_II mammaII ; + newinfo : VerbInfo = mkVerbInfo vII.i.class FormV vII.i.root vII.i.patt mammaV ; + in lin V { + s = table { + VPerf agr => \\suffix,pol => pfx_T (vII.s ! VPerf agr ! suffix ! pol) ; + VImpf (AgP1 Sg) => \\suffix,pol => pfx "ni" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP1 Sg) ! suffix ! pol))) ; + VImpf (AgP2 Sg) => \\suffix,pol => pfx "ti" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP2 Sg) ! suffix ! pol))) ; + VImpf (AgP3Sg Masc) => \\suffix,pol => pfx "ji" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP3Sg Masc) ! suffix ! pol))) ; + VImpf (AgP3Sg Fem) => \\suffix,pol => pfx "ti" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP3Sg Fem) ! suffix ! pol))) ; + VImpf (AgP1 Pl) => \\suffix,pol => pfx "ni" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP1 Pl) ! suffix ! pol))) ; + VImpf (AgP2 Pl) => \\suffix,pol => pfx "ti" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP2 Pl) ! suffix ! pol))) ; + VImpf (AgP3Pl) => \\suffix,pol => pfx "ji" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP3Pl) ! suffix ! pol))) ; + VImp num => \\suffix,pol => pfx_T (vII.s ! VImp num ! suffix ! pol) + } ; + i = newinfo ; + } ; +-- } ; + + -- Make a Form VI verb + -- e.g.: derivedV_VI "tqiegħed" +-- derivedV_VI : V = overload { + derivedV_VI : Str -> V = \mammaVI -> + let + -- use the Form III conjugation, just prefixing a T + mammaIII : Str = dropPfx 1 mammaVI ; -- QIEGĦED + vIII : V = derivedV_III mammaIII ; + newinfo : VerbInfo = updateVerbInfo vIII.i FormVI mammaVI ; + in lin V { + s = table { + VPerf agr => \\suffix,pol => pfx_T (vIII.s ! VPerf agr ! suffix ! pol) ; + VImpf (AgP1 Sg) => \\suffix,pol => pfx "ni" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP1 Sg) ! suffix ! pol))) ; + VImpf (AgP2 Sg) => \\suffix,pol => pfx "ti" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP2 Sg) ! suffix ! pol))) ; + VImpf (AgP3Sg Masc) => \\suffix,pol => pfx "ji" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP3Sg Masc) ! suffix ! pol))) ; + VImpf (AgP3Sg Fem) => \\suffix,pol => pfx "ti" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP3Sg Fem) ! suffix ! pol))) ; + VImpf (AgP1 Pl) => \\suffix,pol => pfx "ni" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP1 Pl) ! suffix ! pol))) ; + VImpf (AgP2 Pl) => \\suffix,pol => pfx "ti" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP2 Pl) ! suffix ! pol))) ; + VImpf (AgP3Pl) => \\suffix,pol => pfx "ji" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP3Pl) ! suffix ! pol))) ; + VImp num => \\suffix,pol => pfx_T (vIII.s ! VImp num ! suffix ! pol) + } ; + i = newinfo ; + } ; +-- } ; + + -- Make a Form VII verb + -- e.g.: derivedV_VII "xeħet" "nxteħet" +-- derivedV_VII : V = overload { + derivedV_VII : Str -> Str -> V = \mammaI,mammaVII -> + let + info : VerbInfo = classifyVerb mammaI ; + c1 : Str = case mammaVII of { + "n" + c@#C + "t" + _ => "n"+c+"t" ; -- NXT-EĦET + "ntgħ" + _ => "ntgħ" ; -- NTGĦ-AĠEN + "nt" + c@#C + _ => "nt"+c ; -- NTR-IFES + "nt" + #Vowel + _ => "nt" ; -- NT-IŻEN + "n" + c@#C + _ => "n"+c ; -- NĦ-ASEL + _ => "nt" --- unknown case + } ; + newinfo : VerbInfo = mkVerbInfo info.class FormVII info.root info.patt mammaVII ; + in lin V { + s = conjFormVII newinfo c1 ; + i = newinfo ; + } ; +-- } ; + + -- Make a Form VIII verb + -- e.g.: derivedV_VIII "xteħet" +-- derivedV_VIII : V = overload { + derivedV_VIII : Str -> V = \mammaVIII -> + let + mammaI : Str = delCharAt 1 mammaVIII ; + info : VerbInfo = classifyVerb mammaI ; + c1 : Str = info.root.C1+"t"; + newinfo : VerbInfo = updateVerbInfo info FormVIII mammaVIII ; + in lin V { + s = conjFormVII newinfo c1 ; -- note we use conjFormVIII ! + i = newinfo ; + } ; +-- } ; + + -- Make a Form IX verb + -- e.g.: derivedV_IX "sfar" +-- derivedV_IX : V = overload { + derivedV_IX : Str -> V = \mammaIX -> + case mammaIX of { + c1@#Consonant + c2@#Consonant + v1@("ie"|"a") + c3@#Consonant => + let + root : Root = mkRoot c1 c2 c3 ; + patt : Pattern = mkPattern v1 ; + class : VClass = classifyRoot root ; + newinfo : VerbInfo = mkVerbInfo class FormIX root patt mammaIX ; + in lin V { + s = conjFormIX newinfo ; + i = newinfo ; + } ; + _ => Predef.error("I don't know how to make a Form IX verb out of" ++ mammaIX) + } ; +-- } ; + + -- Make a Form X verb + derivedV_X : V = overload { + -- e.g.: derivedV_X "stagħġeb" (mkRoot "għ-ġ-b") + derivedV_X : Str -> Root -> V = \mammaX,root -> + let + class : VClass = classifyRoot root ; + patt : Pattern = extractPattern mammaX ; + newinfo : VerbInfo = mkVerbInfo class FormX root patt mammaX ; + in lin V { + s = conjFormX newinfo ; + i = newinfo ; + } ; + -- e.g.: derivedV_X "stagħġeb" "għ-ġ-b" + derivedV_X : Str -> Str -> V = \mammaX,str_root -> + let + root : Root = mkRoot str_root ; + class : VClass = classifyRoot root ; + patt : Pattern = extractPattern mammaX ; + newinfo : VerbInfo = mkVerbInfo class FormX root patt mammaX ; + in lin V { + s = conjFormX newinfo ; + i = newinfo ; + } ; + } ; + + {- ~~~ Strong Verb ~~~ -} -- Regular strong verb ("sħiħ"), eg KITEB - -- Params: Root, Pattern - strongV : Root -> Pattern -> V = \r,p -> + strongV : V = overload { + + -- Params: root, pattern + strongV : Root -> Pattern -> V = \root,patt -> + let imp = conjStrongImp root patt + in strongVWorst root patt imp ; + + -- Params: root, pattern, imperative P2Sg + strongV : Root -> Pattern -> Str -> V =\root,patt,imp_sg -> + let + imp = table { + Sg => imp_sg ; + Pl => (takePfx 3 imp_sg) + root.C3 + "u" -- IFTAĦ > IFTĦU + } ; + in strongVWorst root patt imp ; + + } ; + + -- Worst case for strong verb + strongVWorst : Root -> Pattern -> (Number => Str) -> V = \root,patt,imp -> let - imp = conjStrongImp r p ; - in lin V { - s = table { - VPerf agr => ( conjStrongPerf r p ) ! agr ; + tbl : (VForm => Str) = table { + VPerf agr => ( conjStrongPerf root patt ) ! agr ; VImpf agr => ( conjStrongImpf (imp ! Sg) (imp ! Pl) ) ! agr ; VImp n => imp ! n - } ; - c = Strong Regular ; + } ; + info : VerbInfo = mkVerbInfo (Strong Regular) (FormI) root patt (imp ! Sg) ; + in lin V { + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; } ; - -- Conjugate entire verb in PERFECT tense - -- Params: Root, Pattern - conjStrongPerf : Root -> Pattern -> (Agr => Str) = \root,p -> - let - 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 { - 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) - conjStrongImpf = conjGenericImpf ; - - -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns - -- Params: Root, Pattern - conjStrongImp : Root -> Pattern -> (Number => Str) = \root,p -> - let - 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" => "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 { - Sg => stem_sg ; -- Inti: IKTEB - Pl => stem_pl + "u" -- Intom: IKTBU - } ; - - {- ----- Liquid-Medial Verb ----- -} + {- ~~~ Liquid-Medial Verb ~~~ -} -- Liquid-medial strong verb, eg ŻELAQ - -- Params: Root, Pattern - liquidMedialV : Root -> Pattern -> V = \r,p -> + liquidMedialV : V = overload { + + -- Params: root, pattern + liquidMedialV : Root -> Pattern -> V = \root,patt -> + let imp = conjLiquidMedialImp root patt + in liquidMedialVWorst root patt imp ; + + -- Params: root, pattern, imperative P2Sg + liquidMedialV : Root -> Pattern -> Str -> V = \root,patt,imp_sg -> + let + vowels = extractPattern imp_sg ; + imp = table { + Sg => imp_sg ; + Pl => case root.C1 of { + "għ" => vowels.V1 + root.C1 + root.C2 + root.C3 + "u" ; -- AGĦMEL > AGĦMLU + _ => vowels.V1 + root.C1 + vowels.V2 + root.C2 + root.C3 + "u" -- OĦROĠ > OĦORĠU + } + } ; + in liquidMedialVWorst root patt imp ; + + } ; + + -- Worst case for liquid medial strong verb + liquidMedialVWorst : Root -> Pattern -> (Number => Str) -> V = \root,patt,imp -> let - imp = conjLiquidMedialImp r p ; - in lin V { - s = table { - VPerf agr => ( conjLiquidMedialPerf r p ) ! agr ; + tbl : (VForm => Str) = table { + VPerf agr => ( conjLiquidMedialPerf root patt ) ! agr ; VImpf agr => ( conjLiquidMedialImpf (imp ! Sg) (imp ! Pl) ) ! agr ; VImp n => imp ! n - } ; - c = Strong LiquidMedial ; - } ; - - -- Conjugate entire verb in PERFECT tense - -- Params: Root, Pattern - conjLiquidMedialPerf : Root -> Pattern -> (Agr => Str) = \root,p -> - let - 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 { - 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 ; + } ; + info : VerbInfo = mkVerbInfo (Strong LiquidMedial) (FormI) root patt (imp ! Sg) ; 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 ; + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; } ; - -- Conjugate entire verb in PERFECT tense - -- Params: Root, Pattern - conjReduplicativePerf : Root -> Pattern -> (Agr => Str) = \root,p -> + {- ~~~ Geminated Verb ~~~ -} + + -- Geminated strong verb ("trux"), eg ĦABB + geminatedV : V = overload { + + -- Params: root, pattern + geminatedV : Root -> Pattern -> V = \root,patt -> + let imp = conjGeminatedImp root patt + in geminatedVWorst root patt imp ; + + -- Params: root, pattern, imperative P2Sg + geminatedV : Root -> Pattern -> Str -> V = \root,patt,imp_sg -> + let + imp = table { + Sg => imp_sg ; + Pl => imp_sg + "u" -- ŻOMM > ŻOMMU + } ; + in geminatedVWorst root patt imp ; + + }; + + -- Worst case for reduplicated verb + geminatedVWorst : Root -> Pattern -> (Number => Str) -> V = \root,patt,imp -> 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 - } ; + tbl : (VForm => Str) = table { + VPerf agr => ( conjGeminatedPerf root patt ) ! agr ; + VImpf agr => ( conjGeminatedImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! n + } ; + info : VerbInfo = mkVerbInfo (Strong Geminated) (FormI) root patt (imp ! Sg) ; + in lin V { + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; + } ; - -- Conjugate entire verb in IMPERFECT tense, given the IMPERATIVE - -- Params: Imperative Singular (eg IKTEB), Imperative Plural (eg IKTBU) - conjReduplicativeImpf = conjGenericImpf ; - - -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns - -- Params: Root, Pattern - conjReduplicativeImp : Root -> Pattern -> (Number => Str) = \root,p -> - let - 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 => stem_sg ; -- Inti: ĦOBB - Pl => stem_sg + "u" -- Intom: ĦOBBU - } ; - - {- ----- Assimilative Verb ----- -} + {- ~~~ Assimilative Verb ~~~ -} -- Assimilative weak verb, eg WASAL - -- Params: Root, Pattern - assimilativeV : Root -> Pattern -> V = \r,p -> + assimilativeV : V = overload { + + -- Params: root, pattern + assimilativeV : Root -> Pattern -> V = \root,patt -> + let imp = conjAssimilativeImp root patt + in assimilativeVWorst root patt imp ; + + -- Params: root, pattern, imperative P2Sg + assimilativeV : Root -> Pattern -> Str -> V =\root,patt,imp_sg -> + let + imp = table { + Sg => imp_sg ; + Pl => (dropSfx 2 imp_sg) + root.C3 + "u" -- ASAL > ASLU + } ; + in assimilativeVWorst root patt imp ; + + } ; + + -- Worst case for assimilative verb + assimilativeVWorst : Root -> Pattern -> (Number => Str) -> V = \root,patt,imp -> let - imp = conjAssimilativeImp r p ; - in lin V { - s = table { - VPerf agr => ( conjAssimilativePerf r p ) ! agr ; + tbl : (VForm => Str) = table { + VPerf agr => ( conjAssimilativePerf root patt ) ! agr ; VImpf agr => ( conjAssimilativeImpf (imp ! Sg) (imp ! Pl) ) ! agr ; VImp n => imp ! n - } ; - c = Weak Assimilative ; + } ; + patt2 : Pattern = case (imp!Sg) of { + "ie"+_ => mkPattern "i" patt.V2 ; -- (WAQAF) IEQAF > TIQAFLI + _ => patt -- (WASAL) ASAL > TASALLI + } ; + info : VerbInfo = mkVerbInfo (Weak Assimilative) (FormI) root patt patt2 (imp ! Sg) ; + in lin V { + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; } ; - -- Conjugate entire verb in PERFECT tense - -- Params: Root, Pattern - conjAssimilativePerf : Root -> Pattern -> (Agr => Str) = \root,p -> - let - wasal = root.C1 + p.V1 + root.C2 + p.V2 + root.C3 ; - wasl = root.C1 + p.V1 + root.C2 + root.C3 ; - in - table { - 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 ASAL), Imperative Plural (eg ASLU) - conjAssimilativeImpf = conjGenericImpf ; - - -- Conjugate entire verb in IMPERATIVE tense, infers vowel patterns - -- Params: Root, Pattern - conjAssimilativeImp : Root -> Pattern -> (Number => Str) = \root,p -> - table { - Sg => p.V1 + root.C2 + p.V2 + root.C3 ; -- Inti: ASAL - Pl => p.V1 + root.C2 + root.C3 + "u" -- Intom: ASLU - } ; - - {- ----- Hollow Verb ----- -} + {- ~~~ Hollow Verb ~~~ -} -- Hollow weak verb, eg SAR (S-J-R) - -- Params: Root, Pattern - hollowV : Root -> Pattern -> V = \r,p -> + hollowV : V = overload { + + -- Params: root, pattern + hollowV : Root -> Pattern -> V = \root,patt -> + let imp = conjHollowImp root patt + in hollowVWorst root patt imp ; + + -- Params: root, pattern, imperative P2Sg + hollowV : Root -> Pattern -> Str -> V =\root,patt,imp_sg -> + let + imp = table { + Sg => imp_sg ; + Pl => imp_sg + "u" -- SIR > SIRU + } ; + in hollowVWorst root patt imp ; + + } ; + + -- Worst case for hollow verb + hollowVWorst : Root -> Pattern -> (Number => Str) -> V = \root,patt,imp -> let - imp = conjHollowImp r p ; - in lin V { - s = table { - VPerf agr => ( conjHollowPerf r p ) ! agr ; + tbl : (VForm => Str) = table { + VPerf agr => ( conjHollowPerf root patt ) ! 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 ; + patt2 : Pattern = case patt.V1 of { + "ie" => mkPattern "i" patt.V2 ; -- (ŻIED) ŻID > ŻIDLI + _ => patt -- (MAR) MUR > MURLI + } ; + info : VerbInfo = mkVerbInfo (Weak Hollow) (FormI) root patt patt2 (imp ! Sg) ; 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 ; + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; } ; - -- Conjugate entire verb in PERFECT tense - -- Params: Root, Pattern - conjWeakFinalPerf : Root -> Pattern -> (Agr => Str) = \root,p -> + {- ~~~ Lacking Verb ~~~ -} + + -- Lacking (nieqes) verb, eg MEXA (M-X-J) + lackingV : V = overload { + + -- Params: root, pattern + lackingV : Root -> Pattern -> V = \root,patt -> + let imp = conjLackingImp root patt + in lackingVWorst root patt imp ; + + -- Params: root, pattern, imperative P2Sg + lackingV : Root -> Pattern -> Str -> V =\root,patt,imp_sg -> + let + imp = table { + Sg => imp_sg ; + Pl => case imp_sg of { + aqr+"a" => aqr+"aw" ; -- AQRA > AQRAW + imx+"i" => imx+"u" ; -- IMXI > IMXU + x => (dropSfx 1 x) + "u" --- unknown case + } + } ; + in lackingVWorst root patt imp ; + + } ; + + -- Worst case for lacking verb + lackingVWorst : Root -> Pattern -> (Number => Str) -> V = \root,patt,imp -> 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 + tbl : (VForm => Str) = table { + VPerf agr => ( conjLackingPerf root patt ) ! agr ; + VImpf agr => ( conjLackingImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! n } ; - 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 + info : VerbInfo = mkVerbInfo (Weak Lacking) (FormI) root patt (imp ! Sg) ; + in lin V { + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; } ; - {- ----- Defective Verb ----- -} + {- ~~~ 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 ; + defectiveV : V = overload { + + -- Params: root, pattern + defectiveV : Root -> Pattern -> V = \root,patt -> + let imp = conjDefectiveImp root patt + in defectiveVWorst root patt imp ; + + -- Params: root, pattern, imperative P2Sg + defectiveV : Root -> Pattern -> Str -> V =\root,patt,imp_sg -> + let + imp = table { + Sg => imp_sg ; + Pl => (takePfx 2 imp_sg) + "i" + root.C2 + "għu" -- ISMA' > ISIMGĦU + } ; + in defectiveVWorst root patt imp ; + } ; - -- Conjugate entire verb in PERFECT tense - -- Params: Root, Pattern - conjDefectivePerf : Root -> Pattern -> ( Agr => Str ) = \root,p -> + -- Worst case for defective verb + defectiveVWorst : Root -> Pattern -> (Number => Str) -> V = \root,patt,imp -> 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 - } ; + tbl : (VForm => Str) = table { + VPerf agr => ( conjDefectivePerf root patt ) ! agr ; + VImpf agr => ( conjDefectiveImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! n + } ; + info : VerbInfo = mkVerbInfo (Weak Defective) (FormI) root patt (imp ! Sg) ; + in lin V { + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; + } ; - -- 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) ----- -} + {- ~~~ Quadriliteral Verb (Strong) ~~~ -} -- Make a Quad verb, eg DENDEL (D-L-D-L) - -- Params: Root, Pattern - quadV : Root -> Pattern -> V = \r,p -> + quadV : V = overload { + + -- Params: root, pattern + quadV : Root -> Pattern -> V = \root,patt -> + let imp = conjQuadImp root patt + in quadVWorst root patt imp ; + + -- Params: root, pattern, imperative P2Sg + quadV : Root -> Pattern -> Str -> V =\root,patt,imp_sg -> + let + imp = table { + Sg => imp_sg ; + Pl => (takePfx 4 imp_sg) + root.C4 + "u" -- ĦARBAT > ĦARBTU + } ; + in quadVWorst root patt imp ; + + } ; + + -- Worst case for quad verb + quadVWorst : Root -> Pattern -> (Number => Str) -> V = \root,patt,imp -> let - imp = conjQuadImp r p ; - in lin V { - s = table { - VPerf agr => ( conjQuadPerf r p ) ! agr ; + tbl : (VForm => Str) = table { + VPerf agr => ( conjQuadPerf root patt ) ! agr ; VImpf agr => ( conjQuadImpf (imp ! Sg) (imp ! Pl) ) ! agr ; VImp n => imp ! n } ; - c = Strong Quad ; + info : VerbInfo = mkVerbInfo (Quad QStrong) (FormI) root patt (imp ! Sg) ; + in lin V { + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; } ; - -- 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) ----- -} + {- ~~~ 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 -> + quadWeakV : V = overload { + + -- Params: root, pattern + quadWeakV : Root -> Pattern -> V = \root,patt -> + let imp = conjQuadWeakImp root patt + in quadWeakVWorst root patt imp ; + + -- Params: root, pattern, imperative P2Sg + quadWeakV : Root -> Pattern -> Str -> V =\root,patt,imp_sg -> + let + imp = table { + Sg => imp_sg ; + Pl => case (takeSfx 1 imp_sg) of { + "a" => imp_sg + "w" ; -- KANTA > KANTAW + _ => (dropSfx 1 imp_sg) + "u" -- SERVI > SERVU + } + } ; + in quadWeakVWorst root patt imp ; + + } ; + + -- Worst case for quadWeak verb + quadWeakVWorst : Root -> Pattern -> (Number => Str) -> V = \root,patt,imp -> let - imp = conjQuadWeakImp r p ; - in lin V { - s = table { - VPerf agr => ( conjQuadWeakPerf r p ) ! agr ; + tbl : (VForm => Str) = table { + VPerf agr => ( conjQuadWeakPerf root patt (imp ! Sg) ) ! agr ; VImpf agr => ( conjQuadWeakImpf (imp ! Sg) (imp ! Pl) ) ! agr ; VImp n => imp ! n } ; - c = Weak QuadWeakFinal ; + info : VerbInfo = mkVerbInfo (Quad QWeak) (FormI) root patt (imp ! Sg) ; + in lin V { + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; } ; - -- Conjugate entire verb in PERFECT tense - conjQuadWeakPerf : (Agr => Str) = overload { + {- ~~~ Non-semitic verbs ~~~ -} - -- 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} + -- Make a loan verb, eg IPPARKJA -- Params: mamma - loanV : Str -> V = \kanta -> + loanV : Str -> V = \mamma -> 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 + imp = conjLoanImp mamma ; + tbl : (VForm => Str) = table { + VPerf agr => ( conjLoanPerf mamma ) ! agr ; + VImpf agr => ( conjLoanImpf (imp ! Sg) (imp ! Pl) ) ! agr ; + VImp n => imp ! 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" ; + info : VerbInfo = mkVerbInfo (Loan) (FormI) (imp ! Sg) ; 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 ; - } ; - + s = verbPolarityTable info (verbPronSuffixTable info tbl) ; + i = info ; } ; {- ===== Adjective Paradigms ===== -} -- Overloaded function for building an adjective - -- Return: Adjective mkA : A = overload { -- Same form for gender and number; no comparative form. @@ -1129,7 +1199,7 @@ resource ParadigmsMlt = open -- Determine femininine form of adjective from masculine determineAdjFem : Str -> Str ; determineAdjFem masc = case masc of { - _ + "ef" => (tk 2 masc) + "fa" ; -- NIEXEF + _ + "ef" => (dropSfx 2 masc) + "fa" ; -- NIEXEF _ + "u" => (init masc) + "a" ; -- BRAVU _ + "i" => masc + "ja" ; -- MIMLI _ => masc + "a" -- VOJT diff --git a/lib/src/maltese/ResMlt.gf b/lib/src/maltese/ResMlt.gf index de0c2d857..af929058e 100644 --- a/lib/src/maltese/ResMlt.gf +++ b/lib/src/maltese/ResMlt.gf @@ -12,25 +12,38 @@ resource ResMlt = ParamX - [Tense] ** open Prelude, Predef in { param + {- General -} + Gender = Masc | Fem ; + GenNum = + GSg Gender -- dak, dik + | GPl ; -- dawk + + Agr = + AgP1 Number -- jiena, aħna + | AgP2 Number -- inti, intom + | AgP3Sg Gender -- huwa, hija + | AgP3Pl -- huma + ; + NPCase = Nom | Gen ; + Animacy = + Animate + | Inanimate + ; + + -- Definiteness = + -- Definite -- eg IL-KARTA. In this context same as Determinate + -- | Indefinite -- eg KARTA + -- ; + + {- Numerals -} CardOrd = NCard | NOrd ; - Num_Number = - Num_Sg - | Num_Dl - | Num_Pl - ; - - -- oper - -- Num_Number : Type = { n : Number ; isDual : Bool } ; - - param - DForm = Unit -- 0..10 | Teen -- 11-19 @@ -39,10 +52,18 @@ resource ResMlt = ParamX - [Tense] ** open Prelude, Predef in { | Hund -- 100..999 --| Thou -- 1000+ ; + + Num_Number = + Num_Sg + | Num_Dl + | Num_Pl + ; + Num_Case = NumNominative -- TNEJN, ĦAMSA, TNAX, MIJA | NumAdjectival ; -- ŻEWĠ, ĦAMES, TNAX-IL, MITT + {- Nouns -} Noun_Sg_Type = @@ -63,49 +84,8 @@ resource ResMlt = ParamX - [Tense] ** open Prelude, Predef in { NRegular -- WIĊĊ | NPronSuffix Agr ; -- WIĊĊU - {- Other... -} - GenNum = GSg Gender | GPl ; -- masc/fem/plural, e.g. adjective inflection - - Animacy = - Animate - | Inanimate - ; - - Definiteness = - Definite -- eg IL-KARTA. In this context same as Determinate - | Indefinite -- eg KARTA - ; - --- Person = P1 | P2 | P3 ; --- State = Def | Indef | Const ; --- Mood = Ind | Cnj | Jus ; --- Voice = Act | Pas ; - --- Order = Verbal | Nominal ; - - -- Agreement features - Agr = - 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 - -- | 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 - -- ; + {- Verb -} -- Possible verb forms (tense + person) VForm = @@ -117,6 +97,14 @@ resource ResMlt = ParamX - [Tense] ** open Prelude, Predef in { -- | VVerbalNoun -- Verbal Noun ; + -- Inflection of verbs for pronominal suffixes + VSuffixForm = + VSuffixNone -- eg FTAĦT + | VSuffixDir Agr -- eg FTAĦTU + | VSuffixInd Agr -- eg FTAĦTLU + | VSuffixDirInd GenNum Agr -- eg FTAĦTHULU. D.O. is necessarily 3rd person. + ; + VDerivedForm = FormI | FormII @@ -126,34 +114,38 @@ resource ResMlt = ParamX - [Tense] ** open Prelude, Predef in { | FormVI | FormVII | FormVIII - | FormXI + | FormIX | FormX + | FormUnknown ; -- Verb classification VClass = Strong VStrongClass | Weak VWeakClass - | Loan --- temporary - -- | Romance - -- | English + | Quad VQuadClass + | Loan +-- | Irregular ; - VStrongClass = Regular | LiquidMedial - | Reduplicative - | Quad + | Geminated ; - VWeakClass = Assimilative | Hollow - | WeakFinal + | Lacking | Defective - | QuadWeakFinal ; - + VQuadClass = + QStrong + | QWeak + ; + -- VRomanceEnding = + -- _ARE -- kanta + -- | _ERE | _IRE -- vinċa, serva --- we don't need this distinction, just always use IRE + -- ; -- VQuadClass = -- BiradicalBase -- | RepeatedC3 @@ -161,22 +153,10 @@ resource ResMlt = ParamX - [Tense] ** open Prelude, Predef in { -- | 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 - ; + {- Adjective -} - -- For Adjectives AForm = --- AF Degree GenNum APosit GenNum | ACompar | ASuperl @@ -184,68 +164,143 @@ resource ResMlt = ParamX - [Tense] ** open Prelude, Predef in { oper - -- Roots & Patterns + {- ===== Type declarations ===== -} + + Noun : Type = { + s : Noun_Number => NForm => Str ; + g : Gender ; + -- anim : Animacy ; -- is the noun animate? e.g. TABIB + } ; + + ProperNoun : Type = { + s : Str ; + g : Gender ; + } ; + + Verb : Type = { + s : VForm => VSuffixForm => Polarity => Str ; + i : VerbInfo ; + } ; + + VerbInfo : Type = { + class : VClass ; + form : VDerivedForm ; + root : Root ; -- radicals + patt : Pattern ; -- vowels extracted from mamma + patt2: Pattern ; -- vowel changes; default to patt (experimental) + -- in particular, patt2 is used to indicate whether an IE sould be shortened + -- to an I or an E (same for entire verb) + imp : Str ; -- Imperative Sg. Gives so much information jaħasra! + } ; + + Adjective : Type = { + s : AForm => Str ; + } ; + + + {- ===== Some character classes ===== -} + + Letter : pattern Str = #( "a" | "b" | "ċ" | "d" | "e" | "f" | "ġ" | "g" | "għ" | "h" | "ħ" | "i" | "ie" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "ż" | "z" ); + 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" + LiquidCons : pattern Str = #( "l" | "m" | "n" | "r" | "għ" ); + SonorantCons : pattern Str = #( "l" | "m" | "n" | "r" ); -- See {SA pg13}. Currently unused, but see DoublingConsN below + DoublingConsT : pattern Str = #( "ċ" | "d" | "ġ" | "s" | "x" | "ż" | "z" ); -- require doubling when prefixed with 't', eg DDUM, ĠĠORR, SSIB, TTIR, ŻŻID {GM pg68,2b} {OM pg90} + DoublingConsN : pattern Str = #( "l" | "m" | "r" ); -- require doubling when prefixed with 'n', eg LLAĦĦAQ, MMUR, RRID {OM pg90} + WeakCons : pattern Str = #( "j" | "w" ); + Vowel : pattern Str = #( "a" | "e" | "i" | "o" | "u" ); + VowelIE : pattern Str = #( "a" | "e" | "i" | "ie" | "o" | "u" ); + Digraph : pattern Str = #( "ie" ); + SemiVowel : pattern Str = #( "għ" | "j" ); + + V = Vowel ; + C = Consonant ; + LC = LiquidCons ; + + EorI : Str = "e" | "i" ; + IorE : Str = "i" | "e" ; + + {- ===== Roots & Patterns ===== -} + Pattern : Type = {V1, V2 : Str} ; - -- Root3 : Type = {K, T, B : Str} ; - -- Root4 : Type = Root3 ** {L : Str} ; Root : Type = {C1, C2, C3, C4 : Str} ; + -- Make a root object. Accepts following overloads: + -- mkRoot + -- mkRoot "k-t-b" + -- mkRoot "k-t-b-l" + -- mkRoot "k" "t" "b" + -- mkRoot "k" "t" "b" "l" 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" + case toLower root of { + c1@#Consonant + "-" + c2@#Consonant + "-" + c3@#Consonant => + { C1=c1 ; C2=c2 ; C3=c3 ; C4=[] } ; -- "k-t-b" + c1@#Consonant + "-" + c2@#Consonant + "-" + c3@#Consonant + "-" + c4@#Consonant => + { C1=c1 ; C2=c2 ; C3=c3 ; C4=c4 } ; -- "k-t-b-l" + _ => { C1=(charAt 0 root) ; C2=(charAt 1 root) ; C3=(charAt 2 root) ; C4=(charAt 3 root) } -- "ktb" (not recommended) } ; mkRoot : Str -> Str -> Str -> Root = \c1,c2,c3 -> - { C1=c1 ; C2=c2 ; C3=c3 ; C4=[] } ; + { C1=toLower c1 ; C2=toLower c2 ; C3=toLower c3 ; C4=[] } ; mkRoot : Str -> Str -> Str -> Str -> Root = \c1,c2,c3,c4 -> - { C1=c1 ; C2=c2 ; C3=c3 ; C4=c4 } ; + { C1=toLower c1 ; C2=toLower c2 ; C3=toLower c3 ; C4=toLower c4 } ; } ; mkPattern : Pattern = overload { mkPattern : Pattern = { V1=[] ; V2=[] } ; mkPattern : Str -> Pattern = \v1 -> - { V1=v1 ; V2=[] } ; + { V1=toLower v1 ; V2=[] } ; mkPattern : Str -> Str -> Pattern = \v1,v2 -> - { V1=v1 ; V2=v2 } ; + { V1=toLower v1 ; V2=case v2 of {"" => [] ; _ => toLower 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" ); + -- Extract first two vowels from a token (designed for semitic verb forms) + --- potentially slow + extractPattern : Str -> Pattern = \s -> + case s of { + v1@"ie" + _ + v2@#Vowel + _ => mkPattern v1 v2 ; -- IEQAF + v1@#Vowel + _ + v2@#Vowel + _ => mkPattern v1 v2 ; -- IKTEB + _ + v1@"ie" + _ + v2@#Vowel + _ => mkPattern v1 v2 ; -- RIEQED + _ + v1@"ie" + _ => mkPattern v1 ; -- ŻIED + _ + v1@#Vowel + _ + v2@#Vowel + _ => mkPattern v1 v2 ; -- ĦARBAT + _ + v1@#Vowel + _ => mkPattern v1 ; -- ĦOBB + _ => mkPattern + } ; - {- ===== Type declarations ===== -} + -- Create a VerbInfo record, optionally omitting various fields + mkVerbInfo : VerbInfo = overload { + mkVerbInfo : VClass -> VDerivedForm -> VerbInfo = \c,f -> + { class=c ; form=f ; root=mkRoot ; patt=mkPattern ; patt2=mkPattern ; imp=[] } ; + mkVerbInfo : VClass -> VDerivedForm -> Str -> VerbInfo = \c,f,i -> + { class=c ; form=f ; root=mkRoot ; patt=mkPattern ; patt2=mkPattern ; imp=i } ; + mkVerbInfo : VClass -> VDerivedForm -> Root -> Pattern -> VerbInfo = \c,f,r,p -> + { class=c ; form=f ; root=r ; patt=p ; patt2=p ; imp=[] } ; + mkVerbInfo : VClass -> VDerivedForm -> Root -> Pattern -> Str -> VerbInfo = \c,f,r,p,i -> + { class=c ; form=f ; root=r ; patt=p ; patt2=p ; imp=i } ; + mkVerbInfo : VClass -> VDerivedForm -> Root -> Pattern -> Pattern -> Str -> VerbInfo = \c,f,r,p,p2,i -> + { class=c ; form=f ; root=r ; patt=p ; patt2=p2 ; imp=i } ; + } ; - Noun : Type = { - s : Noun_Number => NForm => Str ; - g : Gender ; --- anim : Animacy ; -- is the noun animate? e.g. TABIB - } ; + -- Change certain fields of a VerbInfo record + updateVerbInfo : VerbInfo = overload { - ProperNoun : Type = { - s : Str ; - g : Gender ; - } ; + -- Root + updateVerbInfo : VerbInfo -> Root -> VerbInfo = \i,r -> + { class=i.class ; form=i.form ; root=r ; patt=i.patt ; patt2=i.patt2 ; imp=i.imp } ; - Verb : Type = { - s : VForm => Str ; --- s : VForm => VSuffixForm => Str ; - c : VClass ; - } ; + -- DerivedForm + updateVerbInfo : VerbInfo -> VDerivedForm -> VerbInfo = \i,f -> + { class=i.class ; form=f ; root=i.root ; patt=i.patt ; patt2=i.patt2 ; imp=i.imp } ; + + -- DerivedForm, Imperative + updateVerbInfo : VerbInfo -> VDerivedForm -> Str -> VerbInfo = \i,f,imp -> + { class=i.class ; form=f ; root=i.root ; patt=i.patt ; patt2=i.patt2 ; imp=imp } ; + + } ; - Adjective : Type = { - s : AForm => Str ; - } ; {- ===== Conversions ===== -} @@ -258,11 +313,98 @@ resource ResMlt = ParamX - [Tense] ** open Prelude, Predef in { {- ===== 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) ; + -- New names for the drop/take operations + takePfx = Predef.take ; + dropPfx = Predef.drop ; + takeSfx = Predef.dp ; + dropSfx = Predef.tk ; + -- Get the character at the specific index (0-based). + -- Negative indices behave as 0 (first character). Out of range indexes return the empty string. + charAt : Int -> Str -> Str ; + charAt i s = takePfx 1 (dropPfx i s) ; + + -- Delete character at the specific index (0-based). + -- Out of range indices are just ignored. + delCharAt : Int -> Str -> Str ; + delCharAt i s = (takePfx i s) + (dropPfx (plus i 1) s) ; + + -- -- Replace first substring + -- replace : Str -> Str -> Str -> Str ; + -- replace needle haystack replacement = + -- case haystack of { + -- x + needle + y => x + replacement + y ; + -- _ => haystack + -- } ; + + -- Prefix with a 'n'/'t' or double initial consonant, as necessary. See {OM pg 90} + pfx_N : Str -> Str = \s -> case takePfx 1 s of { + "" => [] ; + m@#DoublingConsN => m + s ; + _ => "n" + s + } ; + pfx_T : Str -> Str = \s -> case takePfx 1 s of { + "" => [] ; + d@#DoublingConsT => d + s ; + _ => "t" + s + } ; + -- This is just here to standardise + -- pfx_J : Str -> Str = \s -> case takePfx 1 s of { + -- "" => [] ; + -- _ => "j" + s + -- } ; + pfx_J : Str -> Str = \s -> pfx "j" s ; + + -- Generically prefix a string (avoiding empty strings) + pfx : Str -> Str -> Str = \p,s -> case of { + <_, ""> => [] ; + <"", str> => str ; + => px + str + } ; + + -- Add suffix, avoiding triple letters {GO pg96-7} + --- add more cases? + --- potentially slow + sfx : Str -> Str -> Str = \a,b -> + case of { + <"",_> => [] ; + => ke+"n"+b ; + => ha+"k"+b ; + => ho+"l"+b ; + => si+"t"+b ; + => be+"x"+b ; + _ => a + b + } ; + + -- Replace any IE in the word with an I or E --- potentially slow + ie2i : Str -> Str = ie2_ "i" ; + ie2e : Str -> Str = ie2_ "e" ; + ie2_ : Str -> Str -> Str = \iore,serviet -> + case serviet of { + x + "ie" => x + iore ; + x + "ie" + y => x + iore + y ; + x => x + } ; + + -- Is a word mono-syllabic? + --- potentially slow + isMonoSyl : Str -> Bool = \s -> + case s of { + #Consonant + ("ie" | #Vowel) => True ; -- ra + #Consonant + #Consonant + ("ie" | #Vowel) => True ; -- bla + + ("ie" | #Vowel) + #Consonant => True ; -- af + ("ie" | #Vowel) + #Consonant + #Consonant => True ; -- elf + + #Consonant + ("ie" | #Vowel) + #Consonant => True ; -- miet + #Consonant + ("ie" | #Vowel) + #Consonant + #Consonant => True ; -- mort + #Consonant + #Consonant + ("ie" | #Vowel) + #Consonant => True ; -- ħliet + #Consonant + #Consonant + ("ie" | #Vowel) + #Consonant + #Consonant => True ; -- ħriġt + _ => False + } ; + + + -- Add a definite preposition in front of your token addDefinitePreposition : Str -> Str -> Str = \prep,n -> (getDefinitePreposition prep n) ++ n ; addDefiniteArticle = addDefinitePreposition "il" ; getDefiniteArticle = getDefinitePreposition "il" ;