Maltese: all functions implemented (though not necessarily correct)

Oh, and glad Valborg!
This commit is contained in:
john
2013-04-30 14:23:17 +00:00
parent 20d63050a4
commit 6277bf04f9
18 changed files with 5514 additions and 4547 deletions

View File

@@ -9,42 +9,84 @@ concrete AdjectiveMlt of Adjective = CatMlt ** open ResMlt, Prelude in {
lin
-- A -> AP
-- A -> AP -- warm
PositA a = {
s = \\gn => a.s ! (APosit gn) ;
isPre = True -- TO CHECK
isPre = True
} ;
-- A -> NP -> AP
-- A -> NP -> AP -- warmer than I
ComparA a np = {
s = \\gn => case a.hasComp of {
True => a.s ! ACompar ;
_ => compMore ++ a.s ! (APosit gn)
}
++ conjThan ++ np.s ! Nom ;
isPre = False -- TO CHECK
++ conjThan ++ np.s ! NPNom ;
isPre = False
} ;
-- A -> AP
-- A -> AP ; -- warmer
UseComparA a = {
s = \\gn => case a.hasComp of {
True => a.s ! ACompar ;
_ => compMore ++ a.s ! (APosit gn)
} ;
isPre = False -- TO CHECK
isPre = False
} ;
-- Ord -> AP
-- AdjOrd ord = {
-- s = \\_ => ord.s ! Nom ;
-- isPre = True
-- } ;
-- Ord -> AP ; -- warmest
--- Should be: L-IKTAR ĦOBŻA SĦUNA
AdjOrd ord = {
s = \\gn => ord.s ! NumNom ;
isPre = True
} ;
-- CAdv -> AP -> NP -> AP ; -- as cool as John
CAdvAP cadv ap np = {
s = \\gn => cadv.s ++ ap.s ! gn ++ cadv.p ++ np.s ! NPNom ;
isPre = False
} ;
-- A2 -> NP -> AP ; -- married to her
ComplA2 a2 np = {
s = \\gn => a2.s ! APosit gn ++ a2.c2.s ! Definite ++ np.s ! NPAcc ;
isPre = False
} ;
-- A2 -> AP ; -- married to itself
ReflA2 a2 = {
s = \\gn => a2.s ! APosit gn ++ a2.c2.s ! Definite ++ reflPron ! (toVAgr gn) ;
isPre = False
} ;
-- AP -> SC -> AP ; -- good that she is here
SentAP ap sc = {
s = \\gn => ap.s ! gn ++ sc.s ;
isPre = False
} ;
-- AdA -> AP -> AP ; -- very warm
AdAP ada ap = {
s = \\gn => ap.s ! gn ++ ada.s ;
isPre = ap.isPre
} ;
-- A2 -> AP ; -- married
UseA2 a2 = {
s = \\gn => a2.s ! APosit gn ;
isPre = True
} ;
-- AP -> Adv -> AP ; -- warm by nature
AdvAP ap adv = {
s = \\gn => ap.s ! gn ++ adv.s ;
isPre = False
} ;
oper
-- TODO: Don't know where these should go
compMore : Str = "iktar" | "iżjed" ;
compMore : Str = "iktar" ;
compLess : Str = "inqas" ;
conjThan : Str = "minn" ;
}

View File

