diff --git a/lib/src/maltese/AdverbMlt.gf b/lib/src/maltese/AdverbMlt.gf index 4e4870b4d..b1f570c36 100644 --- a/lib/src/maltese/AdverbMlt.gf +++ b/lib/src/maltese/AdverbMlt.gf @@ -8,40 +8,66 @@ concrete AdverbMlt of Adverb = CatMlt ** open ResMlt, Prelude in { lin - -- A -> Adv ; -- warmly + -- A -> Adv + -- warmly 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 = { - 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 = { - 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 = { - s = prepNP prep np + s = prepNP prep np ; + joinsVerb = prep.joinsVerb ; + a = np.a ; }; - -- AdA -> Adv -> Adv ; -- very quickly - AdAdv = cc2 ; - - -- A -> AdA ; -- extremely - PositAdAAdj a = { - s = a.s ! APosit (GSg Masc) ++ "ħafna" ; + -- AdA -> Adv -> Adv + -- very quickly + AdAdv a b = cc2 a b ** { + joinsVerb = False ; + a = agrP3 Sg Masc ; -- ignored when joinsVerb = False } ; - -- Subj -> S -> Adv ; -- when she sleeps - SubjS = cc2 ; + -- A -> AdA + -- 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 = { - s = cadv.s ++ cadv.p + s = cadv.s ++ cadv.p ; + joinsVerb = False ; + a = agrP3 Sg Masc ; -- ignored when joinsVerb = False } ; } diff --git a/lib/src/maltese/CatMlt.gf b/lib/src/maltese/CatMlt.gf index 681824b51..400f7e3cf 100644 --- a/lib/src/maltese/CatMlt.gf +++ b/lib/src/maltese/CatMlt.gf @@ -5,7 +5,7 @@ -- Angelo Zammit 2012 -- Licensed under LGPL -concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude in { +concrete CatMlt of Cat = CommonX - [Adv] ** open ResMlt, Prelude in { flags optimize=all_subs ; @@ -120,4 +120,12 @@ concrete CatMlt of Cat = CommonX ** open ResMlt, Prelude in { N3 = Noun ** {c2, c3 : Compl} ; 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 + } ; + } diff --git a/lib/src/maltese/ConjunctionMlt.gf b/lib/src/maltese/ConjunctionMlt.gf index 185231553..4f72a280a 100644 --- a/lib/src/maltese/ConjunctionMlt.gf +++ b/lib/src/maltese/ConjunctionMlt.gf @@ -12,7 +12,10 @@ concrete ConjunctionMlt of Conjunction = ConjS = conjunctDistrSS ; -- 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" ConjIAdv = conjunctDistrSS ; diff --git a/lib/src/maltese/DictMlt.gf b/lib/src/maltese/DictMlt.gf index 9f37d4a01..cda0c0d49 100644 --- a/lib/src/maltese/DictMlt.gf +++ b/lib/src/maltese/DictMlt.gf @@ -356,7 +356,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { ; kamrad_KMRD_1_7014_V = mkV "kamrad" (mkRoot "k-m-r-d") ; 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") ; 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") ; @@ -428,13 +428,13 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { tmandar_MNDR_2_7086_V = mkV_II "tmandar" (mkRoot "m-n-d-r") ; menghel_MNGHL_1_7087_V = mkV "mengħel" (mkRoot "m-n-għ-l") ; mantna_MNTNJ_1_7088_V = mkV quadWeak form1 (mkRoot "m-n-tn-j") (mkPattern "a" "a") - "mantnejt" "mantnejt" "mantna" "mantniet" "mantnejna" "mantnejtu" "mantnew" - "nmantna" "tmantna" "jmantna" "tmantna" "nmantnu" "tmantnu" "jmantnu" + "mantnejt" "mantnejt" "mantna" "mantniet" "mantnejna" "mantnejtu" "mantnew" + "nmantna" "tmantna" "jmantna" "tmantna" "nmantnu" "tmantnu" "jmantnu" "mantna" "mantnu" ; tmantna_MNTNJ_2_7089_V = mkV quadWeak form2 (mkRoot "m-n-tn-j") (mkPattern "a" "a") - "tmantnejt" "tmantnejt" "tmantna" "tmantniet" "tmantnejna" "tmantnejtu" "tmantnew" - "nitmantna" "titmantna" "jitmantna" "titmantna" "nitmantnu" "titmantnu" "jitmantnu" + "tmantnejt" "tmantnejt" "tmantna" "tmantniet" "tmantnejna" "tmantnejtu" "tmantnew" + "nitmantna" "titmantna" "jitmantna" "titmantna" "nitmantnu" "titmantnu" "jitmantnu" "tmantna" "tmantnu" ; mantar_MNTR_1_7090_V = mkV "mantar" (mkRoot "m-n-t-r") ; @@ -1484,8 +1484,8 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { gezzez_GZZ_2_8121_V = mkV_II "ġeżżeż" (mkRoot "ġ-ż-ż") ; ngezz_GZZ_7_8122_V = mkV_VII "ġeżż" "nġeżż" (mkRoot "ġ-ż-ż") ; gie_GJ'_1_8123_V = irregularV form1 (mkRoot "ġ-j-'") (mkPattern "ie" []) - "ġejt" "ġejt" "ġie" "ġiet" "ġejna" "ġejtu" "ġew" - "niġi" "tiġi" "jiġi" "tiġi" "niġu" "tiġu" "jiġu" + "ġejt" "ġejt" "ġie" "ġiet" "ġejna" "ġejtu" "ġew" + "niġi" "tiġi" "jiġi" "tiġi" "niġu" "tiġu" "jiġu" "ejja" "ejjew" ; gab_GJB_1_8124_V = mkV "ġab" (mkRoot "ġ-j-b") ; @@ -2035,8 +2035,8 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { kejjel_KJL_2_8670_V = mkV_II "kejjel" (mkRoot "k-j-l") ; tkejjel_KJL_5_8671_V = mkV_V "tkejjel" (mkRoot "k-j-l") ; kiel_KJL_1_8672_V = irregularV form1 (mkRoot "k-j-l") (mkPattern "ie" []) - "kilt" "kilt" "kiel" "kielet" "kilna" "kiltu" "kielu" - "niekol" "tiekol" "jiekol" "tiekol" "nieklu" "tieklu" "jieklu" + "kilt" "kilt" "kiel" "kielet" "kilna" "kiltu" "kielu" + "niekol" "tiekol" "jiekol" "tiekol" "nieklu" "tieklu" "jieklu" ("kul"|"iekol") ("kulu"|"ieklu") ; wikkel_KJL_2_8673_V = mkV_II "wikkel" (mkRoot "k-j-l") ; @@ -2062,8 +2062,8 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { tkiewa_KWJ_6_8693_V = mkV_VI "tkiewa" (mkRoot "k-w-j") ; nkewa_KWJ_7_8694_V = mkV_VII "kewa" "nkewa" (mkRoot "k-w-j") ; kien_KWN_1_8695_V = irregularV form1 (mkRoot "k-w-n") (mkPattern "ie" []) - "kont" "kont" "kien" "kienet" "konna" "kontu" "kienu" - "nkun" "tkun" "jkun" "tkun" "nkunu" "tkunu" "jkunu" + "kont" "kont" "kien" "kienet" "konna" "kontu" "kienu" + "nkun" "tkun" "jkun" "tkun" "nkunu" "tkunu" "jkunu" "kun" "kunu" ; kewwen_KWN_2_8696_V = mkV_II "kewwen" (mkRoot "k-w-n") ; @@ -2289,8 +2289,8 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { mewweg_MWG_2_8916_V = mkV_II "mewweġ" (mkRoot "m-w-ġ") ; tmewweg_MWG_5_8917_V = mkV_V "tmewweġ" (mkRoot "m-w-ġ") ; mar_MWR_1_8918_V = irregularV form1 (mkRoot "m-w-r") (mkPattern "a" []) - "mort" "mort" "mar" "marret" "morna" "mortu" "marru" - "mmur" "tmur" "jmur" "tmur" "mmorru" "tmorru" "jmorru" + "mort" "mort" "mar" "marret" "morna" "mortu" "marru" + "mmur" "tmur" "jmur" "tmur" "mmorru" "tmorru" "jmorru" "mur" "morru" ; mawwar_MWR_2_8919_V = mkV_II "mawwar" (mkRoot "m-w-r") ; @@ -2730,8 +2730,8 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { qawwa_QWJ_2_9355_V = mkV_II "qawwa" (mkRoot "q-w-j") ; tqawwa_QWJ_5_9356_V = mkV_V "tqawwa" (mkRoot "q-w-j") ; qal_QWL_1_9357_V = irregularV form1 (mkRoot "q-w-l") (mkPattern "a" []) - "għedt" "għedt" "qal" "qalet" "għedna" "għedtu" "qalu" - "ngħid" "tgħid" "jgħid" "tgħid" "ngħidu" "tgħidu" "jgħidu" + "għedt" "għedt" "qal" "qalet" "għedna" "għedtu" "qalu" + "ngħid" "tgħid" "jgħid" "tgħid" "ngħidu" "tgħidu" "jgħidu" "għid" "għidu" ; -- say/speak (note: GĦAD is also a separate verb) qawwel_QWL_2_9358_V = mkV_II "qawwel" (mkRoot "q-w-l") ; @@ -2890,8 +2890,8 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { razzan_RZN_2_9511_V = mkV_II "rażżan" (mkRoot "r-ż-n") ; trazzan_RZN_5_9512_V = mkV_V "trażżan" (mkRoot "r-ż-n") ; ra_R'J_1_9513_V = irregularV form1 (mkRoot "r-'-j") (mkPattern "a" []) - "rajt" "rajt" "ra" "rat" "rajna" "rajtu" "raw" - "nara" "tara" "jara" "tara" "naraw" "taraw" "jaraw" + "rajt" "rajt" "ra" "rat" "rajna" "rajtu" "raw" + "nara" "tara" "jara" "tara" "naraw" "taraw" "jaraw" "ara" "araw" ; ntwera_R'J_7_9514_V = irregularV form7 (mkRoot "r-'-j") (mkPattern "e" "e") @@ -3458,15 +3458,15 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { twelled_WLD_5_10060_V = mkV_V "twelled" (mkRoot "w-l-d") ; twieled_WLD_6_10061_V = mkV_VI "twieled" (mkRoot "w-l-d") ; emmen_WMN_1_10062_V = irregularV form1 (mkRoot "w-m-n") (mkPattern "e" "e") - "emmint" "emmint" "emmen" "emmnet" "emminna" "emmintu" "emmnu" - "nemmen" "temmen" "jemmen" "temmen" "nemmnu" "temmnu" "jemmnu" + "emmint" "emmint" "emmen" "emmnet" "emminna" "emmintu" "emmnu" + "nemmen" "temmen" "jemmen" "temmen" "nemmnu" "temmnu" "jemmnu" "emmen" "emmnu" ; wemmen_WMN_2_10063_V = mkV_II "wemmen" (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") ; 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") ; twaqqaf_WQF_5_10069_V = mkV_V "twaqqaf" (mkRoot "w-q-f") ; waqa'_WQGH_1_10070_V = mkV "waqa'" (mkRoot "w-q-għ") ; @@ -4167,14 +4167,14 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { hassel_HSL_2_10765_V = mkV_II "ħassel" (mkRoot "ħ-s-l") ; thassel_HSL_5_10766_V = mkV_V "tħassel" (mkRoot "ħ-s-l") ; ta_GHTJ_1_10767_V = irregularV form1 (mkRoot "għ-t-j") (mkPattern "a" []) - "tajt" "tajt" "ta" "tat" "tajna" "tajtu" "taw" - "nagħti" "tagħti" "jagħti" "tagħti" "nagħtu" "tagħtu" "jagħtu" + "tajt" "tajt" "ta" "tat" "tajna" "tajtu" "taw" + "nagħti" "tagħti" "jagħti" "tagħti" "nagħtu" "tagħtu" "jagħtu" "agħti" "agħtu" ; nghata_GHTJ_7_10768_V = mkV_VII "għata" "ngħata" (mkRoot "għ-t-j") ; idda_'DJ_8_10771_V = irregularV form8 (mkRoot "'-d-j") (mkPattern "i" "e") - "iddejt" "iddejt" "idda" "iddiet" "iddejna" "iddejtu" "iddew" - "niddi" "tiddi" "jiddi" "tiddi" "niddu" "tiddu" "jiddu" + "iddejt" "iddejt" "idda" "iddiet" "iddejna" "iddejtu" "iddew" + "niddi" "tiddi" "jiddi" "tiddi" "niddu" "tiddu" "jiddu" "iddi" "iddu" ; idden_'DN_2_10772_V = irregularV form2 (mkRoot "'-d-n") (mkPattern "i" "e") @@ -4184,12 +4184,12 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { ; stieden_'DN_10_10773_V = irregularV form10 (mkRoot "'-d-n") (mkPattern "ie" "e") "stedint" "stedint" "stieden" "stiednet" "stedinna" "stedintu" "stiednu" - "nistieden" "tistieden" "jistieden" "tistieden" "nistiednu" "tistiednu" "jistiednu" + "nistieden" "tistieden" "jistieden" "tistieden" "nistiednu" "tistiednu" "jistiednu" "stieden" "stiednu" ; af_''F_1_10774_V = irregularV form1 (mkRoot "'-'-f") (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" + "naf" "taf" "jaf" "taf" "nafu" "tafu" "jafu" "kun af" "kunu afu" ; ntaf_''F_7_10775_V = irregularV form2 (mkRoot "'-'-f") (mkPattern "a" []) @@ -4198,17 +4198,17 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { "ntaf" "ntafu" ; ha_'HD_1_10776_V = irregularV form1 (mkRoot "'-ħ-d") (mkPattern "a" []) - "ħadt" "ħadt" "ħa" "ħadet" "ħadna" "ħadtu" "ħadu" - "nieħu" "tieħu" "jieħu" "tieħu" "nieħdu" "tieħdu" "jieħdu" + "ħadt" "ħadt" "ħa" "ħadet" "ħadna" "ħadtu" "ħadu" + "nieħu" "tieħu" "jieħu" "tieħu" "nieħdu" "tieħdu" "jieħdu" "ħu" "ħudu" ; ttiehed_'HD_6_10777_V = irregularV form6 (mkRoot "'-ħ-d") (mkPattern "ie" "e") - "ttieħedt" "ttieħedt" "ttieħed" "ttieħdet" "ttieħedna" "ttieħedtu" "ttieħdu" + "ttieħedt" "ttieħedt" "ttieħed" "ttieħdet" "ttieħedna" "ttieħedtu" "ttieħdu" "nittieħed" "tittieħed" "jittieħed" "tittieħed" "nittieħdu" "tittieħdu" "jittieħdu" "ttieħed" "ttieħdu" ; staha_'HJ_10_10778_V = irregularV form10 (mkRoot "'-ħ-j") (mkPattern "a" "a") - "stħajt" "stħajt" "staħa" "stħiet" "stħajna" "stħajtu" "stħew" + "stħajt" "stħajt" "staħa" "stħiet" "stħajna" "stħajtu" "stħew" "nistħi" "tistħi" "jistħi" "tistħi" "nistħu" "tistħu" "jistħu" "istħi" "istħu" ; @@ -4223,7 +4223,7 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { "amba" "ambaw" ; stenna_'NJ_10_10781_V = irregularV form10 (mkRoot "'-n-j") (mkPattern "e" "a") - "stennejt" "stennejt" "stenna" "stenniet" "stennejna" "stennejtu" "stennew" + "stennejt" "stennejt" "stenna" "stenniet" "stennejna" "stennejtu" "stennew" "nistenna" "tistenna" "jistenna" "tistenna" "nistennew" "tistennew" "jistennew" "stenna" "stennew" ; @@ -4273,8 +4273,8 @@ concrete DictMlt of DictMltAbs = CatMlt ** open ParadigmsMlt in { penpen_PNPN_1_10813_V = mkV "penpen" (mkRoot "p-n-p-n") ; hezzez_HZZ_2_10814_V = mkV_II "heżżeż" (mkRoot "h-ż-ż") ; wera_R'J_1_10815_V = irregularV form4 (mkRoot "r-'-j") (mkPattern "e" "a") - "urejt" "urejt" "wera" "uriet" "urejna" "urejtu" "urejna" - "nuri" "turi" "juri" "turi" "nuru" "turu" "juru" + "urejt" "urejt" "wera" "uriet" "urejna" "urejtu" "urejna" + "nuri" "turi" "juri" "turi" "nuru" "turu" "juru" "uri" "uru" ; ntara_R'J_7_10816_V = irregularV form7 (mkRoot "r-'-j") (mkPattern "a" "a") diff --git a/lib/src/maltese/GrammarMlt.gf b/lib/src/maltese/GrammarMlt.gf index 44b38fa9f..885e72082 100644 --- a/lib/src/maltese/GrammarMlt.gf +++ b/lib/src/maltese/GrammarMlt.gf @@ -17,10 +17,10 @@ concrete GrammarMlt of Grammar = RelativeMlt, ConjunctionMlt, PhraseMlt, - TextX, + TextX - [Adv], StructuralMlt, IdiomMlt, - TenseX + TenseX - [Adv] ** { flags coding=utf8 ; diff --git a/lib/src/maltese/IdiomMlt.gf b/lib/src/maltese/IdiomMlt.gf index 01b128a5c..e09f505ac 100644 --- a/lib/src/maltese/IdiomMlt.gf +++ b/lib/src/maltese/IdiomMlt.gf @@ -21,10 +21,10 @@ concrete IdiomMlt of Idiom = CatMlt ** open Prelude, ResMlt in { } 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) + Pres => copula_kien.s ! VImpf (toVAgr np.a) ! Pos ; + Past => copula_kien.s ! VPerf (toVAgr np.a) ! Pos ; + Fut => "ser" ++ copula_kien.s ! VImpf (toVAgr np.a) ! Pos ; + 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 - ProgrVP vp = predV copula_kien ** { - s2 = \\agr => joinVParts (vp.s ! VPIndicat Pres agr ! Simul ! Pos) + ProgrVP vp = CopulaVP ** { + s2 = \\agr => joinVP vp (VPIndicat Pres agr) Simul Pos } ; -- VP -> Utt ; -- let's go diff --git a/lib/src/maltese/LexiconMlt.gf b/lib/src/maltese/LexiconMlt.gf index b001e4edd..8f549399d 100644 --- a/lib/src/maltese/LexiconMlt.gf +++ b/lib/src/maltese/LexiconMlt.gf @@ -81,7 +81,7 @@ 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 (genderedN "kuġin" "kuġini") ; + cousin_N = genderedN "kuġin" "kuġini" ; cow_N = mkN "baqra" "baqar" "baqartejn" [] [] ; cut_V2 = dirV2 (qata'_QTGH_1_9305_V) ; day_N = mkN "ġurnata" "ġranet" ; @@ -109,7 +109,7 @@ concrete LexiconMlt of Lexicon = CatMlt ** fall_V = waqa'_WQGH_1_10070_V ; far_Adv = mkAdv "il-bogħod" ; -- use glue? 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_VS = beza'_BZGH_1_7541_V; feather_N = mkNColl "rix" ; @@ -335,7 +335,7 @@ concrete LexiconMlt of Lexicon = CatMlt ** uncertain_A = regA "inċert" ; understand_V2 = lilV2 (fehem_FHM_1_10830_V) ; 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 ; wait_V2 = lilV2 (stenna_'NJ_10_10781_V) ; walk_V = mexa_MXJ_1_8926_V ; diff --git a/lib/src/maltese/Maybe.gf b/lib/src/maltese/Maybe.gf new file mode 100644 index 000000000..52c9c6427 --- /dev/null +++ b/lib/src/maltese/Maybe.gf @@ -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") ; + +} diff --git a/lib/src/maltese/NounMlt.gf b/lib/src/maltese/NounMlt.gf index f52235c45..ed40ba3ce 100644 --- a/lib/src/maltese/NounMlt.gf +++ b/lib/src/maltese/NounMlt.gf @@ -150,24 +150,16 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in { } ; -- Predet -> NP -> NP - PredetNP pred np = np ** { - s = \\c => pred.s ++ np.s ! c ; - } ; + PredetNP pred np = overwriteNPs np (\\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 - } ; + PPartNP np v2 = overwriteNPs np (\\c => np.s ! c ++ stem1 (v2.s ! VActivePart (toGenNum np.a))) ; -- NP -> RS -> NP - RelNP np rs = np ** { - s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; - } ; + RelNP np rs = overwriteNPs np (\\c => np.s ! c ++ "," ++ rs.s ! np.a ) ; -- NP -> Adv -> NP - AdvNP np adv = np ** { - s = \\c => np.s ! c ++ adv.s ; - } ; + AdvNP np adv = overwriteNPs np (\\c => np.s ! c ++ adv.s) ; -- Num NumSg = {s = \\c => []; n = NumX Sg ; hasCard = False} ; @@ -241,35 +233,23 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in { } ; -- AP -> CN -> CN - AdjCN ap cn = cn ** { - s = \\num => preOrPost ap.isPre (ap.s ! mkGenNum num cn.g) (cn.s ! num) ; - } ; + AdjCN ap cn = overwriteCNs cn (\\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 ; - } ; + RelCN cn rs = overwriteCNs cn (\\num => cn.s ! num ++ rs.s ! agrP3 (nounnum2num num) cn.g) ; -- CN -> Adv -> CN - AdvCN cn adv = cn ** { - s = \\num => cn.s ! num ++ adv.s - } ; + AdvCN cn adv = overwriteCNs cn (\\num => cn.s ! num ++ adv.s) ; -- CN -> SC -> CN - SentCN cn sc = cn ** { - s = \\num => cn.s ! num ++ sc.s - } ; + SentCN cn sc = overwriteCNs cn (\\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 - } ; + ApposCN cn np = overwriteCNs cn (\\num => cn.s ! num ++ np.s ! NPNom) ; + + PossNP cn np = overwriteCNs cn (\\num => cn.s ! num ++ prepNP prep_ta np) ; + + PartNP cn np = overwriteCNs cn (\\num => cn.s ! num ++ prepNP prep_ta np) ; -- Det -> NP -> NP CountNP det np = { @@ -281,9 +261,46 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in { oper -- Copied from ParadigmsMlt (didn't want to change import structure) - mkPrep : Str -> Prep = \fuq -> lin Prep { - s = \\defn => fuq ; - takesDet = False + -- mkPrep : Str -> Prep = \fuq -> lin Prep { + -- s = \\defn => fuq ; + -- 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 ; } ; } diff --git a/lib/src/maltese/ParadigmsMlt.gf b/lib/src/maltese/ParadigmsMlt.gf index 8be8b0d31..452204367 100644 --- a/lib/src/maltese/ParadigmsMlt.gf +++ b/lib/src/maltese/ParadigmsMlt.gf @@ -223,10 +223,10 @@ resource ParadigmsMlt = open } ; 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 = \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 possN : N -> N ; @@ -245,7 +245,25 @@ resource ParadigmsMlt = open -- Same in all cases, e.g. FUQ mkPrep : Str -> Prep = \fuq -> lin Prep { 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: @@ -257,10 +275,12 @@ resource ParadigmsMlt = open Indefinite => ghal ; 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 -- B'ajruplan -- BIL-ktieb @@ -271,12 +291,86 @@ resource ParadigmsMlt = open Indefinite => makePreVowel bi b' ; Definite => makePreFull bil (dropSfx 2 bit) bl } ; - takesDet = True + enclitic = prepClitics bi ; + takesDet = True ; + joinsVerb = False ; } ; - } ; - noPrep : Prep ; -- no preposition - noPrep = mkPrep [] ; + -- All forms: + -- 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 --------------------------------------------------------------- -} @@ -402,7 +496,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo class form root patt impSg ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -449,7 +543,7 @@ resource ParadigmsMlt = open } ; newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ; in lin V { - s = conjFormII newinfo ; + s = stemVariantsTbl (conjFormII newinfo) ; i = newinfo ; } ; @@ -462,7 +556,7 @@ resource ParadigmsMlt = open imp : Str = mammaII ; --- assumption: mamma II is also imperative newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ; in lin V { - s = conjFormII_quad newinfo ; + s = stemVariantsTbl (conjFormII_quad newinfo) ; i = newinfo ; } ; derivedV_QuadII : Str -> Str -> Root -> V = \mammaII, imp, root -> @@ -471,7 +565,7 @@ resource ParadigmsMlt = open patt : Pattern = extractPattern mammaII ; newinfo : VerbInfo = mkVerbInfo class FormII root patt imp ; in lin V { - s = conjFormII_quad newinfo ; + s = stemVariantsTbl (conjFormII_quad newinfo) ; i = newinfo ; } ; } ; @@ -485,7 +579,7 @@ resource ParadigmsMlt = open class : VClass = classifyRoot root ; info : VerbInfo = mkVerbInfo class FormIII root vowels vowels2 mammaIII ; --- assumption: mamma III is also imperative in lin V { - s = conjFormIII info ; + s = stemVariantsTbl (conjFormIII info) ; i = info ; } ; @@ -500,20 +594,22 @@ resource ParadigmsMlt = open mammaII : Str = dropPfx 1 mammaV ; -- WAQQAF vII : V = derivedV_II mammaII root ; info : VerbInfo = mkVerbInfo vII.i.class FormV vII.i.root vII.i.patt mammaV ; - in lin V { - s = table { - VPerf agr => pfx_T (vII.s ! VPerf agr) ; - VImpf (AgP1 Sg) => pfx "ni" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP1 Sg)))) ; - VImpf (AgP2 Sg) => pfx "ti" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP2 Sg)))) ; - VImpf (AgP3Sg Masc) => pfx "ji" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP3Sg Masc)))) ; - VImpf (AgP3Sg Fem) => pfx "ti" (pfx_T (dropPfx 1 (vII.s ! VImpf (AgP3Sg Fem)))) ; - 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) ; + get : VForm -> Str = \vf -> stem1 (vII.s ! vf) ; + tbl : VForm => Str = table { + VPerf agr => pfx_T (get (VPerf agr)) ; + VImpf (AgP1 Sg) => pfx "ni" (pfx_T (dropPfx 1 (get (VImpf (AgP1 Sg))))) ; + VImpf (AgP2 Sg) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP2 Sg))))) ; + VImpf (AgP3Sg Masc) => pfx "ji" (pfx_T (dropPfx 1 (get (VImpf (AgP3Sg Masc))))) ; + VImpf (AgP3Sg Fem) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP3Sg Fem))))) ; + VImpf (AgP1 Pl) => pfx "ni" (pfx_T (dropPfx 1 (get (VImpf (AgP1 Pl))))) ; + VImpf (AgP2 Pl) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP2 Pl))))) ; + VImpf (AgP3Pl) => pfx "ji" (pfx_T (dropPfx 1 (get (VImpf (AgP3Pl))))) ; + VImp num => pfx_T (get (VImp num)) ; VActivePart _ => "" ; --- TODO VPassivePart _ => "" --- TODO } ; + in lin V { + s = stemVariantsTbl (tbl) ; i = info ; } ; @@ -525,20 +621,22 @@ resource ParadigmsMlt = open mammaIII : Str = dropPfx 1 mammaVI ; -- QIEGĦED vIII : V = derivedV_III mammaIII root ; info : VerbInfo = updateVerbInfo vIII.i FormVI mammaVI ; - in lin V { - s = table { - VPerf agr => pfx_T (vIII.s ! VPerf agr) ; - VImpf (AgP1 Sg) => pfx "ni" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP1 Sg)))) ; - VImpf (AgP2 Sg) => pfx "ti" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP2 Sg)))) ; - VImpf (AgP3Sg Masc) => pfx "ji" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP3Sg Masc)))) ; - VImpf (AgP3Sg Fem) => pfx "ti" (pfx_T (dropPfx 1 (vIII.s ! VImpf (AgP3Sg Fem)))) ; - 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) ; + get : VForm -> Str = \vf -> stem1 (vIII.s ! vf) ; + tbl : VForm => Str = table { + VPerf agr => pfx_T (get (VPerf agr)) ; + VImpf (AgP1 Sg) => pfx "ni" (pfx_T (dropPfx 1 (get (VImpf (AgP1 Sg))))) ; + VImpf (AgP2 Sg) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP2 Sg))))) ; + VImpf (AgP3Sg Masc) => pfx "ji" (pfx_T (dropPfx 1 (get (VImpf (AgP3Sg Masc))))) ; + VImpf (AgP3Sg Fem) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP3Sg Fem))))) ; + VImpf (AgP1 Pl) => pfx "ni" (pfx_T (dropPfx 1 (get (VImpf (AgP1 Pl))))) ; + VImpf (AgP2 Pl) => pfx "ti" (pfx_T (dropPfx 1 (get (VImpf (AgP2 Pl))))) ; + VImpf (AgP3Pl) => pfx "ji" (pfx_T (dropPfx 1 (get (VImpf (AgP3Pl))))) ; + VImp num => pfx_T (get (VImp num)) ; VActivePart _ => "" ; --- TODO VPassivePart _ => "" --- TODO } ; + in lin V { + s = stemVariantsTbl (tbl) ; i = info ; } ; @@ -558,7 +656,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo class FormVII root vowels mammaVII ; in lin V { - s = conjFormVII info c1 ; + s = stemVariantsTbl (conjFormVII info c1) ; i = info ; } ; @@ -572,7 +670,7 @@ resource ParadigmsMlt = open info : VerbInfo = mkVerbInfo class FormVIII root vowels mammaVIII ; c1 : Str = root.C1+"t"; in lin V { - s = conjFormVII info c1 ; -- note we use conjFormVII ! + s = stemVariantsTbl (conjFormVII info c1) ; -- note we use conjFormVII ! i = info ; } ; @@ -587,7 +685,7 @@ resource ParadigmsMlt = open class : VClass = classifyRoot root ; info : VerbInfo = mkVerbInfo class FormIX root patt mammaIX ; in lin V { - s = conjFormIX info ; + s = stemVariantsTbl (conjFormIX info) ; i = info ; } ; _ => 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 ; info : VerbInfo = mkVerbInfo class FormX root patt patt2 mammaX ; in lin V { - s = conjFormX info ; + s = stemVariantsTbl (conjFormX info) ; i = info ; } ; @@ -639,7 +737,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Strong Regular) (FormI) root patt (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -681,7 +779,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Strong LiquidMedial) (FormI) root patt (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -718,7 +816,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Strong Geminated) (FormI) root patt (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -759,7 +857,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Weak Assimilative) (FormI) root patt patt2 (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -800,7 +898,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Weak Hollow) (FormI) root patt patt2 (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -841,7 +939,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Weak Lacking) (FormI) root patt (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -878,7 +976,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Weak Defective) (FormI) root patt (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -915,7 +1013,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Quad QStrong) (FormI) root patt (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -955,7 +1053,7 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Quad QWeak) (FormI) root patt (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; @@ -980,29 +1078,35 @@ resource ParadigmsMlt = open } ; info : VerbInfo = mkVerbInfo (Loan) (FormI) (imp ! Sg) ; in lin V { - s = tbl ; + s = stemVariantsTbl tbl ; i = info ; } ; {- Verb --------------------------------------------------------------- -} + hasCompl : Prep -> Compl = \p -> p ** { isPresent = True } ; + noCompl : Compl = noPrep ** { isPresent = False } where { noPrep : Prep = mkPrep [] }; + mkVS : V -> VS ; -- sentence-compl mkVS v = lin VS v ; 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 = prepV2 v noPrep ; + -- dirV2 v = prepV2 v noPrep ; + dirV2 v = lin V2 ( v ** { c2 = noCompl } ) ; 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 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 = dirV3 v noPrep ; + -- dirdirV3 v = dirV3 v noPrep ; + dirdirV3 v = lin V3 (v ** { c2 = noCompl ; c3 = noCompl }) ; mkV3 : overload { 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 p t = lin V2V (v ** { c2 = p ; c3 = t }) ; + mkV2V v p t = lin V2V (v ** { c2 = hasCompl p ; c3 = hasCompl t }) ; {- Conjunction -------------------------------------------------------- -} @@ -1126,10 +1230,11 @@ resource ParadigmsMlt = open } ; 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 = prepA2 a noPrep ; + -- dirA2 a = prepA2 a noPrep ; + dirA2 a = lin A2 (a ** {c2 = noCompl}) ; mkA2 : overload { mkA2 : A -> Prep -> A2 ; @@ -1154,7 +1259,10 @@ resource ParadigmsMlt = open mkAdA : Str -> AdA ; -- adverb modifying adjective, e.g. PJUTTOST 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) ; mkAdA x = lin AdA (ss x) ; mkAdN x = lin AdN (ss x) ; diff --git a/lib/src/maltese/QuestionMlt.gf b/lib/src/maltese/QuestionMlt.gf index 45247a6c4..4aa7c4b06 100644 --- a/lib/src/maltese/QuestionMlt.gf +++ b/lib/src/maltese/QuestionMlt.gf @@ -43,7 +43,7 @@ concrete QuestionMlt of Question = CatMlt ** open ResMlt, ParamX, Prelude in { -- IComp -> NP -> QCl -- where is John 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 -- with whom diff --git a/lib/src/maltese/ResMlt.gf b/lib/src/maltese/ResMlt.gf index a42b151f1..399e77c15 100644 --- a/lib/src/maltese/ResMlt.gf +++ b/lib/src/maltese/ResMlt.gf @@ -7,17 +7,10 @@ --# -path=.:../abstract:../common:../prelude -resource ResMlt = ParamX ** open Prelude, Predef in { +resource ResMlt = ParamX ** open Prelude, Predef, Maybe 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 @@ -52,7 +45,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in { } ; toAgr : VAgr -> Agr = \vagr -> case vagr of { - AgP1 num => mkAgr num P1 Masc ; --- sorry ladies + AgP1 num => mkAgr num P1 Masc ; AgP2 num => mkAgr num P2 Masc ; AgP3Sg gen => mkAgr Pl P3 gen ; AgP3Pl => mkAgr Pl P3 Masc @@ -71,6 +64,11 @@ resource ResMlt = ParamX ** open Prelude, Predef in { Sg => GSg g ; Pl => GPl } ; + mkGenNum : Noun_Number -> Gender -> GenNum = \n,g -> + case nounnum2num n of { + Sg => GSg g ; + Pl => GPl + } ; } ; -- 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 -> Agr = \n -> mkAgr n P3 Masc; - -- } ; + agrP3 : Number -> Gender -> Agr = \n,g -> mkAgr n P3 g; conjAgr : Agr -> Agr -> Agr = \a,b -> { n = (conjNumber a.n b.n) ; @@ -123,7 +118,8 @@ resource ResMlt = ParamX ** open Prelude, Predef in { NPCase = NPNom | NPAcc -- I have a feeling we'll this need eventually - | NPCPrep ; -- [AZ] + | NPCPrep -- [AZ] + ; oper npNom = NPNom ; @@ -151,7 +147,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in { -- _ => VPres -- } ; 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 ; in case o of { @@ -214,6 +210,14 @@ resource ResMlt = ParamX ** open Prelude, Predef in { Pl => Plural } ; + nounnum2num : Noun_Number -> Number = \n -> + case n of { + Singulative => Sg ; + Collective => Sg ; + Dual => Pl ; + Plural => Pl + } ; + numform2nounnum : NumForm -> Noun_Number = \n -> case n of { NumX Sg => Singulative ; @@ -279,7 +283,6 @@ resource ResMlt = ParamX ** open Prelude, Predef in { hasColl : Bool ; -- has a collective form? e.g. BAQAR hasDual : Bool ; -- has a dual form? e.g. SAGĦTEJN takesPron : Bool ; -- takes enclitic pronon? e.g. MISSIERI - -- anim : Animacy ; -- is the noun animate? e.g. TABIB } ; ProperNoun : Type = { @@ -323,7 +326,6 @@ resource ResMlt = ParamX ** open Prelude, Predef in { takesPron = False ; hasDual = notB (isNil dual) ; hasColl = notB (isNil coll) ; - -- anim = Inanimate ; } ; -- Noun phrase @@ -335,33 +337,45 @@ resource ResMlt = ParamX ** open Prelude, Predef in { }; 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 prepNP : Preposition -> NounPhrase -> Str ; - prepNP prep np = case of { - => prep.s ! Definite ++ np.s ! NPCPrep ; -- FIT-TRIQ - => prep.s ! Definite ++ np.s ! NPNom ; -- FUQ IT-TRIQ - => prep.s ! Indefinite ++ np.s ! NPNom -- FI TRIQ + prepNP prep np = case np.isPron of { + True => prep.enclitic ! np.a ; -- magħha + False => case of { + => prep.s ! Definite ++ np.s ! NPCPrep ; -- fit-triq + => prep.s ! Definite ++ np.s ! NPNom ; -- fuq it-triq + => prep.s ! Indefinite ++ np.s ! NPNom -- fi triq + } } ; - Compl = Preposition ; + Compl : Type = Preposition ** {isPresent : Bool} ; -- Compl : Type = { -- s : Str ; -- -- c : NPForm ; -- -- isPre : Bool -- } ; + noCompl : Compl = { + s = \\_ => [] ; + enclitic = \\_ => [] ; + takesDet = False ; + joinsVerb = False ; + isPresent = False ; + } ; + Preposition = { 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 -------------------------------------------------------------- -} oper Pronoun = { - -- s : PronForm => {c1, c2: Str} ; s : PronForm => Str ; -- cases like omm-i / hi-ja are handled elsewhere a : Agr ; } ; @@ -390,8 +404,58 @@ resource ResMlt = ParamX ** open Prelude, Predef in { {- Verb ----------------------------------------------------------------- -} 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 = { - s : VForm => Str ; + s : VForm => Variants3 ; --- need to store different "stems" already at verb level (ġera/ġerie/ġeri) i : VerbInfo ; } ; @@ -460,22 +524,99 @@ resource ResMlt = ParamX ** open Prelude, Predef in { | OQuest -- JIEKOL ĦUT ĠANNI [?] ; + + {- Verb Phrase ---------------------------------------------------------- -} + 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} ; + joinVariants3 : Variants3 -> Polarity -> Str = \stems,pol -> + case of { + => stem1 stems ; + => stem2 stems ++ BIND ++ "x" + } ; + + 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 of { + + -- konna ftaħna / ma konniex ftaħna + => stems.s1 ; + + -- konna ftaħnie-ha / ma konniex ftaħni-ha + => stems.s2 ++ BIND ++ (fromJust Variants3 vp.dir).s1 ; + + -- konna ftaħnie-lha / ma konniex ftaħni-lha + => stems.s2 ++ BIND ++ (fromJust Variants3 vp.ind).s1 ; + + -- konna ftaħni-hie-lha / ma konniex ftaħni-hi-lha + => stems.s3 ++ BIND ++ (fromJust Variants3 vp.dir).s2 ++ BIND ++ (fromJust Variants3 vp.ind).s1 + + } ; + + -- No aux part to handle + False => aux ++ case of { + + -- ftaħna / ftaħnie-x + => stems.s1 ; + => stems.s2 ++ BIND ++ x ; + + -- ftaħnie-ha / ftaħni-hie-x + => stems.s2 ++ BIND ++ (fromJust Variants3 vp.dir).s1 ; + => stems.s3 ++ BIND ++ (fromJust Variants3 vp.dir).s2 ++ BIND ++ x ; + + -- ftaħnie-lha / ftaħni-lhie-x + => stems.s2 ++ BIND ++ (fromJust Variants3 vp.ind).s1 ; + => stems.s3 ++ BIND ++ (fromJust Variants3 vp.ind).s2 ++ BIND ++ x ; + + -- ftaħni-hie-lha / ftaħni-hi-lhie-x + => stems.s3 ++ BIND ++ (fromJust Variants3 vp.dir).s2 ++ BIND ++ (fromJust Variants3 vp.ind).s1 ; + => 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 of { + => False ; + => False ; + => True ; + => True ; + => False ; + => True ; + => True ; + => True ; + => 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] VerbPhrase : Type = { - s : VPForm => Anteriority => Polarity => VerbParts ; -- verb + s : VPForm => Anteriority => Polarity => VerbParts ; s2 : Agr => Str ; -- complement - -- a1 : Str ; - -- a2 : Str ; + dir : Maybe Variants3 ; -- direct object clitic + ind : Maybe Variants3 ; -- indirect object clitic } ; SlashVerbPhrase : Type = VerbPhrase ** {c2 : Compl} ; @@ -492,99 +633,144 @@ resource ResMlt = ParamX ** open Prelude, Predef in { insertObj : (Agr => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> { s = vp.s ; s2 = \\agr => vp.s2 ! agr ++ obj ! agr ; + dir = vp.dir ; + ind = vp.ind ; } ; insertObjPre : (Agr => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> { s = vp.s ; s2 = \\agr => obj ! agr ++ vp.s2 ! agr ; + dir = vp.dir ; + ind = vp.ind ; } ; insertObjc : (Agr => Str) -> SlashVerbPhrase -> SlashVerbPhrase = \obj,vp -> 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 -> { s = vp.s ; s2 = \\agr => vp.s2 ! agr ++ adv ; + dir = vp.dir ; + ind = vp.ind ; } ; 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" ; - VPerf (AgP3Sg Masc) => "kien" ; - VPerf (AgP3Sg Fem) => "kienet" ; - VPerf (AgP1 Pl) => "konna" ; - VPerf (AgP2 Pl) => "kontu" ; - VPerf (AgP3Pl) => "kienu" ; - VImpf (AgP1 Sg) => "nkun" ; - VImpf (AgP2 Sg) => "tkun" ; - VImpf (AgP3Sg Masc) => "jkun" ; - VImpf (AgP3Sg Fem) => "tkun" ; - VImpf (AgP1 Pl) => "nkunu" ; - VImpf (AgP2 Pl) => "tkunu" ; - VImpf (AgP3Pl) => "jkunu" ; - VImp (Pl) => "kun" ; - VImp (Sg) => "kunu" ; - VActivePart gn => "" ; - VPassivePart gn => "" - } ; - i : VerbInfo = mkVerbInfo (Irregular) (FormI) (mkRoot "k-w-n") (mkPattern "ie") ; + copula_kien : {s : VForm => Polarity => Str} = { + s = \\vform,pol => case of { + => "kont" ; + => "kont" ; + => "kien" ; + => "kienet" ; + => "konna" ; + => "kontu" ; + => "kienu" ; + => "nkun" ; + => "tkun" ; + => "jkun" ; + => "tkun" ; + => "nkunu" ; + => "tkunu" ; + => "jkunu" ; + => "kun" ; + => "kunu" ; + + => "kontx" ; + => "kontx" ; + => "kienx" ; + => "kinitx" ; + => "konniex" ; + => "kontux" ; + => "kienux" ; + => "nkunx" ; + => "tkunx" ; + => "jkunx" ; + => "tkunx" ; + => "nkunux" ; + => "tkunux" ; + => "jkunux" ; + => "kunx" ; + => "kunux" ; + => "" ; + => "" + } } ; -- Adapted from [AZ] CopulaVP : VerbPhrase = { s = \\vpf,ant,pol => - case of { - => polarise (copula_kien.s ! VPerf vagr) pol ; - => polarise (copula_kien.s ! VImpf vagr) pol ; - => polarise (copula_kien.s ! VImp num) pol ; - _ => Predef.error "tense not implemented" + --- We are ignoring the anteriority + case of { + --- Here we are bypassing VerbParts by putting negatives in the stem + => mkVerbParts (copula_kien.s ! VPerf vagr ! Pos) [] ; -- kien + => mkVerbParts (copula_kien.s ! VImpf vagr ! Pos) [] ; -- jkun + => mkVerbParts ("se" ++ copula_kien.s ! VImpf vagr ! Pos) [] ; -- se jkun + => mkVerbParts ("kieku" ++ copula_kien.s ! VPerf vagr ! Pos) [] ; -- kieku kien + => mkVerbParts (copula_kien.s ! VImp num ! Pos) [] ; -- kun + => mkVerbParts (copula_kien.s ! VPerf vagr ! Neg) [] ; -- ma kienx + => mkVerbParts (copula_kien.s ! VImpf vagr ! Neg) [] ; -- ma jkunx + => mkVerbParts (mhux ! vagr ++ "se" ++ copula_kien.s ! VImpf vagr ! Pos) [] ; -- mhux se jkun + => mkVerbParts ("kieku" ++ "ma" ++ copula_kien.s ! VPerf vagr ! Neg) [] ; -- kieku ma kienx + => mkVerbParts (copula_kien.s ! VImp num ! Neg) [] -- kunx } ; s2 = \\agr => [] ; - } where { - polarise : Str -> Polarity -> VerbParts = \s,pol -> - mkVParts s (case pol of { Neg => BIND ++ "x" ; _ => [] }) ; + dir = NullVariants3 ; + ind = NullVariants3 ; } ; -- [AZ] predV : Verb -> VerbPhrase = \verb -> { s = \\vpf,ant,pol => let - ma = "ma" ; - mhux = "mhux" ; - b1 : Str -> VerbParts = \s -> mkVParts s [] ; - b2 : Str -> VerbParts = \s -> mkVParts s (BIND ++ "x") ; + ma = makePreVowel "ma" "m'" ; + b1 : Variants3 -> VerbParts = \vs -> mkVerbParts vs ; + b2 : Str -> Variants3 -> VerbParts = \s,vs -> mkVerbParts s vs ; in case vpf of { VPIndicat tense vagr => let - kien = joinVParts (CopulaVP.s ! VPIndicat Past vagr ! Simul ! pol) ; - kienx = joinVParts (CopulaVP.s ! VPIndicat Past vagr ! Simul ! Neg) ; + -- kien = joinVP CopulaVP (VPIndicat Past vagr) Simul Pos ; + -- 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 case of { => b1 (verb.s ! VImpf vagr) ; -- norqod - => b1 (kien ++ verb.s ! VImpf vagr) ; -- kont norqod + => b2 ma (verb.s ! VImpf vagr) ; -- ma norqodx + => b1 (verb.s ! VPerf vagr) ; -- rqadt - => b1 (kien ++ verb.s ! VPerf vagr) ; -- kont rqadt - => b1 ("se" ++ verb.s ! VImpf vagr) ; -- se norqod - => b1 (kien ++ "se" ++ verb.s ! VImpf vagr) ; -- kont se norqod + => b2 ma (verb.s ! VPerf vagr) ; -- ma rqadtx - => b2 (ma ++ verb.s ! VImpf vagr) ; -- ma norqodx - => b1 (ma ++ kienx ++ verb.s ! VImpf vagr) ; -- ma kontx norqod - => b2 (ma ++ verb.s ! VPerf vagr) ; -- ma rqadtx - => b1 (ma ++ kienx ++ verb.s ! VPerf vagr) ; -- ma kontx rqadt - => b1 (mhux ++ "se" ++ verb.s ! VImpf vagr) ; -- mhux se norqod - => b1 (ma ++ kienx ++ "se" ++ verb.s ! VImpf vagr) ; -- ma kontx se norqod + => b2 "se" (verb.s ! VImpf vagr) ; -- se norqod + => b2 (mhux ! vagr ++ "se") (verb.s ! VImpf vagr) ; -- m'iniex se norqod - => b1 (kien ++ verb.s ! VImpf vagr) ; -- kont norqod - => b1 (ma ++ kienx ++ verb.s ! VImpf vagr) -- ma kontx norqod + => b2 kien (verb.s ! VImpf vagr) ; -- kont norqod + => b2 (ma ++ kienx) (verb.s ! VImpf vagr) ; -- ma kontx norqod + + -- Same as Past Simul + => b1 (verb.s ! VPerf vagr) ; -- rqadt + => b2 ma (verb.s ! VPerf vagr) ; -- ma rqadtx + + => b2 kien (verb.s ! VPerf vagr) ; -- kont rqadt + => b2 (ma ++ kienx) (verb.s ! VPerf vagr) ; -- ma kontx rqadt + + => b2 ("se" ++ nkun) (verb.s ! VPerf vagr) ; -- se nkun rqadt + => 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 => [] ; + dir = NullVariants3 ; + ind = NullVariants3 ; -- a1 = [] ; -- n2 = \\_ => [] ; -- a2 = [] ; @@ -595,7 +781,7 @@ resource ResMlt = ParamX ** open Prelude, Predef in { let vpform : VPForm = VPIndicat Past (toVAgr agr) ; in - joinVParts (vp.s ! vpform ! ant ! pol) ++ vp.s2 ! agr ; + joinVP vp vpform ant pol ++ vp.s2 ! agr ; Aux = { s : Tense => Polarity => Str ; @@ -623,6 +809,16 @@ resource ResMlt = ParamX ** open Prelude, Predef in { 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" ; conjThat = conjLi ; @@ -768,19 +964,11 @@ resource ResMlt = ParamX ** open Prelude, Predef in { {- ~~~ Useful helper functions ~~~ -} - -- Non-existant form - noexist : Str = "NOEXIST" ; - -- New names for the drop/take operations - --- dependent on defn of ResMlt.noexist - takePfx : Int -> Str -> Str = \n,s -> case s of { "NOEXIST" => noexist ; _ => Predef.take n s } ; - dropPfx : Int -> Str -> Str = \n,s -> case s of { "NOEXIST" => noexist ; _ => Predef.drop n s } ; - takeSfx : Int -> Str -> Str = \n,s -> case s of { "NOEXIST" => noexist ; _ => Predef.dp n s } ; - 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 ; + takePfx = Predef.take ; + dropPfx = Predef.drop ; + takeSfx = Predef.dp ; + dropSfx = Predef.tk ; -- Get the character at the specific index (0-based). -- Negative indices behave as 0 (first character). Out of range indexes return the empty string. @@ -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} pfx_N : Str -> Str = \s -> case s of { "" => [] ; - "NOEXIST" => noexist ; --- dependent on defn of ResMlt.noexist m@#DoublingConsN + _ => m + s ; _ => "n" + s } ; pfx_T : Str -> Str = \s -> case s of { "" => [] ; - "NOEXIST" => noexist ; --- dependent on defn of ResMlt.noexist d@#DoublingConsT + _ => d + s ; _ => "t" + s } ; @@ -819,8 +1005,6 @@ resource ResMlt = ParamX ** open Prelude, Predef in { pfx : Str -> Str -> Str = \p,s -> case of { <_, ""> => [] ; <"", str> => str ; - <_, "NOEXIST"> => noexist ; --- dependent on defn of ResMlt.noexist - <"NOEXIST", str> => str ; --- dependent on defn of ResMlt.noexist => px + str } ; @@ -830,7 +1014,6 @@ resource ResMlt = ParamX ** open Prelude, Predef in { sfx : Str -> Str -> Str = \a,b -> case of { <"",_> => [] ; - <"NOEXIST",_> => noexist ; --- dependent on defn of ResMlt.noexist => ke+"n"+b ; => ha+"k"+b ; => ho+"l"+b ; diff --git a/lib/src/maltese/SentenceMlt.gf b/lib/src/maltese/SentenceMlt.gf index 544f5e01e..ed8e8ff03 100644 --- a/lib/src/maltese/SentenceMlt.gf +++ b/lib/src/maltese/SentenceMlt.gf @@ -10,8 +10,7 @@ concrete SentenceMlt of Sentence = CatMlt ** open Prelude, ResMlt, - ParamX, - CommonX in { + ParamX in { flags optimize=all_subs ; @@ -29,7 +28,7 @@ concrete SentenceMlt of Sentence = CatMlt ** open True => [] ; -- omit subject pronouns 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 ; } ; } ; @@ -40,7 +39,7 @@ concrete SentenceMlt of Sentence = CatMlt ** open -- VP -> Imp ImpVP vp = { - s = \\pol,n => joinVParts (vp.s ! VPImperat n ! Simul ! pol) + s = \\pol,n => joinVP vp (VPImperat n) Simul pol } ; -- NP -> VPSlash -> ClSlash @@ -57,7 +56,15 @@ concrete SentenceMlt of Sentence = CatMlt ** open -- Cl -> Prep -> ClSlash -- (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 -- (whom) she says that he loves diff --git a/lib/src/maltese/StructuralMlt.gf b/lib/src/maltese/StructuralMlt.gf index db5cabce5..200813c93 100644 --- a/lib/src/maltese/StructuralMlt.gf +++ b/lib/src/maltese/StructuralMlt.gf @@ -17,7 +17,7 @@ concrete StructuralMlt of Structural = CatMlt ** i_Pron = mkPron "jien" "i" "ni" "li" singular P1 masculine ; --- also JIENA 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 we_Pron = mkPron "aħna" "na" plural P1 masculine ; youPl_Pron = mkPron "intom" "kom" plural P2 masculine ; @@ -72,25 +72,30 @@ concrete StructuralMlt of Structural = CatMlt ** above_Prep = mkPrep "fuq" ; after_Prep = mkPrep "wara" ; - before_Prep = mkPrep "qabel" ; - behind_Prep = mkPrep "wara" ; + before_Prep = mkPrep "qabel" + "qabli" "qablek" "qablu" "qabilha" "qabilna" "qabilkom" "qabilhom" ; + behind_Prep = after_Prep ; between_Prep = mkPrep "bejn" ; by8agent_Prep = mkPrep "minn" "mill-" "mit-" ; by8means_Prep = mkPrep "bi" "b'" "bil-" "bit-" "bl-" ; during_Prep = mkPrep "waqt" ; - for_Prep = mkPrep "għal" "għall-" "għat-" ; - from_Prep = mkPrep "minn" "mill-" "mit-" ; + for_Prep = mkPrep "għal" "għall-" "għall-" "għat-" "għall-" + "għalija" "għalik" "għalih" "għaliha" "għalina" "għalikom" "għalihom" + True ; + from_Prep = mkPrep "mingħand" ; in8front_Prep = mkPrep "quddiem" ; in_Prep = mkPrep "fi" "f'" "fil-" "fit-" "fl-" ; on_Prep = mkPrep "fuq" ; - part_Prep = mkPrep "ta'" "t'" "tal-" "tat-" "tal-" ; + part_Prep = possess_Prep ; 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-" ; under_Prep = mkPrep "taħt" ; without_Prep = mkPrep "mingħajr" ; with_Prep = mkPrep "ma'" "m'" "mal-" "mat-" "mal-" ; - except_Prep = mkPrep "apparti" ; + except_Prep = mkPrep "apparti" ; --- special case.. {- Noun phrase ---------------------------------------------------------- -} diff --git a/lib/src/maltese/TextMlt.gf b/lib/src/maltese/TextMlt.gf deleted file mode 100644 index d094ee571..000000000 --- a/lib/src/maltese/TextMlt.gf +++ /dev/null @@ -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 - -} - diff --git a/lib/src/maltese/VerbMlt.gf b/lib/src/maltese/VerbMlt.gf index cc900fcf0..66af5f4eb 100644 --- a/lib/src/maltese/VerbMlt.gf +++ b/lib/src/maltese/VerbMlt.gf @@ -15,6 +15,7 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in { -- V2 -> VPSlash -- love (it) SlashV2a = predVc ; + -- SlashV2a v2 = (predV v2) ** { c2 = noCompl } ; -- gets rid of the V2's prep -- V3 -> NP -> VPSlash -- give it (to her) @@ -61,17 +62,38 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in { -- 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 ! NPCPrep)) bits.pol ; - s2 = \\agr => [] ; + case of { + + -- Get enclitic version of c2 + => { + s = vp.s ; + s2 = \\agr => vp.s2 ! agr ++ vp.c2.enclitic ! np.a ; + dir = NullVariants3 ; + ind = NullVariants3 ; } ; + -- Join pron to verb + => { + s = vp.s ; + s2 = \\agr => [] ; + dir = mkMaybeVariants3 (np.s ! NPCPrep) ; --- we'll need to get all the variants direct from the NP + ind = NullVariants3 ; + } ; + + -- => { + -- s = vp.s ; + -- s2 = \\agr => vp.c2.enclitic ! agr ; + -- dir = NullVariants3 ; + -- ind = NullVariants3 ; + -- } ; + -- 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 of { + => vp.c2.s ! Definite ++ np.s ! NPCPrep ; -- mal-qattus + => vp.c2.s ! Indefinite ++ np.s ! NPNom ; -- ma' qattus + _ => np.s ! NPNom -- il-qattus + }) vp } ; -- VV -> VPSlash -> VPSlash @@ -89,11 +111,14 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in { -- Comp -> VP -- be warm - UseComp comp = insertObj comp.s (predV copula_kien) ; + UseComp comp = insertObj comp.s CopulaVP ; -- VP -> Adv -> VP -- 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 -- always sleep @@ -101,7 +126,31 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in { -- VPSlash -> Adv -> VPSlash -- 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 -- always use (it) @@ -113,24 +162,24 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in { -- V2 -> VP -- 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 -- (be) small CompAP ap = { - s = \\agr => ap.s ! toGenNum agr + s = \\agr => ap.s ! toGenNum agr ; } ; -- NP -> Comp -- (be) the man CompNP np = { - s = \\_ => np.s ! NPAcc + s = \\_ => np.s ! NPAcc ; } ; -- Adv -> Comp -- (be) here CompAdv adv = { - s = \\_ => adv.s + s = \\_ => adv.s ; } ; -- CN -> Comp @@ -139,17 +188,24 @@ concrete VerbMlt of Verb = CatMlt ** open Prelude, ResMlt in { s = \\agr => case agr.n of { Sg => artIndef ++ cn.s ! Singulative ; Pl => cn.s ! Plural - } + } ; } ; -- VP -- be - UseCopula = predV copula_kien ; + UseCopula = CopulaVP ; -- VP -> Prep -> VPSlash -- live in (it) 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 ; + } ; } ; }