(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
This commit is contained in:
Inari Listenmaa
2018-12-05 19:16:35 +02:00
committed by GitHub
parent 78cac3725a
commit dadcd386c9
25 changed files with 401 additions and 332 deletions

View File

@@ -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 ++ "<p style=\"font-size:20px\">"++b.s++"</p>" ++ 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
-}
-}
}

View File

@@ -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->

View File

@@ -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 ;

View File

@@ -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;
-}
-}
}