Italian with full conjugations

This commit is contained in:
aarne
2004-11-30 15:28:53 +00:00
parent 3565bbc26a
commit b1207c48a9
8 changed files with 7350 additions and 0 deletions

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
concrete NumeralsIta of Numerals = open Prelude, TypesIta, MorphoIta in {
lincat Digit = {s : DForm => Str} ;
lincat Sub10 = {s : DForm => Str ; n : Number} ;
lincat Sub100 = {s : Str ; n : Number} ;
lincat Sub1000 = {s : Str ; n : Number} ;
lincat Sub1000000 = {s : Str} ;
lin num x = x ;
lin n2 = mkTal "due" "dodici" "venti" ;
lin n3 = mkTal "tre" "tredici" "trenta" ;
lin n4 = mkTal "quattro" "quattordici" "quaranta" ;
lin n5 = mkTal "cinque" "quindici" "cinquanta" ;
lin n6 = mkTal "sei" "sedici" "sessanta" ;
lin n7 = mkTal "sette" "diciassette" "settanta" ;
lin n8 = mkTal "otto" "diciotto" "ottanta" ;
lin n9 = mkTal "nove" "diciannove" "novanta" ;
lin pot01 = {s = table {ental pred => [] ; _ => "uno"} ; n = Sg} ;
lin pot0 d = {s = table {f => d.s ! f} ; n = Pl} ;
lin pot110 = spl "dieci" ;
lin pot111 = spl "undici" ;
lin pot1to19 d = spl (d.s ! ton) ;
lin pot0as1 n = {s = n.s ! ental indip ; n = n.n} ;
lin pot1 d = spl (d.s ! tiotal) ;
lin pot1plus d e = spl (d.s ! tiotal ++ e.s ! ental indip) ;
lin pot1as2 n = {s = n.s ; n = n.n} ;
lin pot2 d = spl (d.s ! ental pred ++ "cento") ;
lin pot2plus d e = spl (d.s ! ental pred ++ "cento" ++ e.s) ;
lin pot2as3 n = {s = n.s ; n = n.n} ;
lin pot3 n = ss (n.s ++ mille ! n.n) ;
lin pot3plus n m = ss (n.s ++ mille ! n.n ++ 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,148 @@
--1 Italian Word Classes and Morphological Parameters
--
-- This is a resource module for Italian morphology, defining the
-- morphological parameters and word classes of Italian.
-- 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 TypesIta of TypesRomance = {
-- First we give values to the abstract types.
param
Case = Nom | Acc | CPrep Prep ;
Prep = P_di | P_a | P_da | P_in | P_su | P_con ;
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 => "di" ;
P_a => "a" ;
P_da => "da" ;
P_in => "in" ;
P_su => "su" ;
P_con => "con"
} ;
oper
CaseA = Case ;
NPFormA = NPForm ;
nominative = Nom ;
accusative = Acc ;
genitive = CPrep P_di ;
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
-- "più". The definite article needed in the superlative is provided in
-- $syntax.Ita.gf$.
adjCompLong : Adj -> AdjComp = \caro ->
mkAdjComp
caro.s
(\\gn => "più" ++ 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 ! Inf ;
VFin (VPres Ind) n p => amare.s ! Indi Pres n p ;
VFin (VPres Sub) n p => amare.s ! Cong Pres n p ;
VFin (VImperf Ind) n p => amare.s ! Indi Imperf n p ;
VFin (VImperf Sub) n p => amare.s ! Cong Imperf n p ;
VFin VPasse n p => amare.s ! Pass n p ;
VFin VFut n p => amare.s ! Fut n p ;
VFin VCondit n p => amare.s ! Cond n p ;
VImper np => amare.s ! Imper np ;
VPart g n => amare.s ! Part PassP g n
} ;
aux = a
} ;
-- The full conjunction is a table on $VForm$:
param
Tempo = Pres | Imperf ;
TempoP = PresP | PassP ;
VForm =
Inf
| InfClit
| Indi Tempo Number Person
| Pass Number Person
| Fut Number Person
| Cong Tempo Number Person
| Cond Number Person
| Imper NumPersI
| Ger
| Part TempoP Gender Number ;
-- This is the full verb type.
oper Verbum = {s : VForm => Str} ;
}