Maltese RG: big improvements with clitics in VPs

This commit is contained in:
john
2013-05-28 14:45:53 +00:00
parent e969aa69ff
commit ce053c4a98
16 changed files with 761 additions and 305 deletions

View File

@@ -8,40 +8,66 @@ concrete AdverbMlt of Adverb = CatMlt ** open ResMlt, Prelude in {
lin lin
-- A -> Adv ; -- warmly -- A -> Adv
-- warmly
PositAdvAdj a = { PositAdvAdj a = {
s = "b'mod" ++ a.s ! APosit (GSg Masc) s = "b'mod" ++ a.s ! APosit (GSg Masc) ;
joinsVerb = False ;
a = agrP3 Sg Masc ; -- ignored when joinsVerb = False
} ; } ;
-- CAdv -> A -> NP -> Adv ; -- more warmly than John -- CAdv -> A -> NP -> Adv
-- more warmly than John
ComparAdvAdj cadv a np = { ComparAdvAdj cadv a np = {
s = cadv.s ++ a.s ! APosit (GSg Masc) ++ cadv.p ++ np.s ! npNom s = cadv.s ++ a.s ! APosit (GSg Masc) ++ cadv.p ++ np.s ! npNom ;
joinsVerb = False ;
a = np.a ; -- ignored when joinsVerb = False
} ; } ;
-- CAdv -> A -> S -> Adv ; -- more warmly than he runs -- CAdv -> A -> S -> Adv
-- more warmly than he runs
ComparAdvAdjS cadv a s = { ComparAdvAdjS cadv a s = {
s = cadv.s ++ a.s ! APosit (GSg Masc) ++ cadv.p ++ s.s s = cadv.s ++ a.s ! APosit (GSg Masc) ++ cadv.p ++ s.s ;
joinsVerb = False ;
a = agrP3 Sg Masc ; -- ignored when joinsVerb = False
} ; } ;
-- Prep -> NP -> Adv ; -- in the house -- Prep -> NP -> Adv
-- in the house
PrepNP prep np = { PrepNP prep np = {
s = prepNP prep np s = prepNP prep np ;
joinsVerb = prep.joinsVerb ;
a = np.a ;
}; };
-- AdA -> Adv -> Adv ; -- very quickly -- AdA -> Adv -> Adv
AdAdv = cc2 ; -- very quickly
AdAdv a b = cc2 a b ** {
-- A -> AdA ; -- extremely joinsVerb = False ;
PositAdAAdj a = { a = agrP3 Sg Masc ; -- ignored when joinsVerb = False
s = a.s ! APosit (GSg Masc) ++ "ħafna" ;
} ; } ;
-- Subj -> S -> Adv ; -- when she sleeps -- A -> AdA
SubjS = cc2 ; -- extremely
PositAdAAdj a = {
s = a.s ! APosit (GSg Masc) ++ "ħafna" ;
joinsVerb = False ;
a = agrP3 Sg Masc ; -- ignored when joinsVerb = False
} ;
-- CAdv -> AdN ; -- less (than five) -- Subj -> S -> Adv
-- when she sleeps
SubjS s r = cc2 s r ** {
joinsVerb = False ;
a = agrP3 Sg Masc ; -- ignored when joinsVerb = False
} ;
-- CAdv -> AdN
-- less (than five)
AdnCAdv cadv = { AdnCAdv cadv = {
s = cadv.s ++ cadv.p s = cadv.s ++ cadv.p ;
joinsVerb = False ;
a = agrP3 Sg Masc ; -- ignored when joinsVerb = False
} ; } ;
} }

View File

@@ -5,7 +5,7 @@
-- Angelo Zammit 2012 -- Angelo Zammit 2012
-- Licensed under LGPL -- Licensed under LGPL
concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude in { concrete CatMlt of Cat = CommonX - [Adv] ** open ResMlt, Prelude in {
flags flags
optimize=all_subs ; optimize=all_subs ;
@@ -120,4 +120,12 @@ concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude in {
N3 = Noun ** {c2, c3 : Compl} ; N3 = Noun ** {c2, c3 : Compl} ;
PN = ProperNoun ; PN = ProperNoun ;
-- Overridden from CommonX
Adv = {
s : Str ;
joinsVerb : Bool ; -- Adv "for us" completely integrates into verb at VP level
a : Agr ; -- when joinsVerb, this is important
} ;
} }

View File

@@ -12,7 +12,10 @@ concrete ConjunctionMlt of Conjunction =
ConjS = conjunctDistrSS ; ConjS = conjunctDistrSS ;
-- Conj -> [Adv] -> Adv -- "here or there" -- Conj -> [Adv] -> Adv -- "here or there"
ConjAdv = conjunctDistrSS ; ConjAdv c l = conjunctDistrSS c l ** {
joinsVerb = False ;
a = agrP3 Sg Masc ; -- ignored when joinsVerb = False
} ;
-- Conj -> [IAdv] -> IAdv -- "where and with whom" -- Conj -> [IAdv] -> IAdv -- "where and with whom"
ConjIAdv = conjunctDistrSS ; ConjIAdv = conjunctDistrSS ;

View File

@@ -356,7 +356,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in {
; ;
kamrad_KMRD_1_7014_V = mkV "kamrad" (mkRoot "k-m-r-d") ; kamrad_KMRD_1_7014_V = mkV "kamrad" (mkRoot "k-m-r-d") ;
kanga_KNGJ_1_7015_V = mkV "kanġa" (mkRoot "k-n-ġ-j") ; kanga_KNGJ_1_7015_V = mkV "kanġa" (mkRoot "k-n-ġ-j") ;
kanta_KNTJ_1_7016_V = mkV "kanta" (mkRoot "k-n-t-j") ; kanta_KNTJ_1_7016_V = mkV "kanta" "kanta" (mkRoot "k-n-t-j") ;
tkanta_KNTJ_2_7017_V = mkV_II "tkanta" (mkRoot "k-n-t-j") ; tkanta_KNTJ_2_7017_V = mkV_II "tkanta" (mkRoot "k-n-t-j") ;
kopra_KPRJ_1_7018_V = mkV "kopra" (mkRoot "k-p-r-j") ; kopra_KPRJ_1_7018_V = mkV "kopra" (mkRoot "k-p-r-j") ;
tkopra_KPRJ_2_7019_V = mkV_II "tkopra" (mkRoot "k-p-r-j") ; tkopra_KPRJ_2_7019_V = mkV_II "tkopra" (mkRoot "k-p-r-j") ;
@@ -3466,7 +3466,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in {
twemmen_WMN_5_10064_V = mkV_V "twemmen" (mkRoot "w-m-n") ; twemmen_WMN_5_10064_V = mkV_V "twemmen" (mkRoot "w-m-n") ;
wennes_WNS_2_10065_V = mkV_II "wennes" (mkRoot "w-n-s") ; wennes_WNS_2_10065_V = mkV_II "wennes" (mkRoot "w-n-s") ;
twennes_WNS_5_10066_V = mkV_V "twennes" (mkRoot "w-n-s") ; twennes_WNS_5_10066_V = mkV_V "twennes" (mkRoot "w-n-s") ;
waqaf_WQF_1_10067_V = mkV "waqaf" (mkRoot "w-q-f") ; waqaf_WQF_1_10067_V = mkV "waqaf" "ieqaf" (mkRoot "w-q-f") ;
waqqaf_WQF_2_10068_V = mkV_II "waqqaf" (mkRoot "w-q-f") ; waqqaf_WQF_2_10068_V = mkV_II "waqqaf" (mkRoot "w-q-f") ;
twaqqaf_WQF_5_10069_V = mkV_V "twaqqaf" (mkRoot "w-q-f") ; twaqqaf_WQF_5_10069_V = mkV_V "twaqqaf" (mkRoot "w-q-f") ;
waqa'_WQGH_1_10070_V = mkV "waqa'" (mkRoot "w-q-għ") ; waqa'_WQGH_1_10070_V = mkV "waqa'" (mkRoot "w-q-għ") ;

View File

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

View File

@@ -21,10 +21,10 @@ concrete IdiomMlt of Idiom = CatMlt ** open Prelude, ResMlt in {
} }
where { where {
kont : Str = case t of { kont : Str = case t of {
Pres => copula_kien.s ! VImpf (toVAgr np.a) ; Pres => copula_kien.s ! VImpf (toVAgr np.a) ! Pos ;
Past => copula_kien.s ! VPerf (toVAgr np.a) ; Past => copula_kien.s ! VPerf (toVAgr np.a) ! Pos ;
Fut => "ser" ++ copula_kien.s ! VImpf (toVAgr np.a) ; Fut => "ser" ++ copula_kien.s ! VImpf (toVAgr np.a) ! Pos ;
Cond => "kieku" ++ copula_kien.s ! VPerf (toVAgr np.a) Cond => "kieku" ++ copula_kien.s ! VPerf (toVAgr np.a) ! Pos
} ; } ;
} }
} ; } ;
@@ -55,8 +55,8 @@ concrete IdiomMlt of Idiom = CatMlt ** open Prelude, ResMlt in {
} ; } ;
-- VP -> VP ; -- be sleeping -- VP -> VP ; -- be sleeping
ProgrVP vp = predV copula_kien ** { ProgrVP vp = CopulaVP ** {
s2 = \\agr => joinVParts (vp.s ! VPIndicat Pres agr ! Simul ! Pos) s2 = \\agr => joinVP vp (VPIndicat Pres agr) Simul Pos
} ; } ;
-- VP -> Utt ; -- let's go -- VP -> Utt ; -- let's go

View File

