updated ParadigmsSpa

This commit is contained in:
aarne
2005-03-30 15:27:45 +00:00
parent 6cb79f531c
commit f3b9774062
3 changed files with 323 additions and 132 deletions

View File

@@ -273,6 +273,75 @@ oper tener_4 : Str -> Verbum = \tener ->
VP (Pass Pl Fem) => t_ + "enidas"
}
} ;
oper cortar_5 : Str -> Verbum = \cortar ->
let cort_ = Predef.tk 2 cortar in
{s = table {
VI Infn => cort_ + "ar" ;
VI Ger => cort_ + "ando" ;
VI Part => cort_ + "ado" ;
VP (Pres Ind Sg P1) => cort_ + "o" ;
VP (Pres Ind Sg P2) => cort_ + "as" ;
VP (Pres Ind Sg P3) => cort_ + "a" ;
VP (Pres Ind Pl P1) => cort_ + "amos" ;
VP (Pres Ind Pl P2) => cort_ + "áis" ;
VP (Pres Ind Pl P3) => cort_ + "an" ;
VP (Pres Subj Sg P1) => cort_ + "e" ;
VP (Pres Subj Sg P2) => cort_ + "es" ;
VP (Pres Subj Sg P3) => cort_ + "e" ;
VP (Pres Subj Pl P1) => cort_ + "emos" ;
VP (Pres Subj Pl P2) => cort_ + "éis" ;
VP (Pres Subj Pl P3) => cort_ + "en" ;
VP (Impf Ind Sg P1) => cort_ + "aba" ;
VP (Impf Ind Sg P2) => cort_ + "abas" ;
VP (Impf Ind Sg P3) => cort_ + "aba" ;
VP (Impf Ind Pl P1) => cort_ + "ábamos" ;
VP (Impf Ind Pl P2) => cort_ + "abais" ;
VP (Impf Ind Pl P3) => cort_ + "aban" ;
VP (Impf Subj Sg P1) => variants {cort_ + "ara" ; cort_ + "ase"} ;
VP (Impf Subj Sg P2) => variants {cort_ + "aras" ; cort_ + "ases"} ;
VP (Impf Subj Sg P3) => variants {cort_ + "ara" ; cort_ + "ase"} ;
VP (Impf Subj Pl P1) => variants {cort_ + "áramos" ; cort_ + "ásemos"} ;
VP (Impf Subj Pl P2) => variants {cort_ + "arais" ; cort_ + "aseis"} ;
VP (Impf Subj Pl P3) => variants {cort_ + "aran" ; cort_ + "asen"} ;
VP (Pret Sg P1) => cort_ + "é" ;
VP (Pret Sg P2) => cort_ + "aste" ;
VP (Pret Sg P3) => cort_ + "ó" ;
VP (Pret Pl P1) => cort_ + "amos" ;
VP (Pret Pl P2) => cort_ + "asteis" ;
VP (Pret Pl P3) => cort_ + "aron" ;
VP (Fut Ind Sg P1) => cort_ + "aré" ;
VP (Fut Ind Sg P2) => cort_ + "arás" ;
VP (Fut Ind Sg P3) => cort_ + "ará" ;
VP (Fut Ind Pl P1) => cort_ + "aremos" ;
VP (Fut Ind Pl P2) => cort_ + "aréis" ;
VP (Fut Ind Pl P3) => cort_ + "arán" ;
VP (Fut Subj Sg P1) => cort_ + "are" ;
VP (Fut Subj Sg P2) => cort_ + "ares" ;
VP (Fut Subj Sg P3) => cort_ + "are" ;
VP (Fut Subj Pl P1) => cort_ + "áremos" ;
VP (Fut Subj Pl P2) => cort_ + "areis" ;
VP (Fut Subj Pl P3) => cort_ + "aren" ;
VP (Cond Sg P1) => cort_ + "aría" ;
VP (Cond Sg P2) => cort_ + "arías" ;
VP (Cond Sg P3) => cort_ + "aría" ;
VP (Cond Pl P1) => cort_ + "aríamos" ;
VP (Cond Pl P2) => cort_ + "aríais" ;
VP (Cond Pl P3) => cort_ + "arían" ;
VP (Imp Sg P1) => variants {} ;
VP (Imp Sg P2) => cort_ + "a" ;
VP (Imp Sg P3) => cort_ + "e" ;
VP (Imp Pl P1) => cort_ + "emos" ;
VP (Imp Pl P2) => cort_ + "ad" ;
VP (Imp Pl P3) => cort_ + "en" ;
VP (Pass Sg Masc) => cort_ + "ado" ;
VP (Pass Sg Fem) => cort_ + "ada" ;
VP (Pass Pl Masc) => cort_ + "ados" ;
VP (Pass Pl Fem) => cort_ + "adas"
}
} ;
oper deber_6 : Str -> Verbum = \deber ->
let deb_ = Predef.tk 2 deber in
{s = table {

View File

@@ -55,7 +55,13 @@ oper
mkCNomIrreg : Str -> Str -> Gender -> CNom = \mec,mecs ->
mkCNom (numForms mec mecs) ;
mkNomReg : Str -> CNom = \mec ->
case last mec of {
"o" | "e" => mkCNom (nomVino mec) Masc ;
"a" => mkCNom (nomVino mec) Fem ;
"z" => mkCNomIrreg mec (init mec + "ces") Fem ;
_ => mkCNom (nomPilar mec) Masc
} ;
--2 Adjectives
--
@@ -84,6 +90,13 @@ oper
adjBlu : Str -> Adj = \blu ->
mkAdj blu blu blu blu blu ; ---
mkAdjReg : Str -> Adj = \solo ->
case last solo of {
"o" => adjSolo solo ;
"e" => adjUtil solo (solo + "s") ;
_ => adjUtil solo (solo + "es")
---- _ => adjBlu solo
} ;
--2 Personal pronouns
--

View File

@@ -2,7 +2,7 @@
--1 Spanish Lexical Paradigms
--
-- Aarne Ranta 2003
-- Aarne Ranta 2005
--
-- This is an API to the user of the resource grammar
-- for adding lexical items. It give shortcuts for forming
@@ -19,8 +19,8 @@
-- The following modules are presupposed:
resource ParadigmsSpa =
open Prelude, (Types = TypesSpa), SyntaxSpa, MorphoSpa,
ResourceSpa in {
open Prelude, (Types = TypesSpa), SyntaxSpa, MorphoSpa, BeschSpa,
RulesSpa in {
--2 Parameters
--
@@ -40,21 +40,18 @@ oper
singular : Number ;
plural : Number ;
-- To abstract over case names, we define the following. (Except for
-- some pronouns, the accusative is equal to the nominative, the
-- dative is formed by the preposition "a", and the genitive by the
-- preposition "di".)
-- Prepositions used in many-argument functions are either strings
-- (including the 'accusative' empty string) or strings that
-- amalgamate with the following word (the 'genitive' "de" and the
-- 'dative' "à").
Case : Type ;
Preposition : Type ;
nominative : Case ;
accusative : Case ;
dative : Case ;
genitive : Case ;
prep_a : Case ;
prep_de : Case ;
accusative : Preposition ;
dative : Preposition ;
genitive : Preposition ;
mkPreposition : Str -> Preposition ;
--2 Nouns
@@ -63,176 +60,288 @@ oper
mkN : (_,_ : Str) -> Gender -> N ; -- uomo, uomini, masculine
-- Often it is enough with one form. If it ends with
-- "o" or "a", no gender is needed; if with something else,
-- the gender must be given.
-- The regular function takes the singular form and the gender,
-- 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",
-- those ending with "z" have "ces" in plural; all other nouns
-- have "es" as plural ending. The accent is not dealt with.
nVino : Str -> N ; -- vino (, vinos, masculine)
nRana : Str -> N ; -- rana (, ranas, feminine)
nPilar : Str -> Gender -> N ; -- pilar (, pilares), masculine
nTram : Str -> Gender -> N ; -- tram (, tram), masculine
regN : Str -> N ;
-- Nouns used as functions need a case and a preposition. The most common is "di".
-- Recall that the prepositions "a", "di", "da", "in", "su", "con" are treated
-- as part of the case (cf. above).
-- To force a different gender, use one of the following functions.
funPrep : N -> Preposition -> N2 ;
funCase : N -> Case -> N2 ;
funDe : N -> N2 ;
mascN : N -> N ;
femN : N -> N ;
-- Proper names, with their gender.
--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. "numéro de téléphone".
-- They could be formed in syntax, but we give a shortcut here since
-- they are frequent in lexica.
mkPN : Str -> Gender -> PN ; -- Giovanni, masculine
compN : N -> Str -> N ;
-- On the top level, it is maybe $CN$ that is used rather than $N$, and
-- $NP$ rather than $PN$.
mkCN : N -> CN ;
mkNP : Str -> Gender -> NP ;
--3 Relational nouns
--
-- Relational nouns ("fille de x") need a case and a preposition.
mkN2 : N -> Preposition -> N2 ;
-- The most common cases are the genitive "de" and the dative "a",
-- with the empty preposition.
deN2 : N -> N2 ;
aN2 : N -> N2 ;
-- Three-place relational nouns ("la connessione di x a y") need two prepositions.
mkN3 : N -> Preposition -> Preposition -> N3 ;
--3 Relational common noun phrases
--
-- In some cases, you may want to make a complex $CN$ into a
-- relational noun (e.g. "the old town hall of"). However, $N2$ and
-- $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.
mkPN : Str -> Gender -> PN ; -- Jean
-- To form a noun phrase that can also be plural,
-- you can use the worst-case function.
mkNP : Str -> Gender -> Number -> NP ;
--2 Adjectives
-- Non-comparison one-place adjectives need four forms in the worst case.
-- A parameter tells if they are pre- or postpositions in modification.
-- Non-comparison one-place adjectives need five forms in the worst
-- case (masc and fem singular, masc plural, adverbial).
Position : Type ;
prepos : Position ;
postpos : Position ;
mkA : (solo,sola,soli,sole, solamente : Str) -> A ;
mkA1 : (solo,sola,soli,sole,solamente : Str) -> Position -> A1 ;
-- For regular adjectives, all other forms are derived from the
-- masculine singular. The types of adjectives that are recognized are
-- "alto", "fuerte", "util".
-- Adjectives ending with "o" and "e", and invariable adjectives,
-- are the most important regular patterns.
regA : Str -> A ;
adj1Solo : (solo : Str) -> Bool -> A1 ;
adj1Util : (a,b : Str) -> Bool -> A1 ;
adj1Blu : (blu : Str) -> Bool -> A1 ;
-- These functions create postfix adjectives. To switch
-- them to prefix ones (i.e. ones placed before the noun in
-- modification, as in "petite maison"), the following function is
-- provided.
prefA : A -> A ;
-- Two-place adjectives need a preposition and a case as extra arguments.
--3 Two-place adjectives
--
-- Two-place adjectives need a preposition for their second argument.
mkA2 : A1 -> Preposition -> Case -> A2 ; -- divisibile per
mkA2 : A -> Preposition -> A2 ;
-- Comparison adjectives may need two adjectives, corresponding to the
-- positive and other forms.
--3 Comparison adjectives
mkADeg : (buono, migliore : A1) -> ADeg ;
-- Comparison adjectives are in the worst case put up from two
-- adjectives: the positive ("bueno"), and the comparative ("mejor").
-- In the completely regular case, the comparison forms are constructed by
-- the particle "più".
mkADeg : A -> A -> ADeg ;
aSolo : Str -> Position -> ADeg ; -- lento (, più lento)
aUtil : Str -> Str -> Position -> ADeg ; -- grave (, più grave)
aBlu : Str -> Position -> ADeg ; -- blu (, più blu)
-- If comparison is formed by "mas", as usual in Spanish,
-- the following pattern is used:
-- On top level, there are adjectival phrases. The most common case is
-- just to use a one-place adjective.
compADeg : A -> ADeg ;
apSolo : Str -> Position -> AP ;
apUtil : Str -> Str -> Position -> AP ;
apBlu : Str -> Position -> AP ;
-- The regular pattern is the same as $regA$ for plain adjectives,
-- with comparison by "mas".
regADeg : Str -> ADeg ;
-- From a given $ADeg$, it is possible to get back to $A$.
adegA : ADeg -> A ;
-- For prefixed adjectives, the following function is
-- provided.
prefADeg : ADeg -> ADeg ;
--2 Adverbs
-- Adverbs are not inflected. Most lexical ones have position
-- after the verb.
mkAdv : Str -> Adv ;
-- Some appear next to the verb (e.g. "siempre").
mkAdV : Str -> AdV ;
-- Adverbs modifying adjectives and sentences can also be formed.
mkAdA : Str -> AdA ;
--2 Verbs
--
-- The fragment only has present tense so far, but in all persons.
-- The worst case needs nine forms (and is not very user-friendly).
-- Regular verbs are ones inflected like "cortar", "deber", or "vivir".
-- The regular verb function is the first conjugation ("ar") recognizes
-- the variations corresponding to the patterns
-- "actuar, cazar, guiar, pagar, sacar". The module $BeschSpa$ gives
-- the complete set of "Bescherelle" conjugations.
---- mkV : (_,_,_,_,_,_,_,_,_ : Str) -> V ;
regV : Str -> V ;
-- These are examples of standard conjugations. Other conjugations
-- can be extracted from the Italian functional morphology, which has full
-- "Bescherelle" tables.
--3 Two-place verbs
--
-- Two-place verbs need a preposition, except the special case with direct object.
-- (transitive verbs). Notice that a particle comes from the $V$.
vAmar : Str -> V ;
vVender : Str -> V ;
---- vFinire : Str -> V ;
---- vCorrere : (_,_ : Str) -> V ;
mkV2 : V -> Preposition -> V2 ;
-- The verbs 'be' and 'have' are special.
dirV2 : V -> V2 ;
vSer : V ;
vHaber : V ;
-- You can reuse a $V2$ verb in $V$.
-- Two-place verbs, and the special case with direct object. Notice that
-- a particle can be included in a $V$.
v2V : V2 -> V ;
mkV2 : V -> Preposition -> Case -> V2 ;
tvDir : V -> V2 ;
--3 Three-place verbs
--
-- Three-place (ditransitive) verbs need two prepositions, of which
-- the first one or both can be absent.
-- The idiom with "avere" and an invariable noun, such as "paura", "fame",
-- and a two-place variant with "di" + complement.
mkV3 : V -> Preposition -> Preposition -> V3 ; -- parler, à, de
dirV3 : V -> Preposition -> V3 ; -- donner,_,à
dirdirV3 : V -> V3 ; -- donner,_,_
averCosa : Str -> V ;
averCosaDe : Str -> V2 ;
--3 Other complement patterns
--
-- Verbs and adjectives can take complements such as sentences,
-- questions, verb phrases, and adjectives.
mkV0 : V -> V0 ;
mkVS : V -> VS ;
mkV2S : V -> Preposition -> V2S ;
mkVV : V -> VV ; -- plain infinitive: "je veux parler"
deVV : V -> VV ; -- "j'essaie de parler"
aVV : V -> VV ; -- "j'arrive à parler"
mkV2V : V -> Preposition -> Preposition -> V2V ;
mkVA : V -> VA ;
mkV2A : V -> Preposition -> V2A ;
mkVQ : V -> VQ ;
mkV2Q : V -> Preposition -> V2Q ;
mkAS : A -> AS ;
subjAS : A -> AS ;
mkA2S : A -> Preposition -> A2S ;
mkAV : A -> Preposition -> AV ;
mkA2V : A -> Preposition -> Preposition -> A2V ;
--2 Definitions of the paradigms
--
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
--.
Bool = Prelude.Bool ;
Gender = SyntaxSpa.Gender ;
Case = SyntaxSpa.Case ;
Preposition = SyntaxSpa.Case * Str ;
Number = SyntaxSpa.Number ;
masculine = Masc ;
feminine = Fem ;
nominative = Types.nominative ;
accusative = Types.accusative ;
genitive = Types.genitive ;
dative = Types.dative ;
singular = Types.singular ;
plural = Types.plural ;
prep_a = Types.CPrep P_a ;
prep_de = Types.CPrep Types.P_de ;
accusative = <Types.accusative,[]> ;
genitive = <Types.genitive,[]> ;
dative = <Types.dative,[]> ;
mkPreposition p = <Acc,p> ;
singular = Types.singular ;
plural = Types.plural ;
mkN a b g = mkCNomIrreg a b g ** {lock_N = <>} ;
mkN x y g = mkCNomIrreg x y g ** {lock_N = <>} ;
regN x = mkNomReg x ** {lock_N = <>} ;
compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ;
femN x = {s = x.s ; g = feminine ; lock_N = <>} ;
mascN x = {s = x.s ; g = masculine ; lock_N = <>} ;
nVino = \vino -> mkCNom (nomVino vino) masculine ** {lock_N = <>} ;
nRana = \rana -> mkCNom (nomVino rana) feminine ** {lock_N = <>} ;
nPilar = \x,g -> mkCNom (nomPilar x) g ** {lock_N = <>} ;
nTram = \tram,g -> mkCNom (nomTram tram) g ** {lock_N = <>} ;
funPrep = \n,p -> n ** complement p ** {lock_N2 = <>} ;
funCase = \n,p -> n ** complementCas p ** {lock_N2 = <>} ;
funDe a = funGen a ** {lock_N2 = <>} ;
mkPN s g = mkProperName s g ** {lock_PN = <>} ;
mkCN = UseN ;
mkNP s g = UsePN (mkPN s g) ;
mkN2 = \n,p -> n ** {lock_N2 = <> ; c = p.p1 ; s2 = p.p2} ;
deN2 n = mkN2 n genitive ;
aN2 n = mkN2 n dative ;
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c = p.p1 ; s2 = p.p2 ; c3 = q.p1 ; s3 = q.p2} ;
Position = Bool ;
prepos = adjPre ;
postpos = adjPost ;
mkA1 = \x,y,z,u,v,p -> mkAdjective (mkAdj x y z u v) p ** {lock_A1 = <>} ;
adj1Solo = \a,p -> mkAdjective (adjSolo a) p ** {lock_A1 = <>} ;
adj1Util = \a,b,p -> mkAdjective (adjUtil a b) p ** {lock_A1 = <>} ;
adj1Blu = \a,p -> mkAdjective (adjBlu a) p ** {lock_A1 = <>} ;
mkA2 = \a,p,c -> mkAdjCompl a postpos {s2 = p ; c = c} ** {lock_A2 = <>} ;
mkADeg = \b,m -> mkAdjDegr (mkAdjComp b.s m.s) b.p ** {lock_ADeg = <>} ;
aSolo = \a,p -> mkAdjDegrLong (adjSolo a) p ** {lock_ADeg = <>} ;
aUtil = \a,b,p -> mkAdjDegrLong (adjUtil a b) p ** {lock_ADeg = <>} ;
aBlu = \a,p -> mkAdjDegrLong (adjBlu a) p ** {lock_ADeg = <>} ;
apSolo a p = adj1Solo a p ** {lock_AP = <>} ;
apUtil a b p = adj1Util a b p ** {lock_AP = <>} ;
apBlu a p = adj1Blu a p ** {lock_AP = <>} ;
mkPN x g = {s = x ; g = g} ** {lock_PN = <>} ;
mkNP x g n = let np = mkNameNounPhrase x g in
{s = np.s ; g = np.g ; p = np.p ; c = np.c ; n = n ; lock_NP = <>} ;
-- mkV a b c d e f g h i = mkVerbPres a b c d e f g h i ** {lock_V = <>} ;
vAmar x = verbPres (zurrar_3 x) AHabere ** {lock_V = <>} ;
vVender x = verbPres (vender_4 x) AHabere ** {lock_V = <>} ;
-- vFinire x = verbFinire x ** {lock_V = <>} ;
-- vCorrere x y = verbCorrere x y ** {lock_V = <>} ;
vSer = verbSer ** {lock_V = <>} ;
vHaber = verbHaber ** {lock_V = <>} ;
mkV2 a b c = mkTransVerb a b c ** {lock_V2 = <>} ;
tvDir c = mkTransVerbDir c ** {lock_V2 = <>} ;
mkA a b c d e = mkAdj a b c d e ** {p = False ; lock_A = <>} ;
regA a = mkAdjReg a ** {p = False ; lock_A = <>} ;
prefA a = {s = a.s ; p = True ; lock_A = <>} ;
averCosa = \fame ->
{s = let {aver = vHaber.s} in \\v => aver ! v ++ fame} **
{aux=AHabere ; lock_V = <>} ;
averCosaDe = \fame -> mkV2 (averCosa fame) [] prep_de ** {lock_TV = <>} ;
mkA2 a p = a ** {c = p.p1 ; s2 = p.p2 ; lock_A2 = <>} ;
}
mkADeg a b = {s = table {Pos => a.s ; _ => b.s} ; p = a.p ; lock_ADeg = <>} ;
compADeg a = {s = table {Pos => a.s ; _ => \\f => "mas" ++ a.s ! f} ; p = a.p ;
lock_ADeg = <>} ;
regADeg a = compADeg (regA a) ;
prefADeg a = {s = a.s ; p = True ; lock_ADeg = <>} ;
adegA a = {s = a.s ! Pos ; p = a.p ; lock_A = <>} ;
mkAdv x = ss x ** {lock_Adv = <>} ;
mkAdV x = ss x ** {lock_AdV = <>} ;
mkAdA x = ss x ** {lock_AdA = <>} ;
regV x = -- cortar actuar cazar guiar pagar sacar
let
ar = Predef.dp 2 x ;
z = Predef.dp 1 (Predef.tk 2 x) ;
verb = case ar of {
"ir" => vivir_7 x ;
"er" => deber_6 x ;
_ => case z of {
"u" => actuar_9 x ;
"z" => cazar_21 x ;
"i" => guiar_43 x ;
"g" => pagar_53 x ;
"c" => sacar_72 x ;
_ => cortar_5 x
}
}
in verbPres verb AHabere ** {lock_V = <>} ;
mkV2 v p = {s = v.s ; aux = v.aux ; s2 = p.p2 ; c = p.p1 ; lock_V2 = <>} ;
dirV2 v = mkV2 v accusative ;
v2V v = v ** {lock_V = <>} ;
mkV3 v p q = {s = v.s ; aux = v.aux ;
s2 = p.p2 ; s3 = q.p2 ; c = p.p1 ; c3 = q.p1 ; lock_V3 = <>} ;
dirV3 v p = mkV3 v accusative p ;
dirdirV3 v = dirV3 v dative ;
mkV0 v = v ** {lock_V0 = <>} ;
mkVS v = v ** {mn,mp = Ind ; lock_VS = <>} ; ---- more moods
mkV2S v p = mkV2 v p ** {mn,mp = Ind ; lock_V2S = <>} ;
mkVV v = v ** {c = accusative ; lock_VV = <>} ;
deVV v = v ** {c = genitive.p1 ; lock_VV = <>} ;
aVV v = v ** {c = dative.p1 ; lock_VV = <>} ;
mkV2V v p t = mkV2 v p ** {c3 = t.p1 ; s3 = p.p2 ; lock_V2V = <>} ;
mkVA v = v ** {lock_VA = <>} ;
mkV2A v p = mkV2 v p ** {lock_V2A = <>} ;
mkVQ v = v ** {lock_VQ = <>} ;
mkV2Q v p = mkV2 v p ** {lock_V2Q = <>} ;
mkAS v = v ** {mn,mp = Ind ; lock_AS = <>} ; ---- more moods
mkA2S v p = mkA2 v p ** {mn,mp = Ind ; lock_A2S = <>} ;
mkAV v p = v ** {c = p.p1 ; s2 = p.p2 ; lock_AV = <>} ;
mkA2V v p q = mkA2 v p ** {s3 = q.p2 ; c3 = q.p1 ; lock_A2V = <>} ;
} ;