1
0
forked from GitHub/gf-core

starting Spanish

This commit is contained in:
aarne
2004-12-09 13:52:03 +00:00
parent f45bdbfa54
commit 7f4c23c6f5
9 changed files with 2412 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
--# -path=.:../romance:../abstract:../../prelude
concrete CategoriesIta of Categories =
CategoriesRomance with (SyntaxRomance=SyntaxIta) ;

View File

@@ -0,0 +1,207 @@
--# -path=.:../romance:../../prelude
--1 A Simple Spanish Resource Morphology
--
-- Aarne Ranta 2002--2003
--
-- This resource morphology contains definitions needed in the resource
-- syntax. It moreover contains the most usual inflectional patterns.
-- The patterns for verbs contain the complete "Bescherelle" conjugation
-- tables.
--
-- We use the parameter types and word classes defined in $TypesSpa.gf$.
resource MorphoSpa = open (Predef=Predef), Prelude, TypesSpa in {
--2 Some phonology
--
--3 Elision
--
-- The phonological rule of *elision* can be defined as follows in GF.
-- In Italian it includes both vowels and the *impure 's'*.
oper
vocale : Strs = strs {
"a" ; "e" ; "h" ; "i" ; "o" ; "u"
} ;
sImpuro : Strs = strs {
"z" ; "sb" ; "sc" ; "sd" ; "sf" ; "sm" ; "sp" ; "sq" ; "sr" ; "st" ; "sv"
} ;
elision : (_,_,_ : Str) -> Str = \il, l', lo ->
pre {il ; l' / vocale ; lo / sImpuro} ;
elisQue = "che" ; --- no elision in Italian
elisDe = "de" ;
--2 Nouns
--
-- The following macro is useful for creating the forms of number-dependent
-- tables, such as common nouns.
numForms : (_,_ : Str) -> Number => Str = \vino, vini ->
table {Sg => vino ; Pl => vini} ;
-- For example:
nomVino : Str -> Number => Str = \vino -> let {vin = Predef.tk 1 vino} in
numForms vino (vin + "i") ;
nomRana : Str -> Number => Str = \rana -> let {ran = Predef.tk 1 rana} in
numForms rana (ran + "e") ;
nomSale : Str -> Number => Str = \sale -> let {sal = Predef.tk 1 sale} in
numForms sale (sal + "i") ;
nomTram : Str -> Number => Str = \tram ->
numForms tram tram ;
-- Common nouns are inflected in number and have an inherent gender.
mkCNom : (Number => Str) -> Gender -> CNom = \mecmecs,gen ->
{s = mecmecs ; g = gen} ;
mkCNomIrreg : Str -> Str -> Gender -> CNom = \mec,mecs ->
mkCNom (numForms mec mecs) ;
--2 Adjectives
--
-- 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 ->
{s = table {
AF Masc n => numForms solo soli ! n ;
AF Fem n => numForms sola sole ! n ;
AA => solamente
}
} ;
-- Then the regular and invariant patterns.
adjSolo : Str -> Adj = \solo ->
let
sol = Predef.tk 1 solo
in
mkAdj solo (sol + "a") (sol + "i") (sol + "e") (sol + "amente") ;
adjTale : Str -> Adj = \tale ->
let
tal = Predef.tk 1 tale ;
tali = tal + "i" ;
tala = if_then_Str (pbool2bool (Predef.occur (Predef.dp 1 tal) "lr")) tal tale
in
mkAdj tale tale tali tali (tala + "mente") ;
adjBlu : Str -> Adj = \blu ->
mkAdj blu blu blu blu blu ; ---
--2 Personal pronouns
--
-- All the eight personal pronouns can be built by the following macro.
-- The use of "ne" as atonic genitive is debatable.
-- We follow the rule that the atonic nominative is empty.
mkPronoun : (_,_,_,_,_,_,_,_ : Str) ->
PronGen -> Number -> Person -> ClitType -> Pronoun =
\il,le,lui,Lui,son,sa,ses,see,g,n,p,c ->
{s = table {
Ton Nom => il ;
Ton x => prepCase x ++ Lui ;
Aton Nom => il ; ---- [] ;
Aton Acc => le ;
Aton (CPrep P_di) => "ne" ; --- hmm
Aton (CPrep P_a) => lui ;
Aton (CPrep q) => strPrep q ++ Lui ; ---- GF bug with c or p!
Poss Sg Masc => son ;
Poss Sg Fem => sa ;
Poss Pl Masc => ses ;
Poss Pl Fem => see
} ;
g = g ;
n = n ;
p = p ;
c = c
} ;
--2 Reflexive pronouns
--
-- It is simply a function depending on number and person.
pronRefl : Number -> Person -> Str = \n,p -> case <n,p> of {
<Sg,P1> => "mi" ;
<Sg,P2> => "ti" ;
<_, P3> => "si" ;
<Pl,P1> => "ci" ;
<Pl,P2> => "vi"
} ;
--2 Determiners
--
-- 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 ;
qualPron : Gender -> Number -> Str = pronForms (adjTale "quale") ;
talPron : Gender -> Number -> Str = pronForms (adjTale "tale") ;
tuttoPron : Gender -> Number -> Str = pronForms (adjSolo "tutto") ;
--2 Articles
--
-- The definite article has quite some variation: three parameters and
-- elision. This is the simples definition we have been able to find.
artDefTable : Gender => Number => Case => Str = \\g,n,c => case <g,n,c> of {
<_, _, CPrep P_di> => prepArt g n "de" ;
<_, _, CPrep P_da> => prepArt g n "da" ;
<_, _, CPrep P_a> => prepArt g n "a" ;
<_, _, CPrep P_in> => prepArt g n "ne" ;
<_, _, CPrep P_su> => prepArt g n "su" ;
<_, _, CPrep P_con> => prepArt g n "co" ;
<Masc,Sg, Nom> => elision "il" "l'" "lo" ;
<Masc,Sg, _> => elision "il" "l'" "lo" ;
<Fem ,Sg, _> => elision "la" "l'" "la" ;
<Masc,Pl, _> => elision "i" "gli" "gli" ;
<Fem ,Pl, _> => "le"
} ;
-- This auxiliary expresses the uniform rule.
prepArt : Gender -> Number -> Tok -> Tok = \g,n,de -> case <g,n> of {
<Masc,Sg> => elision (de + "l") (de + "ll'") (de + "llo") ;
<Masc,Pl> => elision (de + "i") (de + "gli") (de + "gli") ;
<Fem, Sg> => elision (de + "lla") (de + "ll'") (de + "lla") ;
<Fem, Pl> => de + "lle"
} ;
--2 Verbs
--
--3 The Bescherell conjugations.
--
-- The following conjugations tables were generated using FM software
-- from a Haskell source.
--
-- The verb "essere" is often used in syntax.
-- verbEssere = verbPres (essere_5 "essere") AEsse ;
-- verbAvere = verbPres (avere_6 "avere") AHabere ;
-- machine-generated GF code
-- for Numerals
param DForm = unit | teen | ten | hundred ;
param Modif = mod | unmod | conj ;
}

View File

@@ -0,0 +1,60 @@
concrete NumeralsSpa of Numerals = open MorphoSpa in {
-- by Carlos Gonzalia, Chalmers, 1999
-- original source automatically translated to new GF by AR
lincat Numeral = {s : Str} ;
lincat Digit = {inh : Modif ; s : {p1 : DForm ; p2 : Modif} => Str} ;
lincat Sub10 = {s : {p1 : DForm ; p2 : Modif} => Str} ;
lincat Sub100 = {s : Str} ;
lincat Sub1000 = {s : Str} ;
lincat Sub1000000 = {s : Str} ;
lin num x0 =
{s = x0.s} ;
lin n2 =
{inh = mod ; s = table {{p1 = unit ; p2 = mod} => "dos" ; {p1 = unit ; p2 = unmod} => "dos" ; {p1 = unit ; p2 = conj} => "y" ++ "dos" ; {p1 = teen ; p2 = mod} => "doce" ; {p1 = teen ; p2 = unmod} => "doce" ; {p1 = teen ; p2 = conj} => "doce" ; {p1 = ten ; p2 = mod} => "veinti" ; {p1 = ten ; p2 = unmod} => "veinte" ; {p1 = ten ; p2 = conj} => "veinte" ; {p1 = hundred ; p2 = mod} => "doscientos" ; {p1 = hundred ; p2 = unmod} => "doscientos" ; {p1 = hundred ; p2 = conj} => "doscientos"}} ;
lin n3 =
{inh = conj ; s = table {{p1 = unit ; p2 = mod} => "tres" ; {p1 = unit ; p2 = unmod} => "tres" ; {p1 = unit ; p2 = conj} => "y" ++ "tres" ; {p1 = teen ; p2 = mod} => "trece" ; {p1 = teen ; p2 = unmod} => "trece" ; {p1 = teen ; p2 = conj} => "trece" ; {p1 = ten ; p2 = mod} => "treinta" ; {p1 = ten ; p2 = unmod} => "treinta" ; {p1 = ten ; p2 = conj} => "treinta" ; {p1 = hundred ; p2 = mod} => "trescientos" ; {p1 = hundred ; p2 = unmod} => "trescientos" ; {p1 = hundred ; p2 = conj} => "trescientos"}} ;
lin n4 =
{inh = conj ; s = table {{p1 = unit ; p2 = mod} => "cuatro" ; {p1 = unit ; p2 = unmod} => "cuatro" ; {p1 = unit ; p2 = conj} => "y" ++ "cuatro" ; {p1 = teen ; p2 = mod} => "catorce" ; {p1 = teen ; p2 = unmod} => "catorce" ; {p1 = teen ; p2 = conj} => "catorce" ; {p1 = ten ; p2 = mod} => "cuarenta" ; {p1 = ten ; p2 = unmod} => "cuarenta" ; {p1 = ten ; p2 = conj} => "cuarenta" ; {p1 = hundred ; p2 = mod} => "cuatrocientos" ; {p1 = hundred ; p2 = unmod} => "cuatrocientos" ; {p1 = hundred ; p2 = conj} => "cuatrocientos"}} ;
lin n5 =
{inh = conj ; s = table {{p1 = unit ; p2 = mod} => "cinco" ; {p1 = unit ; p2 = unmod} => "cinco" ; {p1 = unit ; p2 = conj} => "y" ++ "cinco" ; {p1 = teen ; p2 = mod} => "quince" ; {p1 = teen ; p2 = unmod} => "quince" ; {p1 = teen ; p2 = conj} => "quince" ; {p1 = ten ; p2 = mod} => "cincuenta" ; {p1 = ten ; p2 = unmod} => "cincuenta" ; {p1 = ten ; p2 = conj} => "cincuenta" ; {p1 = hundred ; p2 = mod} => "quinientos" ; {p1 = hundred ; p2 = unmod} => "quinientos" ; {p1 = hundred ; p2 = conj} => "quinientos"}} ;
lin n6 =
{inh = conj ; s = table {{p1 = unit ; p2 = mod} => "seis" ; {p1 = unit ; p2 = unmod} => "seis" ; {p1 = unit ; p2 = conj} => "y" ++ "seis" ; {p1 = teen ; p2 = mod} => "dieciseis" ; {p1 = teen ; p2 = unmod} => "dieciseis" ; {p1 = teen ; p2 = conj} => "dieciseis" ; {p1 = ten ; p2 = mod} => "sesenta" ; {p1 = ten ; p2 = unmod} => "sesenta" ; {p1 = ten ; p2 = conj} => "sesenta" ; {p1 = hundred ; p2 = mod} => "seiscientos" ; {p1 = hundred ; p2 = unmod} => "seiscientos" ; {p1 = hundred ; p2 = conj} => "seiscientos"}} ;
lin n7 =
{inh = conj ; s = table {{p1 = unit ; p2 = mod} => "siete" ; {p1 = unit ; p2 = unmod} => "siete" ; {p1 = unit ; p2 = conj} => "y" ++ "siete" ; {p1 = teen ; p2 = mod} => "diecisiete" ; {p1 = teen ; p2 = unmod} => "diecisiete" ; {p1 = teen ; p2 = conj} => "diecisiete" ; {p1 = ten ; p2 = mod} => "setenta" ; {p1 = ten ; p2 = unmod} => "setenta" ; {p1 = ten ; p2 = conj} => "setenta" ; {p1 = hundred ; p2 = mod} => "setecientos" ; {p1 = hundred ; p2 = unmod} => "setecientos" ; {p1 = hundred ; p2 = conj} => "setecientos"}} ;
lin n8 =
{inh = conj ; s = table {{p1 = unit ; p2 = mod} => "ocho" ; {p1 = unit ; p2 = unmod} => "ocho" ; {p1 = unit ; p2 = conj} => "y" ++ "ocho" ; {p1 = teen ; p2 = mod} => "dieciocho" ; {p1 = teen ; p2 = unmod} => "dieciocho" ; {p1 = teen ; p2 = conj} => "dieciocho" ; {p1 = ten ; p2 = mod} => "ochenta" ; {p1 = ten ; p2 = unmod} => "ochenta" ; {p1 = ten ; p2 = conj} => "ochenta" ; {p1 = hundred ; p2 = mod} => "ochocientos" ; {p1 = hundred ; p2 = unmod} => "ochocientos" ; {p1 = hundred ; p2 = conj} => "ochocientos"}} ;
lin n9 =
{inh = conj ; s = table {{p1 = unit ; p2 = mod} => "nueve" ; {p1 = unit ; p2 = unmod} => "nueve" ; {p1 = unit ; p2 = conj} => "y" ++ "nueve" ; {p1 = teen ; p2 = mod} => "diecinueve" ; {p1 = teen ; p2 = unmod} => "diecinueve" ; {p1 = teen ; p2 = conj} => "diecinueve" ; {p1 = ten ; p2 = mod} => "noventa" ; {p1 = ten ; p2 = unmod} => "noventa" ; {p1 = ten ; p2 = conj} => "noventa" ; {p1 = hundred ; p2 = mod} => "novecientos" ; {p1 = hundred ; p2 = unmod} => "novecientos" ; {p1 = hundred ; p2 = conj} => "novecientos"}} ;
lin pot01 =
{s = table {{p1 = unit ; p2 = mod} => "uno" ; {p1 = unit ; p2 = unmod} => "uno" ; {p1 = unit ; p2 = conj} => "y" ++ "uno" ; {p1 = teen ; p2 = mod} => "uno" ; {p1 = teen ; p2 = unmod} => "uno" ; {p1 = teen ; p2 = conj} => "y" ++ "uno" ; {p1 = ten ; p2 = mod} => "uno" ; {p1 = ten ; p2 = unmod} => "uno" ; {p1 = ten ; p2 = conj} => "y" ++ "uno" ; {p1 = hundred ; p2 = mod} => "ciento" ; {p1 = hundred ; p2 = unmod} => "cien" ; {p1 = hundred ; p2 = conj} => "y" ++ "uno"}} ;
lin pot0 d =
{s = table {{p1 = unit ; p2 = mod} => d.s ! {p1 = unit ; p2 = mod} ; {p1 = unit ; p2 = unmod} => d.s ! {p1 = unit ; p2 = unmod} ; {p1 = unit ; p2 = conj} => d.s ! {p1 = unit ; p2 = conj} ; {p1 = teen ; p2 = mod} => d.s ! {p1 = teen ; p2 = mod} ; {p1 = teen ; p2 = unmod} => d.s ! {p1 = teen ; p2 = unmod} ; {p1 = teen ; p2 = conj} => d.s ! {p1 = teen ; p2 = conj} ; {p1 = ten ; p2 = mod} => d.s ! {p1 = ten ; p2 = mod} ; {p1 = ten ; p2 = unmod} => d.s ! {p1 = ten ; p2 = unmod} ; {p1 = ten ; p2 = conj} => d.s ! {p1 = ten ; p2 = conj} ; {p1 = hundred ; p2 = mod} => d.s ! {p1 = hundred ; p2 = mod} ; {p1 = hundred ; p2 = unmod} => d.s ! {p1 = hundred ; p2 = unmod} ; {p1 = hundred ; p2 = conj} => d.s ! {p1 = hundred ; p2 = conj}}} ;
lin pot110 =
{s = "diez"} ;
lin pot111 =
{s = "once"} ;
lin pot1to19 d =
{s = d.s ! {p1 = teen ; p2 = unmod}} ;
lin pot0as1 n =
{s = n.s ! {p1 = unit ; p2 = unmod}} ;
lin pot1 d =
{s = d.s ! {p1 = ten ; p2 = unmod}} ;
lin pot1plus d e =
{s = (d.s ! {p1 = ten ; p2 = mod}) ++ e.s ! {p1 = unit ; p2 = d.inh}} ;
lin pot1as2 n =
{s = n.s} ;
lin pot2 d =
{s = d.s ! {p1 = hundred ; p2 = unmod}} ;
lin pot2plus d e =
{s = (d.s ! {p1 = hundred ; p2 = mod}) ++ e.s} ;
lin pot2as3 n =
{s = n.s} ;
lin pot3 n =
{s = n.s ++ "mil"} ;
lin pot3plus n m =
{s = n.s ++ "mil" ++ m.s} ;
}

View File

@@ -0,0 +1,4 @@
--# -path=.:../romance:../abstract:../../prelude
concrete RulesIta of Rules =
RulesRomance with (SyntaxRomance=SyntaxIta) ;

View File

@@ -0,0 +1,113 @@
--# -path=.:../romance:../abstract:../../prelude
concrete StructuralIta of Structural = CategoriesIta, NumeralsIta **
open SyntaxIta, MorphoIta, Prelude in {
lin
INP = pronNounPhrase pronJe ;
ThouNP = pronNounPhrase pronTu ;
HeNP = pronNounPhrase pronIl ;
SheNP = pronNounPhrase pronElle ;
WeNumNP n = pronNounPhrase (pronWithNum pronNous n) ;
YeNumNP n = pronNounPhrase (pronWithNum pronVous n) ;
YouNP = pronNounPhrase pronVous ;
TheyNP = pronNounPhrase pronIls ;
-- Here is a point where the API is really inadequate for French,
-- which distinguishes between masculine and feminine "they".
-- The following solution is not attractive.
--- TheyNP = pronNounPhrase (variants {pronIls ; pronElles}) ;
ThisNP = mkNameNounPhrase ["questo"] Masc ;
ThatNP = mkNameNounPhrase ["quello"] Masc ;
TheseNumNP n = mkNameNounPhrase ("questi" ++ n.s ! Masc) Masc ;
ThoseNumNP n = mkNameNounPhrase ("quelli" ++ n.s ! Masc) Masc ;
ItNP = pronNounPhrase pronIl ;
EveryDet = chaqueDet ;
AllMassDet = mkDeterminer singular "tutto" "tutta" ;
AllNumDet = mkDeterminerNum plural ["tutti i"] ["tutte le"] ; --- gli
WhichDet = quelDet ;
WhichNumDet = mkDeterminerNum plural "quali" "quali" ;
MostsDet = plupartDet ;
MostDet = mkDeterminer1 singular (["la maggior parte"] ++ elisDe) ; --- de
SomeDet = mkDeterminer1 singular "qualche" ;
SomeNumDet = mkDeterminerNum plural "alcuni" "alcune" ;
NoDet = mkDeterminer singular "nessuno" "nessuna" ; --- non
NoNumDet = mkDeterminerNum plural "nessuni" "nessune" ; ---- ??
AnyDet = mkDeterminer1 singular "qualche" ; ---
AnyNumDet = mkDeterminerNum plural "alcuni" "alcune" ; ---
ManyDet = mkDeterminer plural "molti" "molte" ;
MuchDet = mkDeterminer1 singular "molto" ;
ThisDet = mkDeterminer singular "questo" "questa" ;
ThatDet = mkDeterminer singular "quello" "quella" ;
TheseNumDet = mkDeterminerNum plural "questi" "queste" ; --- ci
ThoseNumDet = mkDeterminerNum plural "quelli" "quelle" ; --- quegli
UseNumeral n = {s = \\_ => n.s} ; ---- gender
HowIAdv = commentAdv ;
WhenIAdv = quandAdv ;
WhereIAdv = ouAdv ;
WhyIAdv = pourquoiAdv ;
AndConj = etConj ;
OrConj = ouConj ;
BothAnd = etetConj ;
EitherOr = ououConj ;
NeitherNor = niniConj ; --- requires ne !
IfSubj = siSubj ;
WhenSubj = quandSubj ;
PhrYes = ouiPhr ;
PhrNo = nonPhr ; --- and also Si!
VeryAdv = ss "molto" ;
TooAdv = ss "troppo" ;
OtherwiseAdv = ss "altramente" ;
ThereforeAdv = ss "quindi" ;
EverybodyNP = mkNameNounPhrase ["tutti"] Masc ;
SomebodyNP = mkNameNounPhrase ["qualcuno"] Masc ;
NobodyNP = mkNameNounPhrase ["nessuno"] Masc ; --- ne
EverythingNP = mkNameNounPhrase ["tutto"] Masc ;
SomethingNP = mkNameNounPhrase ["qualche cosa"] Masc ;
NothingNP = mkNameNounPhrase ["niente"] Masc ; --- ne
CanVV = mkVerbVerbDir (verbPres (potere_72 "potere") AHabere) ;
CanKnowVV = mkVerbVerbDir (verbPres (sapere_81 "sapere") AHabere) ;
MustVV = mkVerbVerbDir (verbPres (dovere_50 "dovere") AHabere) ;
WantVV = mkVerbVerbDir (verbPres (volere_99 "volere") AHabere) ;
EverywhereNP = ss "dappertutto" ;
SomewhereNP = ss ["qualche parte"] ; --- ne - pas
NowhereNP = ss ["nessun parte"] ;
AlthoughSubj = ss "benché" ** {m = Con} ;
AlmostAdv = ss "quasi" ;
QuiteAdv = ss "assai" ;
InPrep = justCase (CPrep P_in) ;
OnPrep = justCase (CPrep P_su) ;
ToPrep = justCase dative ; ---
ThroughPrep = justPrep "per" ;
AbovePrep = justPrep "sopra" ;
UnderPrep = justPrep "sotto" ;
InFrontPrep = justPrep "davanti" ;
BehindPrep = justPrep "dietro" ;
BetweenPrep = justPrep "tra" ;
FromPrep = justCase (CPrep P_da) ;
BeforePrep = justPrep "prima" ;
DuringPrep = justPrep "durante" ;
AfterPrep = justPrep "dopo" ;
WithPrep = justCase (CPrep P_con) ;
WithoutPrep = justPrep "senza" ;
ByMeansPrep = justPrep "per" ;
PossessPrep = justCase genitive ;
PartPrep = justCase genitive ; ---
AgentPrep = justCase (CPrep P_da) ;
}

View File

@@ -0,0 +1,319 @@
--# -path=.:../romance:../../prelude
instance SyntaxIta of SyntaxRomance =
TypesIta ** open Prelude, (CO=Coordination), MorphoIta in {
oper
nameNounPhrase = \jean ->
normalNounPhrase
(\\c => prepCase c ++ jean.s)
jean.g
Sg ;
nounPhraseOn = mkNameNounPhrase "si" Masc ; --- can be plural dep. on object
partitiveNounPhrase = \n,vino ->
normalNounPhrase
(table {
CPrep P_di => elisDe ++ vino.s ! n ;
c => prepCase c ++ artDef vino.g n (CPrep P_di) ++ vino.s ! n
}
)
vino.g
n ;
chaqueDet = mkDeterminer1 Sg "ogni" ;
tousDet = mkDeterminer Pl ["tutti i"] ["tutte le"] ; --- gli
plupartDet = mkDeterminer1 Pl ["la maggior parte di"] ; --- dei, degli, delle
unDet = mkDeterminer Sg artUno artUna ;
plDet = mkDeterminer1 Pl [] ; --- dei, degli, delle
quelDet = mkDeterminer1 Sg "quale" ;
npGenPoss = \n,ton,mec ->
\\c => artDef mec.g n c ++ ton.s ! Poss n mec.g ++ mec.s ! n ; --- mia madre
npGenPossNum = \nu,ton,mec ->
\\c => artDef mec.g Pl c ++ ton.s ! Poss Pl mec.g ++ nu.s ! mec.g ++ mec.s ! Pl ;
existNounPhrase = \delvino -> {
s = \\m =>
case m of {
Ind => case delvino.n of {Sg => "c'è" ; Pl => ["ci sono"]} ;
Con => case delvino.n of {Sg => ["ci sia"] ; Pl => ["ci siano"]}
} ++ delvino.s ! stressed accusative --- ce ne sono ; have to define "ci"
} ;
mkAdjSolo : Str -> Bool -> Adjective = \adj,p ->
mkAdjective (adjSolo adj) p ;
mkAdjTale : Str -> Bool -> Adjective = \adj,p ->
mkAdjective (adjTale adj) p ;
mkAdjDegrSolo : Str -> Bool -> AdjDegr = \adj,p ->
mkAdjDegrLong (adjSolo adj) p ;
mkAdjDegrTale : Str -> Bool -> AdjDegr = \adj,p ->
mkAdjDegrLong (adjTale adj) p ;
comparConj = variants {"di" ; "che"} ;
-- The commonest case for functions is common noun + "di".
funGen : CommNounPhrase -> Function = \mere ->
mere ** complementCas genitive ;
-- Chains of "cui" - "cui" do not arise.
funRelPron = \mere,lequel ->
{s = table {
RComplex g n c => variants {
case mere.c of {
CPrep P_di => artDef mere.g n c ++
lequel.s ! RSimple dative ++ mere.s ! n ;
_ => nonExist} ;
artDef mere.g n c ++ mere.s ! n ++
mere.s2 ++ lequel.s ! RComplex g n mere.c
} ;
_ => nonExist
} ;
g = RG mere.g
} ;
-- Verbs
negVerb = \va -> "non" ++ va ;
copula = \b,w -> let etre = (predVerb verbEssere).s in
etre ! b ! Masc ! w ; ---- Masc
isClitCase = \c -> case c of {
Acc => True ;
CPrep P_a => True ; -- dative
_ => False
} ;
auxVerb ve = case ve.aux of {
AHabere => verbAvere ;
AEsse => verbEssere
} ;
-- The negation of a verb.
posNeg = \b,v,c ->
if_then_else Str b
(v ++ c)
("non" ++ v ++ c) ;
embedConj = "che" ;
-- Relative pronouns
identRelPron = {
s = table {
RSimple c => relPronForms ! c ;
RComplex g n c => composRelPron g n c
} ;
g = RNoGen
} ;
suchPron = talPron ;
composRelPron = ilqualPron ;
allRelForms = \lequel,g,n,c ->
variants {
lequel.s ! RSimple c ;
lequel.s ! RComplex g n c
} ;
-- Interrogative pronouns
nounIntPron = \n, mec ->
{s = \\c => prepCase c ++ qualPron mec.g n ++ mec.s ! n ;
g = mec.g ;
n = n
} ;
intPronWho = \num -> {
s = \\c => prepCase c ++ "chi" ;
g = Masc ; --- can we decide this?
n = num
} ;
intPronWhat = \num -> {
s = table {
c => prepCase c ++ "che" ++ optStr "cosa"
} ;
g = Masc ; --- can we decide this?
n = num
} ;
-- Questions
questVerbPhrase = \jean,dort ->
{s = table {
DirQ => (predVerbPhrase jean dort).s ! Ind ;
IndirQ => "se" ++ (predVerbPhrase jean dort).s ! Ind
}
} ;
existNounPhraseQuest = \delvino ->
let cedelvino = (existNounPhrase delvino).s ! Ind
in {
s = \\m => case m of {DirQ => [] ; _ => "se"} ++ cedelvino
} ;
intVerbPhrase = \qui, dormir ->
let dort = dormir.s ! qui.g ! VPF Simul (VFin presInd qui.n P3)
in
{s = table {
_ => qui.s ! Nom ++ dort
}
} ;
intSlash = \Qui, Tuvois ->
let {qui = Tuvois.s2 ++ Qui.s ! Tuvois.c ; tuvois = Tuvois.s ! Ind} in
{s = table {
DirQ => qui ++ tuvois ;
IndirQ => ifCe Tuvois.c ++ qui ++ tuvois
}
} ;
-- An auxiliary to distinguish between
-- "je ne sais pas" ("ce qui dort" / "ce que tu veux" / "à qui tu penses").
ifCe : Case -> Str = \c -> case c of { ---
Nom => "ciò" ;
Acc => "ciò" ;
_ => []
} ;
questAdverbial = \quand, jean, dort ->
let {jeandort = (predVerbPhrase jean dort).s ! Ind} in
{s = table {
DirQ => quand.s ++ jeandort ; --- inversion?
IndirQ => quand.s ++ jeandort
}
} ;
---- moved from MorphoIta
-- A macro for defining gender-dependent tables will be useful.
-- Its first application is in the indefinite article.
genForms = \matto, matta ->
table {Masc => matto ; Fem => matta} ;
artUno : Str = elision "un" "un" "uno" ;
artUna : Str = elision "una" "un'" "una" ;
artIndef = \g,n,c -> case n of {
Sg => prepCase c ++ genForms artUno artUna ! g ;
_ => prepCase c ++ []
} ;
artDef = \g,n,c -> artDefTable ! g ! n ! c ;
-- The composable pronoun "il quale" is inflected by varying the definite
-- article and the determiner "quale" in the expected way.
ilqualPron : Gender -> Number -> Case -> Str = \g,n,c ->
artDef g n c ++ qualPron g n ;
pronJe = mkPronoun
"io" --- (variants {"io" ; []}) etc
"mi"
"mi"
"me"
"mio" "mia" "miei" "mie"
PNoGen -- gender cannot be known from pronoun alone
Sg
P1
Clit1 ;
pronTu = mkPronoun
"tu"
"ti"
"ti"
"te"
"tuo" "tua" "tuoi" "tue"
PNoGen
Sg
P2
Clit1 ;
pronIl = mkPronoun
"lui"
"lo"
"gli"
"lui"
"suo" "sua" "suoi" "sue"
(PGen Masc)
Sg
P3
Clit2 ;
pronElle = mkPronoun
"lei"
"la"
"le"
"lei"
"suo" "sua" "suoi" "sue"
(PGen Fem)
Sg
P3
Clit2 ;
pronNous = mkPronoun
"noi"
"ci"
"ci"
"noi"
"nostro" "nostra" "nostri" "nostre"
PNoGen
Pl
P1
Clit3 ;
pronVous = mkPronoun
"voi"
"vi"
"vi"
"voi"
"vostro" "vostra" "vostri" "vostre"
PNoGen
Pl --- depends!
P2
Clit3 ;
pronIls = mkPronoun
"loro"
"loro"
"li" --- le !
"loro"
"loro" "loro" "loro" "loro"
PNoGen
Pl
P3
Clit1 ;
-- moved from ResIta
commentAdv = ss "comme" ;
quandAdv = ss "quando" ;
ouAdv = ss "o" ;
pourquoiAdv = ss "perché" ;
etConj = ss "e" ** {n = Pl} ;
ouConj = ss "o" ** {n = Sg} ;
etetConj = sd2 "e" "e" ** {n = Pl} ;
ououConj = sd2 "o" "o" ** {n = Sg} ;
niniConj = sd2 "né" "né" ** {n = Sg} ; --- requires ne !
siSubj = ss "se" ** {m = Ind} ;
quandSubj = ss "quando" ** {m = Ind} ;
ouiPhr = ss ["Sì ."] ;
nonPhr = ss ["No ."] ;
}

View File

@@ -0,0 +1,48 @@
--# -path=.:../romance:../abstract:../../prelude
concrete TestResourceIta of TestResource =
RulesIta, StructuralIta ** open Prelude, TypesIta, MorphoIta, SyntaxIta in {
flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ;
lin
Big = mkAdjDegrTale "grande" adjPre ;
Small = mkAdjDegrSolo "piccolo" adjPre ;
Old = mkAdjDegrLong (mkAdj "vecchio" "vecchia" "vecchi" "vecchie" "vecchiamente")
adjPre ;
Young = mkAdjDegrTale "giovane" adjPre ;
Happy = mkAdjDegrTale "felice" adjPost ;
American = mkAdjective (adjSolo "americano") adjPost ;
Finnish = mkAdjective (adjTale "finlandese") adjPost ;
Married = mkAdjCompl (adjSolo "sposato") adjPost {s2 = [] ; c = dative} ;
Man = mkCNom (numForms "uomo" "uomini") Masc ;
Woman = mkCNom (nomRana "donna") Fem ;
Car = mkCNom (nomRana "macchina") Fem ;
Light = mkCNom (nomSale "luce") Fem ;
House = mkCNom (nomRana "casa") Fem ;
Wine = mkCNom (nomVino "vino") Masc ;
Bottle = mkCNom (nomRana "bottiglia") Fem ;
Bar = mkCNom (nomTram "bar") Masc ;
Walk = verbPres (amare_7 "camminare") AHabere ;
Run = (verbPres (correre_41 "correre") AHabere) ;
Send = mkTransVerbDir (verbPres (amare_7 "mandare") AHabere) ;
Love = mkTransVerbDir (verbPres (amare_7 "amare") AHabere) ;
Wait = mkTransVerbCas (verbPres (amare_7 "aspettare") AHabere) dative ;
Drink = mkTransVerbDir (verbPres (bere_29 "bere") AHabere) ;
Give = mkDitransVerb (verbPres (dare_17 "dare") AHabere) [] dative [] accusative ;
Prefer = mkDitransVerb (verbPres (finire_103 "preferire") AHabere) [] accusative [] dative ;
Say = verbSent (verbPres (dire_44 "dire") AHabere) Ind Ind ;
Prove = verbSent (verbPres (amare_7 "dimostrare") AHabere) Ind Ind ;
SwitchOn = mkTransVerbDir (verbPres (amare_7 "allumare") AHabere) ;
SwitchOff = mkTransVerbDir (verbPres (spegnere_89 "spegnere") AHabere) ;
Mother = funGen (mkCNom (nomSale "madre") Fem) ;
Uncle = funGen (mkCNom (nomVino "zio") Masc) ;
Connection = mkCNom (nomSale "connessione") Fem **
{s2 = [] ; c = CPrep P_da ; s3 = [] ; c3 = dative} ;
Well = ss "bene" ;
Always = ss "sempre" ;
John = mkProperName "Giovanni" Masc ;
Mary = mkProperName "Maria" Fem ;
}

View File

@@ -0,0 +1,151 @@
--1 Spanish Word Classes and Morphological Parameters
--
-- This is a resource module for Spanish morphology, defining the
-- morphological parameters and word classes of Spanish.
-- The morphology is so far only
-- complete w.r.t. the syntax part of the resource grammar.
-- It does not include those parameters that are not needed for
-- analysing individual words: such parameters are defined in syntax modules.
instance TypesSpa of TypesRomance = {
-- First we give values to the abstract types.
param
Case = Nom | Acc | CPrep Prep ;
Prep = P_de | P_a ;
NPForm = Ton Case | Aton Case | Poss Number Gender ;
--2 Prepositions
--
-- The type $Case$ in $types.Ita.gf$ has the dative and genitive
-- cases, which are relevant for pronouns and the definite article,
-- but which are otherwise expressed by prepositions.
oper
prepCase = \c -> case c of {
Nom => [] ;
Acc => [] ;
CPrep p => strPrep p
} ;
strPrep : Prep -> Str = \p -> case p of {
P_di => "de" ;
P_a => "a"
} ;
oper
CaseA = Case ;
NPFormA = NPForm ;
nominative = Nom ;
accusative = Acc ;
genitive = CPrep P_de ;
dative = CPrep P_a ;
stressed = Ton ;
unstressed = Aton ;
oper
pform2case = \p -> case p of {
Ton x => x ;
Aton x => x ;
Poss _ _ => genitive
} ;
case2pform = \c -> case c of {
Nom => Aton Nom ;
Acc => Aton Acc ;
_ => Ton c
} ;
case2pformClit = \c -> case c of {
Nom => Aton Nom ;
Acc => Aton Acc ;
CPrep P_a => Aton c ;
_ => Ton c
} ;
-- Comparative adjectives are only sometimes formed morphologically
-- (actually: by different morphemes).
mkAdjComp : (_,_ : AForm => Str) -> AdjComp =
\buono, migliore ->
{s = table {Pos => buono ; _ => migliore}} ;
-- Usually the comparison forms are built by prefixing the word
-- "mas". The definite article needed in the superlative is provided in
-- $syntax.Ita.gf$.
adjCompLong : Adj -> AdjComp = \caro ->
mkAdjComp
caro.s
(\\gn => "mas" ++ caro.s ! gn) ;
-- Relative pronouns: the case-dependent parameter type.
param RelForm = RSimple Case | RComplex Gender Number Case ;
oper RelFormA = RelForm ;
--2 Relative pronouns
--
-- The simple (atonic) relative pronoun shows genuine variation in all of the
-- cases.
relPronForms = table {
Nom => "che" ;
Acc => "che" ;
CPrep P_a => "cui" ; --- variant a cui
CPrep p => strPrep p ++ "cui"
} ;
-- Verbs: conversion from full verbs to present-tense verbs.
verbPres = \amare,a -> {s = table {
VInfin => amare.s ! VI Infn ;
VFin (VPres Ind) n p => amare.s ! Pres Ind n p ;
VFin (VPres Sub) n p => amare.s ! Pres Sub n p ;
VFin (VImperf Ind) n p => amare.s ! Past Ind n p ;
VFin (VImperf Sub) n p => amare.s ! Past Sub n p ;
VFin VPasse n p => amare.s ! Pret n p ;
VFin VFut n p => amare.s ! Fut Ind n p ;
VFin VCondit n p => amare.s ! Cond n p ;
VImper np => amare.s ! Imp Sg P2 ; ---- n p ;
VPart g n => amare.s ! VI Part ---- g n ?
} ;
aux = a
} ;
-- The full conjunction is a table on $VForm$:
param
VImpers =
Infn
| Ger
| Part
;
VPers =
Pres Mode Number Person
| Past Mode Number Person
| Pret Number Person
| Fut Mode Number Person
| Cond Number Person
| Imp Number Person
| Pass Number Gender
;
VForm =
VI VImpers
| VP VPers
;
-- This is the full verb type.
oper Verbum = {s : VForm => Str} ;
}

File diff suppressed because it is too large Load Diff