@@ -81,7 +81,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
correct_A = regA "korrett" ; correct_A = regA "korrett" ;
count_V2 = dirV2 (ghadd_GHDD_1_10460_V) ; count_V2 = dirV2 (ghadd_GHDD_1_10460_V) ;
country_N = possN (mkN "pajjiż") ; country_N = possN (mkN "pajjiż") ;
cousin_N = possN (genderedN "kuġin" "kuġini") ; cousin_N = genderedN "kuġin" "kuġini" ;
cow_N = mkN "baqra" "baqar" "baqartejn" [] [] ; cow_N = mkN "baqra" "baqar" "baqartejn" [] [] ;
cut_V2 = dirV2 (qata'_QTGH_1_9305_V) ; cut_V2 = dirV2 (qata'_QTGH_1_9305_V) ;
day_N = mkN "ġurnata" "ġranet" ; day_N = mkN "ġurnata" "ġranet" ;
@@ -109,7 +109,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
fall_V = waqa'_WQGH_1_10070_V ; fall_V = waqa'_WQGH_1_10070_V ;
far_Adv = mkAdv "il-bogħod" ; -- use glue? far_Adv = mkAdv "il-bogħod" ; -- use glue?
fat_N = mkNColl "xaħam" ; fat_N = mkNColl "xaħam" ;
father_N2 = mkN2 (possN (mkN "missier" "missierijiet")) ; father_N2 = mkN2 (possN (mkN "missier" "missirijiet")) ;
fear_V2 = prepV2 (beza'_BZGH_1_7541_V) minnP ; fear_V2 = prepV2 (beza'_BZGH_1_7541_V) minnP ;
fear_VS = beza'_BZGH_1_7541_V; fear_VS = beza'_BZGH_1_7541_V;
feather_N = mkNColl "rix" ; feather_N = mkNColl "rix" ;
@@ -335,7 +335,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
uncertain_A = regA "inċert" ; uncertain_A = regA "inċert" ;
understand_V2 = lilV2 (fehem_FHM_1_10830_V) ; understand_V2 = lilV2 (fehem_FHM_1_10830_V) ;
university_N = mkN "università" "universitàjiet" ; university_N = mkN "università" "universitàjiet" ;
village_N = possN (mkN "raħal" "rħula") ; -- VILLAĠĠ village_N = mkN "raħal" "rħula" ; -- VILLAĠĠ
vomit_V = qala'_QLGH_1_9223_V ; vomit_V = qala'_QLGH_1_9223_V ;
wait_V2 = lilV2 (stenna_'NJ_10_10781_V) ; wait_V2 = lilV2 (stenna_'NJ_10_10781_V) ;
walk_V = mexa_MXJ_1_8926_V ; walk_V = mexa_MXJ_1_8926_V ;

55
lib/src/maltese/Maybe.gf Normal file
View File

@@ -0,0 +1,55 @@
{-
Maybe type, modelled on Haskell
John J. Camilleri
-}
resource Maybe = open Prelude, Predef in {
oper
-- Constructors
Maybe : (t : Type) -> Type = \t -> {
inner : t ;
exists : Bool
} ;
Just : (T : Type) -> T -> Maybe T = \_,t -> {
inner = t ;
exists = True
} ;
-- Nothing : (T : Type) -> Maybe T = \_ -> {
-- inner = variants {} ;
-- exists = False
-- } ;
Nothing : (T : Type) -> T -> Maybe T = \_,t -> {
inner = t ;
exists = False
} ;
-- Functions
exists : (T : Type) -> Maybe T -> Bool = \_,m -> m.exists ;
fromJust : (T : Type) -> Maybe T -> T = \_,m -> case m.exists of {
True => m.inner ;
False => Predef.error "Called fromJust with Nothing"
} ;
fromMaybe : (T : Type) -> T -> Maybe T -> T = \_,n,m -> case m.exists of {
True => m.inner ;
False => n
} ;
-- Instance with Str, since it's common
MaybeS = Maybe Str ;
JustS : Str -> Maybe Str = \r -> Just Str r ;
-- NothingS : Maybe Str = Nothing Str ;
NothingS : Maybe Str = Nothing Str "" ;
existsS : Maybe Str -> Bool = exists Str ;
fromJustS : Maybe Str -> Str = fromJust Str ;
fromMaybeS : Str -> Maybe Str -> Str = fromMaybe Str ;
-- Example
-- j : MaybeS = JustS "hello" ;
-- n : MaybeS = NothingS ;
-- s : Str = fromJustS j;
-- b : Bool = existsS j ;
-- r : Str = if_then_Str (existsS j) ("present") ("not present") ;
}

View File

@@ -150,24 +150,16 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
} ; } ;
-- Predet -> NP -> NP -- Predet -> NP -> NP
PredetNP pred np = np ** { PredetNP pred np = overwriteNPs np (\\c => pred.s ++ np.s ! c) ;
s = \\c => pred.s ++ np.s ! c ;
} ;
-- NP -> V2 -> NP -- NP -> V2 -> NP
PPartNP np v2 = np ** { PPartNP np v2 = overwriteNPs np (\\c => np.s ! c ++ stem1 (v2.s ! VActivePart (toGenNum np.a))) ;
s = \\c => np.s ! c ++ v2.s ! VImpf (toVAgr np.a) ; --- TODO: VPresPart
} ;
-- NP -> RS -> NP -- NP -> RS -> NP
RelNP np rs = np ** { RelNP np rs = overwriteNPs np (\\c => np.s ! c ++ "," ++ rs.s ! np.a ) ;
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
} ;
-- NP -> Adv -> NP -- NP -> Adv -> NP
AdvNP np adv = np ** { AdvNP np adv = overwriteNPs np (\\c => np.s ! c ++ adv.s) ;
s = \\c => np.s ! c ++ adv.s ;
} ;
-- Num -- Num
NumSg = {s = \\c => []; n = NumX Sg ; hasCard = False} ; NumSg = {s = \\c => []; n = NumX Sg ; hasCard = False} ;
@@ -241,35 +233,23 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
} ; } ;
-- AP -> CN -> CN -- AP -> CN -> CN
AdjCN ap cn = cn ** { AdjCN ap cn = overwriteCNs cn (\\num => preOrPost ap.isPre (ap.s ! mkGenNum num cn.g) (cn.s ! num)) ;
s = \\num => preOrPost ap.isPre (ap.s ! mkGenNum num cn.g) (cn.s ! num) ;
} ;
-- CN -> RS -> CN -- CN -> RS -> CN
RelCN cn rs = cn ** { RelCN cn rs = overwriteCNs cn (\\num => cn.s ! num ++ rs.s ! agrP3 (nounnum2num num) cn.g) ;
s = \\num => cn.s ! num ++ rs.s ! mkGenNum num cn.g ;
} ;
-- CN -> Adv -> CN -- CN -> Adv -> CN
AdvCN cn adv = cn ** { AdvCN cn adv = overwriteCNs cn (\\num => cn.s ! num ++ adv.s) ;
s = \\num => cn.s ! num ++ adv.s
} ;
-- CN -> SC -> CN -- CN -> SC -> CN
SentCN cn sc = cn ** { SentCN cn sc = overwriteCNs cn (\\num => cn.s ! num ++ sc.s) ;
s = \\num => cn.s ! num ++ sc.s
} ;
-- CN -> NP -> CN -- CN -> NP -> CN
ApposCN cn np = cn ** { ApposCN cn np = overwriteCNs cn (\\num => cn.s ! num ++ np.s ! NPNom) ;
s = \\num => cn.s ! num ++ np.s ! NPNom
} ; PossNP cn np = overwriteCNs cn (\\num => cn.s ! num ++ prepNP prep_ta np) ;
PossNP cn np = cn ** {
s = \\num => cn.s ! num ++ prepNP (mkPrep "ta'") np PartNP cn np = overwriteCNs cn (\\num => cn.s ! num ++ prepNP prep_ta np) ;
} ;
PartNP cn np = cn ** {
s = \\num => cn.s ! num ++ prepNP (mkPrep "ta'") np
} ;
-- Det -> NP -> NP -- Det -> NP -> NP
CountNP det np = { CountNP det np = {
@@ -281,9 +261,46 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
oper oper
-- Copied from ParadigmsMlt (didn't want to change import structure) -- Copied from ParadigmsMlt (didn't want to change import structure)
mkPrep : Str -> Prep = \fuq -> lin Prep { -- mkPrep : Str -> Prep = \fuq -> lin Prep {
s = \\defn => fuq ; -- s = \\defn => fuq ;
takesDet = False -- takesDet = False
-- } ;
prep_ta = lin Prep {
s = table {
Indefinite => "ta'" ;
Definite => makePreFull "tal-" "ta" "t'"
} ;
enclitic : Agr => Str = \\agr => case toVAgr agr of {
AgP1 Sg => "tiegħi" ;
AgP2 Sg => "tiegħek" ;
AgP3Sg Masc => "tiegħu" ;
AgP3Sg Fem => "tagħha" ;
AgP1 Pl => "tagħna" ;
AgP2 Pl => "tagħkom" ;
AgP2Pl => "tagħhom"
} ;
takesDet = True ;
joinsVerb = False ;
} ;
oper
-- Overwrite the s field in an NP
-- Use this instead of np ** { s = ... }
overwriteNPs : NounPhrase -> (NPCase => Str) -> NounPhrase = \np,tbl -> {
s = tbl ;
a = np.a ;
isPron = np.isPron ;
isDefn = np.isDefn ;
} ;
-- Overwrite the s field in a Noun
-- Use this instead of n ** { s = ... }
overwriteCNs : Noun -> (Noun_Number => Str) -> Noun = \n,tbl -> {
s = tbl ;
g = n.g ;
hasColl = n.hasColl ;
hasDual = n.hasDual ;
takesPron = n.takesPron ;
} ; } ;
} }

View File

