forked from GitHub/gf-core
Maltese: all functions implemented (though not necessarily correct)
Oh, and glad Valborg!
This commit is contained in:
@@ -11,6 +11,13 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
{- Maybe type------------------------------------------------------------ -}
|
||||
|
||||
-- oper
|
||||
-- Maybe : Type t = t ** {exists : Bool} ;
|
||||
-- Just : t -> Maybe t = \s -> s ** {exists = True} ;
|
||||
-- Nothing : t -> Maybe t = \s -> s ** {exists = False} ;
|
||||
|
||||
{- General -------------------------------------------------------------- -}
|
||||
|
||||
param
|
||||
@@ -18,8 +25,8 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
Gender = Masc | Fem ;
|
||||
|
||||
GenNum =
|
||||
GSg Gender -- dak, dik
|
||||
| GPl -- dawk
|
||||
GSg Gender -- DAK, DIK
|
||||
| GPl -- DAWK
|
||||
;
|
||||
|
||||
Definiteness =
|
||||
@@ -28,41 +35,149 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
;
|
||||
|
||||
oper
|
||||
bool2definiteness : Bool -> Definiteness = \b ->
|
||||
if_then_else Definiteness b Definite Indefinite ;
|
||||
|
||||
-- Agreement system corrected based on comments by [AZ]
|
||||
Agr : Type = { g : Gender ; n : Number ; p : Person } ;
|
||||
Agr : Type = { n : Number ; p : Person ; g : Gender } ;
|
||||
|
||||
mkAgr : Gender -> Number -> Person -> Agr = \g,n,p -> {g = g ; n = n ; p = p} ;
|
||||
-- Make Agr from raw ingredients
|
||||
mkAgr : Number -> Person -> Gender -> Agr = \n,p,g -> {n = n ; p = p ; g = g} ;
|
||||
|
||||
toVAgr : Agr -> VAgr = \agr ->
|
||||
case <agr.p,agr.n> of {
|
||||
<P1,num> => AgP1 num;
|
||||
<P2,num> => AgP2 num;
|
||||
<P3,Sg> => AgP3Sg agr.g;
|
||||
<P3,Pl> => AgP3Pl
|
||||
-- Convert to Agr from other typek
|
||||
toAgr = overload {
|
||||
toAgr : GenNum -> Agr = \gn -> case gn of {
|
||||
GSg g => {n = Sg ; p = P3 ; g = g} ;
|
||||
GPl => {n = Pl ; p = P3 ; g = Masc}
|
||||
} ;
|
||||
toAgr : VAgr -> Agr = \vagr ->
|
||||
case vagr of {
|
||||
AgP1 num => mkAgr num P1 Masc ; --- sorry ladies
|
||||
AgP2 num => mkAgr num P2 Masc ;
|
||||
AgP3Sg gen => mkAgr Pl P3 gen ;
|
||||
AgP3Pl => mkAgr Pl P3 Masc
|
||||
} ;
|
||||
} ;
|
||||
|
||||
toAgr : VAgr -> Agr = \vagr ->
|
||||
case vagr of {
|
||||
AgP1 num => mkAgr Masc num P1 ; --- sorry ladies
|
||||
AgP2 num => mkAgr Masc num P2 ;
|
||||
AgP3Sg gen => mkAgr gen Pl P3 ;
|
||||
AgP3Pl => mkAgr Masc Pl P3
|
||||
|
||||
-- Make Agr from raw ingredients
|
||||
mkGenNum = overload {
|
||||
mkGenNum : Gender -> Number -> GenNum = \g,n ->
|
||||
case n of {
|
||||
Sg => GSg g ;
|
||||
Pl => GPl
|
||||
} ;
|
||||
mkGenNum : Number -> Gender -> GenNum = \n,g ->
|
||||
case n of {
|
||||
Sg => GSg g ;
|
||||
Pl => GPl
|
||||
} ;
|
||||
} ;
|
||||
|
||||
-- Convert to GenNum from another type
|
||||
toGenNum : Agr -> GenNum = \a ->
|
||||
case a.n of {
|
||||
Sg => GSg a.g ;
|
||||
Pl => GPl
|
||||
} ;
|
||||
|
||||
-- Convert to VAgr from another type
|
||||
toVAgr = overload {
|
||||
toVAgr : Agr -> VAgr = \agr ->
|
||||
case <agr.p,agr.n> of {
|
||||
<P1,num> => AgP1 num;
|
||||
<P2,num> => AgP2 num;
|
||||
<P3,Sg> => AgP3Sg agr.g;
|
||||
<P3,Pl> => AgP3Pl
|
||||
} ;
|
||||
toVAgr : GenNum -> VAgr = \gn ->
|
||||
case gn of {
|
||||
GSg g => AgP3Sg g;
|
||||
GPl => AgP3Pl
|
||||
} ;
|
||||
} ;
|
||||
|
||||
-- agrP3 : Agr = overload {
|
||||
agrP3 : Number -> Gender -> Agr = \n,g -> mkAgr n P3 g;
|
||||
-- agrP3 : Number -> Agr = \n -> mkAgr n P3 Masc;
|
||||
-- } ;
|
||||
|
||||
conjAgr : Agr -> Agr -> Agr = \a,b -> {
|
||||
n = (conjNumber a.n b.n) ;
|
||||
p = (conjPerson a.p b.p) ;
|
||||
g = a.g ;
|
||||
} ;
|
||||
|
||||
-- ConjNumber, ConjPerson are defined in ParamX
|
||||
conjGender : Gender -> Gender -> Gender = \a,b -> b ;
|
||||
|
||||
param
|
||||
-- Agreement for verbs
|
||||
VAgr =
|
||||
AgP1 Number -- jiena, aħna
|
||||
| AgP2 Number -- inti, intom
|
||||
| AgP3Sg Gender -- huwa, hija
|
||||
| AgP3Pl -- huma
|
||||
AgP1 Number -- JIENA, AĦNA
|
||||
| AgP2 Number -- INTI, INTOM
|
||||
| AgP3Sg Gender -- HUWA, HIJA
|
||||
| AgP3Pl -- HUMA
|
||||
;
|
||||
|
||||
param
|
||||
NPCase = Nom | CPrep ; -- [AZ]
|
||||
NPCase =
|
||||
NPNom
|
||||
| NPAcc -- I have a feeling we'll this need eventually
|
||||
| NPCPrep ; -- [AZ]
|
||||
|
||||
oper
|
||||
npNom = NPNom ;
|
||||
npAcc = NPAcc ;
|
||||
|
||||
{- Clause --------------------------------------------------------------- -}
|
||||
|
||||
oper
|
||||
Clause : Type = {
|
||||
s : Tense => Anteriority => Polarity => Order => Str
|
||||
} ;
|
||||
QClause : Type = {
|
||||
s : Tense => Anteriority => Polarity => QForm => Str
|
||||
} ;
|
||||
RClause : Type = {
|
||||
s : Tense => Anteriority => Polarity => Agr => Str
|
||||
} ;
|
||||
|
||||
-- Clause
|
||||
mkClause : Str -> Agr -> VerbPhrase -> Clause = \subj,agr,vp -> {
|
||||
s = \\t,a,p,o =>
|
||||
let
|
||||
-- verb = vp.s ! t ! a ! p ! o ! agr ;
|
||||
-- vform = case <t,agr> of {
|
||||
-- _ => VPres
|
||||
-- } ;
|
||||
vpform : VPForm = VPIndicat t (toVAgr agr) ;
|
||||
verb : Str = joinVParts (vp.s ! vpform ! a ! p) ;
|
||||
compl : Str = vp.s2 ! agr ;
|
||||
in
|
||||
case o of {
|
||||
-- ODir => subj ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ vp.p ++ compl ;
|
||||
-- OQuest => verb.aux ++ subj ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ vp.p ++ compl
|
||||
|
||||
-- ABSOLUTELY NOT CORRECT: in progress
|
||||
ODir => subj ++ verb ++ compl ;
|
||||
OQuest => subj ++ verb ++ compl
|
||||
}
|
||||
} ;
|
||||
|
||||
mkQuestion : {s : Str} -> Clause -> QClause = \wh,cl -> {
|
||||
s = \\t,a,p =>
|
||||
let
|
||||
cls = cl.s ! t ! a ! p ;
|
||||
why = wh.s
|
||||
in table {
|
||||
QDir => why ++ cls ! OQuest ;
|
||||
QIndir => why ++ cls ! ODir
|
||||
}
|
||||
} ;
|
||||
|
||||
{- Numeral -------------------------------------------------------------- -}
|
||||
|
||||
param
|
||||
CardOrd = NCard | NOrd ;
|
||||
|
||||
-- Order of magnitude
|
||||
@@ -91,6 +206,34 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
| NumAdj -- "Type A" in {MDG, 133}, e.g. ŻEWĠ, ĦAMES, TNAX-IL, MITT
|
||||
;
|
||||
|
||||
oper
|
||||
|
||||
num2nounnum : Number -> Noun_Number = \n ->
|
||||
case n of {
|
||||
Sg => Singulative ;
|
||||
Pl => Plural
|
||||
} ;
|
||||
|
||||
numform2nounnum : NumForm -> Noun_Number = \n ->
|
||||
case n of {
|
||||
NumX Sg => Singulative ;
|
||||
NumX Pl => Plural ;
|
||||
Num0 => Singulative ;
|
||||
Num1 => Singulative ;
|
||||
Num2 => Dual ;
|
||||
Num3_10 => Collective ;
|
||||
Num11_19 => Singulative ;
|
||||
Num20_99 => Plural
|
||||
} ;
|
||||
|
||||
numform2num : NumForm -> Number = \n ->
|
||||
case n of {
|
||||
NumX num => num ;
|
||||
Num0 => Sg ;
|
||||
Num1 => Sg ;
|
||||
_ => Pl
|
||||
} ;
|
||||
|
||||
{- Determiners etc. ----------------------------------------------------- -}
|
||||
|
||||
oper
|
||||
@@ -127,7 +270,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
-- isDefn : Bool ;
|
||||
-- } ;
|
||||
|
||||
{- Nouns ---------------------------------------------------------------- -}
|
||||
{- Noun ----------------------------------------------------------------- -}
|
||||
|
||||
oper
|
||||
Noun : Type = {
|
||||
@@ -159,6 +302,61 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
| Plural -- ĦUTIET
|
||||
;
|
||||
|
||||
oper
|
||||
-- Noun: Takes all forms and a gender
|
||||
-- Params:
|
||||
-- Singulative, eg KOXXA
|
||||
-- Collective, eg KOXXOX
|
||||
-- Double, eg KOXXTEJN
|
||||
-- Determinate Plural, eg KOXXIET
|
||||
-- Indeterminate Plural
|
||||
-- Gender
|
||||
mkNoun : (_,_,_,_,_ : Str) -> Gender -> Noun = \sing,coll,dual,det,ind,gen -> {
|
||||
s = table {
|
||||
Singulative => sing ;
|
||||
Collective => coll ;
|
||||
Dual => dual ;
|
||||
Plural => if_then_Str (isNil det) ind det
|
||||
-- Plural => variants {det ; ind}
|
||||
} ;
|
||||
g = gen ;
|
||||
takesPron = False ;
|
||||
hasDual = notB (isNil dual) ;
|
||||
hasColl = notB (isNil coll) ;
|
||||
-- anim = Inanimate ;
|
||||
} ;
|
||||
|
||||
-- Noun phrase
|
||||
mkNP : Str -> Number -> Person -> Gender -> NounPhrase = \s,n,p,g -> {
|
||||
s = \\npcase => s ;
|
||||
a = mkAgr n p g ;
|
||||
isPron = False ;
|
||||
isDefn = False ;
|
||||
};
|
||||
|
||||
regNP : Str -> NounPhrase = \kulhadd ->
|
||||
mkNP kulhadd Sg P3 Masc ; -- KULĦADD KUNTENT (not KULĦADD KUNTENTA)
|
||||
|
||||
-- Join a preposition and NP to a string
|
||||
prepNP : Preposition -> NounPhrase -> Str ;
|
||||
prepNP prep np = case <np.isDefn,prep.takesDet> of {
|
||||
<True,True> => prep.s ! Definite ++ np.s ! NPCPrep ; -- FIT-TRIQ
|
||||
<True,False> => prep.s ! Definite ++ np.s ! NPNom ; -- FUQ IT-TRIQ
|
||||
<False,_> => prep.s ! Indefinite ++ np.s ! NPNom -- FI TRIQ
|
||||
} ;
|
||||
|
||||
Compl = Preposition ;
|
||||
-- Compl : Type = {
|
||||
-- s : Str ;
|
||||
-- -- c : NPForm ;
|
||||
-- -- isPre : Bool
|
||||
-- } ;
|
||||
|
||||
Preposition = {
|
||||
s : Definiteness => Str ;
|
||||
takesDet : Bool
|
||||
} ;
|
||||
|
||||
{- Pronoun -------------------------------------------------------------- -}
|
||||
|
||||
oper
|
||||
@@ -181,6 +379,14 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
| Gen -- Genitive: qalbu
|
||||
;
|
||||
|
||||
oper
|
||||
-- Interrogative pronoun
|
||||
mkIP : Str -> Number -> {s : Str ; n : Number} = \who,n ->
|
||||
{
|
||||
s = who ;
|
||||
n = n
|
||||
} ;
|
||||
|
||||
{- Verb ----------------------------------------------------------------- -}
|
||||
|
||||
oper
|
||||
@@ -206,8 +412,8 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
VPerf VAgr -- Perfect tense in all pronoun cases
|
||||
| VImpf VAgr -- Imperfect tense in all pronoun cases
|
||||
| VImp Number -- Imperative is always P2, Sg & Pl
|
||||
-- | VPresPart GenNum -- Present Particible for Gender/Number
|
||||
-- | VPastPart GenNum -- Past Particible for Gender/Number
|
||||
| VActivePart GenNum -- Present/active particible, e.g. RIEQED
|
||||
| VPassivePart GenNum -- Passive/past particible, e.g. MAĦBUB
|
||||
-- | VVerbalNoun -- Verbal Noun
|
||||
;
|
||||
|
||||
@@ -249,23 +455,31 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
| QWeak
|
||||
;
|
||||
|
||||
Order =
|
||||
ODir -- ĠANNI JIEKOL ĦUT
|
||||
| OQuest -- JIEKOL ĦUT ĠANNI [?]
|
||||
;
|
||||
|
||||
oper
|
||||
|
||||
-- Verb stem and suffixes for dir/ind objects, polarity
|
||||
VerbParts : Type = { stem, dir, ind, pol : Str } ;
|
||||
mkVParts = overload {
|
||||
mkVParts : Str -> Str -> VerbParts = \a,d -> {stem=a; dir=[]; ind=[]; pol=d} ;
|
||||
mkVParts : Str -> Str -> Str -> Str -> VerbParts = \a,b,c,d -> {stem=a; dir=b; ind=c; pol=d} ;
|
||||
} ;
|
||||
joinVParts : VerbParts -> Str = \vb -> vb.stem ++ vb.dir ++ vb.ind ++ vb.ind ;
|
||||
|
||||
joinVParts : VerbParts -> Str = \vb -> vb.stem ++ vb.dir ++ vb.ind ++ vb.pol ;
|
||||
|
||||
-- [AZ]
|
||||
VP : Type = {
|
||||
VerbPhrase : Type = {
|
||||
s : VPForm => Anteriority => Polarity => VerbParts ; -- verb
|
||||
s2 : Agr => Str ; -- complement
|
||||
-- a1 : Str ;
|
||||
-- a2 : Str ;
|
||||
} ;
|
||||
|
||||
SlashVerbPhrase : Type = VerbPhrase ** {c2 : Compl} ;
|
||||
|
||||
param
|
||||
-- [AZ]
|
||||
VPForm =
|
||||
@@ -275,15 +489,28 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
|
||||
oper
|
||||
|
||||
-- [AZ]
|
||||
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
insertObj : (Agr => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
s2 = obj ;
|
||||
-- a1 = vp.a1 ;
|
||||
-- a2 = vp.a2 ;
|
||||
s2 = \\agr => vp.s2 ! agr ++ obj ! agr ;
|
||||
} ;
|
||||
|
||||
copula_kien = {
|
||||
insertObjPre : (Agr => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
s2 = \\agr => obj ! agr ++ vp.s2 ! agr ;
|
||||
} ;
|
||||
|
||||
insertObjc : (Agr => Str) -> SlashVerbPhrase -> SlashVerbPhrase = \obj,vp ->
|
||||
insertObj obj vp ** {c2 = vp.c2} ;
|
||||
|
||||
insertAdV : Str -> VerbPhrase -> VerbPhrase = \adv,vp -> {
|
||||
s = vp.s ;
|
||||
s2 = \\agr => vp.s2 ! agr ++ adv ;
|
||||
} ;
|
||||
|
||||
predVc : (Verb ** {c2 : Compl}) -> SlashVerbPhrase = \verb ->
|
||||
predV verb ** {c2 = verb.c2} ;
|
||||
|
||||
copula_kien : Verb = {
|
||||
s : (VForm => Str) = table {
|
||||
VPerf (AgP1 Sg) => "kont" ;
|
||||
VPerf (AgP2 Sg) => "kont" ;
|
||||
@@ -300,13 +527,15 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
VImpf (AgP2 Pl) => "tkunu" ;
|
||||
VImpf (AgP3Pl) => "jkunu" ;
|
||||
VImp (Pl) => "kun" ;
|
||||
VImp (Sg) => "kunu"
|
||||
VImp (Sg) => "kunu" ;
|
||||
VActivePart gn => "" ;
|
||||
VPassivePart gn => ""
|
||||
} ;
|
||||
i : VerbInfo = mkVerbInfo (Irregular) (FormI) (mkRoot "k-w-n") (mkPattern "ie") ;
|
||||
} ;
|
||||
|
||||
-- Adapted from [AZ]
|
||||
CopulaVP : VP = {
|
||||
CopulaVP : VerbPhrase = {
|
||||
s = \\vpf,ant,pol =>
|
||||
case <vpf> of {
|
||||
<VPIndicat Past vagr> => polarise (copula_kien.s ! VPerf vagr) pol ;
|
||||
@@ -321,7 +550,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
} ;
|
||||
|
||||
-- [AZ]
|
||||
predV : Verb -> VP = \verb -> {
|
||||
predV : Verb -> VerbPhrase = \verb -> {
|
||||
s = \\vpf,ant,pol =>
|
||||
let
|
||||
ma = "ma" ;
|
||||
@@ -332,7 +561,8 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
case vpf of {
|
||||
VPIndicat tense vagr =>
|
||||
let
|
||||
kien = joinVParts (CopulaVP.s ! VPIndicat Past vagr ! Simul ! pol) ;
|
||||
kien = joinVParts (CopulaVP.s ! VPIndicat Past vagr ! Simul ! pol) ;
|
||||
kienx = joinVParts (CopulaVP.s ! VPIndicat Past vagr ! Simul ! Neg) ;
|
||||
in
|
||||
case <tense,ant,pol> of {
|
||||
<Pres,Simul,Pos> => b1 (verb.s ! VImpf vagr) ; -- norqod
|
||||
@@ -343,14 +573,14 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
<Fut, Anter,Pos> => b1 (kien ++ "se" ++ verb.s ! VImpf vagr) ; -- kont se norqod
|
||||
|
||||
<Pres,Simul,Neg> => b2 (ma ++ verb.s ! VImpf vagr) ; -- ma norqodx
|
||||
<Pres,Anter,Neg> => b1 (ma ++ kien ++ verb.s ! VImpf vagr) ; -- ma kontx norqod
|
||||
<Pres,Anter,Neg> => b1 (ma ++ kienx ++ verb.s ! VImpf vagr) ; -- ma kontx norqod
|
||||
<Past,Simul,Neg> => b2 (ma ++ verb.s ! VPerf vagr) ; -- ma rqadtx
|
||||
<Past,Anter,Neg> => b1 (ma ++ kien ++ verb.s ! VPerf vagr) ; -- ma kontx rqadt
|
||||
<Past,Anter,Neg> => b1 (ma ++ kienx ++ verb.s ! VPerf vagr) ; -- ma kontx rqadt
|
||||
<Fut, Simul,Neg> => b1 (mhux ++ "se" ++ verb.s ! VImpf vagr) ; -- mhux se norqod
|
||||
<Fut, Anter,Neg> => b1 (ma ++ kien ++ "se" ++ verb.s ! VImpf vagr) ; -- ma kontx se norqod
|
||||
<Fut, Anter,Neg> => b1 (ma ++ kienx ++ "se" ++ verb.s ! VImpf vagr) ; -- ma kontx se norqod
|
||||
|
||||
<Cond,_,Pos> => b1 (kien ++ verb.s ! VImpf vagr) ; -- kont norqod
|
||||
<Cond,_,Neg> => b1 (ma ++ kien ++ verb.s ! VImpf vagr) -- ma kontx norqod
|
||||
<Cond,_,Neg> => b1 (ma ++ kienx ++ verb.s ! VImpf vagr) -- ma kontx norqod
|
||||
} ;
|
||||
VPImperat num => b2 (verb.s ! VImp num) -- torqodx
|
||||
};
|
||||
@@ -360,6 +590,42 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
-- a2 = [] ;
|
||||
} ;
|
||||
|
||||
-- There is no infinitive in Maltese; use perfective
|
||||
infVP : VerbPhrase -> Anteriority -> Polarity -> Agr -> Str = \vp,ant,pol,agr ->
|
||||
let
|
||||
vpform : VPForm = VPIndicat Past (toVAgr agr) ;
|
||||
in
|
||||
joinVParts (vp.s ! vpform ! ant ! pol) ++ vp.s2 ! agr ;
|
||||
|
||||
Aux = {
|
||||
s : Tense => Polarity => Str ;
|
||||
} ;
|
||||
auxHemm : Aux = {
|
||||
s = \\t,p => case <t,p> of {
|
||||
<Pres,Pos> => "hemm" ;
|
||||
<Pres,Neg> => "m'hemmx" ;
|
||||
<Past,Pos> => "kien hemm" ;
|
||||
<Past,Neg> => "ma kienx hemm" ;
|
||||
<Fut,Pos> => "ħa jkun hemm" ;
|
||||
<Fut,Neg> => "mhux ħa jkun hemm" ;
|
||||
<Cond,Pos> => "jekk hemm" ;
|
||||
<Cond,Neg> => "jekk hemmx"
|
||||
}
|
||||
} ;
|
||||
|
||||
reflPron : VAgr => Str = table {
|
||||
AgP1 Sg => "lili nnifsi" ;
|
||||
AgP2 Sg => "lilek innifsek" ;
|
||||
AgP3Sg Masc => "lilu nnifsu" ;
|
||||
AgP3Sg Fem => "lila nnifisha" ;
|
||||
AgP1 Pl => "lilna nfusna" ;
|
||||
AgP2 Pl => "lilkom infuskom" ;
|
||||
AgP3Pl => "lilhom infushom"
|
||||
} ;
|
||||
|
||||
conjLi : Str = "li" ;
|
||||
conjThat = conjLi ;
|
||||
|
||||
{- Adjecive ------------------------------------------------------------ -}
|
||||
|
||||
oper
|
||||
@@ -375,12 +641,32 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
| ASuperl -- Superlative, e.g. L-ISBAĦ
|
||||
;
|
||||
|
||||
oper
|
||||
-- adjective: Takes all forms (except superlative)
|
||||
-- Params:
|
||||
-- Masculine, eg SABIĦ
|
||||
-- Feminine, eg SABIĦA
|
||||
-- Plural, eg SBIEĦ
|
||||
-- Comparative, eg ISBAĦ
|
||||
mkAdjective : (_,_,_,_ : Str) -> Adjective = \masc,fem,plural,compar -> {
|
||||
s = table {
|
||||
APosit gn => case gn of {
|
||||
GSg Masc => masc ;
|
||||
GSg Fem => fem ;
|
||||
GPl => plural
|
||||
} ;
|
||||
ACompar => compar ;
|
||||
ASuperl => artDef ++ compar
|
||||
} ;
|
||||
hasComp = notB (isNil compar) ;
|
||||
} ;
|
||||
|
||||
{- Other ---------------------------------------------------------------- -}
|
||||
|
||||
oper
|
||||
|
||||
{- ~~~ 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"
|
||||
@@ -426,7 +712,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
mkRoot : Str -> Str -> Str -> Str -> Root = \c1,c2,c3,c4 ->
|
||||
{ C1=toLower c1 ; C2=toLower c2 ; C3=toLower c3 ; C4=toLower c4 } ;
|
||||
} ;
|
||||
|
||||
|
||||
mkPattern : Pattern = overload {
|
||||
mkPattern : Pattern =
|
||||
{ V1=[] ; V2=[] } ;
|
||||
@@ -480,21 +766,6 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
{- ~~~ Conversions ~~~ -}
|
||||
|
||||
numform2nounnum : NumForm -> Noun_Number = \n ->
|
||||
case n of {
|
||||
NumX Sg => Singulative ;
|
||||
NumX Pl => Plural ;
|
||||
Num0 => Singulative ;
|
||||
Num1 => Singulative ;
|
||||
Num2 => Dual ;
|
||||
Num3_10 => Collective ;
|
||||
Num11_19 => Singulative ;
|
||||
Num20_99 => Plural
|
||||
} ;
|
||||
|
||||
{- ~~~ Useful helper functions ~~~ -}
|
||||
|
||||
-- Non-existant form
|
||||
@@ -552,7 +823,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
<"NOEXIST", str> => str ; --- dependent on defn of ResMlt.noexist
|
||||
<px, str> => px + str
|
||||
} ;
|
||||
|
||||
|
||||
-- Add suffix, avoiding triple letters {GO pg96-7}
|
||||
--- add more cases?
|
||||
--- potentially slow
|
||||
@@ -643,49 +914,4 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
|
||||
ma+"z-" ++ BIND / strs { "z" }
|
||||
} ;
|
||||
|
||||
{- ~~~ Worst-case functions ~~~ -}
|
||||
|
||||
-- Noun: Takes all forms and a gender
|
||||
-- Params:
|
||||
-- Singulative, eg KOXXA
|
||||
-- Collective, eg KOXXOX
|
||||
-- Double, eg KOXXTEJN
|
||||
-- Determinate Plural, eg KOXXIET
|
||||
-- Indeterminate Plural
|
||||
-- Gender
|
||||
mkNoun : (_,_,_,_,_ : Str) -> Gender -> Noun = \sing,coll,dual,det,ind,gen -> {
|
||||
s = table {
|
||||
Singulative => sing ;
|
||||
Collective => coll ;
|
||||
Dual => dual ;
|
||||
Plural => if_then_Str (isNil det) ind det
|
||||
-- Plural => variants {det ; ind}
|
||||
} ;
|
||||
g = gen ;
|
||||
takesPron = False ;
|
||||
hasDual = notB (isNil dual) ;
|
||||
hasColl = notB (isNil coll) ;
|
||||
-- anim = Inanimate ;
|
||||
} ;
|
||||
|
||||
-- adjective: Takes all forms (except superlative)
|
||||
-- Params:
|
||||
-- Masculine, eg SABIĦ
|
||||
-- Feminine, eg SABIĦA
|
||||
-- Plural, eg SBIEĦ
|
||||
-- Comparative, eg ISBAĦ
|
||||
mkAdjective : (_,_,_,_ : Str) -> Adjective = \masc,fem,plural,compar -> {
|
||||
s = table {
|
||||
APosit gn => case gn of {
|
||||
GSg Masc => masc ;
|
||||
GSg Fem => fem ;
|
||||
GPl => plural
|
||||
} ;
|
||||
ACompar => compar ;
|
||||
ASuperl => artDef ++ compar
|
||||
} ;
|
||||
hasComp = notB (isNil compar) ;
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user