@@ -6,16 +6,42 @@
concrete AdverbMlt of Adverb = CatMlt ** open ResMlt, Prelude in {
-- AdN
-- Adv
lin
-- Prep -> NP -> Adv
PrepNP prep np = {
s = case <np.isDefn,prep.takesDet> of {
<True,True> => prep.s ! Definite ++ np.s ! CPrep ; -- FIT-TRIQ
<True,False> => prep.s ! Definite ++ np.s ! Nom ; -- FUQ IT-TRIQ
<False,_> => prep.s ! Indefinite ++ np.s ! Nom -- FI TRIQ
}
-- A -> Adv ; -- warmly
PositAdvAdj a = {
s = "b'mod" ++ a.s ! APosit (GSg Masc)
} ;
-- CAdv -> A -> NP -> Adv ; -- more warmly than John
ComparAdvAdj cadv a np = {
s = cadv.s ++ a.s ! APosit (GSg Masc) ++ cadv.p ++ np.s ! npNom
} ;
-- CAdv -> A -> S -> Adv ; -- more warmly than he runs
ComparAdvAdjS cadv a s = {
s = cadv.s ++ a.s ! APosit (GSg Masc) ++ cadv.p ++ s.s
} ;
-- Prep -> NP -> Adv ; -- in the house
PrepNP prep np = {
s = prepNP prep np
};
-- AdA -> Adv -> Adv ; -- very quickly
AdAdv = cc2 ;
-- A -> AdA ; -- extremely
PositAdAAdj a = {
s = a.s ! APosit (GSg Masc) ++ "ħafna" ;
} ;
-- Subj -> S -> Adv ; -- when she sleeps
SubjS = cc2 ;
-- CAdv -> AdN ; -- less (than five)
AdnCAdv cadv = {
s = cadv.s ++ cadv.p
} ;
}

View File

@@ -15,29 +15,28 @@ concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude in {
-- Tensed/Untensed
S = {s : Str} ;
-- QS = {s : QForm => Str} ;
-- RS = {s : Agr => Str ; c : NPCase} ; -- c for it clefts
-- SSlash = {s : Str ; c2 : Str} ;
QS = {s : QForm => Str} ;
RS = {s : Agr => Str} ;
SSlash = {s : Str ; c2 : Compl} ; -- not sure if we need c2
-- Sentence
Cl = {s : ResMlt.Tense => Anteriority => Polarity => Str} ;
-- ClSlash = {
-- s : ResMlt.Tense => Anteriority => Polarity => Order => Str ;
-- c2 : Str
-- } ;
-- Imp = {s : Polarity => ImpForm => Str} ;
Cl = Clause ;
ClSlash = Clause ** {c2 : Compl} ; -- not sure if we need c2
Imp = {s : Polarity => Number => Str} ;
-- Question
-- QCl = {s : ResMlt.Tense => Anteriority => Polarity => QForm => Str} ;
-- IP = {s : NPCase => Str ; n : Number} ;
-- IComp = {s : Str} ;
-- IDet = {s : Str ; n : Number} ;
-- IQuant = {s : Number => Str} ;
QCl = QClause ;
IP = {s : Str ; n : Number} ;
IComp = {s : Str} ;
IDet = {s : Str ; n : Number} ;
IQuant = {s : Str} ;
-- Relative
RCl = RClause ;
RP = {s : Str} ;
-- RCl = {
-- s : ResMlt.Tense => Anteriority => Polarity => Agr => Str ;
-- c : NPCase
@@ -46,9 +45,9 @@ concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude in {
-- Verb
VP = ResMlt.VP ;
VPSlash = ResMlt.VP ;
-- Comp = {s : Agr => Str} ;
VP = VerbPhrase ;
VPSlash = SlashVerbPhrase ;
Comp = {s : Agr => Str} ;
-- Adjective
@@ -61,7 +60,7 @@ concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude in {
Pron = Pronoun ;
Det = Determiner ;
-- Predet = {s : Str} ;
Predet = {s : Str} ;
Quant = Quantifier ;
-- [AZ]
@@ -103,23 +102,22 @@ concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude in {
-- Structural
Conj = {s1,s2 : Str} ;
-- Subj = {s : Str} ;
Prep = {
s : Definiteness => Str ;
takesDet : Bool
} ;
Subj = {s : Str} ;
Prep = Preposition ;
-- Open lexical classes, e.g. Lexicon
V, VS, VQ, VA = Verb ;
V2, V2A, V2Q, V2S = Verb ** {prep : Prep} ;
-- VV = {s : VVForm => Str ; typ : VVType} ;
V3, V2V = Verb ** {prep1,prep2 : Prep} ; -- ** {typ : VVType} ;
V2, V2A, V2Q, V2S = Verb ** {c2 : Compl} ;
VV = Verb ;
V3, V2V = Verb ** {c2, c3 : Compl} ; -- ** {typ : VVType} ;
A = Adjective ;
A2 = Adjective ;
A2 = Adjective ** {c2 : Compl} ;
N, N2, N3 = Noun ;
N = Noun ;
N2 = Noun ** {c2 : Compl} ;
N3 = Noun ** {c2, c3 : Compl} ;
PN = ProperNoun ;
}

View File

@@ -7,10 +7,91 @@
concrete ConjunctionMlt of Conjunction =
CatMlt ** open ResMlt, Coordination, Prelude in {
-- Adv
-- AP
-- NP
-- RS
-- S
lin
-- Conj -> [S] -> S -- "he walks and she runs"
ConjS = conjunctDistrSS ;
-- Conj -> [Adv] -> Adv -- "here or there"
ConjAdv = conjunctDistrSS ;
-- Conj -> [IAdv] -> IAdv -- "where and with whom"
ConjIAdv = conjunctDistrSS ;
-- Conj -> [NP] -> NP -- "either her or me"
ConjNP conj ss = {
s = \\npcase => conj.s1 ++ ss.np1.s ! npcase ++ conj.s2 ++ ss.np2.s ! npcase ;
a = ss.np2.a ;
isPron = andB ss.np1.isPron ss.np2.isPron ;
isDefn = andB ss.np1.isDefn ss.np2.isDefn ;
} ;
-- Conj -> [AP] -> AP -- "cold and warm"
ConjAP conj ss = conjunctDistrTable GenNum conj ss ** {
isPre = ss.isPre
} ;
-- Conj -> [RS] -> RS -- "who walks and whose mother runs"
ConjRS conj ss = conjunctDistrTable Agr conj ss ** {
c = ss.c
} ;
-- Conj -> [CN] -> CN -- "man and woman"
ConjCN conj ss = {
s = \\num => conj.s1 ++ ss.n1.s ! num ++ conj.s2 ++ ss.n2.s ! num ;
g = conjGender ss.n1.g ss.n2.g ;
hasColl = False ;
hasDual = False ;
takesPron = False ;
} ;
-- These fun's are generated from the list cat's.
BaseS = twoSS ;
ConsS = consrSS comma ;
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseIAdv = twoSS ;
ConsIAdv = consrSS comma ;
BaseNP x y = { np1 = x ; np2 = y } ;
ConsNP xs x = {
np1 = {
s = \\npcase => x.np1.s ! npcase ++ comma ++ x.np2.s ! npcase ;
a = conjAgr x.np1.a x.np2.a ;
isPron = andB x.np1.isPron x.np2.isPron ;
isDefn = andB x.np1.isDefn x.np2.isDefn ;
} ;
np2 = xs ;
} ;
BaseAP x y = twoTable GenNum x y ** {isPre = andB x.isPre y.isPre} ;
ConsAP xs x = consrTable GenNum comma xs x ** {isPre = andB xs.isPre x.isPre} ;
BaseRS x y = twoTable Agr x y ** {c = y.c} ;
ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
BaseCN x y = { n1 = x ; n2 = y } ;
ConsCN xs x = {
n1 = {
s = \\num => x.n1.s ! num ++ comma ++ x.n2.s ! num ;
g = x.n2.g ;
hasColl = False ;
hasDual = False ;
takesPron = False ;
} ;
n2 = xs ;
} ;
lincat
-- These basically match the lincat's in CommonX/CatMlt
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[IAdv] = {s1,s2 : Str} ;
[NP] = {np1,np2 : NounPhrase} ;
[AP] = {s1,s2 : GenNum => Str ; isPre : Bool} ;
[RS] = {s1,s2 : Agr => Str} ;
[CN] = {n1,n2 : Noun} ;
}

View File

@@ -860,7 +860,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in {
berraq_BRQ_2_7501_V = mkV_II "berraq" (mkRoot "b-r-q") ;
tberraq_BRQ_5_7502_V = mkV_V "tberraq" (mkRoot "b-r-q") ;
barr_BRR_1_7503_V = mkV "barr" (mkRoot "b-r-r") ;
barax_BRX_1_7504_V = mkV "barax" (mkRoot "b-r-x") ;
barax_BRX_1_7504_V = mkV "barax" "obrox" (mkRoot "b-r-x") ;
barrax_BRX_2_7505_V = mkV_II "barrax" (mkRoot "b-r-x") ;
tbarrax_BRX_5_7506_V = mkV_V "tbarrax" (mkRoot "b-r-x") ;
nbarax_BRX_7_7507_V = mkV_VII "barax" "nbarax" (mkRoot "b-r-x") ;
@@ -905,7 +905,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in {
tbizzel_BZL_5_7546_V = mkV_V "tbiżżel" (mkRoot "b-ż-l") ;
bezzel_BZL_2_7547_V = mkV_II "beżżel" (mkRoot "b-ż-l") ;
tbezzel_BZL_5_7548_V = mkV_V "tbeżżel" (mkRoot "b-ż-l") ;
bezaq_BZQ_1_7549_V = mkV "beżaq" (mkRoot "b-ż-q") ;
bezaq_BZQ_1_7549_V = mkV "beżaq" "obżoq" (mkRoot "b-ż-q") ;
bezzaq_BZQ_2_7550_V = mkV_II "beżżaq" (mkRoot "b-ż-q") ;
tbezzaq_BZQ_5_7551_V = mkV_V "tbeżżaq" (mkRoot "b-ż-q") ;
nbezaq_BZQ_7_7552_V = mkV_VII "beżaq" "nbeżaq" (mkRoot "b-ż-q") ;
@@ -1044,7 +1044,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in {
diehex_DHX_3_7685_V = mkV_III "diehex" (mkRoot "d-h-x") ;
ddiehex_DHX_6_7686_V = mkV_VI "ddiehex" (mkRoot "d-h-x") ;
ndiehex_DHX_7_7687_V = mkV_VII "diehex" "ndiehex" (mkRoot "d-h-x") ;
dahak_DHK_1_7688_V = mkV "daħak" (mkRoot "d-ħ-k") ;
dahak_DHK_1_7688_V = mkV "daħak" "idħak" (mkRoot "d-ħ-k") ;
dahhak_DHK_2_7689_V = mkV_II "daħħak" (mkRoot "d-ħ-k") ;
ddiehek_DHK_6_7690_V = mkV_VI "ddieħek" (mkRoot "d-ħ-k") ;
ndahak_DHK_7_7691_V = mkV_VII "daħak" "ndaħak" (mkRoot "d-ħ-k") ;
@@ -2582,7 +2582,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in {
qaffel_QFL_2_9207_V = mkV_II "qaffel" (mkRoot "q-f-l") ;
nqafel_QFL_7_9208_V = mkV_VII "qafel" "nqafel" (mkRoot "q-f-l") ;
qaffas_QFS_2_9209_V = mkV_II "qaffas" (mkRoot "q-f-s") ;
qaghad_QGHD_1_9210_V = mkV "qagħad" (mkRoot "q-għ-d") ;
qaghad_QGHD_1_9210_V = mkV "qagħad" "oqgħod" (mkRoot "q-għ-d") ;
qaghghad_QGHD_2_9211_V = mkV_II "qagħgħad" (mkRoot "q-għ-d") ;
qieghed_QGHD_3_9212_V = mkV_III "qiegħed" (mkRoot "q-għ-d") ;
tqieghed_QGHD_6_9213_V = mkV_VI "tqiegħed" (mkRoot "q-għ-d") ;
@@ -3554,7 +3554,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in {
xxiegheb_XGHB_6_10152_V = mkV_VI "xxiegħeb" (mkRoot "x-għ-b") ;
xoghof_XGHF_1_10153_V = mkV "xogħof" (mkRoot "x-għ-f") ;
xieghef_XGHF_3_10154_V = mkV_III "xiegħef" (mkRoot "x-għ-f") ;
xeghel_XGHL_1_10155_V = mkV "xegħel" (mkRoot "x-għ-l") ;
xeghel_XGHL_1_10155_V = mkV "xegħel" "ixgħel" (mkRoot "x-għ-l") ;
xieghel_XGHL_3_10156_V = mkV_III "xiegħel" (mkRoot "x-għ-l") ;
nxeghel_XGHL_7_10157_V = mkV_VII "xegħel" "nxegħel" (mkRoot "x-għ-l") ;
xteghel_XGHL_8_10158_V = mkV_VIII "xtegħel" (mkRoot "x-għ-l") ;
@@ -3929,7 +3929,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in {
tghallem_GHLM_5_10527_V = mkV_V "tgħallem" (mkRoot "għ-l-m") ;
ntghallem_GHLM_7_10528_V = mkV_VII "għallem" "ntgħallem" (mkRoot "għ-l-m") ;
ghelem_GHLM_1_10529_V = mkV "għelem" (mkRoot "għ-l-m") ;
ghalaq_GHLQ_1_10530_V = mkV "għalaq" (mkRoot "għ-l-q") ;
ghalaq_GHLQ_1_10530_V = mkV "għalaq" "agħlaq" (mkRoot "għ-l-q") ;
ghallaq_GHLQ_2_10531_V = mkV_II "għallaq" (mkRoot "għ-l-q") ;
nghalaq_GHLQ_7_10532_V = mkV_VII "għalaq" "ngħalaq" (mkRoot "għ-l-q") ;
ntghalaq_GHLQ_7_10533_V = mkV_VII "għalaq" "ntgħalaq" (mkRoot "għ-l-q") ;

View File

@@ -17,9 +17,10 @@ concrete GrammarMlt of Grammar =
RelativeMlt,
ConjunctionMlt,
PhraseMlt,
TextX - [Utt],
TextX,
StructuralMlt,
IdiomMlt
IdiomMlt,
TenseX
** {
flags coding=utf8 ;

View File

@@ -6,5 +6,72 @@
concrete IdiomMlt of Idiom = CatMlt ** open Prelude, ResMlt in {
lin
-- VP -> Cl ; -- it is hot
ImpersCl vp = mkClause "" (agrP3 Sg Masc) vp ;
-- VP -> Cl ; -- one sleeps
GenericCl vp = mkClause "wieħed" (agrP3 Sg Masc) vp ;
-- NP -> RS -> Cl ; -- it is I who did it
CleftNP np rs = {
s = \\t,a,p,o => case p of {
Pos => np.s ! NPNom ++ kont ++ "li" ++ rs.s ! np.a ; -- jiena kont li qrajt il-ktieb
Neg => "mhux" ++ np.s ! NPNom ++ kont ++ "li" ++ rs.s ! np.a -- mhux jiena kont li qrajt il-ktieb
}
where {
kont : Str = case t of {
Pres => copula_kien.s ! VImpf (toVAgr np.a) ;
Past => copula_kien.s ! VPerf (toVAgr np.a) ;
Fut => "ser" ++ copula_kien.s ! VImpf (toVAgr np.a) ;
Cond => "kieku" ++ copula_kien.s ! VPerf (toVAgr np.a)
} ;
}
} ;
-- Adv -> S -> Cl ; -- it is here she slept
CleftAdv adv s = {
s = \\t,a,p,o => adv.s ++ s.s ;
} ;
-- NP -> Cl ; -- there is a house
ExistNP np = {
s = \\t,a,p,o => auxHemm.s ! t ! p ++ np.s ! NPAcc ;
} ;
-- IP -> QCl ; -- which houses are there
ExistIP ip = {
s = \\t,a,p,o => ip.s ++ auxHemm.s ! t ! p ;
} ;
-- NP -> Adv -> Cl ; -- there is a house in Paris
ExistNPAdv np adv = {
s = \\t,a,p,o => auxHemm.s ! t ! p ++ np.s ! NPAcc ++ adv.s ;
} ;
-- IP -> Adv -> QCl ; -- which houses are there in Paris
ExistIPAdv ip adv = {
s = \\t,a,p,o => ip.s ++ auxHemm.s ! t ! p ++ adv.s ;
} ;
-- VP -> VP ; -- be sleeping
ProgrVP vp = predV copula_kien ** {
s2 = \\agr => joinVParts (vp.s ! VPIndicat Pres agr ! Simul ! Pos)
} ;
-- VP -> Utt ; -- let's go
ImpPl1 vp = {
s = "ejja" ++ infVP vp Simul Pos (mkAgr Pl P1 Masc)
} ;
-- NP -> VP -> Utt ; -- let John walk
ImpP3 np vp = {
s = halli ++ np.s ! NPAcc ++ infVP vp Simul Pos np.a
} where {
halli : Str = case np.a.n of {
Sg => "ħalli" ;
Pl => "ħallu"
}
} ;
}

View File

@@ -37,7 +37,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
belly_N = possN (mkN "żaqq" "żquq") ;
big_A = brokenA "kbir" "kbar" "ikbar" ;
bike_N = mkN "rota" ;
bird_N = mkN "għasfur" "għasafar" ; -- feminine: GĦASFURA
bird_N = genderedN "għasfur" "għasafar" ;
bite_V2 = lilV2 (gidem_GDM_1_8009_V) ;
black_A = mkA "iswed" "sewda" "suwed" ;
blood_N = possN (mkN [] "demm" [] "dmija" []) ;
@@ -52,7 +52,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
bread_N = mkNColl "ħobż" ;
break_V2 = dirV2 (kiser_KSR_1_8636_V) ;
breast_N = possN (mkN "sider" "sdur") ; -- also ISDRA
-- breathe_V -- ĦA N-NIFS
breathe_V = mkV "respira" ; -- ĦA N-NIFS
broad_A = mkA "wiesgħa" "wiesgħa" "wiesgħin" ;
brother_N2 = mkN2 (possN (mkN "ħu" "aħwa")) ;
brown_A = sameA "kannella" ;
@@ -63,11 +63,11 @@ concrete LexiconMlt of Lexicon = CatMlt **
cap_N = mkN "beritta" ;
car_N = mkN "karozza" ;
carpet_N = mkN "tapit" "twapet" ; -- TAPITI
cat_N = mkN "qattus" "qtates" ; -- feminine: QATTUSA
cat_N = genderedN "qattus" "qtates" ;
ceiling_N = mkN "saqaf" "soqfa";
chair_N = mkN "siġġu" "siġġijiet" ;
cheese_N = mkNColl "ġobon" ;
child_N = mkN "tifel" "tfal" ; -- feminine: TIFLA
child_N = genderedN "tifel" "tifla" "tfal" ;
church_N = mkN "knisja" "knejjes" ;
city_N = mkN "belt" "bliet" feminine ;
clean_A = brokenA "nadif" "nodfa" ;
@@ -81,16 +81,16 @@ concrete LexiconMlt of Lexicon = CatMlt **
correct_A = regA "korrett" ;
count_V2 = dirV2 (ghadd_GHDD_1_10460_V) ;
country_N = possN (mkN "pajjiż") ;
cousin_N = possN (mkN "kuġin") ; -- feminine: KUĠINA
cousin_N = possN (genderedN "kuġin" "kuġini") ;
cow_N = mkN "baqra" "baqar" "baqartejn" [] [] ;
cut_V2 = dirV2 (qata'_QTGH_1_9305_V) ;
day_N = mkN "ġurnata" "ġranet" ;
die_V = miet_MWT_1_8923_V ;
dig_V = hafer_HFR_1_8233_V ;
dirty_A = regA "maħmuġ" ;
distance_N3 = mkN "distanza" ;
distance_N3 = mkN3 (mkN "distanza") minnP saP ;
do_V2 = dirV2 (ghamel_GHML_1_10544_V) ;
doctor_N = mkN "tabib" "tobba" ; -- feminine: TABIBA
doctor_N = genderedN "tabib" "tobba" ;
dog_N = mkN "kelb" "klieb" ;
door_N = mkN "bieb" "bibien" ;
drink_V2 = dirV2 (xorob_XRB_1_10231_V) ;
@@ -99,7 +99,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
dust_N = mkNColl "trab" ; -- not sure but sounds right
ear_N = possN (mkNDual "widna") ;
earth_N = mkN "art" "artijiet" feminine ;
easy_A2V = sameA "faċli" ;
easy_A2V = dirA2 (sameA "faċli") ;
eat_V2 = dirV2 (kiel_KJL_1_8672_V) ;
egg_N = mkNColl "bajd" ;
empty_A = mkA "vojt" "vojta" "vojta" ;
@@ -118,10 +118,10 @@ concrete LexiconMlt of Lexicon = CatMlt **
fingernail_N = possN (mkN "difer" [] "difrejn" "dwiefer" []) ;
fire_N = mkN "nar" "nirien" ;
fish_N = mkNColl "ħut" ;
-- float_V
float_V = gham_GHWM_1_10750_V ; ---
floor_N = mkN "art" "artijiet" feminine ;
flower_N = mkN "fjura" ;
-- flow_V
flow_V = ghadda_GHDJ_2_10679_V ;
fly_V = tar_TJR_1_9972_V ;
fog_N = mkN [] "ċpar" [] [] [] ;
foot_N = possN (mk5N "sieq" [] "saqajn" "saqajn" [] feminine) ;
@@ -129,7 +129,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
forget_V2 = lilV2 (nesa_NSJ_1_9126_V) ;
freeze_V = ffriza_V ;
fridge_N = mkN "friġġ" "friġġijiet" ;
friend_N = possN (mkN "ħabib" "ħbieb") ; -- feminine: ĦABIBA
friend_N = possN (genderedN "ħabib" "ħbieb") ;
fruit_N = mkNColl "frott" ;
full_A = regA "mimli" ;
fun_AV = sameA "pjaċevoli" ;
@@ -297,7 +297,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
split_V2 = lilV2 (qasam_QSM_1_9292_V) ;
squeeze_V2 = dirV2 (ghasar_GHSR_1_10625_V) ;
stab_V2 = lilV2 (mewwes_MWS_2_8921_V) ;
-- stand_V
stand_V = qaghad_QGHD_1_9210_V ; ---
star_N = mkN "stilla" "stilel" ;
steel_N = mkNNoPlural "azzar" ;
stick_N = mkN "lasta" ;
@@ -317,7 +317,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
tail_N = possN (mkN "denb" "dnieb") ;
talk_V3 = mkV3 kellem_KLM_2_8597_V maP fuqP ; -- PAĊPAĊ, PARLA
teach_V2 = lilV2 (ghallem_GHLM_2_10526_V) ;
teacher_N = mkN "għalliem" "għalliema" ; -- feminine: GĦALLIEMA
teacher_N = genderedN "għalliem" "għalliema" ;
television_N = mkN "televixin" "televixins" ;
thick_A = mkA "oħxon" "ħoxna" "ħoxnin" "eħxen" ;
thin_A = brokenA "rqiq" "rqaq" "rqaq" ;
@@ -372,10 +372,23 @@ concrete LexiconMlt of Lexicon = CatMlt **
lilP = mkPrep "lil" ;
maP = mkPrep "ma'" ;
taP = mkPrep "ta'" ;
saP = mkPrep "sa" ;
biP = mkPrep "bi" ;
fiP = mkPrep "fi" ;
lilV2 : V -> V2 ;
lilV2 v = prepV2 v (mkPrep "lil") ;
genderedN : N = overload {
genderedN : Str -> Str -> N = \qattus,qtates ->
let
m : N = mkN qattus qtates masculine ;
f : N = mkN (qattus+"a") qtates feminine ;
in (m | f) ;
genderedN : Str -> Str -> Str -> N = \qattus,qattusa,qtates ->
let
m : N = mkN qattus qtates masculine ;
f : N = mkN qattusa qtates feminine ;
in (m | f) ;
} ;
} ;

View File

@@ -40,7 +40,7 @@ resource MorphoMlt = ResMlt ** open Prelude in {
Suffixed Dat => _li ; -- rajtli
Suffixed Gen => _i -- qalbi, idejja
} ;
a = mkAgr gen num pers ;
a = mkAgr num pers gen ;
} ;
-- hija, aħna, intom, huma
@@ -53,7 +53,7 @@ resource MorphoMlt = ResMlt ** open Prelude in {
Suffixed Dat => "l"+_ha ; -- rajtilha
Suffixed Gen => _ha -- qalbha
} ;
a = mkAgr gen num pers ;
a = mkAgr num pers gen ;
} ;
} ;
@@ -618,7 +618,9 @@ resource MorphoMlt = ResMlt ** open Prelude in {
in table {
VPerf agr => perf ! agr ;
VImpf agr => impf ! agr ;
VImp num => imp ! num
VImp num => imp ! num ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
conjFormII_quad : VerbInfo -> (VForm => Str) = \i ->
@@ -703,7 +705,9 @@ resource MorphoMlt = ResMlt ** open Prelude in {
in table {
VPerf agr => perf ! agr ;
VImpf agr => impf ! agr ;
VImp num => imp ! num
VImp num => imp ! num ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
{- ~~~ Form III verbs ~~~ -}
@@ -743,7 +747,9 @@ resource MorphoMlt = ResMlt ** open Prelude in {
in table {
VPerf agr => perf ! agr ;
VImpf agr => impf ! agr ;
VImp num => imp ! num
VImp num => imp ! num ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
{- ~~~ Form VII and VIII verbs ~~~ -}
@@ -812,7 +818,9 @@ resource MorphoMlt = ResMlt ** open Prelude in {
in table {
VPerf agr => perf ! agr ;
VImpf agr => impf ! agr ;
VImp num => imp ! num
VImp num => imp ! num ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
{- ~~~ Form IX verbs ~~~ -}
@@ -846,7 +854,9 @@ resource MorphoMlt = ResMlt ** open Prelude in {
in table {
VPerf agr => perf ! agr ;
VImpf agr => impf ! agr ;
VImp num => imp ! num
VImp num => imp ! num ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
{- ~~~ Form X verbs ~~~ -}
@@ -938,7 +948,9 @@ resource MorphoMlt = ResMlt ** open Prelude in {
in table {
VPerf agr => perf ! agr ;
VImpf agr => impf ! agr ;
VImp num => imp ! num
VImp num => imp ! num ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
}

View File

@@ -39,18 +39,23 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
lin
-- Det -> CN -> NP
DetCN det cn = {
DetCN det cn =
let
-- To stop complaining about lock fields
det = lin Det det ;
cn = lin CN cn ;
in {
s = table {
Nom => case <det.isPron, cn.takesPron> of {
NPCPrep => cn.s ! numform2nounnum det.n ;
_ => case <det.isPron, cn.takesPron> of {
<True,True> => glue (cn.s ! numform2nounnum det.n) det.clitic ;
<True,_> => artDef ++ cn.s ! numform2nounnum det.n ++ det.s ! cn.g ;
_ => chooseNounNumForm det cn
} ;
CPrep => cn.s ! numform2nounnum det.n
}
} ;
a = case (numform2nounnum det.n) of {
Singulative => mkAgr cn.g Sg P3 ; --- collective?
_ => mkAgr cn.g Pl P3
Singulative => mkAgr Sg P3 cn.g ; --- collective?
_ => mkAgr Pl P3 cn.g
} ;
isPron = False ;
isDefn = det.isDefn ;
@@ -87,6 +92,18 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
isDefn = quant.isDefn ;
} ;
-- Det -> NP
DetNP det = {
-- s = case det.hasNum of {
-- True => \\_ => det.s ! Masc ;
-- _ => \\c => det.s ! Masc
-- } ;
s = \\c => det.s ! Masc ;
a = agrP3 (numform2num det.n) Masc ;
isPron = False ;
isDefn = True ;
} ;
-- Quant
DefArt = {
s = \\_ => artDef ;
@@ -114,8 +131,9 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
-- Pron -> NP
UsePron p = {
s = table {
Nom => p.s ! Personal ;
CPrep => p.s ! Suffixed Acc
NPNom => p.s ! Personal ;
NPAcc => p.s ! Personal ;
NPCPrep => p.s ! Suffixed Acc
} ;
a = p.a ;
isPron = True ;
@@ -131,6 +149,26 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
isDefn = True ;
} ;
-- Predet -> NP -> NP
PredetNP pred np = np ** {
s = \\c => pred.s ++ np.s ! c ;
} ;
-- NP -> V2 -> NP
PPartNP np v2 = np ** {
s = \\c => np.s ! c ++ v2.s ! VImpf (toVAgr np.a) ; --- TODO: VPresPart
} ;
-- NP -> RS -> NP
RelNP np rs = np ** {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
} ;
-- NP -> Adv -> NP
AdvNP np adv = np ** {
s = \\c => np.s ! c ++ adv.s ;
} ;
-- Num
NumSg = {s = \\c => []; n = NumX Sg ; hasCard = False} ;
NumPl = {s = \\c => []; n = NumX Pl ; hasCard = False} ;
@@ -150,17 +188,102 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
-- Numeral -> Ord
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
-- AdN -> Card -> Card
AdNum adn card = card ** {
s = \\c => adn.s ++ card.s ! c ;
} ;
-- A -> Ord
OrdSuperl a = {
s = \\c => case a.hasComp of {
True => a.s ! ASuperl ;
False => "l-iktar" ++ a.s ! APosit (GSg Masc) --- should agree
}
} ;
-- CN -> NP
MassNP cn = {
s = \\c => cn.s ! Collective ;
a = agrP3 Sg cn.g ;
isPron = False ;
isDefn = True ;
} ;
-- N -> CN
UseN n = n ;
-- N2 -> CN
UseN2 n = n ;
UseN2 n2 = n2 ; -- just ignore the c2
-- Card
-- CN
-- Det
-- NP
-- Num
-- Ord
-- N3 -> N2
Use2N3 n3 = n3 ** { c2 = n3.c2 } ;
-- N3 -> N2
Use3N3 n3 = n3 ** { c2 = n3.c3 } ;
-- N2 -> NP -> CN
ComplN2 n2 np = {
s = \\num => n2.s ! num ++ prepNP n2.c2 np ;
g = n2.g ;
hasColl = False ;
hasDual = False ;
takesPron = False ;
} ;
-- N3 -> NP -> N2
ComplN3 n3 np = {
s = \\num => n3.s ! num ++ prepNP n3.c3 np ;
g = n3.g ;
hasColl = False ;
hasDual = False ;
takesPron = False ;
c2 = n3.c3
} ;
-- AP -> CN -> CN
AdjCN ap cn = cn ** {
s = \\num => preOrPost ap.isPre (ap.s ! mkGenNum num cn.g) (cn.s ! num) ;
} ;
-- CN -> RS -> CN
RelCN cn rs = cn ** {
s = \\num => cn.s ! num ++ rs.s ! mkGenNum num cn.g ;
} ;
-- CN -> Adv -> CN
AdvCN cn adv = cn ** {
s = \\num => cn.s ! num ++ adv.s
} ;
-- CN -> SC -> CN
SentCN cn sc = cn ** {
s = \\num => cn.s ! num ++ sc.s
} ;
-- CN -> NP -> CN
ApposCN cn np = cn ** {
s = \\num => cn.s ! num ++ np.s ! NPNom
} ;
PossNP cn np = cn ** {
s = \\num => cn.s ! num ++ prepNP (mkPrep "ta'") np
} ;
PartNP cn np = cn ** {
s = \\num => cn.s ! num ++ prepNP (mkPrep "ta'") np
} ;
-- Det -> NP -> NP
CountNP det np = {
s = \\c => det.s ! np.a.g ++ np.s ! c ;
a = agrP3 (numform2num det.n) np.a.g ;
isPron = False ;
isDefn = np.isDefn ;
} ;
oper
-- Copied from ParadigmsMlt (didn't want to change import structure)
mkPrep : Str -> Prep = \fuq -> lin Prep {
s = \\defn => fuq ;
takesDet = False
} ;
}

View File

@@ -24,16 +24,14 @@ resource ParadigmsMlt = open
{- Parameters --------------------------------------------------------- -}
-- Abstraction over gender names
Gender : Type ;
masculine : Gender ; --%
feminine : Gender ; --%
Gender = ResMlt.Gender ;
masculine = Masc ;
feminine = Fem ;
-- human = Masc ;
-- nonhuman = Neutr ;
singular : Number = Sg ;
plural : Number = Pl ;
singular = Sg ;
plural = Pl ;
form1 = FormI ;
form2 = FormII ;
@@ -213,7 +211,7 @@ resource ParadigmsMlt = open
-- Proper noun
mkPN : Str -> Gender -> Number -> ProperNoun = \name,g,n -> {
s = name ;
a = mkAgr g n P3 ;
a = mkAgr n P3 g ;
} ;
mkN2 = overload {
@@ -225,7 +223,10 @@ resource ParadigmsMlt = open
} ;
prepN2 : N -> Prep -> N2 ;
prepN2 = \n,p -> lin N2 (n ** {c2 = p.s}) ;
prepN2 = \n,p -> lin N2 (n ** {c2 = p}) ;
mkN3 : Noun -> Prep -> Prep -> N3 ;
mkN3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ;
-- Mark a noun as taking possessive enclitic pronouns
possN : N -> N ;
@@ -395,7 +396,9 @@ resource ParadigmsMlt = open
VImpf (AgP2 Pl) => impfP2Pl ;
VImpf (AgP3Pl) => impfP3Pl ;
VImp (Pl) => impSg ;
VImp (Sg) => impPl
VImp (Sg) => impPl ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
info : VerbInfo = mkVerbInfo class form root patt impSg ;
in lin V {
@@ -507,7 +510,9 @@ resource ParadigmsMlt = open
VImpf (AgP1 Pl) => pfx "ni" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP1 Pl)))) ;
VImpf (AgP2 Pl) => pfx "ti" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP2 Pl)))) ;
VImpf (AgP3Pl) => pfx "ji" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP3Pl)))) ;
VImp num => pfx_T (vII.s ! VImp num)
VImp num => pfx_T (vII.s ! VImp num) ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
i = info ;
} ;
@@ -530,7 +535,9 @@ resource ParadigmsMlt = open
VImpf (AgP1 Pl) => pfx "ni" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP1 Pl)))) ;
VImpf (AgP2 Pl) => pfx "ti" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP2 Pl)))) ;
VImpf (AgP3Pl) => pfx "ji" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP3Pl)))) ;
VImp num => pfx_T (vIII.s ! VImp num)
VImp num => pfx_T (vIII.s ! VImp num) ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
i = info ;
} ;
@@ -626,7 +633,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjStrongPerf root patt ) ! agr ;
VImpf agr => ( conjStrongImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
info : VerbInfo = mkVerbInfo (Strong Regular) (FormI) root patt (imp ! Sg) ;
in lin V {
@@ -666,7 +675,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjLiquidMedialPerf root patt ) ! agr ;
VImpf agr => ( conjLiquidMedialImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
info : VerbInfo = mkVerbInfo (Strong LiquidMedial) (FormI) root patt (imp ! Sg) ;
in lin V {
@@ -701,7 +712,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjGeminatedPerf root patt ) ! agr ;
VImpf agr => ( conjGeminatedImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
info : VerbInfo = mkVerbInfo (Strong Geminated) (FormI) root patt (imp ! Sg) ;
in lin V {
@@ -736,7 +749,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjAssimilativePerf root patt ) ! agr ;
VImpf agr => ( conjAssimilativeImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
patt2 : Pattern = case (imp!Sg) of {
"ie"+_ => mkPattern "i" patt.V2 ; -- (WAQAF) IEQAF > TIQAFLI
@@ -775,7 +790,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjHollowPerf root patt ) ! agr ;
VImpf agr => ( conjHollowImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
patt2 : Pattern = case patt.V1 of {
"ie" => mkPattern "i" patt.V2 ; -- (ŻIED) ŻID > ŻIDLI
@@ -818,7 +835,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjLackingPerf root patt ) ! agr ;
VImpf agr => ( conjLackingImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
info : VerbInfo = mkVerbInfo (Weak Lacking) (FormI) root patt (imp ! Sg) ;
in lin V {
@@ -853,7 +872,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjDefectivePerf root patt ) ! agr ;
VImpf agr => ( conjDefectiveImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
info : VerbInfo = mkVerbInfo (Weak Defective) (FormI) root patt (imp ! Sg) ;
in lin V {
@@ -888,7 +909,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjQuadPerf root patt ) ! agr ;
VImpf agr => ( conjQuadImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
info : VerbInfo = mkVerbInfo (Quad QStrong) (FormI) root patt (imp ! Sg) ;
in lin V {
@@ -926,7 +949,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjQuadWeakPerf root patt (imp ! Sg) ) ! agr ;
VImpf agr => ( conjQuadWeakImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
info : VerbInfo = mkVerbInfo (Quad QWeak) (FormI) root patt (imp ! Sg) ;
in lin V {
@@ -949,7 +974,9 @@ resource ParadigmsMlt = open
tbl : (VForm => Str) = table {
VPerf agr => ( conjLoanPerf mamma ) ! agr ;
VImpf agr => ( conjLoanImpf (imp ! Sg) (imp ! Pl) ) ! agr ;
VImp n => imp ! n
VImp n => imp ! n ;
VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO
} ;
info : VerbInfo = mkVerbInfo (Loan) (FormI) (imp ! Sg) ;
in lin V {
@@ -963,13 +990,13 @@ resource ParadigmsMlt = open
mkVS v = lin VS v ;
prepV2 : V -> Prep -> V2 ;
prepV2 v p = lin V2 ( v ** { prep = p } ) ;
prepV2 v p = lin V2 ( v ** { c2 = p } ) ;
dirV2 : V -> V2 ;
dirV2 v = prepV2 v noPrep ;
prepPrepV3 : V -> Prep -> Prep -> V3 ;
prepPrepV3 v p t = lin V3 (v ** { prep1 = p ; prep2 = t }) ;
prepPrepV3 v p t = lin V3 (v ** { c2 = p ; c3 = t }) ;
dirV3 : V -> Prep -> V3 ;
dirV3 v p = prepPrepV3 v noPrep p ;
@@ -995,7 +1022,7 @@ resource ParadigmsMlt = open
} ;
mkV2V : V -> Prep -> Prep -> V2V ; -- e.g. want (noPrep NP) (to VP)
mkV2V v p t = lin V2V (v ** { prep1 = p ; prep2 = t }) ;
mkV2V v p t = lin V2V (v ** { c2 = p ; c3 = t }) ;
{- Conjunction -------------------------------------------------------- -}
@@ -1099,7 +1126,10 @@ resource ParadigmsMlt = open
} ;
prepA2 : A -> Prep -> A2 ;
prepA2 a p = lin A2 (a ** {c2 = p.s}) ;
prepA2 a p = lin A2 (a ** {c2 = p}) ;
dirA2 : A -> A2 ;
dirA2 a = prepA2 a noPrep ;
mkA2 : overload {
mkA2 : A -> Prep -> A2 ;

View File

@@ -6,9 +6,31 @@
concrete PhraseMlt of Phrase = CatMlt ** open ParamX, Prelude, ResMlt in {
-- PConj
-- Phr
-- Utt
-- Voc
lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
UttS s = s ;
UttQS qs = {s = qs.s ! QDir} ;
-- Pol -> Imp -> Utt
UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ;
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ;
UttImpPol = UttImpSg ; -- no polite form
UttIP ip = {s = ip.s} ;
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! npNom} ;
UttVP vp = {s = infVP vp Simul Pos (agrP3 Sg Masc)} ;
UttAdv adv = adv ;
UttCN n = {s = n.s ! (num2nounnum Sg)} ;
UttCard n = {s = n.s ! NumNom} ;
UttAP ap = {s = ap.s ! mkGenNum Sg Masc} ;
UttInterj i = i ;
NoPConj = {s = []} ;
PConjConj conj = {s = conj.s2} ;
NoVoc = {s = []} ;
VocNP np = {s = "," ++ np.s ! npNom} ;
}

View File

@@ -8,10 +8,107 @@ concrete QuestionMlt of Question = CatMlt ** open ResMlt, ParamX, Prelude in {
flags optimize=all_subs ;
-- IAdv
-- IComp
-- IDet
-- IP
-- QCl
lin
-- Cl -> QCl
-- does John walk
QuestCl cl = {
s = \\t,a,p =>
let cls = cl.s ! t ! a ! p
in table {
QDir => cls ! OQuest ;
QIndir => "kieku" ++ cls ! ODir
}
} ;
-- IP -> VP -> QCl
-- who walks
QuestVP qp vp =
let
-- cl = mkClause (qp.s ! npNom) (agrP3 qp.n) vp
cl = mkClause qp.s (agrP3 qp.n Masc) vp
in {
s = \\t,a,p,_ => cl.s ! t ! a ! p ! ODir
} ;
-- IP -> ClSlash -> QCl
-- whom does John love
QuestSlash ip slash =
mkQuestion (ss (slash.c2.s ! Definite ++ ip.s)) slash ;
-- IAdv -> Cl -> QCl
-- why does John walk
QuestIAdv iadv cl = mkQuestion iadv cl ;
-- IComp -> NP -> QCl
-- where is John
QuestIComp icomp np =
mkQuestion icomp (mkClause (np.s ! npNom) np.a (predV copula_kien)) ;
-- Prep -> IP -> IAdv
-- with whom
PrepIP prep ip = {s = prep.s ! Definite ++ ip.s} ;
-- IP -> Adv -> IP
-- who in Paris
AdvIP ip adv = {
s = ip.s ++ adv.s ;
n = ip.n
} ;
-- IDet -> CN -> IP
-- which five songs
IdetCN idet cn = {
s = idet.s ++ cn.s ! num2nounnum idet.n ;
n = idet.n
} ;
-- IDet -> IP
-- which five
IdetIP idet = {
s = idet.s ;
n = idet.n
} ;
-- IQuant -> Num -> IDet
-- which (five)
IdetQuant iquant num = {
s = iquant.s ++ num.s ! NumNom ;
n = numform2num num.n
} ;
-- IAdv -> Adv -> IAdv
-- where in Paris
AdvIAdv iadv adv = ss (iadv.s ++ adv.s) ;
-- IAdv -> IComp
-- where (is it)
CompIAdv iadv = iadv ;
-- IP -> IComp
-- who (is it)
CompIP ip = ss (ip.s) ;
lincat
QVP = ResMlt.VerbPhrase ;
lin
-- VPSlash -> IP -> QVP
-- buys what
ComplSlashIP vp np = insertObjPre (\\_ => vp.c2.s ! Definite ++ np.s) vp ;
-- VP -> IAdv -> QVP
-- lives where
AdvQVP vp adv = insertObj (\\_ => adv.s) vp ;
-- QVP -> IAdv -> QVP
-- buys what where
AddAdvQVP qvp iadv = insertObj (\\_ => iadv.s) qvp ;
-- IP -> QVP -> QCl
-- who buys what where
QuestQVP ip vp =
let cl = mkClause (ip.s) (agrP3 ip.n Masc) vp
in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ;
}

View File

@@ -6,7 +6,35 @@
concrete RelativeMlt of Relative = CatMlt ** open ResMlt in {
-- RCl
flags optimize=all_subs ;
lin
-- Cl -> RCl
RelCl cl = {
s = \\t,a,p,_ => "li" ++ cl.s ! t ! a ! p ! ODir ;
} ;
-- RP -> VP -> RCl
RelVP rp vp = {
s = \\t,ant,p,agr =>
let
cl = mkClause rp.s agr vp
in
cl.s ! t ! ant ! p ! ODir ;
} ;
-- RP -> ClSlash -> RCl
RelSlash rp slash = {
s = \\t,a,p,agr =>
rp.s ++ slash.s ! t ! a ! p ! ODir ;
} ;
-- Prep -> NP -> RP -> RP
FunRP prep np rp = {
s = np.s ! NPAcc ++ (prep.s ! bool2definiteness np.isDefn) ++ rp.s ;
} ;
-- RP
IdRP = { s = "li" } ;
}

View File

@@ -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,11 +35,53 @@ 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} ;
-- 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
} ;
} ;
-- 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;
@@ -40,29 +89,95 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
<P3,Sg> => AgP3Sg agr.g;
<P3,Pl> => AgP3Pl
} ;
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
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" ;
@@ -333,6 +562,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
VPIndicat tense vagr =>
let
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,6 +641,26 @@ 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
@@ -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
@@ -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) ;
} ;
}

View File

@@ -19,31 +19,115 @@ concrete SentenceMlt of Sentence = CatMlt ** open
-- NP -> VP -> Cl
-- John walks
PredVP np vp = {
s = \\tense,ant,pol => (s ++ v ++ o)
s = \\tense,ant,pol,ord =>
case ord of {
ODir => (s ++ v ++ o) ; -- ĠANNI JIEKOL ĦUT
OQuest => (v ++ o ++ s) -- JIEKOL ĦUT ĠANNI ?
}
where {
s = case np.isPron of {
s : Str = case np.isPron of {
True => [] ; -- omit subject pronouns
False => np.s ! Nom
False => np.s ! NPNom
} ;
v = joinVParts (vp.s ! VPIndicat tense (toVAgr np.a) ! ant ! pol) ;
o = vp.s2 ! np.a ;
-- s = if_then_Str np.isPron [] (np.s ! Nom) ; -- omit subject pronouns
-- v = joinVParts (vp.s ! VPIndicat tense (toVAgr np.a) ! ant ! pol) ;
-- o = vp.s2 ! np.a ;
v : Str = joinVParts (vp.s ! VPIndicat tense (toVAgr np.a) ! ant ! pol) ;
o : Str = vp.s2 ! np.a ;
} ;
} ;
-- Temp -> Polarity -> Cl -> S
-- SC -> VP -> Cl
-- that she goes is good
PredSCVP sc vp = mkClause sc.s (agrP3 Sg Masc) vp ;
-- VP -> Imp
ImpVP vp = {
s = \\pol,n => joinVParts (vp.s ! VPImperat n ! Simul ! pol)
} ;
-- NP -> VPSlash -> ClSlash
-- (whom) he sees
SlashVP np vp =
mkClause (np.s ! npNom) np.a vp ** {c2 = vp.c2} ;
-- ClSlash -> Adv -> ClSlash
-- (whom) he sees today
AdvSlash slash adv = {
s = \\t,a,p,o => slash.s ! t ! a ! p ! o ++ adv.s ;
c2 = slash.c2
} ;
-- Cl -> Prep -> ClSlash
-- (with whom) he walks
SlashPrep cl prep = cl ** {c2 = prep} ;
-- NP -> VS -> SSlash -> ClSlash
-- (whom) she says that he loves
SlashVS np vs slash =
mkClause (np.s ! npNom) np.a
(insertObj (\\_ => conjLi ++ slash.s) (predV vs)) **
{c2 = slash.c2} ;
-- S -> SC
-- that she goes
EmbedS s = {
s = conjLi ++ s.s
} ;
-- QS -> SC
-- who goes
EmbedQS qs = {
s = qs.s ! QIndir
} ;
-- VP -> SC
-- to go
EmbedVP vp = {
s = infVP vp Simul Pos (agrP3 Sg Masc) --- agr
} ;
-- Temp -> Pol -> Cl -> S
UseCl t p cl = {
s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p
s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! ODir
} ;
-- Cl
-- Imp
-- QS
-- RS
-- S
-- SC
-- SSlash
-- Temp -> Pol -> QCl -> QS
UseQCl t p qcl = {
s = \\q => t.s ++ p.s ++ qcl.s ! t.t ! t.a ! p.p ! q
} ;
-- Temp -> Pol -> RCl -> RS
UseRCl t p rcl = {
s = \\r => t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p ! r ;
-- c = cl.c
} ;
-- Temp -> Pol -> ClSlash -> SSlash
UseSlash t p clslash = {
s = t.s ++ p.s ++ clslash.s ! t.t ! t.a ! p.p ! ODir ;
c2 = clslash.c2
} ;
-- Adv -> S -> S
-- then I will go home
AdvS a s = {
s = a.s ++ s.s
} ;
-- Adv -> S -> S
-- next week, I will go home
ExtAdvS a s = {
s = a.s ++ "," ++ s.s
} ;
-- S -> Subj -> S -> S
-- I go home if she comes
SSubjS a s b = {
s = a.s ++ "," ++ s.s ++ b.s
} ;
-- S -> RS -> S
-- she sleeps, which is good
RelS s r = {
s = s.s ++ "," ++ r.s ! agrP3 Sg Masc
} ;
}

View File

@@ -5,7 +5,7 @@
-- Licensed under LGPL
concrete StructuralMlt of Structural = CatMlt **
open MorphoMlt, ResMlt, ParadigmsMlt, Prelude in {
open MorphoMlt, ResMlt, ParadigmsMlt, (C = ConstructX), Prelude in {
flags
optimize=all ;
@@ -23,20 +23,30 @@ concrete StructuralMlt of Structural = CatMlt **
youPl_Pron = mkPron "intom" "kom" plural P2 masculine ;
they_Pron = mkPron "huma" "hom" plural P3 masculine ;
youPol_Pron = youSg_Pron ;
-- it_Pron = mkPron "it" "it" "its" "its" singular P3 nonhuman ;
it_Pron = he_Pron ;
whatPl_IP = mkIP ("x'" ++ BIND) plural ;
whatSg_IP = mkIP ("x'" ++ BIND) singular ;
whoPl_IP = mkIP "min" plural ;
whoSg_IP = mkIP "min" singular ;
{- Determiner ----------------------------------------------------------- -}
all_Predet = ss "kollha" ;
-- every_Det = mkDeterminerSpec singular "every" "everyone" False ;
every_Det = mkDeterminer singular "kull" ; --- KULĦADD
few_Det = mkDeterminer plural "ftit" ;
many_Det = mkDeterminer plural "ħafna" ; -- bosta
-- most_Predet = ss "most" ;
-- much_Det = mkDeterminer singular "much" ;
many_Det = mkDeterminer plural "ħafna" ;
most_Predet = ss "il-maġġoranza ta'" ; --- TAL-, TAN-
much_Det = mkDeterminer singular "ħafna" ;
only_Predet = ss "biss" ;
someSg_Det = mkDeterminer singular "xi" ;
somePl_Det = mkDeterminer plural "xi" ;
-- not_predet = {s = "not" ; lock_Predet = <>} ;
not_Predet = ss "mhux" ;
how8many_IDet = {
s = "kemm" ; -- KEMM IL-...
n = plural
} ;
{- Quantifier ----------------------------------------------------------- -}
@@ -45,7 +55,7 @@ concrete StructuralMlt of Structural = CatMlt **
no_Quant = let l_ebda = artDef ++ "ebda" in
mkQuant l_ebda l_ebda l_ebda False ;
-- which_IQuant = {s = \\_ => "which"} ;
which_IQuant = ss "liema" ;
{- Conjunction ---------------------------------------------------------- -}
@@ -82,91 +92,82 @@ concrete StructuralMlt of Structural = CatMlt **
with_Prep = mkPrep "ma'" "m'" "mal-" "mat-" "mal-" ;
except_Prep = mkPrep "apparti" ;
{- Others --------------------------------------------------------------- -}
{- Noun phrase ---------------------------------------------------------- -}
-- almost_AdA = mkAdA "almost" ;
-- almost_AdN = mkAdN "almost" ;
-- although_Subj = ss "although" ;
-- always_AdV = mkAdV "always" ;
-- because_Subj = ss "because" ;
-- can8know_VV, can_VV = {
-- s = table {
-- VVF VInf => ["be able to"] ;
-- VVF VPres => "can" ;
-- VVF VPPart => ["been able to"] ;
-- VVF VPresPart => ["being able to"] ;
-- VVF VPast => "could" ; --# notpresent
-- VVPastNeg => "couldn't" ; --# notpresent
-- VVPresNeg => "can't"
-- } ;
-- typ = VVAux
-- } ;
-- everybody_NP = regNP "everybody" singular ;
-- everything_NP = regNP "everything" singular ;
-- everywhere_Adv = mkAdv "everywhere" ;
-- here_Adv = mkAdv "here" ;
-- here7to_Adv = mkAdv ["to here"] ;
-- here7from_Adv = mkAdv ["from here"] ;
-- how_IAdv = ss "how" ;
-- how8much_IAdv = ss "how much" ;
-- how8many_IDet = mkDeterminer plural ["how many"] ;
-- if_Subj = ss "if" ;
-- less_CAdv = C.mkCAdv "less" "than" ;
-- more_CAdv = C.mkCAdv "more" "than" ;
-- most_Predet = ss "most" ;
-- must_VV = {
-- s = table {
-- VVF VInf => ["have to"] ;
-- VVF VPres => "must" ;
-- VVF VPPart => ["had to"] ;
-- VVF VPresPart => ["having to"] ;
-- VVF VPast => ["had to"] ; --# notpresent
-- VVPastNeg => ["hadn't to"] ; --# notpresent
-- VVPresNeg => "mustn't"
-- } ;
-- typ = VVAux
-- } ;
-- no_Utt = ss "no" ;
-- please_Voc = ss "please" ;
-- quite_Adv = mkAdv "quite" ;
-- so_AdA = mkAdA "so" ;
-- somebody_NP = regNP "somebody" singular ;
-- something_NP = regNP "something" singular ;
-- somewhere_Adv = mkAdv "somewhere" ;
-- there_Adv = mkAdv "there" ;
-- there7to_Adv = mkAdv "there" ;
-- there7from_Adv = mkAdv ["from there"] ;
-- too_AdA = mkAdA "too" ;
-- very_AdA = mkAdA "very" ;
-- want_VV = mkVV (regV "want") ;
-- whatPl_IP = mkIP "what" "what" "what's" plural ;
-- whatSg_IP = mkIP "what" "what" "what's" singular ;
-- when_IAdv = ss "when" ;
-- when_Subj = ss "when" ;
-- where_IAdv = ss "where" ;
-- whoPl_IP = mkIP "who" "whom" "whose" plural ;
-- whoSg_IP = mkIP "who" "whom" "whose" singular ;
-- why_IAdv = ss "why" ;
-- yes_Utt = ss "yes" ;
everybody_NP = regNP "kulħadd" ;
everything_NP = regNP "kollox" ;
somebody_NP = regNP "xi ħadd" ;
something_NP = regNP "xi ħaġa" ;
nobody_NP = regNP "ħadd" ;
nothing_NP = regNP "xejn" ;
-- nobody_NP = regNP "nobody" singular ;
-- nothing_NP = regNP "nothing" singular ;
{- Subjunction ---------------------------------------------------------- -}
-- at_least_AdN = mkAdN "at least" ;
-- at_most_AdN = mkAdN "at most" ;
although_Subj = ss "avolja" ;
because_Subj = ss "għax" ;
if_Subj = ss "jekk" ;
when_Subj = ss "meta" ;
that_Subj = ss "li" ;
{- Adverb --------------------------------------------------------------- -}
-- as_CAdv = C.mkCAdv "as" "as" ;
almost_AdA = mkAdA "kważi" ;
almost_AdN = mkAdN "kważi" ;
always_AdV = mkAdV "dejjem" ;
at_least_AdN = mkAdN "mill-inqas" ;
at_most_AdN = mkAdN "l-iktar" ;
everywhere_Adv = mkAdv "kullimkien" ;
here_Adv = mkAdv "hawn" ;
here7to_Adv = mkAdv ["s'hawnhekk"] ;
here7from_Adv = mkAdv ["minn hawnhekk"] ;
less_CAdv = C.mkCAdv "inqas" "minn" ; --- INQAS MILL-IEĦOR
more_CAdv = C.mkCAdv "iktar" "minn" ; --- IKTAR MIT-TNEJN
quite_Adv = mkAdv "pjuttost" ;
so_AdA = mkAdA "allura" ;
somewhere_Adv = mkAdv "x'imkien" ;
there_Adv = mkAdv "hemmhekk" ;
there7to_Adv = mkAdv "s'hemmhekk" ;
there7from_Adv = mkAdv ["minn hemmhekk"] ;
too_AdA = mkAdA "ukoll" ;
very_AdA = mkAdA "ħafna" ;
as_CAdv = C.mkCAdv "" "daqs" ; -- "as good as gold"
have_V2 = dirV2 (
irregularV form1 (ResMlt.mkRoot) (ResMlt.mkPattern)
how_IAdv = ss "kif" ;
how8much_IAdv = ss "kemm" ;
when_IAdv = ss "meta" ;
where_IAdv = ss "fejn" ;
why_IAdv = ss "għalfejn" ;
{- Verb ----------------------------------------------------------------- -}
can8know_VV = af_V ;
can_VV = sata'_V ;
must_VV = kellu_V ;
want_VV = ried_V ;
have_V2 = dirV2 (kellu_V) ;
oper
af_V = irregularV form1 (ResMlt.mkRoot "'-'-f") (ResMlt.mkPattern "a" [])
"kont naf" "kont taf" "kien jaf" "kienet taf" "konna nafu" "kontu tafu" "kienu jafu" --- will fail for negative
"naf" "taf" "jaf" "taf" "nafu" "tafu" "jafu"
"kun af" "kunu afu"
;
sata'_V = mkV "sata'" (ResMlt.mkRoot "s-t-għ") ;
ried_V = mkV "ried" (ResMlt.mkRoot "r-j-d") ;
kellu_V = irregularV form1 (ResMlt.mkRoot) (ResMlt.mkPattern)
"kelli" "kellek" "kellu" "kellha" "kellna" "kellkom" "kellhom"
"għandi" "għandek" "għandu" "għandha" "għandna" "għandkom" "għandhom"
"kollok" "kollkom"
) ;
;
-- that_Subj = ss "that" ;
{- Others --------------------------------------------------------------- -}
lin
lin language_title_Utt = ss "Malti" ;
please_Voc = ss "jekk jgħoġbok" ; --- JEKK JGĦOĠOBKOM
no_Utt = ss "le" ;
yes_Utt = ss "iva" ;
language_title_Utt = ss "Malti" ;
}

View File

@@ -9,31 +9,147 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in {
flags optimize=all_subs ;
lin
-- V -> VP ;
-- V -> VP
UseV = predV ;
-- V2 -> VPSlash
SlashV2a = predV ;
-- love (it)
SlashV2a = predVc ;
-- V3 -> NP -> VPSlash
-- give it (to her)
Slash2V3 v np =
insertObjc (\\_ => v.c2.s ! Definite ++ np.s ! NPAcc) (predV v ** {c2 = v.c3}) ;
-- V3 -> NP -> VPSlash
-- give (it) to her
Slash3V3 v np =
insertObjc (\\_ => v.c3.s ! Definite ++ np.s ! NPAcc) (predVc v) ;
-- VV -> VP -> VP
-- want to run
ComplVV vv vp = insertObj (\\agr => infVP vp Simul Pos agr) (predV vv) ;
-- VS -> S -> VP
-- say that she runs
ComplVS v s = insertObj (\\_ => conjLi ++ s.s) (predV v) ;
-- VQ -> QS -> VP
-- wonder who runs
ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
-- VA -> AP -> VP
-- they become red
ComplVA v ap = insertObj (\\agr => ap.s ! toGenNum agr) (predV v) ;
-- V2V -> VP -> VPSlash
-- beg (her) to go
SlashV2V v vp = insertObjc (\\agr => v.c3.s ! Definite ++ infVP vp Simul Pos agr) (predVc v) ;
-- V2S -> S -> VPSlash
-- answer (to him) that it is good
SlashV2S v s = insertObjc (\\_ => conjThat ++ s.s) (predVc v) ;
-- V2Q -> QS -> VPSlash
-- ask (him) who came
SlashV2Q v q = insertObjc (\\_ => q.s ! QIndir) (predVc v) ;
-- V2A -> AP -> VPSlash
-- paint (it) red
SlashV2A v ap = insertObjc (\\a => ap.s ! toGenNum a) (predVc v) ;
-- VPSlash -> NP -> VP
-- love it
ComplSlash vp np =
case np.isPron of {
-- Join pron to verb
True => {
s = \\vpf,ant,pol =>
let bits = vp.s ! vpf ! ant ! pol in
mkVParts (glue bits.stem (np.s ! CPrep)) bits.pol ;
mkVParts (glue bits.stem (np.s ! NPCPrep)) bits.pol ;
s2 = \\agr => [] ;
} ;
-- Insert obj to VP
_ => insertObj (\\agr => np.s ! CPrep) vp
_ => insertObj (\\agr => np.s ! NPCPrep) vp
} ;
-- VV -> VPSlash -> VPSlash
-- want to buy
SlashVV vv vp =
insertObj (\\agr => infVP vp Simul Pos agr) (predV vv) **
{c2 = vp.c2} ;
-- V2V -> NP -> VPSlash -> VPSlash
-- beg me to buy
SlashV2VNP vv np vp =
insertObjPre (\\_ => vv.c2.s ! Definite ++ np.s ! NPAcc)
(insertObjc (\\agr => vv.c3.s ! Definite ++ infVP vp Simul Pos agr) (predVc vv)) **
{c2 = vp.c2} ;
-- Comp -> VP
-- be warm
UseComp comp = insertObj comp.s (predV copula_kien) ;
-- VP -> Adv -> VP
-- sleep here
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
-- AdV -> VP -> VP
-- AdVVP adv vp = insertAdV adv.s vp ;
-- always sleep
AdVVP adv vp = insertAdV adv.s vp ;
-- VPSlash -> Adv -> VPSlash
-- use (it) here
AdvVPSlash vp adv = insertObj (\\_ => adv.s) vp ** {c2 = vp.c2} ;
-- AdV -> VPSlash -> VPSlash
-- always use (it)
AdVVPSlash adv vp = insertAdV adv.s vp ** {c2 = vp.c2} ;
-- VPSlash -> VP
-- love himself
ReflVP vpslash = insertObjPre (\\agr => vpslash.s2 ! agr ++ reflPron ! toVAgr agr) vpslash ;
-- V2 -> VP
-- be loved
PassV2 v2 = insertObj (\\agr => v2.s ! VPassivePart (toGenNum agr) ++ v2.c2.s ! Definite) (predV copula_kien) ;
-- AP -> Comp
-- (be) small
CompAP ap = {
s = \\agr => ap.s ! toGenNum agr
} ;
-- NP -> Comp
-- (be) the man
CompNP np = {
s = \\_ => np.s ! NPAcc
} ;
-- Adv -> Comp
-- (be) here
CompAdv adv = {
s = \\_ => adv.s
} ;
-- CN -> Comp
-- (be) a man/men
CompCN cn = {
s = \\agr => case agr.n of {
Sg => artIndef ++ cn.s ! Singulative ;
Pl => cn.s ! Plural
}
} ;
-- VP
-- be
UseCopula = predV copula_kien ;
-- VP -> Prep -> VPSlash
-- live in (it)
VPSlashPrep vp p = vp ** {
c2 = p
} ;
}