@@ -223,10 +223,10 @@ resource ParadigmsMlt = open
} ; } ;
prepN2 : N -> Prep -> N2 ; prepN2 : N -> Prep -> N2 ;
prepN2 = \n,p -> lin N2 (n ** {c2 = p}) ; prepN2 = \n,p -> lin N2 (n ** {c2 = hasCompl p}) ;
mkN3 : Noun -> Prep -> Prep -> N3 ; mkN3 : Noun -> Prep -> Prep -> N3 ;
mkN3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; mkN3 = \n,p,q -> lin N3 (n ** {c2 = hasCompl p ; c3 = hasCompl q}) ;
-- Mark a noun as taking possessive enclitic pronouns -- Mark a noun as taking possessive enclitic pronouns
possN : N -> N ; possN : N -> N ;
@@ -245,7 +245,25 @@ resource ParadigmsMlt = open
-- Same in all cases, e.g. FUQ -- Same in all cases, e.g. FUQ
mkPrep : Str -> Prep = \fuq -> lin Prep { mkPrep : Str -> Prep = \fuq -> lin Prep {
s = \\defn => fuq ; s = \\defn => fuq ;
takesDet = False enclitic = prepClitics fuq ;
takesDet = False ;
joinsVerb = False ;
} ;
-- Same in non-clitic cases, but given all clitic cases e.g. QABEL
mkPrep : (_,_,_,_,_,_,_,_ : Str) -> Prep = \qabel, qabli, qablek, qablu, qabilha, qabilna, qabilkom, qabilhom -> lin Prep {
s = \\defn => qabel ;
enclitic = \\agr => case toVAgr agr of {
AgP1 Sg => qabli ;
AgP2 Sg => qablek ;
AgP3Sg Masc => qablu ;
AgP3Sg Fem => qabilha ;
AgP1 Pl => qabilna ;
AgP2 Pl => qabilkom ;
AgP2Pl => qabilhom
} ;
takesDet = False ;
joinsVerb = False ;
} ; } ;
-- Forms: -- Forms:
@@ -257,10 +275,12 @@ resource ParadigmsMlt = open
Indefinite => ghal ; Indefinite => ghal ;
Definite => makePreFull ghall (dropSfx 2 ghat) ghall Definite => makePreFull ghall (dropSfx 2 ghat) ghall
} ; } ;
takesDet = True enclitic = prepClitics ghal ;
takesDet = True ;
joinsVerb = False ;
} ; } ;
-- All forms: -- All forms, but assumed enclitic forms
-- BI ktieb/triq -- BI ktieb/triq
-- B'ajruplan -- B'ajruplan
-- BIL-ktieb -- BIL-ktieb
@@ -271,12 +291,86 @@ resource ParadigmsMlt = open
Indefinite => makePreVowel bi b' ; Indefinite => makePreVowel bi b' ;
Definite => makePreFull bil (dropSfx 2 bit) bl Definite => makePreFull bil (dropSfx 2 bit) bl
} ; } ;
takesDet = True enclitic = prepClitics bi ;
takesDet = True ;
joinsVerb = False ;
} ; } ;
} ;
noPrep : Prep ; -- no preposition -- All forms:
noPrep = mkPrep [] ; -- BI ktieb/triq
-- B'ajruplan
-- BIL-ktieb
-- BIT-triq
-- BL-ajruplan
-- BIJA
-- BIK
-- BIH
-- BIHA
-- BINA
-- BIKOM
-- BIHOM
mkPrep : (_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Bool -> Prep = \bi,b',bil,bit,bl,bija,bik,bih,biha,bina,bikom,bihom,joinsV -> lin Prep {
s = table {
Indefinite => makePreVowel bi b' ;
Definite => makePreFull bil (dropSfx 2 bit) bl
} ;
enclitic = \\agr => case toVAgr agr of {
AgP1 Sg => bija ;
AgP2 Sg => bik ;
AgP3Sg Masc => bih ;
AgP3Sg Fem => biha ;
AgP1 Pl => bina ;
AgP2 Pl => bikom ;
AgP2Pl => bihom
} ;
takesDet = True ;
joinsVerb = joinsV ;
} ;
} ;
prepClitics : Str -> (Agr => Str) = \taht -> \\agr =>
case taht of {
war+"a" => case toVAgr agr of {
AgP1 Sg => war+"ajja" ;
AgP2 Sg => war+"ajk" ;
AgP3Sg Masc => war+"ajh" ;
AgP3Sg Fem => war+"ajha" ;
AgP1 Pl => war+"ajna" ;
AgP2 Pl => war+"ajkom" ;
AgP2Pl => war+"ajhom"
} ;
f+"i" => case toVAgr agr of {
AgP1 Sg => f+"ija" ;
AgP2 Sg => f+"ik" ;
AgP3Sg Masc => f+"ih" ;
AgP3Sg Fem => f+"iha" ;
AgP1 Pl => f+"ina" ;
AgP2 Pl => f+"ikom" ;
AgP2Pl => f+"ihom"
} ;
t+"a'" => case toVAgr agr of {
AgP1 Sg => t+"iegħi" ;
AgP2 Sg => t+"iegħek" ;
AgP3Sg Masc => t+"iegħu" ;
AgP3Sg Fem => t+"agħha" ;
AgP1 Pl => t+"agħna" ;
AgP2 Pl => t+"agħkom" ;
AgP2Pl => t+"agħhom"
} ;
_ => case toVAgr agr of {
AgP1 Sg => taht+"i" ;
AgP2 Sg => taht+"ek" ;
AgP3Sg Masc => taht+"u" ;
AgP3Sg Fem => taht + "ha" ;
AgP1 Pl => case taht of {bej+"n" => bej+"na"; _ => taht+"na"} ;
AgP2 Pl => taht + "kom" ;
AgP2Pl => taht + "hom"
}
} ;
{- Verb --------------------------------------------------------------- -} {- Verb --------------------------------------------------------------- -}
@@ -402,7 +496,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo class form root patt impSg ; info : VerbInfo = mkVerbInfo class form root patt impSg ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -449,7 +543,7 @@ resource ParadigmsMlt = open
} ; } ;
newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ; newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ;
in lin V { in lin V {
s = conjFormII newinfo ; s = stemVariantsTbl (conjFormII newinfo) ;
i = newinfo ; i = newinfo ;
} ; } ;
@@ -462,7 +556,7 @@ resource ParadigmsMlt = open
imp : Str = mammaII ; --- assumption: mamma II is also imperative imp : Str = mammaII ; --- assumption: mamma II is also imperative
newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ; newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ;
in lin V { in lin V {
s = conjFormII_quad newinfo ; s = stemVariantsTbl (conjFormII_quad newinfo) ;
i = newinfo ; i = newinfo ;
} ; } ;
derivedV_QuadII : Str -> Str -> Root -> V = \mammaII, imp, root -> derivedV_QuadII : Str -> Str -> Root -> V = \mammaII, imp, root ->
@@ -471,7 +565,7 @@ resource ParadigmsMlt = open
patt : Pattern = extractPattern mammaII ; patt : Pattern = extractPattern mammaII ;
newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ; newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ;
in lin V { in lin V {
s = conjFormII_quad newinfo ; s = stemVariantsTbl (conjFormII_quad newinfo) ;
i = newinfo ; i = newinfo ;
} ; } ;
} ; } ;
@@ -485,7 +579,7 @@ resource ParadigmsMlt = open
class : VClass = classifyRoot root ; class : VClass = classifyRoot root ;
info : VerbInfo = mkVerbInfo class FormIII root vowels vowels2 mammaIII ; --- assumption: mamma III is also imperative info : VerbInfo = mkVerbInfo class FormIII root vowels vowels2 mammaIII ; --- assumption: mamma III is also imperative
in lin V { in lin V {
s = conjFormIII info ; s = stemVariantsTbl (conjFormIII info) ;
i = info ; i = info ;
} ; } ;
@@ -500,20 +594,22 @@ resource ParadigmsMlt = open
mammaII : Str = dropPfx 1 mammaV ; -- WAQQAF mammaII : Str = dropPfx 1 mammaV ; -- WAQQAF
vII : V = derivedV_II mammaII root ; vII : V = derivedV_II mammaII root ;
info : VerbInfo = mkVerbInfo vII.i.class FormV vII.i.root vII.i.patt mammaV ; info : VerbInfo = mkVerbInfo vII.i.class FormV vII.i.root vII.i.patt mammaV ;
in lin V { get : VForm -> Str = \vf -> stem1 (vII.s ! vf) ;
s = table { tbl : VForm => Str = table {
VPerf agr => pfx_T (vII.s ! VPerf agr) ; VPerf agr => pfx_T (get (VPerf agr)) ;
VImpf (AgP1 Sg) => pfx "ni" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP1 Sg)))) ; VImpf (AgP1 Sg) => pfx "ni" (pfx_T (dropPfx 1 (get (VImpf (AgP1 Sg))))) ;
VImpf (AgP2 Sg) => pfx "ti" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP2 Sg)))) ; VImpf (AgP2 Sg) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP2 Sg))))) ;
VImpf (AgP3Sg Masc) => pfx "ji" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP3Sg Masc)))) ; VImpf (AgP3Sg Masc) => pfx "ji" (pfx_T (dropPfx 1 (get (VImpf (AgP3Sg Masc))))) ;
VImpf (AgP3Sg Fem) => pfx "ti" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP3Sg Fem)))) ; VImpf (AgP3Sg Fem) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP3Sg Fem))))) ;
VImpf (AgP1 Pl) => pfx "ni" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP1 Pl)))) ; VImpf (AgP1 Pl) => pfx "ni" (pfx_T (dropPfx 1 (get (VImpf (AgP1 Pl))))) ;
VImpf (AgP2 Pl) => pfx "ti" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP2 Pl)))) ; VImpf (AgP2 Pl) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP2 Pl))))) ;
VImpf (AgP3Pl) => pfx "ji" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP3Pl)))) ; VImpf (AgP3Pl) => pfx "ji" (pfx_T (dropPfx 1 (get (VImpf (AgP3Pl))))) ;
VImp num => pfx_T (vII.s ! VImp num) ; VImp num => pfx_T (get (VImp num)) ;
VActivePart _ => "" ; --- TODO VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO VPassivePart _ => "" --- TODO
} ; } ;
in lin V {
s = stemVariantsTbl (tbl) ;
i = info ; i = info ;
} ; } ;
@@ -525,20 +621,22 @@ resource ParadigmsMlt = open
mammaIII : Str = dropPfx 1 mammaVI ; -- QIEGĦED mammaIII : Str = dropPfx 1 mammaVI ; -- QIEGĦED
vIII : V = derivedV_III mammaIII root ; vIII : V = derivedV_III mammaIII root ;
info : VerbInfo = updateVerbInfo vIII.i FormVI mammaVI ; info : VerbInfo = updateVerbInfo vIII.i FormVI mammaVI ;
in lin V { get : VForm -> Str = \vf -> stem1 (vIII.s ! vf) ;
s = table { tbl : VForm => Str = table {
VPerf agr => pfx_T (vIII.s ! VPerf agr) ; VPerf agr => pfx_T (get (VPerf agr)) ;
VImpf (AgP1 Sg) => pfx "ni" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP1 Sg)))) ; VImpf (AgP1 Sg) => pfx "ni" (pfx_T (dropPfx 1 (get (VImpf (AgP1 Sg))))) ;
VImpf (AgP2 Sg) => pfx "ti" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP2 Sg)))) ; VImpf (AgP2 Sg) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP2 Sg))))) ;
VImpf (AgP3Sg Masc) => pfx "ji" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP3Sg Masc)))) ; VImpf (AgP3Sg Masc) => pfx "ji" (pfx_T (dropPfx 1 (get (VImpf (AgP3Sg Masc))))) ;
VImpf (AgP3Sg Fem) => pfx "ti" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP3Sg Fem)))) ; VImpf (AgP3Sg Fem) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP3Sg Fem))))) ;
VImpf (AgP1 Pl) => pfx "ni" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP1 Pl)))) ; VImpf (AgP1 Pl) => pfx "ni" (pfx_T (dropPfx 1 (get (VImpf (AgP1 Pl))))) ;
VImpf (AgP2 Pl) => pfx "ti" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP2 Pl)))) ; VImpf (AgP2 Pl) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP2 Pl))))) ;
VImpf (AgP3Pl) => pfx "ji" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP3Pl)))) ; VImpf (AgP3Pl) => pfx "ji" (pfx_T (dropPfx 1 (get (VImpf (AgP3Pl))))) ;
VImp num => pfx_T (vIII.s ! VImp num) ; VImp num => pfx_T (get (VImp num)) ;
VActivePart _ => "" ; --- TODO VActivePart _ => "" ; --- TODO
VPassivePart _ => "" --- TODO VPassivePart _ => "" --- TODO
} ; } ;
in lin V {
s = stemVariantsTbl (tbl) ;
i = info ; i = info ;
} ; } ;
@@ -558,7 +656,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo class FormVII root vowels mammaVII ; info : VerbInfo = mkVerbInfo class FormVII root vowels mammaVII ;
in lin V { in lin V {
s = conjFormVII info c1 ; s = stemVariantsTbl (conjFormVII info c1) ;
i = info ; i = info ;
} ; } ;
@@ -572,7 +670,7 @@ resource ParadigmsMlt = open
info : VerbInfo = mkVerbInfo class FormVIII root vowels mammaVIII ; info : VerbInfo = mkVerbInfo class FormVIII root vowels mammaVIII ;
c1 : Str = root.C1+"t"; c1 : Str = root.C1+"t";
in lin V { in lin V {
s = conjFormVII info c1 ; -- note we use conjFormVII ! s = stemVariantsTbl (conjFormVII info c1) ; -- note we use conjFormVII !
i = info ; i = info ;
} ; } ;
@@ -587,7 +685,7 @@ resource ParadigmsMlt = open
class : VClass = classifyRoot root ; class : VClass = classifyRoot root ;
info : VerbInfo = mkVerbInfo class FormIX root patt mammaIX ; info : VerbInfo = mkVerbInfo class FormIX root patt mammaIX ;
in lin V { in lin V {
s = conjFormIX info ; s = stemVariantsTbl (conjFormIX info) ;
i = info ; i = info ;
} ; } ;
_ => Predef.error("I don't know how to make a Form IX verb out of" ++ mammaIX) _ => Predef.error("I don't know how to make a Form IX verb out of" ++ mammaIX)
@@ -602,7 +700,7 @@ resource ParadigmsMlt = open
patt2 : Pattern = vowelChangesIE root patt ; patt2 : Pattern = vowelChangesIE root patt ;
info : VerbInfo = mkVerbInfo class FormX root patt patt2 mammaX ; info : VerbInfo = mkVerbInfo class FormX root patt patt2 mammaX ;
in lin V { in lin V {
s = conjFormX info ; s = stemVariantsTbl (conjFormX info) ;
i = info ; i = info ;
} ; } ;
@@ -639,7 +737,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Strong Regular) (FormI) root patt (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Strong Regular) (FormI) root patt (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -681,7 +779,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Strong LiquidMedial) (FormI) root patt (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Strong LiquidMedial) (FormI) root patt (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -718,7 +816,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Strong Geminated) (FormI) root patt (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Strong Geminated) (FormI) root patt (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -759,7 +857,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Weak Assimilative) (FormI) root patt patt2 (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Weak Assimilative) (FormI) root patt patt2 (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -800,7 +898,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Weak Hollow) (FormI) root patt patt2 (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Weak Hollow) (FormI) root patt patt2 (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -841,7 +939,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Weak Lacking) (FormI) root patt (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Weak Lacking) (FormI) root patt (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -878,7 +976,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Weak Defective) (FormI) root patt (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Weak Defective) (FormI) root patt (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -915,7 +1013,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Quad QStrong) (FormI) root patt (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Quad QStrong) (FormI) root patt (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -955,7 +1053,7 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Quad QWeak) (FormI) root patt (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Quad QWeak) (FormI) root patt (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
@@ -980,29 +1078,35 @@ resource ParadigmsMlt = open
} ; } ;
info : VerbInfo = mkVerbInfo (Loan) (FormI) (imp ! Sg) ; info : VerbInfo = mkVerbInfo (Loan) (FormI) (imp ! Sg) ;
in lin V { in lin V {
s = tbl ; s = stemVariantsTbl tbl ;
i = info ; i = info ;
} ; } ;
{- Verb --------------------------------------------------------------- -} {- Verb --------------------------------------------------------------- -}
hasCompl : Prep -> Compl = \p -> p ** { isPresent = True } ;
noCompl : Compl = noPrep ** { isPresent = False } where { noPrep : Prep = mkPrep [] };
mkVS : V -> VS ; -- sentence-compl mkVS : V -> VS ; -- sentence-compl
mkVS v = lin VS v ; mkVS v = lin VS v ;
prepV2 : V -> Prep -> V2 ; prepV2 : V -> Prep -> V2 ;
prepV2 v p = lin V2 ( v ** { c2 = p } ) ; prepV2 v p = lin V2 ( v ** { c2 = hasCompl p } ) ;
dirV2 : V -> V2 ; dirV2 : V -> V2 ;
dirV2 v = prepV2 v noPrep ; -- dirV2 v = prepV2 v noPrep ;
dirV2 v = lin V2 ( v ** { c2 = noCompl } ) ;
prepPrepV3 : V -> Prep -> Prep -> V3 ; prepPrepV3 : V -> Prep -> Prep -> V3 ;
prepPrepV3 v p t = lin V3 (v ** { c2 = p ; c3 = t }) ; prepPrepV3 v p t = lin V3 (v ** { c2 = hasCompl p ; c3 = hasCompl t }) ;
dirV3 : V -> Prep -> V3 ; dirV3 : V -> Prep -> V3 ;
dirV3 v p = prepPrepV3 v noPrep p ; -- dirV3 v p = prepPrepV3 v noPrep p ;
dirV3 v t = lin V3 (v ** { c2 = noCompl ; c3 = hasCompl t }) ;
dirdirV3 : V -> V3 ; dirdirV3 : V -> V3 ;
dirdirV3 v = dirV3 v noPrep ; -- dirdirV3 v = dirV3 v noPrep ;
dirdirV3 v = lin V3 (v ** { c2 = noCompl ; c3 = noCompl }) ;
mkV3 : overload { mkV3 : overload {
mkV3 : V -> V3 ; -- ditransitive, e.g. give,_,_ mkV3 : V -> V3 ; -- ditransitive, e.g. give,_,_
@@ -1022,7 +1126,7 @@ resource ParadigmsMlt = open
} ; } ;
mkV2V : V -> Prep -> Prep -> V2V ; -- e.g. want (noPrep NP) (to VP) mkV2V : V -> Prep -> Prep -> V2V ; -- e.g. want (noPrep NP) (to VP)
mkV2V v p t = lin V2V (v ** { c2 = p ; c3 = t }) ; mkV2V v p t = lin V2V (v ** { c2 = hasCompl p ; c3 = hasCompl t }) ;
{- Conjunction -------------------------------------------------------- -} {- Conjunction -------------------------------------------------------- -}
@@ -1126,10 +1230,11 @@ resource ParadigmsMlt = open
} ; } ;
prepA2 : A -> Prep -> A2 ; prepA2 : A -> Prep -> A2 ;
prepA2 a p = lin A2 (a ** {c2 = p}) ; prepA2 a p = lin A2 (a ** {c2 = hasCompl p}) ;
dirA2 : A -> A2 ; dirA2 : A -> A2 ;
dirA2 a = prepA2 a noPrep ; -- dirA2 a = prepA2 a noPrep ;
dirA2 a = lin A2 (a ** {c2 = noCompl}) ;
mkA2 : overload { mkA2 : overload {
mkA2 : A -> Prep -> A2 ; mkA2 : A -> Prep -> A2 ;
@@ -1154,7 +1259,10 @@ resource ParadigmsMlt = open
mkAdA : Str -> AdA ; -- adverb modifying adjective, e.g. PJUTTOST mkAdA : Str -> AdA ; -- adverb modifying adjective, e.g. PJUTTOST
mkAdN : Str -> AdN ; -- adverb modifying numeral, e.g. MADWAR mkAdN : Str -> AdN ; -- adverb modifying numeral, e.g. MADWAR
mkAdv x = lin Adv (ss x) ; mkAdv x = lin Adv (ss x) ** {
joinsVerb = False ;
a = agrP3 Sg Masc ; -- ignored when joinsVerb = False
} ;
mkAdV x = lin AdV (ss x) ; mkAdV x = lin AdV (ss x) ;
mkAdA x = lin AdA (ss x) ; mkAdA x = lin AdA (ss x) ;
mkAdN x = lin AdN (ss x) ; mkAdN x = lin AdN (ss x) ;

View File

@@ -43,7 +43,7 @@ concrete QuestionMlt of Question = CatMlt ** open ResMlt, ParamX, Prelude in {
-- IComp -> NP -> QCl -- IComp -> NP -> QCl
-- where is John -- where is John
QuestIComp icomp np = QuestIComp icomp np =
mkQuestion icomp (mkClause (np.s ! npNom) np.a (predV copula_kien)) ; mkQuestion icomp (mkClause (np.s ! npNom) np.a CopulaVP) ;
-- Prep -> IP -> IAdv -- Prep -> IP -> IAdv
-- with whom -- with whom

View File

@@ -7,17 +7,10 @@
--# -path=.:../abstract:../common:../prelude --# -path=.:../abstract:../common:../prelude
resource ResMlt = ParamX ** open Prelude, Predef in { resource ResMlt = ParamX ** open Prelude, Predef, Maybe in {
flags coding=utf8 ; 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 -------------------------------------------------------------- -} {- General -------------------------------------------------------------- -}
param param
@@ -52,7 +45,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
} ; } ;
toAgr : VAgr -> Agr = \vagr -> toAgr : VAgr -> Agr = \vagr ->
case vagr of { case vagr of {
AgP1 num => mkAgr num P1 Masc ; --- sorry ladies AgP1 num => mkAgr num P1 Masc ;
AgP2 num => mkAgr num P2 Masc ; AgP2 num => mkAgr num P2 Masc ;
AgP3Sg gen => mkAgr Pl P3 gen ; AgP3Sg gen => mkAgr Pl P3 gen ;
AgP3Pl => mkAgr Pl P3 Masc AgP3Pl => mkAgr Pl P3 Masc
@@ -71,6 +64,11 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
Sg => GSg g ; Sg => GSg g ;
Pl => GPl Pl => GPl
} ; } ;
mkGenNum : Noun_Number -> Gender -> GenNum = \n,g ->
case nounnum2num n of {
Sg => GSg g ;
Pl => GPl
} ;
} ; } ;
-- Convert to GenNum from another type -- Convert to GenNum from another type
@@ -96,10 +94,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
} ; } ;
} ; } ;
-- agrP3 : Agr = overload { agrP3 : Number -> Gender -> Agr = \n,g -> mkAgr n P3 g;
agrP3 : Number -> Gender -> Agr = \n,g -> mkAgr n P3 g;
-- agrP3 : Number -> Agr = \n -> mkAgr n P3 Masc;
-- } ;
conjAgr : Agr -> Agr -> Agr = \a,b -> { conjAgr : Agr -> Agr -> Agr = \a,b -> {
n = (conjNumber a.n b.n) ; n = (conjNumber a.n b.n) ;
@@ -123,7 +118,8 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
NPCase = NPCase =
NPNom NPNom
| NPAcc -- I have a feeling we'll this need eventually | NPAcc -- I have a feeling we'll this need eventually
| NPCPrep ; -- [AZ] | NPCPrep -- [AZ]
;
oper oper
npNom = NPNom ; npNom = NPNom ;
@@ -151,7 +147,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
-- _ => VPres -- _ => VPres
-- } ; -- } ;
vpform : VPForm = VPIndicat t (toVAgr agr) ; vpform : VPForm = VPIndicat t (toVAgr agr) ;
verb : Str = joinVParts (vp.s ! vpform ! a ! p) ; verb : Str = joinVP vp vpform a p ;
compl : Str = vp.s2 ! agr ; compl : Str = vp.s2 ! agr ;
in in
case o of { case o of {
@@ -214,6 +210,14 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
Pl => Plural Pl => Plural
} ; } ;
nounnum2num : Noun_Number -> Number = \n ->
case n of {
Singulative => Sg ;
Collective => Sg ;
Dual => Pl ;
Plural => Pl
} ;
numform2nounnum : NumForm -> Noun_Number = \n -> numform2nounnum : NumForm -> Noun_Number = \n ->
case n of { case n of {
NumX Sg => Singulative ; NumX Sg => Singulative ;
@@ -279,7 +283,6 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
hasColl : Bool ; -- has a collective form? e.g. BAQAR hasColl : Bool ; -- has a collective form? e.g. BAQAR
hasDual : Bool ; -- has a dual form? e.g. SAGĦTEJN hasDual : Bool ; -- has a dual form? e.g. SAGĦTEJN
takesPron : Bool ; -- takes enclitic pronon? e.g. MISSIERI takesPron : Bool ; -- takes enclitic pronon? e.g. MISSIERI
-- anim : Animacy ; -- is the noun animate? e.g. TABIB
} ; } ;
ProperNoun : Type = { ProperNoun : Type = {
@@ -323,7 +326,6 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
takesPron = False ; takesPron = False ;
hasDual = notB (isNil dual) ; hasDual = notB (isNil dual) ;
hasColl = notB (isNil coll) ; hasColl = notB (isNil coll) ;
-- anim = Inanimate ;
} ; } ;
-- Noun phrase -- Noun phrase
@@ -335,33 +337,45 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
}; };
regNP : Str -> NounPhrase = \kulhadd -> regNP : Str -> NounPhrase = \kulhadd ->
mkNP kulhadd Sg P3 Masc ; -- KULĦADD KUNTENT (not KULĦADD KUNTENTA) mkNP kulhadd Sg P3 Masc ; -- kulħadd kuntent
-- Join a preposition and NP to a string -- Join a preposition and NP to a string
prepNP : Preposition -> NounPhrase -> Str ; prepNP : Preposition -> NounPhrase -> Str ;
prepNP prep np = case <np.isDefn,prep.takesDet> of { prepNP prep np = case np.isPron of {
<True,True> => prep.s ! Definite ++ np.s ! NPCPrep ; -- FIT-TRIQ True => prep.enclitic ! np.a ; -- magħha
<True,False> => prep.s ! Definite ++ np.s ! NPNom ; -- FUQ IT-TRIQ False => case <np.isDefn, prep.takesDet> of {
<False,_> => prep.s ! Indefinite ++ np.s ! NPNom -- FI TRIQ <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 = Preposition ** {isPresent : Bool} ;
-- Compl : Type = { -- Compl : Type = {
-- s : Str ; -- s : Str ;
-- -- c : NPForm ; -- -- c : NPForm ;
-- -- isPre : Bool -- -- isPre : Bool
-- } ; -- } ;
noCompl : Compl = {
s = \\_ => [] ;
enclitic = \\_ => [] ;
takesDet = False ;
joinsVerb = False ;
isPresent = False ;
} ;
Preposition = { Preposition = {
s : Definiteness => Str ; s : Definiteness => Str ;
takesDet : Bool enclitic : Agr => Str ; -- when suffixed by pronouns; magħ-ha
takesDet : Bool ; -- True: fil- / False: fuq il-
joinsVerb : Bool ; -- True for for_Prep (I.O. suffix)
} ; } ;
{- Pronoun -------------------------------------------------------------- -} {- Pronoun -------------------------------------------------------------- -}
oper oper
Pronoun = { Pronoun = {
-- s : PronForm => {c1, c2: Str} ;
s : PronForm => Str ; -- cases like omm-i / hi-ja are handled elsewhere s : PronForm => Str ; -- cases like omm-i / hi-ja are handled elsewhere
a : Agr ; a : Agr ;
} ; } ;
@@ -390,8 +404,58 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
{- Verb ----------------------------------------------------------------- -} {- Verb ----------------------------------------------------------------- -}
oper oper
Variants3 : Type = {s1, s2, s3 : Str} ;
-- Shortcut functions for accessing stems
stem1 : Variants3 -> Str = \stems -> stems.s1 ;
stem2 : Variants3 -> Str = \stems -> stems.s2 ;
stem3 : Variants3 -> Str = \stems -> stems.s3 ;
mkVariants3 : Variants3 = overload {
mkVariants3 : (s1 : Str) -> Variants3 = \a -> { s1 = a ; s2 = a ; s3 = a } ;
mkVariants3 : (s1, s2, s3 : Str) -> Variants3 = \a,b,c -> { s1 = a ; s2 = b ; s3 = c } ;
} ;
mkMaybeVariants3 : Str -> Maybe Variants3 = \s -> Just Variants3 (mkVariants3 s) ;
NullVariants3 : Maybe Variants3 = Nothing Variants3 { s1 = [] ; s2 = [] ; s3 = [] } ;
-- Produce stem variants as needed (only call on compile-time strings!)
-- Refer to doc/stems.org
stemVariantsPerf : Str -> Variants3 = \s ->
let
ftahna : Str = s ;
ftahnie : Str = case s of {
ftahn + "a" => ftahn + "ie" ;
fet + h@#Cns + "et" => fet + h + "it" ;
_ => s
} ;
ftahni : Str = case s of {
ftahn + "a" => ftahn + "i" ;
_ => ftahnie
} ;
in
{ s1 = ftahna ; s2 = ftahnie ; s3 = ftahni } ;
stemVariantsImpf : Str -> Variants3 = \s ->
let
ftahna : Str = s ;
ftahnie : Str = case s of {
nift + "aħ" => nift + "ħ" ;
_ => s
} ;
in
{ s1 = ftahna ; s2 = ftahnie ; s3 = ftahna } ;
-- Convert old verb form table into one with stem variants
stemVariantsTbl : (VForm => Str) -> (VForm => Variants3) = \tbl ->
\\vf => case vf of {
VPerf _ => stemVariantsPerf (tbl ! vf) ;
VImpf _ => stemVariantsImpf (tbl ! vf) ;
_ => mkVariants3 (tbl ! vf)
} ;
Verb : Type = { Verb : Type = {
s : VForm => Str ; s : VForm => Variants3 ; --- need to store different "stems" already at verb level (ġera/ġerie/ġeri)
i : VerbInfo ; i : VerbInfo ;
} ; } ;
@@ -460,22 +524,99 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
| OQuest -- JIEKOL ĦUT ĠANNI [?] | OQuest -- JIEKOL ĦUT ĠANNI [?]
; ;
{- Verb Phrase ---------------------------------------------------------- -}
oper oper
-- Verb stem and suffixes for dir/ind objects, polarity joinVariants3 : Variants3 -> Polarity -> Str = \stems,pol ->
VerbParts : Type = { stem, dir, ind, pol : Str } ; case <pol> of {
mkVParts = overload { <Pos> => stem1 stems ;
mkVParts : Str -> Str -> VerbParts = \a,d -> {stem=a; dir=[]; ind=[]; pol=d} ; <Neg> => stem2 stems ++ BIND ++ "x"
mkVParts : Str -> Str -> Str -> Str -> VerbParts = \a,b,c,d -> {stem=a; dir=b; ind=c; pol=d} ; } ;
joinVP : VerbPhrase -> VPForm -> Anteriority -> Polarity -> Str = \vp,form,ant,pol ->
let
stems = (vp.s ! form ! ant ! pol).main ;
aux = (vp.s ! form ! ant ! pol).aux ;
x : Str = "x" ;
in
case takesAux form ant of {
-- aux is already negated for us
True => aux ++ case <exists Variants3 vp.dir, exists Variants3 vp.ind> of {
-- konna ftaħna / ma konniex ftaħna
<False,False> => stems.s1 ;
-- konna ftaħnie-ha / ma konniex ftaħni-ha
<True ,False> => stems.s2 ++ BIND ++ (fromJust Variants3 vp.dir).s1 ;
-- konna ftaħnie-lha / ma konniex ftaħni-lha
<False,True > => stems.s2 ++ BIND ++ (fromJust Variants3 vp.ind).s1 ;
-- konna ftaħni-hie-lha / ma konniex ftaħni-hi-lha
<True, True > => stems.s3 ++ BIND ++ (fromJust Variants3 vp.dir).s2 ++ BIND ++ (fromJust Variants3 vp.ind).s1
} ;
-- No aux part to handle
False => aux ++ case <exists Variants3 vp.dir, exists Variants3 vp.ind, pol> of {
-- ftaħna / ftaħnie-x
<False,False,Pos> => stems.s1 ;
<False,False,Neg> => stems.s2 ++ BIND ++ x ;
-- ftaħnie-ha / ftaħni-hie-x
<True ,False,Pos> => stems.s2 ++ BIND ++ (fromJust Variants3 vp.dir).s1 ;
<True ,False,Neg> => stems.s3 ++ BIND ++ (fromJust Variants3 vp.dir).s2 ++ BIND ++ x ;
-- ftaħnie-lha / ftaħni-lhie-x
<False,True ,Pos> => stems.s2 ++ BIND ++ (fromJust Variants3 vp.ind).s1 ;
<False,True ,Neg> => stems.s3 ++ BIND ++ (fromJust Variants3 vp.ind).s2 ++ BIND ++ x ;
-- ftaħni-hie-lha / ftaħni-hi-lhie-x
<True, True ,Pos> => stems.s3 ++ BIND ++ (fromJust Variants3 vp.dir).s2 ++ BIND ++ (fromJust Variants3 vp.ind).s1 ;
<True, True ,Neg> => stems.s3 ++ BIND ++ (fromJust Variants3 vp.dir).s3 ++ BIND ++ (fromJust Variants3 vp.ind).s2 ++ BIND ++ x
}
} ;
-- Does a tense + ant take an auxiliary verb?
-- This affects where (if) the negation is applied
-- This is a workaround to avoid having a bool param in VerbParts
-- Must match with the logic in predV
takesAux : VPForm -> Anteriority -> Bool = \vpf,ant ->
case <vpf,ant> of {
<VPIndicat Pres _, Simul> => False ;
<VPIndicat Past _, Simul> => False ;
<VPIndicat Fut _, Simul> => True ;
<VPIndicat Cond _, Simul> => True ;
<VPIndicat Pres _, Anter> => False ;
<VPIndicat Past _, Anter> => True ;
<VPIndicat Fut _, Anter> => True ;
<VPIndicat Cond _, Anter> => True ;
<VPImperat _, _> => False
} ;
VerbParts : Type = {
aux : Str ; -- when present, negation is applied here
main : Variants3 ; -- enclitics always applied here
} ;
mkVerbParts = overload {
mkVerbParts : Variants3 -> VerbParts = \vs -> { aux = [] ; main = vs } ;
mkVerbParts : Str -> VerbParts = \m -> { aux = [] ; main = mkVariants3 m } ;
mkVerbParts : Str -> Variants3 -> VerbParts = \a,vs -> { aux = a ; main = vs } ;
mkVerbParts : Str -> Str -> VerbParts = \a,m -> { aux = a ; main = mkVariants3 m } ;
} ; } ;
joinVParts : VerbParts -> Str = \vb -> vb.stem ++ vb.dir ++ vb.ind ++ vb.pol ;
-- [AZ] -- [AZ]
VerbPhrase : Type = { VerbPhrase : Type = {
s : VPForm => Anteriority => Polarity => VerbParts ; -- verb s : VPForm => Anteriority => Polarity => VerbParts ;
s2 : Agr => Str ; -- complement s2 : Agr => Str ; -- complement
-- a1 : Str ; dir : Maybe Variants3 ; -- direct object clitic
-- a2 : Str ; ind : Maybe Variants3 ; -- indirect object clitic
} ; } ;
SlashVerbPhrase : Type = VerbPhrase ** {c2 : Compl} ; SlashVerbPhrase : Type = VerbPhrase ** {c2 : Compl} ;
@@ -492,99 +633,144 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
insertObj : (Agr => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> { insertObj : (Agr => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> {
s = vp.s ; s = vp.s ;
s2 = \\agr => vp.s2 ! agr ++ obj ! agr ; s2 = \\agr => vp.s2 ! agr ++ obj ! agr ;
dir = vp.dir ;
ind = vp.ind ;
} ; } ;
insertObjPre : (Agr => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> { insertObjPre : (Agr => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> {
s = vp.s ; s = vp.s ;
s2 = \\agr => obj ! agr ++ vp.s2 ! agr ; s2 = \\agr => obj ! agr ++ vp.s2 ! agr ;
dir = vp.dir ;
ind = vp.ind ;
} ; } ;
insertObjc : (Agr => Str) -> SlashVerbPhrase -> SlashVerbPhrase = \obj,vp -> insertObjc : (Agr => Str) -> SlashVerbPhrase -> SlashVerbPhrase = \obj,vp ->
insertObj obj vp ** {c2 = vp.c2} ; insertObj obj vp ** {c2 = vp.c2} ;
insertIndObj : Str -> VerbPhrase -> VerbPhrase = \ind,vp -> {
s = vp.s ;
s2 = vp.s2 ;
dir = vp.dir ;
ind = mkMaybeVariants3 ind ;
};
insertAdV : Str -> VerbPhrase -> VerbPhrase = \adv,vp -> { insertAdV : Str -> VerbPhrase -> VerbPhrase = \adv,vp -> {
s = vp.s ; s = vp.s ;
s2 = \\agr => vp.s2 ! agr ++ adv ; s2 = \\agr => vp.s2 ! agr ++ adv ;
dir = vp.dir ;
ind = vp.ind ;
} ; } ;
predVc : (Verb ** {c2 : Compl}) -> SlashVerbPhrase = \verb -> predVc : (Verb ** {c2 : Compl}) -> SlashVerbPhrase = \verb ->
predV verb ** {c2 = verb.c2} ; predV verb ** {c2 = verb.c2} ;
copula_kien : Verb = { copula_kien : {s : VForm => Polarity => Str} = {
s : (VForm => Str) = table { s = \\vform,pol => case <vform,pol> of {
VPerf (AgP1 Sg) => "kont" ; <VPerf (AgP1 Sg), Pos> => "kont" ;
VPerf (AgP2 Sg) => "kont" ; <VPerf (AgP2 Sg), Pos> => "kont" ;
VPerf (AgP3Sg Masc) => "kien" ; <VPerf (AgP3Sg Masc), Pos> => "kien" ;
VPerf (AgP3Sg Fem) => "kienet" ; <VPerf (AgP3Sg Fem), Pos> => "kienet" ;
VPerf (AgP1 Pl) => "konna" ; <VPerf (AgP1 Pl), Pos> => "konna" ;
VPerf (AgP2 Pl) => "kontu" ; <VPerf (AgP2 Pl), Pos> => "kontu" ;
VPerf (AgP3Pl) => "kienu" ; <VPerf (AgP3Pl), Pos> => "kienu" ;
VImpf (AgP1 Sg) => "nkun" ; <VImpf (AgP1 Sg), Pos> => "nkun" ;
VImpf (AgP2 Sg) => "tkun" ; <VImpf (AgP2 Sg), Pos> => "tkun" ;
VImpf (AgP3Sg Masc) => "jkun" ; <VImpf (AgP3Sg Masc), Pos> => "jkun" ;
VImpf (AgP3Sg Fem) => "tkun" ; <VImpf (AgP3Sg Fem), Pos> => "tkun" ;
VImpf (AgP1 Pl) => "nkunu" ; <VImpf (AgP1 Pl), Pos> => "nkunu" ;
VImpf (AgP2 Pl) => "tkunu" ; <VImpf (AgP2 Pl), Pos> => "tkunu" ;
VImpf (AgP3Pl) => "jkunu" ; <VImpf (AgP3Pl), Pos> => "jkunu" ;
VImp (Pl) => "kun" ; <VImp (Pl), Pos> => "kun" ;
VImp (Sg) => "kunu" ; <VImp (Sg), Pos> => "kunu" ;
VActivePart gn => "" ;
VPassivePart gn => "" <VPerf (AgP1 Sg), Neg> => "kontx" ;
} ; <VPerf (AgP2 Sg), Neg> => "kontx" ;
i : VerbInfo = mkVerbInfo (Irregular) (FormI) (mkRoot "k-w-n") (mkPattern "ie") ; <VPerf (AgP3Sg Masc), Neg> => "kienx" ;
<VPerf (AgP3Sg Fem), Neg> => "kinitx" ;
<VPerf (AgP1 Pl), Neg> => "konniex" ;
<VPerf (AgP2 Pl), Neg> => "kontux" ;
<VPerf (AgP3Pl), Neg> => "kienux" ;
<VImpf (AgP1 Sg), Neg> => "nkunx" ;
<VImpf (AgP2 Sg), Neg> => "tkunx" ;
<VImpf (AgP3Sg Masc), Neg> => "jkunx" ;
<VImpf (AgP3Sg Fem), Neg> => "tkunx" ;
<VImpf (AgP1 Pl), Neg> => "nkunux" ;
<VImpf (AgP2 Pl), Neg> => "tkunux" ;
<VImpf (AgP3Pl), Neg> => "jkunux" ;
<VImp (Pl), Neg> => "kunx" ;
<VImp (Sg), Neg> => "kunux" ;
<VActivePart gn, _> => "" ;
<VPassivePart gn, _> => ""
}
} ; } ;
-- Adapted from [AZ] -- Adapted from [AZ]
CopulaVP : VerbPhrase = { CopulaVP : VerbPhrase = {
s = \\vpf,ant,pol => s = \\vpf,ant,pol =>
case <vpf> of { --- We are ignoring the anteriority
<VPIndicat Past vagr> => polarise (copula_kien.s ! VPerf vagr) pol ; case <vpf, pol> of {
<VPIndicat Pres vagr> => polarise (copula_kien.s ! VImpf vagr) pol ; --- Here we are bypassing VerbParts by putting negatives in the stem
<VPImperat num> => polarise (copula_kien.s ! VImp num) pol ; <VPIndicat Past vagr, Pos> => mkVerbParts (copula_kien.s ! VPerf vagr ! Pos) [] ; -- kien
_ => Predef.error "tense not implemented" <VPIndicat Pres vagr, Pos> => mkVerbParts (copula_kien.s ! VImpf vagr ! Pos) [] ; -- jkun
<VPIndicat Fut vagr, Pos> => mkVerbParts ("se" ++ copula_kien.s ! VImpf vagr ! Pos) [] ; -- se jkun
<VPIndicat Cond vagr, Pos> => mkVerbParts ("kieku" ++ copula_kien.s ! VPerf vagr ! Pos) [] ; -- kieku kien
<VPImperat num, Pos> => mkVerbParts (copula_kien.s ! VImp num ! Pos) [] ; -- kun
<VPIndicat Past vagr, Neg> => mkVerbParts (copula_kien.s ! VPerf vagr ! Neg) [] ; -- ma kienx
<VPIndicat Pres vagr, Neg> => mkVerbParts (copula_kien.s ! VImpf vagr ! Neg) [] ; -- ma jkunx
<VPIndicat Fut vagr, Neg> => mkVerbParts (mhux ! vagr ++ "se" ++ copula_kien.s ! VImpf vagr ! Pos) [] ; -- mhux se jkun
<VPIndicat Cond vagr, Neg> => mkVerbParts ("kieku" ++ "ma" ++ copula_kien.s ! VPerf vagr ! Neg) [] ; -- kieku ma kienx
<VPImperat num, Neg> => mkVerbParts (copula_kien.s ! VImp num ! Neg) [] -- kunx
} ; } ;
s2 = \\agr => [] ; s2 = \\agr => [] ;
} where { dir = NullVariants3 ;
polarise : Str -> Polarity -> VerbParts = \s,pol -> ind = NullVariants3 ;
mkVParts s (case pol of { Neg => BIND ++ "x" ; _ => [] }) ;
} ; } ;
-- [AZ] -- [AZ]
predV : Verb -> VerbPhrase = \verb -> { predV : Verb -> VerbPhrase = \verb -> {
s = \\vpf,ant,pol => s = \\vpf,ant,pol =>
let let
ma = "ma" ; ma = makePreVowel "ma" "m'" ;
mhux = "mhux" ; b1 : Variants3 -> VerbParts = \vs -> mkVerbParts vs ;
b1 : Str -> VerbParts = \s -> mkVParts s [] ; b2 : Str -> Variants3 -> VerbParts = \s,vs -> mkVerbParts s vs ;
b2 : Str -> VerbParts = \s -> mkVParts s (BIND ++ "x") ;
in in
case vpf of { case vpf of {
VPIndicat tense vagr => VPIndicat tense vagr =>
let let
kien = joinVParts (CopulaVP.s ! VPIndicat Past vagr ! Simul ! pol) ; -- kien = joinVP CopulaVP (VPIndicat Past vagr) Simul Pos ;
kienx = joinVParts (CopulaVP.s ! VPIndicat Past vagr ! Simul ! Neg) ; -- kienx = joinVP CopulaVP (VPIndicat Past vagr) Simul Neg ;
kien = copula_kien.s ! (VPerf vagr) ! Pos ;
kienx = copula_kien.s ! (VPerf vagr) ! Neg ;
nkun = copula_kien.s ! (VImpf vagr) ! Pos ;
in in
case <tense,ant,pol> of { case <tense,ant,pol> of {
<Pres,Simul,Pos> => b1 (verb.s ! VImpf vagr) ; -- norqod <Pres,Simul,Pos> => b1 (verb.s ! VImpf vagr) ; -- norqod
<Pres,Anter,Pos> => b1 (kien ++ verb.s ! VImpf vagr) ; -- kont norqod <Pres,Simul,Neg> => b2 ma (verb.s ! VImpf vagr) ; -- ma norqodx
<Past,Simul,Pos> => b1 (verb.s ! VPerf vagr) ; -- rqadt <Past,Simul,Pos> => b1 (verb.s ! VPerf vagr) ; -- rqadt
<Past,Anter,Pos> => b1 (kien ++ verb.s ! VPerf vagr) ; -- kont rqadt <Past,Simul,Neg> => b2 ma (verb.s ! VPerf vagr) ; -- ma rqadtx
<Fut, Simul,Pos> => b1 ("se" ++ verb.s ! VImpf vagr) ; -- se norqod
<Fut, Anter,Pos> => b1 (kien ++ "se" ++ verb.s ! VImpf vagr) ; -- kont se norqod
<Pres,Simul,Neg> => b2 (ma ++ verb.s ! VImpf vagr) ; -- ma norqodx <Fut, Simul,Pos> => b2 "se" (verb.s ! VImpf vagr) ; -- se norqod
<Pres,Anter,Neg> => b1 (ma ++ kienx ++ verb.s ! VImpf vagr) ; -- ma kontx norqod <Fut, Simul,Neg> => b2 (mhux ! vagr ++ "se") (verb.s ! VImpf vagr) ; -- m'iniex se norqod
<Past,Simul,Neg> => b2 (ma ++ verb.s ! VPerf vagr) ; -- ma rqadtx
<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 ++ kienx ++ "se" ++ verb.s ! VImpf vagr) ; -- ma kontx se norqod
<Cond,_,Pos> => b1 (kien ++ verb.s ! VImpf vagr) ; -- kont norqod <Cond, _ ,Pos> => b2 kien (verb.s ! VImpf vagr) ; -- kont norqod
<Cond,_,Neg> => b1 (ma ++ kienx ++ verb.s ! VImpf vagr) -- ma kontx norqod <Cond, _ ,Neg> => b2 (ma ++ kienx) (verb.s ! VImpf vagr) ; -- ma kontx norqod
-- Same as Past Simul
<Pres,Anter,Pos> => b1 (verb.s ! VPerf vagr) ; -- rqadt
<Pres,Anter,Neg> => b2 ma (verb.s ! VPerf vagr) ; -- ma rqadtx
<Past,Anter,Pos> => b2 kien (verb.s ! VPerf vagr) ; -- kont rqadt
<Past,Anter,Neg> => b2 (ma ++ kienx) (verb.s ! VPerf vagr) ; -- ma kontx rqadt
<Fut, Anter,Pos> => b2 ("se" ++ nkun) (verb.s ! VPerf vagr) ; -- se nkun rqadt
<Fut, Anter,Neg> => b2 (mhux ! vagr ++ "se" ++ nkun) (verb.s ! VPerf vagr) -- m'iniex se nkun rqadt
} ; } ;
VPImperat num => b2 (verb.s ! VImp num) -- torqodx VPImperat num => b1 (verb.s ! VImp num) -- torqodx
}; };
s2 = \\agr => [] ; s2 = \\agr => [] ;
dir = NullVariants3 ;
ind = NullVariants3 ;
-- a1 = [] ; -- a1 = [] ;
-- n2 = \\_ => [] ; -- n2 = \\_ => [] ;
-- a2 = [] ; -- a2 = [] ;
@@ -595,7 +781,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
let let
vpform : VPForm = VPIndicat Past (toVAgr agr) ; vpform : VPForm = VPIndicat Past (toVAgr agr) ;
in in
joinVParts (vp.s ! vpform ! ant ! pol) ++ vp.s2 ! agr ; joinVP vp vpform ant pol ++ vp.s2 ! agr ;
Aux = { Aux = {
s : Tense => Polarity => Str ; s : Tense => Polarity => Str ;
@@ -623,6 +809,16 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
AgP3Pl => "lilhom infushom" AgP3Pl => "lilhom infushom"
} ; } ;
mhux : VAgr => Str = table {
AgP1 Sg => "m'iniex" ;
AgP2 Sg => "m'intix" ;
AgP3Sg Masc => "m'hux" ;
AgP3Sg Fem => "m'hix" ;
AgP1 Pl => "m'aħniex" ;
AgP2 Pl => "m'intomx" ;
AgP3Pl => "m'humiex"
} ;
conjLi : Str = "li" ; conjLi : Str = "li" ;
conjThat = conjLi ; conjThat = conjLi ;
@@ -768,19 +964,11 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
{- ~~~ Useful helper functions ~~~ -} {- ~~~ Useful helper functions ~~~ -}
-- Non-existant form
noexist : Str = "NOEXIST" ;
-- New names for the drop/take operations -- New names for the drop/take operations
--- dependent on defn of ResMlt.noexist takePfx = Predef.take ;
takePfx : Int -> Str -> Str = \n,s -> case s of { "NOEXIST" => noexist ; _ => Predef.take n s } ; dropPfx = Predef.drop ;
dropPfx : Int -> Str -> Str = \n,s -> case s of { "NOEXIST" => noexist ; _ => Predef.drop n s } ; takeSfx = Predef.dp ;
takeSfx : Int -> Str -> Str = \n,s -> case s of { "NOEXIST" => noexist ; _ => Predef.dp n s } ; dropSfx = Predef.tk ;
dropSfx : Int -> Str -> Str = \n,s -> case s of { "NOEXIST" => noexist ; _ => Predef.tk n s } ;
-- takePfx = Predef.take ;
-- dropPfx = Predef.drop ;
-- takeSfx = Predef.dp ;
-- dropSfx = Predef.tk ;
-- Get the character at the specific index (0-based). -- Get the character at the specific index (0-based).
-- Negative indices behave as 0 (first character). Out of range indexes return the empty string. -- Negative indices behave as 0 (first character). Out of range indexes return the empty string.
@@ -803,13 +991,11 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
-- Prefix with a 'n'/'t' or double initial consonant, as necessary. See {OM pg 90} -- Prefix with a 'n'/'t' or double initial consonant, as necessary. See {OM pg 90}
pfx_N : Str -> Str = \s -> case s of { pfx_N : Str -> Str = \s -> case s of {
"" => [] ; "" => [] ;
"NOEXIST" => noexist ; --- dependent on defn of ResMlt.noexist
m@#DoublingConsN + _ => m + s ; m@#DoublingConsN + _ => m + s ;
_ => "n" + s _ => "n" + s
} ; } ;
pfx_T : Str -> Str = \s -> case s of { pfx_T : Str -> Str = \s -> case s of {
"" => [] ; "" => [] ;
"NOEXIST" => noexist ; --- dependent on defn of ResMlt.noexist
d@#DoublingConsT + _ => d + s ; d@#DoublingConsT + _ => d + s ;
_ => "t" + s _ => "t" + s
} ; } ;
@@ -819,8 +1005,6 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
pfx : Str -> Str -> Str = \p,s -> case <p,s> of { pfx : Str -> Str -> Str = \p,s -> case <p,s> of {
<_, ""> => [] ; <_, ""> => [] ;
<"", str> => str ; <"", str> => str ;
<_, "NOEXIST"> => noexist ; --- dependent on defn of ResMlt.noexist
<"NOEXIST", str> => str ; --- dependent on defn of ResMlt.noexist
<px, str> => px + str <px, str> => px + str
} ; } ;
@@ -830,7 +1014,6 @@ resource ResMlt = ParamX ** open Prelude, Predef in {
sfx : Str -> Str -> Str = \a,b -> sfx : Str -> Str -> Str = \a,b ->
case <a,takePfx 1 b> of { case <a,takePfx 1 b> of {
<"",_> => [] ; <"",_> => [] ;
<"NOEXIST",_> => noexist ; --- dependent on defn of ResMlt.noexist
<ke+"nn","n"> => ke+"n"+b ; <ke+"nn","n"> => ke+"n"+b ;
<ha+"kk","k"> => ha+"k"+b ; <ha+"kk","k"> => ha+"k"+b ;
<ho+"ll","l"> => ho+"l"+b ; <ho+"ll","l"> => ho+"l"+b ;

View File

@@ -10,8 +10,7 @@
concrete SentenceMlt of Sentence = CatMlt ** open concrete SentenceMlt of Sentence = CatMlt ** open
Prelude, Prelude,
ResMlt, ResMlt,
ParamX, ParamX in {
CommonX in {
flags optimize=all_subs ; flags optimize=all_subs ;
@@ -29,7 +28,7 @@ concrete SentenceMlt of Sentence = CatMlt ** open
True => [] ; -- omit subject pronouns True => [] ; -- omit subject pronouns
False => np.s ! NPNom False => np.s ! NPNom
} ; } ;
v : Str = joinVParts (vp.s ! VPIndicat tense (toVAgr np.a) ! ant ! pol) ; v : Str = joinVP vp (VPIndicat tense (toVAgr np.a)) ant pol ;
o : Str = vp.s2 ! np.a ; o : Str = vp.s2 ! np.a ;
} ; } ;
} ; } ;
@@ -40,7 +39,7 @@ concrete SentenceMlt of Sentence = CatMlt ** open
-- VP -> Imp -- VP -> Imp
ImpVP vp = { ImpVP vp = {
s = \\pol,n => joinVParts (vp.s ! VPImperat n ! Simul ! pol) s = \\pol,n => joinVP vp (VPImperat n) Simul pol
} ; } ;
-- NP -> VPSlash -> ClSlash -- NP -> VPSlash -> ClSlash
@@ -57,7 +56,15 @@ concrete SentenceMlt of Sentence = CatMlt ** open
-- Cl -> Prep -> ClSlash -- Cl -> Prep -> ClSlash
-- (with whom) he walks -- (with whom) he walks
SlashPrep cl prep = cl ** {c2 = prep} ; -- SlashPrep cl prep = cl ** {c2 = prep} ;
SlashPrep cl prep = cl ** {c2 = {
s = prep.s ;
enclitic = prep.enclitic ;
takesDet = prep.takesDet ;
joinsVerb = prep.joinsVerb ;
isPresent = True ;
}
} ;
-- NP -> VS -> SSlash -> ClSlash -- NP -> VS -> SSlash -> ClSlash
-- (whom) she says that he loves -- (whom) she says that he loves

View File

@@ -17,7 +17,7 @@ concrete StructuralMlt of Structural = CatMlt **
i_Pron = mkPron "jien" "i" "ni" "li" singular P1 masculine ; --- also JIENA i_Pron = mkPron "jien" "i" "ni" "li" singular P1 masculine ; --- also JIENA
youSg_Pron = mkPron "int" "ek" "ek" "lek" singular P2 masculine ; --- also INTI youSg_Pron = mkPron "int" "ek" "ek" "lek" singular P2 masculine ; --- also INTI
he_Pron = mkPron "hu" "u" "u" "lu" singular P3 masculine ; --- also HUWA he_Pron = mkPron "hu" "u" "hu" "lu" singular P3 masculine ; --- also HUWA
she_Pron = mkPron "hi" "ha" singular P3 feminine ; --- also HIJA she_Pron = mkPron "hi" "ha" singular P3 feminine ; --- also HIJA
we_Pron = mkPron "aħna" "na" plural P1 masculine ; we_Pron = mkPron "aħna" "na" plural P1 masculine ;
youPl_Pron = mkPron "intom" "kom" plural P2 masculine ; youPl_Pron = mkPron "intom" "kom" plural P2 masculine ;
@@ -72,25 +72,30 @@ concrete StructuralMlt of Structural = CatMlt **
above_Prep = mkPrep "fuq" ; above_Prep = mkPrep "fuq" ;
after_Prep = mkPrep "wara" ; after_Prep = mkPrep "wara" ;
before_Prep = mkPrep "qabel" ; before_Prep = mkPrep "qabel"
behind_Prep = mkPrep "wara" ; "qabli" "qablek" "qablu" "qabilha" "qabilna" "qabilkom" "qabilhom" ;
behind_Prep = after_Prep ;
between_Prep = mkPrep "bejn" ; between_Prep = mkPrep "bejn" ;
by8agent_Prep = mkPrep "minn" "mill-" "mit-" ; by8agent_Prep = mkPrep "minn" "mill-" "mit-" ;
by8means_Prep = mkPrep "bi" "b'" "bil-" "bit-" "bl-" ; by8means_Prep = mkPrep "bi" "b'" "bil-" "bit-" "bl-" ;
during_Prep = mkPrep "waqt" ; during_Prep = mkPrep "waqt" ;
for_Prep = mkPrep "għal" "għall-" "għat-" ; for_Prep = mkPrep "għal" "għall-" "għall-" "għat-" "għall-"
from_Prep = mkPrep "minn" "mill-" "mit-" ; "għalija" "għalik" "għalih" "għaliha" "għalina" "għalikom" "għalihom"
True ;
from_Prep = mkPrep "mingħand" ;
in8front_Prep = mkPrep "quddiem" ; in8front_Prep = mkPrep "quddiem" ;
in_Prep = mkPrep "fi" "f'" "fil-" "fit-" "fl-" ; in_Prep = mkPrep "fi" "f'" "fil-" "fit-" "fl-" ;
on_Prep = mkPrep "fuq" ; on_Prep = mkPrep "fuq" ;
part_Prep = mkPrep "ta'" "t'" "tal-" "tat-" "tal-" ; part_Prep = possess_Prep ;
possess_Prep = mkPrep "ta'" "t'" "tal-" "tat-" "tal-" ; possess_Prep = mkPrep "ta'" "t'" "tal-" "tat-" "tal-" ;
through_Prep = mkPrep "ġo" "ġol-" "ġot-" ; through_Prep = mkPrep "minn ġo" "minn ġol-" "minn ġol-" "minn ġot-" "minn ġol-"
"minn ġo fija" "minn ġo fik" "minn ġo fih" "minn ġo fiha" "minn ġo fina" "minn ġo fikom" "minn ġo fihom"
False ;
to_Prep = mkPrep "lil" "lill-" "lit-" ; to_Prep = mkPrep "lil" "lill-" "lit-" ;
under_Prep = mkPrep "taħt" ; under_Prep = mkPrep "taħt" ;
without_Prep = mkPrep "mingħajr" ; without_Prep = mkPrep "mingħajr" ;
with_Prep = mkPrep "ma'" "m'" "mal-" "mat-" "mal-" ; with_Prep = mkPrep "ma'" "m'" "mal-" "mat-" "mal-" ;
except_Prep = mkPrep "apparti" ; except_Prep = mkPrep "apparti" ; --- special case..
{- Noun phrase ---------------------------------------------------------- -} {- Noun phrase ---------------------------------------------------------- -}

View File

@@ -1,12 +0,0 @@
-- TextMlt.gf: many-phrase texts
--
-- Maltese GF Resource Grammar
-- John J. Camilleri 2011 -- 2013
-- Licensed under LGPL
concrete IdiomMlt of Idiom = CatMlt ** open Prelude, ResMlt in {
-- Text
}

View File

@@ -15,6 +15,7 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in {
-- V2 -> VPSlash -- V2 -> VPSlash
-- love (it) -- love (it)
SlashV2a = predVc ; SlashV2a = predVc ;
-- SlashV2a v2 = (predV v2) ** { c2 = noCompl } ; -- gets rid of the V2's prep
-- V3 -> NP -> VPSlash -- V3 -> NP -> VPSlash
-- give it (to her) -- give it (to her)
@@ -61,17 +62,38 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in {
-- VPSlash -> NP -> VP -- VPSlash -> NP -> VP
-- love it -- love it
ComplSlash vp np = ComplSlash vp np =
case np.isPron of { case <np.isPron, vp.c2.isPresent> of {
-- Join pron to verb
True => { -- Get enclitic version of c2
s = \\vpf,ant,pol => <True,True> => {
let bits = vp.s ! vpf ! ant ! pol in s = vp.s ;
mkVParts (glue bits.stem (np.s ! NPCPrep)) bits.pol ; s2 = \\agr => vp.s2 ! agr ++ vp.c2.enclitic ! np.a ;
s2 = \\agr => [] ; dir = NullVariants3 ;
ind = NullVariants3 ;
} ; } ;
-- Join pron to verb
<True,False> => {
s = vp.s ;
s2 = \\agr => [] ;
dir = mkMaybeVariants3 (np.s ! NPCPrep) ; --- we'll need to get all the variants direct from the NP
ind = NullVariants3 ;
} ;
-- <False,False> => {
-- s = vp.s ;
-- s2 = \\agr => vp.c2.enclitic ! agr ;
-- dir = NullVariants3 ;
-- ind = NullVariants3 ;
-- } ;
-- Insert obj to VP -- Insert obj to VP
_ => insertObj (\\agr => np.s ! NPCPrep) vp -- _ => insertObj (\\agr => vp.c2.s ! bool2definiteness np.isDefn ++ np.s ! NPNom) vp
_ => insertObj (\\agr => case <vp.c2.isPresent,np.isDefn> of {
<True,True> => vp.c2.s ! Definite ++ np.s ! NPCPrep ; -- mal-qattus
<True,False> => vp.c2.s ! Indefinite ++ np.s ! NPNom ; -- ma' qattus
_ => np.s ! NPNom -- il-qattus
}) vp
} ; } ;
-- VV -> VPSlash -> VPSlash -- VV -> VPSlash -> VPSlash
@@ -89,11 +111,14 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in {
-- Comp -> VP -- Comp -> VP
-- be warm -- be warm
UseComp comp = insertObj comp.s (predV copula_kien) ; UseComp comp = insertObj comp.s CopulaVP ;
-- VP -> Adv -> VP -- VP -> Adv -> VP
-- sleep here -- sleep here
AdvVP vp adv = insertObj (\\_ => adv.s) vp ; AdvVP vp adv = case adv.joinsVerb of {
True => insertIndObj (indObjSuffix adv.a) vp ;
False => insertObj (\\_ => adv.s) vp
} ;
-- AdV -> VP -> VP -- AdV -> VP -> VP
-- always sleep -- always sleep
@@ -101,7 +126,31 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in {
-- VPSlash -> Adv -> VPSlash -- VPSlash -> Adv -> VPSlash
-- use (it) here -- use (it) here
AdvVPSlash vp adv = insertObj (\\_ => adv.s) vp ** {c2 = vp.c2} ; AdvVPSlash vp adv = case adv.joinsVerb of {
True => insertIndObj (indObjSuffix adv.a) vp ;
False => insertObj (\\_ => adv.s) vp
} ** {c2 = vp.c2} ;
oper
-- Only for_Prep causes these to be used, thus it doesn't make sense to store this
-- information in Prep.
indObjSuffix : Agr -> Str = \agr ->
case (toVAgr agr) of {
AgP1 Sg => "li" ;
AgP2 Sg => "lek" ;
AgP3Sg Masc => "lu" ;
-- AgP3Sg Fem => "ilha" ;
-- AgP1 Pl => "ilna" ;
-- AgP2 Pl => "ilkom" ;
-- AgP3Pl => "ilhom" --- need to introduce variants here too
AgP3Sg Fem => "lha" ;
AgP1 Pl => "lna" ;
AgP2 Pl => "lkom" ;
AgP3Pl => "lhom"
} ;
lin
-- AdV -> VPSlash -> VPSlash -- AdV -> VPSlash -> VPSlash
-- always use (it) -- always use (it)
@@ -113,24 +162,24 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in {
-- V2 -> VP -- V2 -> VP
-- be loved -- be loved
PassV2 v2 = insertObj (\\agr => v2.s ! VPassivePart (toGenNum agr) ++ v2.c2.s ! Definite) (predV copula_kien) ; PassV2 v2 = insertObj (\\agr => stem1 (v2.s ! VPassivePart (toGenNum agr)) ++ v2.c2.s ! Definite) CopulaVP ;
-- AP -> Comp -- AP -> Comp
-- (be) small -- (be) small
CompAP ap = { CompAP ap = {
s = \\agr => ap.s ! toGenNum agr s = \\agr => ap.s ! toGenNum agr ;
} ; } ;
-- NP -> Comp -- NP -> Comp
-- (be) the man -- (be) the man
CompNP np = { CompNP np = {
s = \\_ => np.s ! NPAcc s = \\_ => np.s ! NPAcc ;
} ; } ;
-- Adv -> Comp -- Adv -> Comp
-- (be) here -- (be) here
CompAdv adv = { CompAdv adv = {
s = \\_ => adv.s s = \\_ => adv.s ;
} ; } ;
-- CN -> Comp -- CN -> Comp
@@ -139,17 +188,24 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in {
s = \\agr => case agr.n of { s = \\agr => case agr.n of {
Sg => artIndef ++ cn.s ! Singulative ; Sg => artIndef ++ cn.s ! Singulative ;
Pl => cn.s ! Plural Pl => cn.s ! Plural
} } ;
} ; } ;
-- VP -- VP
-- be -- be
UseCopula = predV copula_kien ; UseCopula = CopulaVP ;
-- VP -> Prep -> VPSlash -- VP -> Prep -> VPSlash
-- live in (it) -- live in (it)
VPSlashPrep vp p = vp ** { VPSlashPrep vp p = vp ** {
c2 = p -- c2 = lin Compl (p ** {isPresent = True}) ;
c2 = {
s = p.s ;
enclitic = p.enclitic ;
takesDet = p.takesDet ;
joinsVerb = p.joinsVerb ;
isPresent = True ;
} ;
} ; } ;
} }