From dadcd386c99d6e52a5621a4b5dbbc994ebf88ee3 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 5 Dec 2018 19:16:35 +0200 Subject: [PATCH] (Romance) Attributive and predicative adjective forms (#93) * (Fre,Por) accomodate changes to Romance adjectives - to support Spanish buen/bueno, gran/grande and catalan bo/bon * (Cat) Update paradigms to allow predicative and attributive forms of adj * (Spa) fix argument order in Spanish adjective paradigms * (Eng) fix missing paradigm invarA * (Spa) Flip order of args in mkAdj constructor --- src/catalan/DocumentationCatFunctor.gf | 54 ++++++------- src/catalan/LexiconCat.gf | 50 ++++++------ src/catalan/MorphoCat.gf | 22 +++--- src/catalan/ParadigmsCat.gf | 91 ++++++++++++---------- src/french/DocumentationFreFunctor.gf | 4 +- src/french/LexiconFre.gf | 6 +- src/french/MorphoFre.gf | 17 +++-- src/french/ParadigmsFre.gf | 12 ++- src/italian/DocumentationItaFunctor.gf | 54 ++++++------- src/italian/MakeStructuralIta.gf | 2 +- src/italian/MorphoIta.gf | 12 +-- src/portuguese/DocumentationPorFunctor.gf | 4 +- src/portuguese/ExtendPor.gf | 12 ++- src/portuguese/MorphoPor.gf | 13 ++-- src/portuguese/ParadigmsPor.gf | 2 +- src/romance/AdjectiveRomance.gf | 17 ++--- src/romance/CatRomance.gf | 4 +- src/romance/CommonRomance.gf | 42 ++++++++-- src/romance/NounRomance.gf | 10 +-- src/romance/PhraseRomance.gf | 4 +- src/romance/VerbRomance.gf | 73 +++++++++--------- src/spanish/DocumentationSpaFunctor.gf | 54 ++++++------- src/spanish/MorphoSpa.gf | 46 +++++++---- src/spanish/ParadigmsSpa.gf | 93 ++++++++++++----------- src/spanish/ParseSpa.gf | 35 ++++----- 25 files changed, 401 insertions(+), 332 deletions(-) diff --git a/src/catalan/DocumentationCatFunctor.gf b/src/catalan/DocumentationCatFunctor.gf index cd08241fd..74e0e3f11 100644 --- a/src/catalan/DocumentationCatFunctor.gf +++ b/src/catalan/DocumentationCatFunctor.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common -incomplete concrete DocumentationCatFunctor of Documentation = CatCat ** open +incomplete concrete DocumentationCatFunctor of Documentation = CatCat ** open Terminology, -- the interface to be instantiated ResCat, CommonRomance, @@ -19,22 +19,22 @@ lincat Definition = {s : Str} ; Document = {s : Str} ; Tag = {s : Str} ; - + {- -} --# notpresent oper heading : N -> Str = \n -> (nounHeading n).s ; - + lin InflectionN, InflectionN3, InflectionN3 = \noun -> { t = "n" ; - s1 = heading1 (heading noun_Category ++ + s1 = heading1 (heading noun_Category ++ case noun.g of { - Masc => "("+heading masculine_Parameter+")" ; + Masc => "("+heading masculine_Parameter+")" ; Fem => "("+heading feminine_Parameter+")" }) ; - s2 = frameTable ( + s2 = frameTable ( tr (th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ tr (td (noun.s ! Sg) ++ td (noun.s ! Pl)) ) @@ -45,8 +45,8 @@ lin s1 = heading1 (nounHeading adjective_Category).s ; s2 = frameTable ( tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ - tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (AF Masc Sg)) ++ td (adj.s ! Posit ! (AF Masc Pl))) ++ - tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (AF Fem Sg)) ++ td (adj.s ! Posit ! (AF Fem Pl))) + tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (genNum2Aform Masc Sg)) ++ td (adj.s ! Posit ! (genNum2Aform Masc Pl))) ++ + tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (genNum2Aform Fem Sg)) ++ td (adj.s ! Posit ! (genNum2Aform Fem Pl))) ) } ; @@ -141,23 +141,23 @@ lin MkDocument d i e = ss (i.s1 ++ d.s ++ i.s2 ++ paragraph e.s) ; -- explanation appended in a new paragraph MkTag i = ss i.t ; -oper +oper verbExample : CatCat.Cl -> Str = \cl -> - (S.mkUtt cl).s + (S.mkUtt cl).s ++ ";" ++ (S.mkUtt (S.mkS S.anteriorAnt cl)).s --# notpresent ; - inflVerb : Verb -> Str = \verb -> - let + inflVerb : Verb -> Str = \verb -> + let vfin : CommonRomance.VF -> Str = \f -> - verb.s ! f ; + verb.s ! f ; ttable : TMood -> Str = \tense -> frameTable ( - tr (th "" ++ - th (heading singular_Parameter) ++ - th (heading plural_Parameter)) ++ - tr (th "1.p" ++ + tr (th "" ++ + th (heading singular_Parameter) ++ + th (heading plural_Parameter)) ++ + tr (th "1.p" ++ td (vfin (VFin tense Sg P1)) ++ td (vfin (VFin tense Pl P1))) ++ tr (th "2.p" ++ @@ -170,11 +170,11 @@ oper ttable2 : (Mood -> TMood) -> Str = \f -> frameTable ( - tr (intagAttr "th" "colspan=2" "" ++ - th (heading indicative_Parameter) ++ - th (heading conjunctive_Parameter)) ++ + tr (intagAttr "th" "colspan=2" "" ++ + th (heading indicative_Parameter) ++ + th (heading conjunctive_Parameter)) ++ tr (intagAttr "th" "rowspan=3" (heading singular_Parameter) ++ - th "1.p" ++ + th "1.p" ++ td (vfin (VFin (f Indic) Sg P1)) ++ td (vfin (VFin (f Conjunct) Sg P1))) ++ tr (th "2.p" ++ @@ -182,7 +182,7 @@ oper td (vfin (VFin (f Conjunct) Sg P2))) ++ tr (th "3.p" ++ td (vfin (VFin (f Indic) Sg P3)) ++ - td (vfin (VFin (f Conjunct) Sg P3))) ++ + td (vfin (VFin (f Conjunct) Sg P3))) ++ tr (intagAttr "th" "rowspan=3" (heading plural_Parameter) ++ th "1.p" ++ td (vfin (VFin (f Indic) Pl P1)) ++ @@ -190,7 +190,7 @@ oper tr (th "2.p" ++ td (vfin (VFin (f Indic) Pl P2)) ++ td (vfin (VFin (f Conjunct) Pl P2))) ++ - tr (th "3.p" ++ + tr (th "3.p" ++ td (vfin (VFin (f Indic) Pl P3)) ++ td (vfin (VFin (f Conjunct) Pl P3))) ) ; @@ -209,17 +209,17 @@ oper paragraph (vfin (VInfin False)) ++ heading2 (heading imperative_Parameter) ++ frameTable ( - tr (th "sg.2.p" ++ td (vfin (VImper SgP2))) ++ - tr (th "pl.1.p" ++ td (vfin (VImper PlP1))) ++ + tr (th "sg.2.p" ++ td (vfin (VImper SgP2))) ++ + tr (th "pl.1.p" ++ td (vfin (VImper PlP1))) ++ tr (th "pl.2.p" ++ td (vfin (VImper PlP2))) ) ++ heading2 (heading participle_Parameter) ++ frameTable ( tr (th (heading past_Parameter) ++ td (vfin (VPart Masc Sg))) ++ tr (th (heading present_Parameter) ++ td (vfin VGer)) - ) ; + ) ; {- --# notpresent --} +-} } diff --git a/src/catalan/LexiconCat.gf b/src/catalan/LexiconCat.gf index b1a14fc16..81efb50d6 100644 --- a/src/catalan/LexiconCat.gf +++ b/src/catalan/LexiconCat.gf @@ -1,25 +1,25 @@ --# -path=.:../romance:../common:../abstract:../../prelude -concrete LexiconCat of Lexicon = CatCat ** open +concrete LexiconCat of Lexicon = CatCat ** open (M=MorphoCat), ParadigmsCat, BeschCat in { -flags +flags coding=utf8 ; optimize=values ; oper regFN : Str -> N = \s -> femN (regN s) ; - regMN : Str -> N = \s -> regN s ; + regMN : Str -> N = \s -> regN s ; irregMN : Str -> Str -> N = \pa,pans -> M.mkNounIrreg pa pans masculine ** {lock_N=<>} ; saberV : V = verbV (saber_99 "saber") ; lin - airplane_N = regMN "avió" ; + airplane_N = regMN "avió" ; answer_V2S = mkV2S (verbV (compondre_26 "respondre")) dative ; apartment_N = regMN "pis" ; apple_N = regFN "poma" ; - art_N = regMN "art" ; + art_N = regMN "art" ; ask_V2Q = mkV2Q (mkV "preguntar") dative ; baby_N = regMN "nadó" ; bad_A = mkADeg (regA "dolent") (regA "pitjor") ; @@ -28,10 +28,10 @@ lin become_VA = reflV (mkV "tornar") ; -- esdevenir beer_N = regFN "cervesa" ; beg_V2V = mkV2V (mkV "demanar") accusative dative ; - big_A = regADeg "gros" ; + big_A = mkA "gros" "grossa" ; bike_N = regFN "bicicleta" ; bird_N = regMN "ocell" ; - black_A = compADeg (mkA "negre" "negra" "negres" "negres" "negrament") ; + black_A = compADeg (mkA "negre" "negra" "negres" "negres" "negrament") ; blue_A = compADeg (mkA "blau" "blava" "blaus" "blaves" "blavament") ; boat_N = regFN "barca" ; book_N = regMN "llibre" ; @@ -55,15 +55,15 @@ lin cheese_N = regMN "formatge" ; child_N = regMN "nen" ; -- nena church_N = regFN "església" ; - city_N = regFN "ciutat" ; + city_N = regFN "ciutat" ; clean_A = regADeg "net" ; clever_A = regADeg "inteligent" ; close_V2 = dirV2 (verbV (trencar_112 "tancar")) ; coat_N = regMN "abric" ; cold_A = regADeg "fred" ; come_V = verbV (venir_117 "venir") ; - computer_N = regMN "ordinador" ; - country_N = mkN "país" "països" masculine ; + computer_N = regMN "ordinador" ; + country_N = mkN "país" "països" masculine ; cousin_N = regMN "cosí" ; cow_N = mkN "vaca" ; die_V = verbV (morir_71 "morir") ; @@ -92,7 +92,7 @@ lin girl_N = regFN "noia" ; glove_N = regMN "guant" ; gold_N = regMN "or" ; - good_A = prefA (mkADeg (mkA "bo" "bona") (mkA "millor")) ; + good_A = mkA (prefA "bo" "bon") (mkA "millor") ; go_V = (verbV (anar_4 "anar")) ; green_A = regADeg "verd" ; harbour_N = regMN "port" ; @@ -107,7 +107,7 @@ lin important_A = regADeg "important" ; industry_N = regFN "indústria" ; iron_N = regMN "ferro" ; - king_N = regMN "rei" ; + king_N = regMN "rei" ; know_V2 = dirV2 saberV ; know_VQ = mkVQ saberV; know_VS = mkVS saberV; @@ -133,7 +133,7 @@ lin music_N = regFN "música" ; narrow_A = regADeg "estret" ; new_A = prefixA (compADeg (mkA "nou" "nova" "nous" "noves" "novament")) ; - newspaper_N = regMN "diari" ; -- periòdic + newspaper_N = regMN "diari" ; -- periòdic oil_N = regMN "oli" ; old_A = regADeg "vell" ; open_V2 = dirV2 (verbV (obrir_77 "obrir")) ; @@ -147,14 +147,14 @@ lin play_V2 = dirV2 (verbV (pregar_86 "jugar")) ; policeman_N = regMN "policia" ; -- fem refers to the institution priest_N = regMN "capellà" ; -- masc - probable_AS = mkAS (regA "probable") ; + probable_AS = mkAS (regA "probable") ; queen_N = regN "reina" ; radio_N = regFN "ràdio" ; rain_V0 = mkV0 (verbV (moure_72 "ploure")) ; read_V2 = dirV2 (verbV (servir_101 "llegir")) ; red_A = regADeg "vermell" ; religion_N = mkN "religió" "religions" feminine ; - restaurant_N = regMN "restaurant" ; + restaurant_N = regMN "restaurant" ; river_N = regMN "riu" ; rock_N = regFN "roca" ; roof_N = regFN "teulada" ; @@ -163,7 +163,7 @@ lin say_VS = mkVS (verbV (dir_41 "dir")) ; school_N = regFN "escola" ; science_N = regFN "ciència" ; - sea_N = regMN "mar" ; -- masc & fem + sea_N = regMN "mar" ; -- masc & fem seek_V2 = dirV2 (verbV (trencar_112 "buscar")) ; see_V2 = dirV2 (verbV (veure_118 "veure")) ; sell_V3 = dirV3 (verbV (vendre_116 "vendre")) dative ; @@ -184,13 +184,13 @@ lin star_N = regFN "estrella" ; steel_N = regMN "acer" ; stone_N = regFN "pedra" ; - stove_N = regMN "forn" ; + stove_N = regMN "forn" ; student_N = regN "estudiant" ; -- used both for fem & masc stupid_A = regADeg "estúpid" ; - sun_N = regMN "sol" ; + sun_N = regMN "sol" ; switch8off_V2 = dirV2 (verbV (pregar_86 "apagar")) ; switch8on_V2 = dirV2 (verbV (atendre_8 "encendre")) ; - table_N = regFN "taula" ; + table_N = regFN "taula" ; talk_V3 = mkV3 (mkV "parlar") dative genitive ; teacher_N = regMN "mestre" ; -- mestra teach_V2 = dirV2 (mkV "ensenyar") ; @@ -228,7 +228,7 @@ lin add_V3 = dirV3 (mkV "afegir") dative ; -- also: (mkV "sumar") number_N = regMN "número" ; put_V2 = dirV2 (mkV "posar") ; - stop_V = mkV "aturar" ; + stop_V = mkV "aturar" ; jump_V = mkV "saltar" ; left_Ord = M.mkOrd (regA "esquerra") ; right_Ord = M.mkOrd (regA "dreta") ; @@ -269,7 +269,7 @@ lin fog_N = regFN "boira" ; foot_N = regMN "peu" ; forest_N = regMN "bosc" ; - grass_N = regFN "herba" ; + grass_N = regFN "herba" ; guts_N = regMN "budell" ; hair_N = regMN "cabell" ; hand_N = regFN "mà" ; @@ -290,7 +290,7 @@ lin nose_N = regMN "nas" ; person_N = regFN "persona" ; rain_N = regFN "pluja" ; -- pluges - road_N = regMN "carrer" ; + road_N = regMN "carrer" ; root_N = regFN "arrel" ; rope_N = regN "corda" ; salt_N = regFN "sal" ; @@ -300,14 +300,14 @@ lin sky_N = regMN "cel" ; smoke_N = regMN "fum" ; snow_N = regFN "neu" ; -- fem - stick_N = regMN "bastó" ; + stick_N = regMN "bastó" ; tail_N = regFN "cua" ; tongue_N = mkN "llengua" ; -- llengües tooth_N = regFN "dent" ; wife_N = regFN "esposa" ; wind_N = regMN "vent" ; wing_N = regFN "ala" ; - worm_N = regMN "cuc" ; + worm_N = regMN "cuc" ; year_N = regMN "any" ; bite_V2 = dirV2 (verbV (pregar_86 "mossegar")) ; blow_V = mkV "bufar" ; @@ -327,7 +327,7 @@ lin hold_V2 = dirV2 (verbV (obtenir_78 "sostenir")) ; hunt_V2 = dirV2 (verbV (començar_22 "caçar")) ; kill_V2 = dirV2 (mkV "matar") ; - laugh_V = verbV (riure_96 "riure") ; + laugh_V = verbV (riure_96 "riure") ; lie_V = reflV (verbV (jeure_62 "jeure")) ; play_V = verbV (pregar_86 "jugar") ; pull_V2 = dirV2 (mkV "tibar") ; diff --git a/src/catalan/MorphoCat.gf b/src/catalan/MorphoCat.gf index 906ebed15..13ce7fbf5 100644 --- a/src/catalan/MorphoCat.gf +++ b/src/catalan/MorphoCat.gf @@ -94,14 +94,19 @@ oper -- Here are some patterns. First one that describes the worst case. -- gcc M2.1 - mkAdj : (_,_,_,_,_ : Str) -> Adj = \prim,prima,prims,primes,primament -> + mkAdjFull : (x1,_,_,_,_,x6 : Str) -> Adj = \bon,bo,prima,prims,primes,primament -> {s = table { - AF Masc n => numForms prim prims ! n ; - AF Fem n => numForms prima primes ! n ; - AA => primament + ASg Masc AAttr => bon ; + ASg Masc APred => bo ; + ASg Fem _ => prima ; + APl Masc => prims ; + APl Fem => primes ; + AA => primament } } ; + mkAdj : (x1,_,_,_,x5 : Str) -> Adj = \a,b,c,d,e -> mkAdjFull a a b c d e ; + --- Then the regular and invariant patterns. adjPrim : Str -> Adj = \prim -> @@ -116,16 +121,15 @@ oper let fond = Predef.tk 1 fondo in adjBlau fondo (fond + "a") ; - adjBo : Str -> Adj = \bo -> - mkAdj bo (bo + "na") (bo + "ns") (bo + "nes") (bo + "nament") ; + adjBo : (bo,bon : Str) -> Adj = \bo,bon -> + mkAdjFull bon bo (bon + "a") (bon + "s") (bon + "es") (bon + "ament") ; adjFidel : Str -> Adj = \fidel -> let fidels : Str = case (last fidel) of { _ + ("s"|"ç"|"x") => fidel + "os" ; --feliç; capaç _ => fidel + "s" } ; - in mkAdj fidel fidel fidels fidels - (fidel + "ment") ; + in mkAdj fidel fidel fidels fidels (fidel + "ment") ; --boig, boja, bojos, boges --lleig, lletja, lletjos, lletges @@ -300,6 +304,6 @@ oper unaccent : Str -> Str = \vocal -> -- Determiners, traditionally called indefinite pronouns, are inflected -- in gender and number, like adjectives. - pronForms : Adj -> Gender -> Number -> Str = \tal,g,n -> tal.s ! AF g n ; + pronForms : Adj -> Gender -> Number -> Str = \tal,g,n -> tal.s ! genNum2Aform g n ; } diff --git a/src/catalan/ParadigmsCat.gf b/src/catalan/ParadigmsCat.gf index b4947813b..63f13096c 100644 --- a/src/catalan/ParadigmsCat.gf +++ b/src/catalan/ParadigmsCat.gf @@ -5,12 +5,12 @@ -- Aarne Ranta 2004 - 2006 -- Jordi Saludes 2008: Modified from ParadigmsSpa -- --- This is an API for the user of the resource grammar +-- This is an API for the user of the resource grammar -- for adding lexical items. It gives functions for forming -- expressions of open categories: nouns, adjectives, verbs. --- +-- -- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API, $Structural.gf$. +-- accessed through the resource syntax API, $Structural.gf$. -- -- The main difference with $MorphoCat.gf$ is that the types -- referred to are compiled resource grammar types. We have moreover @@ -24,11 +24,11 @@ -- verbs, there is a fairly complete list of irregular verbs in -- [``IrregCat`` ../../catalan/IrregCat.gf]. -resource ParadigmsCat = - open - (Predef=Predef), - Prelude, - MorphoCat, +resource ParadigmsCat = + open + (Predef=Predef), + Prelude, + MorphoCat, BeschCat, CatCat in { @@ -36,19 +36,19 @@ flags optimize=all ; coding = utf8 ; ---2 Parameters +--2 Parameters -- -- To abstract over gender names, we define the following identifiers. oper - Gender : Type ; + Gender : Type ; masculine : Gender ; feminine : Gender ; -- To abstract over number names, we define the following. - Number : Type ; + Number : Type ; singular : Number ; plural : Number ; @@ -70,7 +70,7 @@ oper mkN : overload { -- The regular function takes the singular form and the gender, --- and computes the plural and the gender by a heuristic. +-- and computes the plural and the gender by a heuristic. -- The heuristic says that the gender is feminine for nouns -- ending with "a" or "z", and masculine for all other words. -- Nouns ending with "a", "o", "e" have the plural with "s", @@ -89,23 +89,23 @@ oper } ; ---3 Compound nouns +--3 Compound nouns -- -- Some nouns are ones where the first part is inflected as a noun but --- the second part is not inflected. e.g. "número de telèfon". +-- the second part is not inflected. e.g. "número de telèfon". -- They could be formed in syntax, but we give a shortcut here since -- they are frequent in lexica. compN : N -> Str -> N ; -- compound, e.g. "número" + "de telèfon" ---3 Relational nouns --- --- Relational nouns ("filla de x") need a case and a preposition. +--3 Relational nouns +-- +-- Relational nouns ("filla de x") need a case and a preposition. mkN2 : N -> Prep -> N2 ; -- e.g. filla + genitive --- The most common cases are the genitive "de" and the dative "a", +-- The most common cases are the genitive "de" and the dative "a", -- with the empty preposition. deN2 : N -> N2 ; -- relation with genitive @@ -123,11 +123,11 @@ oper -- $N3$ are purely lexical categories. But you can use the $AdvCN$ -- and $PrepNP$ constructions to build phrases like this. --- +-- --3 Proper names and noun phrases -- -- Proper names need a string and a gender. --- The default gender is feminine for names ending with "a", otherwise masculine. TODO +-- The default gender is feminine for names ending with "a", otherwise masculine. TODO mkPN : overload { mkPN : (Anna : Str) -> PN ; -- feminine for "-a", otherwise masculine @@ -151,8 +151,8 @@ oper mkA : (fort,forta,forts,fortes,fortament : Str) -> A ; -- worst case --- In the worst case, two separate adjectives are given: --- the positive ("bo"), and the comparative ("millor"). +-- In the worst case, two separate adjectives are given: +-- the positive ("bo"), and the comparative ("millor"). mkA : (bo : A) -> (millor : A) -> A -- special comparison (default with "mas") } ; @@ -177,7 +177,7 @@ oper --2 Adverbs -- Adverbs are not inflected. Most lexical ones have position --- after the verb. +-- after the verb. mkAdv : Str -> Adv ; @@ -200,11 +200,11 @@ oper mkV : (cantar : Str) -> V ; -- regular in models I, IIa, IIb --- Verbs with predictable alternation: +-- Verbs with predictable alternation: -- a) inchoative verbs, servir serveixo -- b) re verbs with c/g in root, vendre venc ; subj. vengui - mkV : (servir,serveixo : Str) -> V ; --inchoative verbs and "re" verbs whose 1st person ends in c + mkV : (servir,serveixo : Str) -> V ; --inchoative verbs and "re" verbs whose 1st person ends in c -- Most irregular verbs are found in $IrregCat$. If this is not enough, -- the module $BeschCat$ gives all the patterns of the "Bescherelle" @@ -229,7 +229,7 @@ oper --3 Two-place verbs -- -- Two-place verbs need a preposition, except the special case with direct object. --- (transitive verbs). +-- (transitive verbs). mkV2 : overload { mkV2 : Str -> V2 ; -- regular verb, direct object @@ -274,9 +274,9 @@ oper mkAV : A -> Prep -> AV ; --% mkA2V : A -> Prep -> Prep -> A2V ; --% --- Notice: categories $AS, A2S, AV, A2V$ are just $A$, +-- Notice: categories $AS, A2S, AV, A2V$ are just $A$, -- and the second argument is given --- as an adverb. Likewise +-- as an adverb. Likewise -- $V0$ is just $V$. V0 : Type ; --% @@ -289,7 +289,7 @@ oper -- The definitions should not bother the user of the API. So they are -- hidden from the document. - Gender = MorphoCat.Gender ; + Gender = MorphoCat.Gender ; Number = MorphoCat.Number ; masculine = Masc ; feminine = Fem ; @@ -323,19 +323,23 @@ oper makeNP x g n = {s = (pn2np (mk2PN x g)).s; a = agrP3 g n ; hasClit = False ; isPol = False ; isNeg = False} ** {lock_NP = <>} ; - mk5A a b c d e = + mk5A a b c d e = compADeg {s = \\_ => (mkAdj a b c d e).s ; isPre = False ; lock_A = <>} ; mk2A a b = compADeg {s = \\_ => (mkAdj2Reg a b).s ; isPre = False ; lock_A = <>} ; regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ; lock_A = <>} ; - prefA a = {s = a.s ; isPre = True ; lock_A = <>} ; + prefA = overload { + prefA : A -> A = \a -> a ** {isPre = True} ; + prefA : Str -> Str -> A = \bo,bon -> + compADeg (lin A {s = \\_ => (adjBo bo bon).s ; isPre = True}) ; + } ; mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ; - mkADeg a b = - {s = table {Posit => a.s ! Posit ; _ => b.s ! Posit} ; + mkADeg a b = + {s = table {Posit => a.s ! Posit ; _ => b.s ! Posit} ; isPre = a.isPre ; lock_A = <>} ; - compADeg a = - {s = table {Posit => a.s ! Posit ; _ => \\f => "més" ++ a.s ! Posit ! f} ; + compADeg a = + {s = table {Posit => a.s ! Posit ; _ => \\f => "més" ++ a.s ! Posit ! f} ; isPre = a.isPre ; lock_A = <>} ; regADeg a = compADeg (regA a) ; @@ -356,7 +360,7 @@ oper _ + "re" => perdre_83 x ; _ + "er" => verbEr x ; --handles accents in infinitives and c/ç, g/j - _ + "ir" => dormir_44 x ; --inchoative verbs with regAltV + _ + "ir" => dormir_44 x ; --inchoative verbs with regAltV _ + "ur" => dur_45 x ; _ => cantar_15 x } ; @@ -384,10 +388,10 @@ oper mk3V x y z = let ure = Predef.dp 3 x ; venc = Predef.dp 4 y ; - gut = Predef.dp 3 z + gut = Predef.dp 3 z in case of { <_+"re",_,"gut"> => regAltV x y ; --default participle of type dolgut - + --if these are overfitting, just comment out. --still doesn't catch creure, seure; mk4V with creiem as 4th arg? <"ure",_, "uit"> => coure_32 x ; --coure coem cuit @@ -425,7 +429,7 @@ oper special_ppV ve pa = { s = table { - VPart g n => (regA pa).s ! Posit ! AF g n ; + VPart g n => (regA pa).s ! Posit ! genNum2Aform g n ; p => ve.s ! p } ; lock_V = <> ; @@ -489,7 +493,7 @@ oper -- To form a noun phrase that can also be plural, -- you can use the worst-case function. - makeNP : Str -> Gender -> Number -> NP ; + makeNP : Str -> Gender -> Number -> NP ; mkA = overload { mkA : (util : Str) -> A = regA ; @@ -504,7 +508,10 @@ oper mkADeg : A -> A -> A ; compADeg : A -> A ; regADeg : Str -> A ; - prefA : A -> A ; + prefA : overload { + prefA : A -> A ; -- gran + prefA : (bo,bon : Str) -> A -- predicative masc, attributive masc + } ; prefixA = prefA ; mkV = overload { @@ -521,7 +528,7 @@ oper mkV2 = overload { mkV2 : Str -> V2 = \s -> dirV2 (mkV s) ; - mkV2 : V -> V2 = dirV2 ; + mkV2 : V -> V2 = dirV2 ; mkV2 : V -> Prep -> V2 = mk2V2 } ; mk2V2 : V -> Prep -> V2 ; diff --git a/src/french/DocumentationFreFunctor.gf b/src/french/DocumentationFreFunctor.gf index b48eff57e..5ea92921a 100644 --- a/src/french/DocumentationFreFunctor.gf +++ b/src/french/DocumentationFreFunctor.gf @@ -45,8 +45,8 @@ lin s1 = heading1 (nounHeading adjective_Category).s ; s2 = frameTable ( tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ - tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (AF Masc Sg)) ++ td (adj.s ! Posit ! (AF Masc Pl))) ++ - tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (AF Fem Sg)) ++ td (adj.s ! Posit ! (AF Fem Pl))) + tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (genNum2Aform Masc Sg)) ++ td (adj.s ! Posit ! (genNum2Aform Masc Pl))) ++ + tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (genNum2Aform Fem Sg)) ++ td (adj.s ! Posit ! (genNum2Aform Fem Pl))) ) } ; diff --git a/src/french/LexiconFre.gf b/src/french/LexiconFre.gf index 42b916840..0203a9fa5 100644 --- a/src/french/LexiconFre.gf +++ b/src/french/LexiconFre.gf @@ -18,7 +18,7 @@ lin bad_A = prefA (mkADeg (regA "mauvais") (regA "pire")) ; bank_N = regGenN "banque" feminine ; beautiful_A = - prefA (compADeg (mkA (pre {voyelle => "bel" ; _ => "beau" }) "belle" "beaux" "bellement")) ; + prefA (compADeg (mkA "beau" "bel" "beaux" "belle" "bellement")) ; become_VA = mkVA devenir_V ; beer_N = regGenN "bière" feminine ; beg_V2V = mkV2V (regV "demander") accusative dative ; @@ -129,11 +129,11 @@ lin music_N = regGenN "musique" feminine ; narrow_A = regA "étroit" ; new_A = - prefA (compADeg (mkA (pre {voyelle => "nouvel" ; _ => "nouveau" }) "nouvelle" "nouveaux" "nouvellement")) ; + prefA (compADeg (mkA "nouveau" "nouvel" "nouveaux" "nouvelle" "nouvellement")) ; newspaper_N = regGenN "journal" masculine ; oil_N = regGenN "huile" feminine ; old_A = - prefA (compADeg (mkA (pre {voyelle => "vieil" ; _ => "vieux" }) "vieille" "vieux" "vieillement")) ; + prefA (compADeg (mkA "vieux" "vieil" "vieux" "vieille" "vieillement")) ; open_V2 = ouvrir_V2 ; paint_V2A = mkV2A (v2V peindre_V2) accusative (mkPrep "en") ; paper_N = regGenN "papier" masculine ; diff --git a/src/french/MorphoFre.gf b/src/french/MorphoFre.gf index 42fdb7a23..87d6c3ef9 100644 --- a/src/french/MorphoFre.gf +++ b/src/french/MorphoFre.gf @@ -72,14 +72,19 @@ oper -- Adjectives are conveniently seen as gender-dependent nouns. -- Here are some patterns. First one that describes the worst case. - mkAdj : (_,_,_,_ : Str) -> Adj = \vieux,vieuxs,vieille,vieillement -> - {s = table { - AF Masc n => numForms vieux vieuxs ! n ; - AF Fem n => nomReg vieille ! n ; - AA => vieillement - } + mkAdj' : (_,_,_,_,_ : Str) -> Adj ; + mkAdj' vieux vieil vieuxs vieille vieillement = { + s = table { + ASg Masc _ => pre {#voyelle => vieil ; "h" => vieil ; _ => vieux} ; + ASg Fem _ => vieille ; + APl g => genForms vieuxs (vieille + "s") ! g ; + AA => vieillement + } } ; + mkAdj : (_,_,_,_ : Str) -> Adj ; + mkAdj bleu bleus bleue bleuement = mkAdj' bleu bleu bleus bleue bleuement ; + -- Then the regular and invariant patterns. adjReg : Str -> Gender => Number => Str = \bu -> table { diff --git a/src/french/ParadigmsFre.gf b/src/french/ParadigmsFre.gf index 97dea8761..551425d61 100644 --- a/src/french/ParadigmsFre.gf +++ b/src/french/ParadigmsFre.gf @@ -160,9 +160,12 @@ oper mkA : (banal,banale,banaux : Str) -> A ; --- This is the worst-case paradigm for the positive forms. +-- This is the worst-case paradigm for the positive forms, except for "vieux/vieil". - mkA : (banal,banale,banaux,banalement : Str) -> A ; -- worst-case adjective + mkA : (banal,banale,banaux,banalement : Str) -> A ; -- almost worst-case adjective + +-- This is the worst-case paradigm for the positive forms, used for "vieux/vieil". + mkA : (vieux,vieil,vieille,vieuxs,vieuxment : Str) -> A ; -- worst-case adjetive -- If comparison forms are irregular (i.e. not formed by "plus", e.g. -- "bon-meilleur"), the positive and comparative can be given as separate @@ -387,7 +390,8 @@ oper mkPN : N -> PN = \x -> lin PN {s = x.s ! Sg ; g = x.g} ; } ; - mk4A a b c d = compADeg {s = \\_ => (mkAdj a c b d).s ; isPre = False ; lock_A = <>} ; + mk4A a b c d = mk5A a a b c d ; + mk5A a b c d e = compADeg {s = \\_ => (mkAdj' a b c d e).s ; isPre = False ; lock_A = <>} ; regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ; lock_A = <>} ; prefA a = {s = a.s ; isPre = True ; lock_A = <>} ; @@ -398,6 +402,7 @@ oper mkA : (sec,seche : Str) -> A = \sec,seche -> mk4A sec seche (sec + "s") (seche + "ment") ; mkA : (banal,banale,banaux : Str) -> A = \sec,seche,secs -> mk4A sec seche secs (seche + "ment") ; mkA : (banal,banale,banaux,banalement : Str) -> A = mk4A ; + mkA : (vieux,vieil,vieille,vieuxs,vieuxment : Str) -> A = mk5A ; mkA : A -> A -> A = mkADeg }; @@ -471,6 +476,7 @@ oper regA : Str -> A ; mk4A : (banal,banale,banaux,banalement : Str) -> A ; + mk5A : (vieux,vieil,vieille,vieuxs,vieuxment : Str) -> A ; -- worst-case adjetive prefA : A -> A ; diff --git a/src/italian/DocumentationItaFunctor.gf b/src/italian/DocumentationItaFunctor.gf index 9bf75a0f1..e36d281fc 100644 --- a/src/italian/DocumentationItaFunctor.gf +++ b/src/italian/DocumentationItaFunctor.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common -incomplete concrete DocumentationItaFunctor of Documentation = CatIta ** open +incomplete concrete DocumentationItaFunctor of Documentation = CatIta ** open Terminology, -- the interface to be instantiated ResIta, CommonRomance, @@ -19,22 +19,22 @@ lincat Definition = {s : Str} ; Document = {s : Str} ; Tag = {s : Str} ; - + {- -} --# notpresent oper heading : N -> Str = \n -> (nounHeading n).s ; - + lin InflectionN, InflectionN3, InflectionN3 = \noun -> { t = "n" ; - s1 = heading1 (heading noun_Category ++ + s1 = heading1 (heading noun_Category ++ case noun.g of { - Masc => "("+heading masculine_Parameter+")" ; + Masc => "("+heading masculine_Parameter+")" ; Fem => "("+heading feminine_Parameter+")" }) ; - s2 = frameTable ( + s2 = frameTable ( tr (th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ tr (td (noun.s ! Sg) ++ td (noun.s ! Pl)) ) @@ -45,8 +45,8 @@ lin s1 = heading1 (nounHeading adjective_Category).s ; s2 = frameTable ( tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ - tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (AF Masc Sg)) ++ td (adj.s ! Posit ! (AF Masc Pl))) ++ - tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (AF Fem Sg)) ++ td (adj.s ! Posit ! (AF Fem Pl))) + tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (genNum2Aform Masc Sg)) ++ td (adj.s ! Posit ! (genNum2Aform Masc Pl))) ++ + tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (genNum2Aform Fem Sg)) ++ td (adj.s ! Posit ! (genNum2Aform Fem Pl))) ) } ; @@ -142,23 +142,23 @@ lin MkDocument d i e = ss (i.s1 ++ d.s ++ i.s2 ++ paragraph e.s) ; -- explanation appended in a new paragraph MkTag i = ss i.t ; -oper +oper verbExample : CatIta.Cl -> Str = \cl -> - (S.mkUtt cl).s + (S.mkUtt cl).s ++ ";" ++ (S.mkUtt (S.mkS S.anteriorAnt cl)).s --# notpresent ; - inflVerb : Verb -> Str = \verb -> - let + inflVerb : Verb -> Str = \verb -> + let vfin : CommonRomance.VF -> Str = \f -> - verb.s ! f ; + verb.s ! f ; ttable : TMood -> Str = \tense -> frameTable ( - tr (th "" ++ - th (heading singular_Parameter) ++ - th (heading plural_Parameter)) ++ - tr (th "1.p" ++ + tr (th "" ++ + th (heading singular_Parameter) ++ + th (heading plural_Parameter)) ++ + tr (th "1.p" ++ td (vfin (VFin tense Sg P1)) ++ td (vfin (VFin tense Pl P1))) ++ tr (th "2.p" ++ @@ -171,11 +171,11 @@ oper ttable2 : (Mood -> TMood) -> Str = \f -> frameTable ( - tr (intagAttr "th" "colspan=2" "" ++ - th (heading indicative_Parameter) ++ - th (heading conjunctive_Parameter)) ++ + tr (intagAttr "th" "colspan=2" "" ++ + th (heading indicative_Parameter) ++ + th (heading conjunctive_Parameter)) ++ tr (intagAttr "th" "rowspan=3" (heading singular_Parameter) ++ - th "1.p" ++ + th "1.p" ++ td (vfin (VFin (f Indic) Sg P1)) ++ td (vfin (VFin (f Conjunct) Sg P1))) ++ tr (th "2.p" ++ @@ -183,7 +183,7 @@ oper td (vfin (VFin (f Conjunct) Sg P2))) ++ tr (th "3.p" ++ td (vfin (VFin (f Indic) Sg P3)) ++ - td (vfin (VFin (f Conjunct) Sg P3))) ++ + td (vfin (VFin (f Conjunct) Sg P3))) ++ tr (intagAttr "th" "rowspan=3" (heading plural_Parameter) ++ th "1.p" ++ td (vfin (VFin (f Indic) Pl P1)) ++ @@ -191,7 +191,7 @@ oper tr (th "2.p" ++ td (vfin (VFin (f Indic) Pl P2)) ++ td (vfin (VFin (f Conjunct) Pl P2))) ++ - tr (th "3.p" ++ + tr (th "3.p" ++ td (vfin (VFin (f Indic) Pl P3)) ++ td (vfin (VFin (f Conjunct) Pl P3))) ) ; @@ -210,17 +210,17 @@ oper paragraph (vfin (VInfin False)) ++ heading2 (heading imperative_Parameter) ++ frameTable ( - tr (th "sg.2.p" ++ td (vfin (VImper SgP2))) ++ - tr (th "pl.1.p" ++ td (vfin (VImper PlP1))) ++ + tr (th "sg.2.p" ++ td (vfin (VImper SgP2))) ++ + tr (th "pl.1.p" ++ td (vfin (VImper PlP1))) ++ tr (th "pl.2.p" ++ td (vfin (VImper PlP2))) ) ++ heading2 (heading participle_Parameter) ++ frameTable ( tr (th (heading past_Parameter) ++ td (vfin (VPart Masc Sg))) ++ tr (th (heading present_Parameter) ++ td (vfin VGer)) - ) ; + ) ; {- --# notpresent --} +-} } diff --git a/src/italian/MakeStructuralIta.gf b/src/italian/MakeStructuralIta.gf index 2d4718e29..2982aa53d 100644 --- a/src/italian/MakeStructuralIta.gf +++ b/src/italian/MakeStructuralIta.gf @@ -15,7 +15,7 @@ oper mkPredet = overload { mkPredet : A -> Predet = \adj -> lin Predet { - s = \\a,c => prepCase c ++ adj.s ! Posit ! AF a.g a.n ; + s = \\a,c => prepCase c ++ adj.s ! Posit ! genNum2Aform a.g a.n ; c = Nom ; a = PNoAg } ; diff --git a/src/italian/MorphoIta.gf b/src/italian/MorphoIta.gf index 60868b79b..3921644b9 100644 --- a/src/italian/MorphoIta.gf +++ b/src/italian/MorphoIta.gf @@ -78,10 +78,12 @@ oper mkAdj : (_,_,_,_,_ : Str) -> Adj = \solo,sola,soli,sole,solamente -> {s = table { - AF Masc n => numForms solo soli ! n ; - AF Fem n => numForms sola sole ! n ; - AA => solamente - } + ASg Masc _ => solo ; + ASg Fem _ => sola ; + APl Masc => soli ; + APl Fem => sole ; + AA => solamente + } } ; -- Then the regular and invariant patterns. @@ -189,6 +191,6 @@ oper -- Determiners, traditionally called indefinite pronouns, are inflected -- in gender and number, like adjectives. - pronForms : Adj -> Gender -> Number -> Str = \tale,g,n -> tale.s ! AF g n ; + pronForms : Adj -> Gender -> Number -> Str = \tale,g,n -> tale.s ! genNum2Aform g n ; } diff --git a/src/portuguese/DocumentationPorFunctor.gf b/src/portuguese/DocumentationPorFunctor.gf index 8a98bfc24..84d945438 100644 --- a/src/portuguese/DocumentationPorFunctor.gf +++ b/src/portuguese/DocumentationPorFunctor.gf @@ -45,8 +45,8 @@ lin s1 = heading1 (nounHeading adjective_Category).s ; s2 = frameTable ( tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ - tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (AF Masc Sg)) ++ td (adj.s ! Posit ! (AF Masc Pl))) ++ - tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (AF Fem Sg)) ++ td (adj.s ! Posit ! (AF Fem Pl))) + tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (genNum2Aform Masc Sg)) ++ td (adj.s ! Posit ! (genNum2Aform Masc Pl))) ++ + tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (genNum2Aform Fem Sg)) ++ td (adj.s ! Posit ! (genNum2Aform Fem Pl))) ) } ; diff --git a/src/portuguese/ExtendPor.gf b/src/portuguese/ExtendPor.gf index 52cb8e901..e06683e48 100644 --- a/src/portuguese/ExtendPor.gf +++ b/src/portuguese/ExtendPor.gf @@ -127,7 +127,7 @@ concrete ExtendPor of Extend = } ; ICompAP ap = { - s =\\a => "o quão" ++ ap.s ! AF a.g a.n ; + s =\\a => "o quão" ++ ap.s ! (genNum2Aform a.g a.n) ; cop = serCopula } ; @@ -165,12 +165,12 @@ concrete ExtendPor of Extend = ComplBareVS = ComplVS ; AdjAsCN ap = { - s =\\n => ap.s ! AF Masc n ; + s =\\n => ap.s ! (genNum2Aform Masc n) ; g = Masc } ; AdjAsNP ap = heavyNP { - s = \\_c => ap.s ! AF Masc Sg ; + s = \\_c => ap.s ! ASg Masc APred ; a = Ag Masc Sg P3 } ; @@ -200,10 +200,8 @@ concrete ExtendPor of Extend = } ; CompoundAP noun adj = { - s = \\af => case af of { - AF g n => adj.s ! Posit ! AF noun.g n ++ "de" ++ noun.s ! n ; - -- do I need do(s)/da(s)? - _ => adj.s ! Posit ! AF noun.g Sg ++ "de" ++ noun.s ! Sg + s = \\af => case (aform2aagr af) of { + {n = n} => adj.s ! Posit ! (genNum2Aform noun.g n) ++ "de" ++ noun.s ! n } ; isPre = adj.isPre } ; diff --git a/src/portuguese/MorphoPor.gf b/src/portuguese/MorphoPor.gf index e4c206042..e45c92d57 100644 --- a/src/portuguese/MorphoPor.gf +++ b/src/portuguese/MorphoPor.gf @@ -118,9 +118,9 @@ oper mkAdj : (_,_,_,_,_ : Str) -> Adj = \burro,burra,burros,burras,burramente -> {s = table { - AF Masc n => numForms burro burros ! n ; - AF Fem n => numForms burra burras ! n ; - AA => burramente + ASg g _ => genForms burro burra ! g ; + APl g => genForms burros burras ! g ; + AA => burramente } } ; @@ -129,7 +129,8 @@ oper adj = mkAdjReg aj in { s = table { - AF g n => adj.s ! AF g n ; + ASg g _ => adj.s ! ASg g APred ; + APl g => adj.s ! APl g ; AA => av } } ; @@ -245,11 +246,11 @@ oper -- inflected in gender and number, like adjectives. pronForms : Adj -> Gender -> Number -> Str = - \tale,g,n -> tale.s ! AF g n ; + \tale,g,n -> tale.s ! (genNum2Aform g n) ; mkOrdinal : A -> Ord = \adj -> lin Ord { - s = \\ag => adj.s ! Posit ! AF ag.g ag.n ; + s = \\ag => adj.s ! Posit ! (genNum2Aform ag.g ag.n) ; } ; mkQuantifier : (esse,essa,esses,essas : Str) -> Quant = \esse,essa,esses,essas-> diff --git a/src/portuguese/ParadigmsPor.gf b/src/portuguese/ParadigmsPor.gf index 6066a16b5..88c9e38b6 100644 --- a/src/portuguese/ParadigmsPor.gf +++ b/src/portuguese/ParadigmsPor.gf @@ -366,7 +366,7 @@ oper -- deviant past participle, e.g. abrir - aberto special_ppV ve pa = { s = table { - VPart g n => (adjPreto pa).s ! AF g n ; + VPart g n => (adjPreto pa).s ! (genNum2Aform g n) ; p => ve.s ! p } ; lock_V = <> ; diff --git a/src/romance/AdjectiveRomance.gf b/src/romance/AdjectiveRomance.gf index 5be6fe69a..02c13540c 100644 --- a/src/romance/AdjectiveRomance.gf +++ b/src/romance/AdjectiveRomance.gf @@ -1,4 +1,4 @@ -incomplete concrete AdjectiveRomance of Adjective = +incomplete concrete AdjectiveRomance of Adjective = CatRomance ** open CommonRomance, ResRomance, Prelude in { flags coding=utf8; lin @@ -8,11 +8,11 @@ incomplete concrete AdjectiveRomance of Adjective = isPre = a.isPre } ; ComparA a np = { - s = \\af => a.s ! Compar ! af ++ conjThan ++ (np.s ! Nom).ton ; + s = \\af => a.s ! Compar ! af ++ conjThan ++ (np.s ! Nom).ton ; isPre = False } ; CAdvAP ad ap np = { - s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ (np.s ! Nom).ton ; + s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ (np.s ! Nom).ton ; isPre = False } ; UseComparA a = { @@ -20,29 +20,26 @@ incomplete concrete AdjectiveRomance of Adjective = isPre = a.isPre } ; AdjOrd ord = { - s = \\af => ord.s ! (case af of { - AF g n => aagr g n ; - _ => aagr Masc Sg ---- - }) ; + s = \\af => ord.s ! aform2aagr af ; ---- isPre = False ---- } ; -- $SuperlA$ belongs to determiner syntax in $Noun$. ComplA2 adj np = { - s = \\af => adj.s ! Posit ! af ++ appCompl adj.c2 np ; + s = \\af => adj.s ! Posit ! af ++ appCompl adj.c2 np ; isPre = False } ; ReflA2 adj = { - s = \\af => + s = \\af => adj.s ! Posit ! af ++ adj.c2.s ++ prepCase adj.c2.c ++ reflPron Sg P3 Nom ; --- agr isPre = False } ; SentAP ap sc = { - s = \\a => ap.s ! a ++ sc.s ! dative ; -- prête à dormir --- mood + s = \\a => ap.s ! a ++ sc.s ! dative ; -- prête à dormir --- mood isPre = False } ; diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index 3fb733aa1..0c60bc415 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -134,8 +134,8 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] NP = \np -> (np.s ! Nom).comp ; Conj = \c -> c.s2 ; - A = \a -> a.s ! Posit ! AF Masc Sg ; - A2 = \a -> a.s ! Posit ! AF Masc Sg ++ a.c2.s ; + A = \a -> a.s ! Posit ! ASg Masc APred ; + A2 = \a -> a.s ! Posit ! ASg Masc APred ++ a.c2.s ; N = \n -> n.s ! Sg ; N2 = \n -> n.s ! Sg ++ n.c2.s ; diff --git a/src/romance/CommonRomance.gf b/src/romance/CommonRomance.gf index 6620875bd..e30e0bea1 100644 --- a/src/romance/CommonRomance.gf +++ b/src/romance/CommonRomance.gf @@ -30,7 +30,9 @@ param -- Comparative adjectives are moreover inflected in degree -- (which in Romance is usually syntactic, though). - AForm = AF Gender Number | AA ; + AForm = ASg Gender APosition | APl Gender | AA ; + + APosition = AAttr | APred ; -- Gender is not morphologically determined for first and second person pronouns. @@ -49,18 +51,44 @@ oper } ; + -- genderpos2gender : GenderPosition -> {p1:Gender,p2:Number} = \gp -> case gp of { + -- MascSg _ => ; + -- MascPl => ; + -- FemSg => ; + -- FemPl => + -- } ; + + aform2gender : AForm -> Gender = \a -> case a of { - AF g _ => g ; - _ => Masc -- "le plus lentement" + ASg g _ => g ; + APl g => g ; + _ => Masc -- "le plus lentement" } ; aform2number : AForm -> Number = \a -> case a of { - AF _ n => n ; + APl _ => Pl ; _ => Sg -- "le plus lentement" } ; aform2aagr : AForm -> AAgr = \a -> case a of { - AF g n => aagr g n ; - _ => aagr Masc Sg -- "le plus lentement" + ASg g _ => aagr g Sg ; + APl g => aagr g Pl ; + _ => aagr Masc Sg -- "le plus lentement" } ; + aagr2aform : AAgr -> AForm = \gn -> case gn of { + {g=g ; n=Sg} => ASg g APred ; + {g=g ; n=Pl} => APl g + } ; + + genNum2Aform : Gender -> Number -> AForm ; + genNum2Aform g n = case n of { + Sg => ASg g APred ; + Pl => APl g + } ; + + genNumPos2Aform : Gender -> Number -> Bool -> AForm ; + genNumPos2Aform g n isPre = case n of { + Sg => ASg g (if_then_else APosition isPre AAttr APred) ; + Pl => APl g + } ; conjGender : Gender -> Gender -> Gender = \m,n -> case m of { @@ -236,7 +264,7 @@ oper oper mkOrd : {s : Degree => AForm => Str} -> {s : AAgr => Str} ; - mkOrd x = {s = \\ag => x.s ! Posit ! AF ag.g ag.n} ; + mkOrd x = {s = \\ag => x.s ! Posit ! aagr2aform ag } ; -- This is used in Spanish and Italian to bind clitics with preceding verb. diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index 465d8e7a3..cf54e4ed1 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -101,9 +101,9 @@ incomplete concrete NounRomance of Noun = AdNum adn num = {s = \\a => adn.s ++ num.s ! a ; isNum = num.isNum ; n = num.n} ; - OrdSuperl adj = {s = \\a => adj.s ! Superl ! AF a.g a.n} ; + OrdSuperl adj = {s = \\a => adj.s ! Superl ! genNum2Aform a.g a.n} ; - OrdNumeralSuperl num adj = {s = \\a => num.s ! NOrd a.g a.n ++ adj.s ! Superl ! AF a.g a.n} ; -- la terza più grande + OrdNumeralSuperl num adj = {s = \\a => num.s ! NOrd a.g a.n ++ adj.s ! Superl ! genNum2Aform a.g a.n} ; -- la terza più grande ---- could be discontinuous: la terza città più grande DefArt = { @@ -153,7 +153,7 @@ incomplete concrete NounRomance of Noun = let g = cn.g in { - s = \\n => preOrPost ap.isPre (ap.s ! (AF g n)) (cn.s ! n) ; + s = \\n => preOrPost ap.isPre (ap.s ! genNumPos2Aform g n ap.isPre) (cn.s ! n) ; g = g ; } ; @@ -188,9 +188,9 @@ incomplete concrete NounRomance of Noun = CountNP det np = heavyNPpol np.isNeg {s = \\c => det.s ! np.a.g ! c ++ (np.s ! genitive).ton ; a = np.a ** {n = det.n} } ; - + AdjDAP det ap = { - s = \\g => det.s ! g ++ ap.s ! AF g det.n ; + s = \\g => det.s ! g ++ ap.s ! genNum2Aform g det.n ; n = det.n ; } ; diff --git a/src/romance/PhraseRomance.gf b/src/romance/PhraseRomance.gf index 04a41b9aa..933e3ec91 100644 --- a/src/romance/PhraseRomance.gf +++ b/src/romance/PhraseRomance.gf @@ -1,4 +1,4 @@ -incomplete concrete PhraseRomance of Phrase = +incomplete concrete PhraseRomance of Phrase = CatRomance ** open CommonRomance, ResRomance, Prelude in { flags optimize = all_subs ; @@ -18,7 +18,7 @@ incomplete concrete PhraseRomance of Phrase = UttVP vp = {s = infVP vp (agrP3 Fem Sg)} ; --- Agr UttAdv adv = adv ; UttCN n = {s = n.s ! Sg} ; - UttAP ap = {s = ap.s ! AF Masc Sg} ; + UttAP ap = {s = ap.s ! genNum2Aform Masc Sg} ; UttCard n = {s = n.s ! Masc} ; UttInterj i = i ; diff --git a/src/romance/VerbRomance.gf b/src/romance/VerbRomance.gf index a5bfa4e51..d4dba254d 100644 --- a/src/romance/VerbRomance.gf +++ b/src/romance/VerbRomance.gf @@ -1,4 +1,4 @@ -incomplete concrete VerbRomance of Verb = +incomplete concrete VerbRomance of Verb = CatRomance ** open Prelude, CommonRomance, ResRomance in { flags optimize=all_subs ; @@ -6,50 +6,50 @@ incomplete concrete VerbRomance of Verb = lin UseV = predV ; - ComplVV v vp = + ComplVV v vp = insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v) ; ComplVS v s = insertExtrapos (\\b => conjThat ++ s.s ! (v.m ! b)) (predV v) ; ComplVQ v q = insertExtrapos (\\_ => q.s ! QIndir) (predV v) ; - ComplVA v ap = - insertComplement (\\a => let agr = complAgr a in ap.s ! AF agr.g agr.n) (predV v) ; + ComplVA v ap = + insertComplement (\\a => let agr = complAgr a in ap.s ! genNum2Aform agr.g agr.n) (predV v) ; SlashV2a v = mkVPSlash v.c2 (predV v) ; Slash2V3 v np = mkVPSlash v.c3 (insertObject v.c2 np (predV v)) ; Slash3V3 v np = mkVPSlash v.c2 (insertObject v.c3 np (predV v)) ; - SlashV2V v vp = + SlashV2V v vp = mkVPSlash v.c2 - (insertComplement - (\\a => v.c3.s ++ prepCase v.c3.c ++ infVP vp a) - (predV v)) ; + (insertComplement + (\\a => v.c3.s ++ prepCase v.c3.c ++ infVP vp a) + (predV v)) ; - SlashV2S v s = + SlashV2S v s = mkVPSlash v.c2 - (insertExtrapos + (insertExtrapos (\\b => conjThat ++ s.s ! Indic) ---- mood - (predV v)) ; + (predV v)) ; - SlashV2Q v q = + SlashV2Q v q = mkVPSlash v.c2 - (insertExtrapos + (insertExtrapos (\\_ => q.s ! QIndir) - (predV v)) ; + (predV v)) ; {- ---- lincat should be fixed - SlashV2A v ap = + SlashV2A v ap = let af = case v.c3.isDir of { - True => AF np.a.g np.a.n ; -- ... bleues - _ => AF Masc Sg -- il les peint en bleu + True => genNum2Aform np.a.g np.a.n ; -- ... bleues + _ => genNum2Aform Masc Sg -- il les peint en bleu } -} - SlashV2A v ap = - let af = AF Masc Sg + SlashV2A v ap = + let af = genNum2Aform Masc Sg in mkVPSlash v.c2 - (insertComplement + (insertComplement (\\_ => v.c3.s ++ prepCase v.c3.c ++ ap.s ! af) (predV v)) ; @@ -57,33 +57,33 @@ incomplete concrete VerbRomance of Verb = ReflVP v = case v.c2.isDir of { True => insertRefl v ; - False => insertComplement + False => insertComplement (\\a => let agr = verbAgr a in v.c2.s ++ reflPron agr.n agr.p v.c2.c) v } ; - SlashVV v vp = + SlashVV v vp = mkVPSlash vp.c2 (insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v)) ; - SlashV2VNP v np vps = let obj = np.s ! v.c2.c in { + SlashV2VNP v np vps = let obj = np.s ! v.c2.c in { s = v ; agr = getVPAgr v ; - clit1 = obj.c1 ; - clit2 = obj.c2 ; - clit3 = {s,imp = [] ; hasClit = False} ; ---- shortcut from insertObject, to check AR 20/11/2013 - isNeg = False ; + clit1 = obj.c1 ; + clit2 = obj.c2 ; + clit3 = {s,imp = [] ; hasClit = False} ; ---- shortcut from insertObject, to check AR 20/11/2013 + isNeg = False ; neg = negation ; comp = \\a => v.c2.s ++ obj.comp ++ prepCase v.c3.c ++ infVP vps a ; ext = \\p => [] ; c2 = vps.c2 } ; -{- ---- this takes ages to compile, hence inlined as above AR 20/11/2013 - SlashV2VNP v np vp = +{- ---- this takes ages to compile, hence inlined as above AR 20/11/2013 + SlashV2VNP v np vp = mkVPSlash vp.c2 - (insertComplement - (\\a => prepCase v.c3.c ++ infVP vp a) - (insertObject v.c2 np (predV v))) ; + (insertComplement + (\\a => prepCase v.c3.c ++ infVP vp a) + (insertObject v.c2 np (predV v))) ; -} @@ -91,9 +91,9 @@ incomplete concrete VerbRomance of Verb = UseCopula = predV copula ; - CompAP ap = {s = \\ag => let agr = complAgr ag in ap.s ! AF agr.g agr.n ; cop = serCopula} ; - CompCN cn = { s = \\ag => - let agr = complAgr ag in + CompAP ap = {s = \\ag => let agr = complAgr ag in ap.s ! genNum2Aform agr.g agr.n ; cop = serCopula} ; + CompCN cn = { s = \\ag => + let agr = complAgr ag in artIndef False cn.g agr.n Nom ++ cn.s ! agr.n ; cop = serCopula }; --- RE 7/12/2010 -- AR added indef 2/8/2011 @@ -109,11 +109,10 @@ incomplete concrete VerbRomance of Verb = AdVVPSlash adv vps = vps ** insertAdV adv.s vps ; - PassV2 v = insertComplement + PassV2 v = insertComplement (\\a => let agr = complAgr a in v.s ! VPart agr.g agr.n) (predV auxPassive) ; VPSlashPrep vp prep = vp ** { c2 = {s = prep.s ; c = prep.c ; isDir = False} } ; } - diff --git a/src/spanish/DocumentationSpaFunctor.gf b/src/spanish/DocumentationSpaFunctor.gf index 9a59e6263..41734738f 100644 --- a/src/spanish/DocumentationSpaFunctor.gf +++ b/src/spanish/DocumentationSpaFunctor.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common -incomplete concrete DocumentationSpaFunctor of Documentation = CatSpa ** open +incomplete concrete DocumentationSpaFunctor of Documentation = CatSpa ** open Terminology, -- the interface to be instantiated ResSpa, CommonRomance, @@ -19,22 +19,22 @@ lincat Definition = {s : Str} ; Document = {s : Str} ; Tag = {s : Str} ; - + {- -} --# notpresent oper heading : N -> Str = \n -> (nounHeading n).s ; - + lin InflectionN, InflectionN3, InflectionN3 = \noun -> { t = "n" ; - s1 = heading1 (heading noun_Category ++ + s1 = heading1 (heading noun_Category ++ case noun.g of { - Masc => "("+heading masculine_Parameter+")" ; + Masc => "("+heading masculine_Parameter+")" ; Fem => "("+heading feminine_Parameter+")" }) ; - s2 = frameTable ( + s2 = frameTable ( tr (th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ tr (td (noun.s ! Sg) ++ td (noun.s ! Pl)) ) @@ -45,8 +45,8 @@ lin s1 = heading1 (nounHeading adjective_Category).s ; s2 = frameTable ( tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ - tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (AF Masc Sg)) ++ td (adj.s ! Posit ! (AF Masc Pl))) ++ - tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (AF Fem Sg)) ++ td (adj.s ! Posit ! (AF Fem Pl))) + tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! genNum2Aform Masc Sg) ++ td (adj.s ! Posit ! (genNum2Aform Masc Pl))) ++ + tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! genNum2Aform Fem Sg) ++ td (adj.s ! Posit ! (genNum2Aform Fem Pl))) ) } ; @@ -142,23 +142,23 @@ lin MkDocument b i e = ss (i.s1 ++ "

"++b.s++"

" ++ i.s2 ++ paragraph e.s) ; -- explanation appended in a new paragraph MkTag i = ss i.t ; -oper +oper verbExample : CatSpa.Cl -> Str = \cl -> - (S.mkUtt cl).s + (S.mkUtt cl).s ++ ";" ++ (S.mkUtt (S.mkS S.anteriorAnt cl)).s --# notpresent ; - inflVerb : Verb -> Str = \verb -> - let + inflVerb : Verb -> Str = \verb -> + let vfin : CommonRomance.VF -> Str = \f -> - verb.s ! f ; + verb.s ! f ; ttable : TMood -> Str = \tense -> frameTable ( - tr (th "" ++ - th (heading singular_Parameter) ++ - th (heading plural_Parameter)) ++ - tr (th "1.p" ++ + tr (th "" ++ + th (heading singular_Parameter) ++ + th (heading plural_Parameter)) ++ + tr (th "1.p" ++ td (vfin (VFin tense Sg P1)) ++ td (vfin (VFin tense Pl P1))) ++ tr (th "2.p" ++ @@ -171,11 +171,11 @@ oper ttable2 : (Mood -> TMood) -> Str = \f -> frameTable ( - tr (intagAttr "th" "colspan=2" "" ++ - th (heading indicative_Parameter) ++ - th (heading conjunctive_Parameter)) ++ + tr (intagAttr "th" "colspan=2" "" ++ + th (heading indicative_Parameter) ++ + th (heading conjunctive_Parameter)) ++ tr (intagAttr "th" "rowspan=3" (heading singular_Parameter) ++ - th "1.p" ++ + th "1.p" ++ td (vfin (VFin (f Indic) Sg P1)) ++ td (vfin (VFin (f Conjunct) Sg P1))) ++ tr (th "2.p" ++ @@ -183,7 +183,7 @@ oper td (vfin (VFin (f Conjunct) Sg P2))) ++ tr (th "3.p" ++ td (vfin (VFin (f Indic) Sg P3)) ++ - td (vfin (VFin (f Conjunct) Sg P3))) ++ + td (vfin (VFin (f Conjunct) Sg P3))) ++ tr (intagAttr "th" "rowspan=3" (heading plural_Parameter) ++ th "1.p" ++ td (vfin (VFin (f Indic) Pl P1)) ++ @@ -191,7 +191,7 @@ oper tr (th "2.p" ++ td (vfin (VFin (f Indic) Pl P2)) ++ td (vfin (VFin (f Conjunct) Pl P2))) ++ - tr (th "3.p" ++ + tr (th "3.p" ++ td (vfin (VFin (f Indic) Pl P3)) ++ td (vfin (VFin (f Conjunct) Pl P3))) ) ; @@ -210,17 +210,17 @@ oper paragraph (vfin (VInfin False)) ++ heading2 (heading imperative_Parameter) ++ frameTable ( - tr (th "sg.2.p" ++ td (vfin (VImper SgP2))) ++ - tr (th "pl.1.p" ++ td (vfin (VImper PlP1))) ++ + tr (th "sg.2.p" ++ td (vfin (VImper SgP2))) ++ + tr (th "pl.1.p" ++ td (vfin (VImper PlP1))) ++ tr (th "pl.2.p" ++ td (vfin (VImper PlP2))) ) ++ heading2 (heading participle_Parameter) ++ frameTable ( tr (th (heading past_Parameter) ++ td (vfin (VPart Masc Sg))) ++ tr (th (heading present_Parameter) ++ td (vfin VGer)) - ) ; + ) ; {- --# notpresent --} +-} } diff --git a/src/spanish/MorphoSpa.gf b/src/spanish/MorphoSpa.gf index 83620b9ce..c942fcb9e 100644 --- a/src/spanish/MorphoSpa.gf +++ b/src/spanish/MorphoSpa.gf @@ -57,12 +57,16 @@ oper -- Adjectives are conveniently seen as gender-dependent nouns. -- Here are some patterns. First one that describes the worst case. - mkAdj : (_,_,_,_,_ : Str) -> Adj = \solo,sola,soli,sole,solamente -> + mkAdj : (x1,_,_,_,_,_,x7 : Str) -> Adj = \buen,solo,gran,sola,solos,solas,solamente -> {s = table { - AF Masc n => numForms solo soli ! n ; - AF Fem n => numForms sola sole ! n ; - AA => solamente - } + ASg Masc AAttr => buen ; + ASg Masc APred => solo ; + ASg Fem AAttr => gran ; + ASg Fem APred => sola ; + APl Masc => solos ; + APl Fem => solas ; + AA => solamente + } } ; -- Then the regular and invariant patterns. @@ -71,26 +75,36 @@ oper let sol = Predef.tk 1 solo in - mkAdj solo (sol + "a") (sol + "os") (sol + "as") (sol + "amente") ; + mkAdj solo solo (sol + "a") (sol + "a") + (sol + "os") (sol + "as") (sol + "amente") ; -- masculine and feminine are identical: -- adjectives ending with -e, -a and many but not all that end in a consonant adjUtil : Str -> Str -> Adj = \util,utiles -> - mkAdj util util utiles utiles (util + "mente") ; + mkAdj util util util util + utiles utiles (util + "mente") ; -- adjectives that end in consonant but have different masc and fem forms -- español, hablador ... adjEspanol : Str -> Str -> Adj = \espanol,espanola -> - mkAdj espanol espanola (espanol + "es") (espanol + "as") (espanola + "mente") ; + mkAdj espanol espanol espanola espanola + (espanol + "es") (espanol + "as") (espanola + "mente") ; - adjBlu : Str -> Adj = \blu -> - mkAdj blu blu blu blu blu ; --- + adjBueno : Str -> Adj = \bueno -> + let buen = init bueno in + mkAdj buen bueno (buen + "a") (buen + "a") + (buen + "os") (buen + "as") (buen + "amente") ; + + adjGrande : Str -> Str -> Adj = \gran,grande -> + mkAdj gran grande gran grande + (grande + "s") (grande + "s") (grande + "mente") ; -- francés francesa franceses francesas adjEs : Str -> Adj = \francEs -> let franc : Str = Predef.tk 2 francEs ; frances : Str = franc + "es" ; - in mkAdj francEs (frances + "a") (frances + "es") (frances + "as") (frances + "amente") ; + in mkAdj francEs francEs (frances + "a") (frances + "a") + (frances + "es") (frances + "as") (frances + "amente") ; -- alemán alemana alemanes alemanas @@ -106,11 +120,13 @@ oper "ú" => "u" } ; alemVn : Str = alem + V + "n" ; - in mkAdj alemAn (alemVn + "a") (alemVn + "es") - (alemVn + "as") (alemVn + "amente") ; + in mkAdj alemAn alemAn (alemVn + "a") (alemVn + "a") + (alemVn + "es") (alemVn + "as") (alemVn + "amente") ; mkAdjReg : Str -> Adj = \solo -> case solo of { + "grande" => adjGrande "gran" "grande" ; + "bueno" => adjBueno solo ; _ + "o" => adjSolo solo ; _ + ("e" | "a") => adjUtil solo (solo + "s") ; _ + "és" => adjEs solo ; @@ -153,11 +169,11 @@ oper -- Determiners, traditionally called indefinite pronouns, are inflected -- in gender and number, like adjectives. - pronForms : Adj -> Gender -> Number -> Str = \tale,g,n -> tale.s ! AF g n ; + pronForms : Adj -> Gender -> Number -> Str = \tale,g,n -> tale.s ! genNum2Aform g n ; mkOrdinal : A -> Ord = \adj-> lin Ord { - s = \\ag => adj.s ! Posit ! AF ag.g ag.n ; + s = \\ag => adj.s ! Posit ! genNum2Aform ag.g ag.n ; } ; mkQuantifier : (ese,esa,esos,esas : Str) -> Quant = \ese,esa,esos,esas-> diff --git a/src/spanish/ParadigmsSpa.gf b/src/spanish/ParadigmsSpa.gf index 08f3cc3d6..b1a73aa4b 100644 --- a/src/spanish/ParadigmsSpa.gf +++ b/src/spanish/ParadigmsSpa.gf @@ -4,12 +4,12 @@ -- -- Aarne Ranta 2004 - 2006 -- --- This is an API for the user of the resource grammar +-- This is an API for the user of the resource grammar -- for adding lexical items. It gives functions for forming -- expressions of open categories: nouns, adjectives, verbs. --- +-- -- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API, $Structural.gf$. +-- accessed through the resource syntax API, $Structural.gf$. -- -- The main difference with $MorphoSpa.gf$ is that the types -- referred to are compiled resource grammar types. We have moreover @@ -23,30 +23,30 @@ -- verbs, there is a fairly complete list of irregular verbs in -- [``IrregSpa`` ../../spanish/IrregSpa.gf]. -resource ParadigmsSpa = - open - (Predef=Predef), - Prelude, - MorphoSpa, +resource ParadigmsSpa = + open + (Predef=Predef), + Prelude, + MorphoSpa, BeschSpa, CatSpa in { flags optimize=all ; coding=utf8 ; ---2 Parameters +--2 Parameters -- -- To abstract over gender names, we define the following identifiers. oper - Gender : Type ; + Gender : Type ; masculine : Gender ; feminine : Gender ; -- To abstract over number names, we define the following. - Number : Type ; + Number : Type ; singular : Number ; plural : Number ; @@ -71,7 +71,7 @@ oper mkN : overload { -- The regular function takes the singular form and the gender, --- and computes the plural and the gender by a heuristic. +-- and computes the plural and the gender by a heuristic. -- The heuristic says that the gender is feminine for nouns -- ending with "a" or "z", and masculine for all other words. -- Nouns ending with "a", "o", "e" have the plural with "s", @@ -92,23 +92,23 @@ oper } ; ---3 Compound nouns +--3 Compound nouns -- -- Some nouns are ones where the first part is inflected as a noun but --- the second part is not inflected. e.g. "número de teléfono". +-- the second part is not inflected. e.g. "número de teléfono". -- They could be formed in syntax, but we give a shortcut here since -- they are frequent in lexica. compN : N -> Str -> N ; -- compound, e.g. "número" + "de teléfono" ---3 Relational nouns --- --- Relational nouns ("fille de x") need a case and a preposition. +--3 Relational nouns +-- +-- Relational nouns ("fille de x") need a case and a preposition. mkN2 : N -> Prep -> N2 ; -- relational noun with preposition --- The most common cases are the genitive "de" and the dative "a", +-- The most common cases are the genitive "de" and the dative "a", -- with the empty preposition. deN2 : N -> N2 ; -- relational noun with preposition "de" @@ -126,7 +126,7 @@ oper -- $N3$ are purely lexical categories. But you can use the $AdvCN$ -- and $PrepNP$ constructions to build phrases like this. --- +-- --3 Proper names and noun phrases -- -- Proper names need a string and a gender. @@ -156,10 +156,12 @@ oper -- One-place adjectives compared with "mas" need five forms in the worst -- case (masc and fem singular, masc plural, adverbial). - mkA : (solo,sola,solos,solas,solamente : Str) -> A ; -- worst-case + mkA : (solo,sola,solos,solas,solamente : Str) -> A ; -- almost worst-case, except for buen/bueno gran/grande --- In the worst case, two separate adjectives are given: --- the positive ("bueno"), and the comparative ("mejor"). + mkA : (gran,grande,gran,grande,grandes,grandes,solamente : Str) -> A ; -- worst-case + +-- In the worst case, two separate adjectives are given: +-- the positive ("bueno"), and the comparative ("mejor"). mkA : (bueno : A) -> (mejor : A) -> A ; -- special comparison (default with "mas") @@ -184,7 +186,7 @@ oper --2 Adverbs -- Adverbs are not inflected. Most lexical ones have position --- after the verb. +-- after the verb. mkAdv : Str -> Adv ; @@ -197,7 +199,7 @@ oper mkAdA : Str -> AdA ; mkAdN : Str -> AdN ; - + --2 Verbs @@ -239,7 +241,7 @@ oper --3 Two-place verbs -- -- Two-place verbs need a preposition, except the special case with direct object. --- (transitive verbs). +-- (transitive verbs). mkV2 : overload { mkV2 : Str -> V2 ; -- regular, direct object @@ -258,7 +260,7 @@ oper -- the first one or both can be absent. mkV3 : overload { - mkV3 : V -> V3 ; -- donner (+ accusative + dative) + mkV3 : V -> V3 ; -- donner (+ accusative + dative) mkV3 : V -> Prep -> V3 ; -- placer (+ accusative) + dans mkV3 : V -> Prep -> Prep -> V3 -- parler + dative + genitive } ; @@ -301,9 +303,9 @@ oper mkAV : A -> Prep -> AV ; --% mkA2V : A -> Prep -> Prep -> A2V ; --% --- Notice: categories $AS, A2S, AV, A2V$ are just $A$, +-- Notice: categories $AS, A2S, AV, A2V$ are just $A$, -- and the second argument is given --- as an adverb. Likewise +-- as an adverb. Likewise -- $V0$ is just $V$. V0 : Type ; --% @@ -316,7 +318,7 @@ oper -- The definitions should not bother the user of the API. So they are -- hidden from the document. - Gender = MorphoSpa.Gender ; + Gender = MorphoSpa.Gender ; Number = MorphoSpa.Number ; masculine = Masc ; feminine = Fem ; @@ -354,22 +356,23 @@ oper makeNP x g n = {s = (pn2np (mk2PN x g)).s; a = agrP3 g n ; hasClit = False ; isPol = False ; isNeg = False} ** {lock_NP = <>} ; - mk5A a b c d e = - compADeg {s = \\_ => (mkAdj a b c d e).s ; isPre = False ; lock_A = <>} ; + mk7A a b c d e f g = + compADeg {s = \\_ => (mkAdj a b c d e f g).s ; isPre = False ; lock_A = <>} ; - mk2A a b = - compADeg {s = \\_ => (adjEspanol a b).s ; isPre = False ; lock_A = <>} ; + mk5A a b c d e = mk7A a a b b c d e ; + + mk2A a b = compADeg {s = \\_ => (adjEspanol a b).s ; isPre = False ; lock_A = <>} ; regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ; lock_A = <>} ; prefA a = {s = a.s ; isPre = True ; lock_A = <>} ; mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ; - mkADeg a b = - {s = table {Posit => a.s ! Posit ; _ => b.s ! Posit} ; + mkADeg a b = + {s = table {Posit => a.s ! Posit ; _ => b.s ! Posit} ; isPre = a.isPre ; lock_A = <>} ; - compADeg a = - {s = table {Posit => a.s ! Posit ; _ => \\f => "más" ++ a.s ! Posit ! f} ; + compADeg a = + {s = table {Posit => a.s ! Posit ; _ => \\f => "más" ++ a.s ! Posit ! f} ; isPre = a.isPre ; lock_A = <>} ; regADeg a = compADeg (regA a) ; @@ -381,7 +384,7 @@ oper regV x = -- cortar actuar cazar guiar pagar sacar - let + let ar = Predef.dp 2 x ; z = Predef.dp 1 (Predef.tk 2 x) ; verb = case ar of { @@ -407,7 +410,7 @@ oper special_ppV ve pa = { s = table { - VPart g n => (adjSolo pa).s ! AF g n ; + VPart g n => (adjSolo pa).s ! genNum2Aform g n ; p => ve.s ! p } ; lock_V = <> ; @@ -417,10 +420,10 @@ oper regAltV x y = case x of { _ + "ar" => verboV (regAlternV x y) ; - _ => verboV (regAlternVEr x y) + _ => verboV (regAlternVEr x y) } ; - + mk2V2 v p = lin V2 (v ** {c2 = p}) ; dirV2 v = mk2V2 v accusative ; @@ -502,17 +505,19 @@ oper -- To form a noun phrase that can also be plural, -- you can use the worst-case function. - makeNP : Str -> Gender -> Number -> NP ; + makeNP : Str -> Gender -> Number -> NP ; mkA = overload { mkA : (util : Str) -> A = regA ; mkA : (espanol,espanola : Str) -> A = mk2A ; mkA : (solo,sola,solos,solas,solamente : Str) -> A = mk5A ; + mkA : (_,_,_,_,_,_,_ : Str) -> A = mk7A ; mkA : (bueno : A) -> (mejor : A) -> A = mkADeg ; - mkA : (blanco : A) -> (hueso : Str) -> A = \blanco,hueso -> blanco ** + mkA : (blanco : A) -> (hueso : Str) -> A = \blanco,hueso -> blanco ** { s = \\x,y => blanco.s ! x ! y ++ hueso } ; } ; + mk7A : (_,_,_,_,_,_,_ : Str) -> A ; mk5A : (solo,sola,solos,solas,solamente : Str) -> A ; mk2A : (espanol,espanola : Str) -> A ; regA : Str -> A ; @@ -538,7 +543,7 @@ oper mkV2 = overload { mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; - mkV2 : V -> V2 = dirV2 ; + mkV2 : V -> V2 = dirV2 ; mkV2 : V -> Prep -> V2 = mk2V2 } ; mk2V2 : V -> Prep -> V2 ; diff --git a/src/spanish/ParseSpa.gf b/src/spanish/ParseSpa.gf index 6ee0a6922..7b17e50f1 100644 --- a/src/spanish/ParseSpa.gf +++ b/src/spanish/ParseSpa.gf @@ -1,5 +1,5 @@ --# -path=alltenses -concrete ParseSpa of ParseEngAbs = +concrete ParseSpa of ParseEngAbs = TenseSpa, -- CatSpa, NounSpa - [PPartNP], @@ -19,7 +19,7 @@ concrete ParseSpa of ParseEngAbs = VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, ClSlash, RCl, EmptyRelSlash], - DictEngSpa ** + DictEngSpa ** open MorphoSpa, ResSpa, ParadigmsSpa, SyntaxSpa, Prelude in { flags @@ -30,11 +30,11 @@ flags lin -- missing from ExtraSpa; should not really be there either - GenNP np = + GenNP np = let denp = (np.s ! ResSpa.genitive).ton in { - s = \\_,_,_,_ => [] ; + s = \\_,_,_,_ => [] ; sp = \\_,_,_ => denp ; - s2 = denp ; + s2 = denp ; isNeg = False ; } ; @@ -48,7 +48,7 @@ lin another_Quant = mkQuantifier "otro" "otra" "otros" "otras" ; some_Quant = mkQuantifier "algún" "alguna" "algunos" "algunas" ; - anySg_Det = mkDeterminer "algún" "alguna" Sg False ; ---- also meaning "whichever" ? + anySg_Det = mkDeterminer "algún" "alguna" Sg False ; ---- also meaning "whichever" ? each_Det = SyntaxSpa.every_Det ; but_Subj = {s = "pero" ; m = Indic} ; ---- strange to have this as Subj @@ -70,7 +70,7 @@ lin g = cn.g } ; -{- +{- DashCN noun1 noun2 = { s = \\n,c => noun1.s ! Sg ! Nom ++ "-" ++ noun2.s ! n ! c ; g = noun2.g @@ -80,7 +80,7 @@ lin s = \\n,c => v.s ! VPresPart ; g = Neutr } ; - + GerundAP v = { s = \\agr => v.s ! VPresPart ; isPre = True @@ -89,7 +89,8 @@ lin PastPartAP v = { s = table { - AF g n => v.s ! VPart g n ; + ASg g _ => v.s ! VPart g Sg ; + APl g _ => v.s ! VPart g Pl ; _ => v.s ! VPart Masc Sg ---- the adverb form } ; isPre = True @@ -108,11 +109,11 @@ lin infVP v.typ vp ant.a p.p a) (predVc v) ; - SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++ - v.c3 ++ + SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++ + v.c3 ++ vpi.s ! VVAux ! a) (predVc v) ; - ComplVV v a p vp = insertObj (\\agr => a.s ++ p.s ++ + ComplVV v a p vp = insertObj (\\agr => a.s ++ p.s ++ infVP v.typ vp a.a p.p agr) (predVV v) ; -} @@ -126,10 +127,10 @@ lin {- CompQS qs = {s = \\_ => qs.s ! QIndir} ; - CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ + CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ infVP VVInf vp ant.a p.p a} ; - VPSlashVS vs vp = + VPSlashVS vs vp = insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) ** {c2 = ""; gapInMiddle = False} ; @@ -147,11 +148,11 @@ lin s = \\c => np1.s ! c ++ "," ++ np2.s ! npNom ; a = np1.a } ; - + AdAdV = cc2 ; - + UttAdV adv = adv; --} +-} }