Romance languages for the new API.

This commit is contained in:
aarne
2003-12-16 11:38:55 +00:00
parent 054ef0a1ac
commit 06936f0f18
16 changed files with 1253 additions and 89 deletions

View File

@@ -36,11 +36,13 @@ lincat
PN = {s : Str ; g : Gender} ;
Det = {s : Gender => Str ; n : Number} ;
Adj1 = Adjective ;
-- = {s : Gender => Number => Str ; p : Bool} ;
-- = {s : AForm => Str ; p : Bool} ;
Adj2 = Adjective ** {s2 : Preposition ; c : CaseA} ;
AdjDeg = {s : Degree => Gender => Number => Str ; p : Bool} ;
AdjDeg = {s : Degree => AForm => Str ; p : Bool} ;
AP = Adjective ;
Fun = CommNoun ** {s2 : Preposition ; c : CaseA} ;
Fun = Function ;
-- = CommNoun ** {s2 : Preposition ; c : CaseA} ;
Fun2 = Function ** {s3 : Preposition ; c3 : CaseA} ;
Prep = {s : Preposition ; c : CaseA} ;
Num = {s : Gender => Str} ;
@@ -48,8 +50,11 @@ lincat
-- = {s : VF => Str} ;
VG = {s : Bool => Gender => VF => Str} ;
VP = {s : Gender => VF => Str} ;
TV = Verb ** {s2 : Preposition ; c : CaseA} ;
TV = TransVerb ;
-- = Verb ** {s2 : Preposition ; c : CaseA} ;
V3 = TransVerb ** {s3 : Preposition ; c3 : CaseA} ;
VS = Verb ** {mp,mn : Mode} ;
VV = Verb ** {c : CaseA} ;
AdV = {s : Str} ;
S = Sentence ;
@@ -68,19 +73,21 @@ lincat
ConjD = {s1,s2 : Str ; n : Number} ;
ListS = {s1,s2 : Mode => Str} ;
ListAP = {s1,s2 : Gender => Number => Str ; p : Bool} ;
ListAP = {s1,s2 : AForm => Str ; p : Bool} ;
ListNP = {s1,s2 : CaseA => Str ; g : PronGen ; n : Number ; p : Person} ;
Subj = {s : Str ; m : Mode} ;
--.
lin
UseN = noun2CommNounPhrase ;
ModAdj = modCommNounPhrase ;
ModGenOne = npGenDet singular ;
---- ModGenMany = npGenDet plural ;
ModGenMany = npGenDetNum ;
UsePN = nameNounPhrase ;
UseFun = funAsCommNounPhrase ; -- [SyntaxFra.noun2CommNounPhrase]
AppFun = appFunComm ;
AppFun2 = appFun2 ;
AdjP1 = adj2adjPhrase ;
ComplAdj = complAdj ;
PositAdjP = positAdjPhrase ;
@@ -89,24 +96,43 @@ lin
DetNP = detNounPhrase ;
IndefOneNP = indefNounPhrase singular ;
---- IndefManyNP = indefNounPhrase plural ;
IndefManyNP = indefNounPhraseNum ;
DefOneNP = defNounPhrase singular ;
---- DefManyNP = defNounPhrase plural ;
DefManyNP = defNounPhraseNum ;
MassNP = partitiveNounPhrase singular ;
UseInt i = {s = \\_ => i.s} ;
NoNum = noNum ;
CNthatS = nounThatSentence ;
PredVP = predVerbPhrase ;
PosVG = predVerbGroup True ;
NegVG = predVerbGroup False ;
PredV = predVerb ;
PredAP = predAdjective ;
PredCN = predCommNoun ;
PredTV = complTransVerb ;
PredV3 = complDitransVerb ;
PredNP = predNounPhrase ;
PredAdV = predAdverb ;
PredVS = complSentVerb ;
PredVV = complVerbVerb ;
PredPassV = predPassVerb ;
VTrans = transAsVerb ;
AdjAdv a = {s = a.s ! AA} ;
AdvVP = adVerbPhrase ;
PrepNP = prepNounPhrase ;
AdvCN = advCommNounPhrase ;
AdvAP = advAdjPhrase ;
ThereNP = existNounPhrase ;
PosSlashTV = slashTransVerb True ;
NegSlashTV = slashTransVerb False ;
OneVP = predVerbPhrase nounPhraseOn ;
IdRP = identRelPron ;
FunRP = funRelPron ;
@@ -116,17 +142,18 @@ lin
RelSuch = relSuch ;
WhoOne = intPronWho singular ;
---- WhoMany = intPronWho plural ;
WhoMany = intPronWho plural ;
WhatOne = intPronWhat singular ;
---- WhatMany = intPronWhat plural ;
WhatMany = intPronWhat plural ;
FunIP = funIntPron ;
NounIPOne = nounIntPron singular ;
---- NounIPMany = nounIntPron plural ;
NounIPMany = nounIntPron plural ;
QuestVP = questVerbPhrase ;
IntVP = intVerbPhrase ;
IntSlash = intSlash ;
QuestAdv = questAdverbial ;
IsThereNP = existNounPhraseQuest ;
ImperVP = imperVerbPhrase ;
@@ -135,6 +162,8 @@ lin
ImperOne = imperUtterance singular ;
ImperMany = imperUtterance plural ;
AdvS = advSentence ;
TwoS = twoSentence ;
ConsS = consSentence ;
ConjS = conjunctSentence ;
@@ -153,10 +182,14 @@ lin
SubjS = subjunctSentence ; -- stack
SubjImper = subjunctImperative ;
SubjQu = subjunctQuestion ;
SubjVP = subjunctVerbPhrase ;
PhrNP = useNounPhrase ;
PhrOneCN = useCommonNounPhrase singular ;
PhrManyCN = useCommonNounPhrase plural ;
PhrIP ip = ip ;
PhrIAdv ia = ia ;
OnePhr p = p ;
ConsPhr = cc2 ;
}

View File

@@ -47,6 +47,8 @@ oper
mkNameNounPhrase : Str -> Gender -> NounPhrase = \jean,m ->
nameNounPhrase (mkProperName jean m) ;
nounPhraseOn = mkNameNounPhrase "on" Masc ;
normalNounPhrase : (CaseA => Str) -> Gender -> Number -> NounPhrase = \cs,g,n ->
{s = \\p => cs ! (pform2case p) ;
g = PGen g ;
@@ -173,6 +175,26 @@ oper
npGenPossNum : Numeral -> NounPhrase -> CommNounPhrase -> CaseA => Str ;
-- Constructions like "l'idée que la terre est ronde" are formed at the
-- first place as common nouns, so that one can also have "la suggestion que...".
nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \idee,x ->
{s = \\n => idee.s ! n ++ elisQue ++ x.s ! Ind ;
g = idee.g
} ;
-- The existence construction "il y a", "c'è / ci sono" is defined separately,
-- and ad hoc, in each language.
existNounPhrase : NounPhrase -> Sentence ;
-- The partitive noun phrase has special nominative and accusative, which look like
-- genitives ("du vin, avec du vin", as well as genitive form, where the definite
-- article contracts away ("de vin").
partitiveNounPhrase : Number -> CommNounPhrase -> NounPhrase ;
--2 Adjectives
--
-- Adjectives have a parameter $p$ telling if postposition is
@@ -219,7 +241,7 @@ oper
-- variants "che" and "di".
comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \bon, toi ->
{s = \\g,n => bon.s ! Comp ! g ! n ++ comparConj ++
{s = \\a => bon.s ! Comp ! a ++ comparConj ++
toi.s ! stressed accusative ;
p = False
} ;
@@ -233,8 +255,8 @@ oper
superlNounPhrase : AdjDegr -> CommNoun -> NounPhrase = \bon, mec ->
normalNounPhrase
(\\c => artDef mec.g Sg c ++ if_then_else Str bon.p
(bon.s ! Sup ! mec.g ! Sg ++ mec.s ! Sg)
(mec.s ! Sg ++ artDef mec.g Sg nominative ++ bon.s ! Sup ! mec.g ! Sg)
(bon.s ! Sup ! AF mec.g Sg ++ mec.s ! Sg)
(mec.s ! Sg ++ artDef mec.g Sg nominative ++ bon.s ! Sup ! AF mec.g Sg)
)
mec.g
Sg ;
@@ -272,7 +294,7 @@ oper
mkAdjective adj p ** c ;
complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \relie,jean ->
{s = \\g,n => relie.s ! g ! n ++ relie.s2 ++ jean.s ! case2pform relie.c ;
{s = \\a => relie.s ! a ++ relie.s2 ++ jean.s ! case2pform relie.c ;
p = False
} ;
@@ -288,8 +310,8 @@ oper
modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \bon,mec ->
{s = \\n => if_then_else Str bon.p
(bon.s ! mec.g ! n ++ mec.s ! n)
(mec.s ! n ++ bon.s ! mec.g ! n) ;
(bon.s ! AF mec.g n ++ mec.s ! n)
(mec.s ! n ++ bon.s ! AF mec.g n) ;
g = mec.g
} ;
@@ -310,24 +332,38 @@ oper
-- of the readings is meaningful.
appFunComm : Function -> NounPhrase -> CommNounPhrase = \mere,jean ->
noun2CommNounPhrase
{s = \\n => mere.s ! n ++ mere.s2 ++ jean.s ! case2pform mere.c ;
g = mere.g
} ;
{s = \\n => mere.s ! n ++ mere.s2 ++ jean.s ! case2pform mere.c ;
g = mere.g
} ;
-- Two-place functions add one argument place.
Function2 = Function ** {s3 : Preposition ; c3 : CaseA} ;
-- There application starts by filling the first place.
appFun2 : Function2 -> NounPhrase -> Function = \vol, paris ->
{s = \\n => vol.s ! n ++ vol.s2 ++ paris.s ! case2pform vol.c ;
g = vol.g ;
s2 = vol.s3 ;
c = vol.c3
} ;
-- It is possible to use a function word as a common noun; the semantics is
-- often existential or indexical.
funAsCommNounPhrase : Function -> CommNounPhrase =
noun2CommNounPhrase ;
funAsCommNounPhrase : Function -> CommNounPhrase = \x -> x ;
-- The following is an aggregate corresponding to the original function application
-- producing "ma mère" and "la mère de Jean". It does not appear in the
-- resource grammar API any longer.
appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll, mere, jean ->
let {n = jean.n ; g = mere.g ; nf = if_then_else Number coll Sg n} in
variants {
let
n = jean.n ;
g = mere.g ; nf = if_then_else Number coll Sg n
in variants {
defNounPhrase nf (appFunComm mere jean) ;
npGenDet nf jean mere
} ;
@@ -374,7 +410,7 @@ oper
-- on semantic grounds.
predAdjective : AdjPhrase -> VerbGroup = \bon ->
{s = \\b,g,v => copula b ! v ++ bon.s ! g ! nombreVerb v} ;
{s = \\b,g,v => copula b ! v ++ bon.s ! AF g (nombreVerb v)} ;
predCommNoun : CommNounPhrase -> VerbGroup = \homme ->
{s = \\b,g,v => copula b ! v ++ indefNoun (nombreVerb v) homme} ;
@@ -382,6 +418,13 @@ oper
predNounPhrase : NounPhrase -> VerbGroup = \jean ->
{s = \\b,g,v => copula b ! v ++ jean.s ! stressed nominative} ;
predAdverb : Adverb -> VerbGroup = \dehors ->
{s = \\b,g,v => copula b ! v ++ dehors.s} ;
-- Passivization is like adjectival predication.
predPassVerb : Verb -> VerbGroup = \aimer ->
{s = \\b,g,v => copula b ! v ++ aimer.s ! VPart g (nombreVerb v)} ;
-- complement a verb with noun phrase and optional preposition
@@ -434,6 +477,38 @@ oper
mkTransVerbDir : Verb -> TransVerb = \aimer ->
mkTransVerbCas aimer accusative ;
-- Transitive verbs can be used elliptically as verbs. The semantics
-- is left to applications. The definition is trivial, due to record
-- subtyping.
transAsVerb : TransVerb -> Verb = \love ->
love ;
-- *Ditransitive verbs* are verbs with three argument places.
-- We treat so far only the rule in which the ditransitive
-- verb takes both complements to form a verb phrase.
DitransVerb = TransVerb ** {s3 : Preposition ; c3 : CaseA} ;
mkDitransVerb : Verb -> Preposition -> CaseA -> Preposition -> CaseA -> DitransVerb =
\v,p1,c1,p2,c2 ->
v ** {s2 = p1 ; c = c1 ; s3 = p2 ; c3 = c2} ;
--- This must be completed to account for the cliticization of the second object.
complDitransVerb :
DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = \donner,jean,vin ->
{s = \\b,g,w =>
let
donne = donner.s ! w ;
Jean = jean.s ! (case2pform donner.c) ;
duvin = vin.s ! (case2pform donner.c3) ;
in
if_then_Str (andB (isNounPhraseClit jean) (isTransVerbClit donner))
(posNeg b (Jean ++ donne) duvin)
(posNeg b donne (Jean ++ duvin))
} ;
-- The following macro builds the "ne - pas" or "non" negation. The second
-- string argument is used for the complement of a verb phrase. In Italian,
-- one string argument would actually be enough.
@@ -459,10 +534,15 @@ oper
-- treated as cases. Therefore, both a preposition and a case are needed
-- as arguments.
prepNounPhrase : {s : Preposition ; c : CaseA} -> NounPhrase -> Adverb =
\dans,jean ->
prepNounPhrase : {s : Preposition ; c : CaseA} -> NounPhrase -> Adverb = \dans,jean ->
{s = dans.s ++ jean.s ! Ton dans.c} ;
justPrep : Preposition -> {s : Preposition ; c : CaseA} = \sans ->
{s = sans ; c = prepositional} ;
justCase : CaseA -> {s : Preposition ; c : CaseA} = \nom ->
{s = [] ; c = nom} ;
-- This is a source of the "homme avec un téléscope" ambiguity, and may produce
-- strange things, like "les voitures toujours".
-- Semantics will have to make finer distinctions among adverbials.
@@ -473,6 +553,11 @@ oper
g = mec.g
} ;
advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \trop,lent ->
{s = \\a => trop.s ++ lent.s ! a ;
p = lent.p
} ;
--2 Sentences
--
-- Sentences depend on a *mode parameter* selecting between
@@ -511,6 +596,21 @@ oper
embedConj : Str ;
--3 Verb-complement verbs
--
-- Verb-complement verbs take verb phrases as complements.
-- They can need an oblique case ("à", "de"), but they work like ordinary verbs.
VerbVerb : Type = Verb ** {c : CaseA} ;
complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \devoir, nager ->
{s = \\b,g,v => if_then_Str b (devoir.s ! v) (negVerb (devoir.s ! v)) ++
prepCase devoir.c ++ nager.s ! True ! g ! VInfin
} ;
mkVerbVerbDir : Verb -> VerbVerb = \v -> v ** {c = accusative} ;
--2 Sentences missing noun phrases
--
-- This is one instance of Gazdar's *slash categories*, corresponding to his
@@ -669,6 +769,10 @@ oper
questVerbPhrase : NounPhrase -> VerbPhrase -> Question ;
-- The existence question is treated separately.
existNounPhraseQuest : NounPhrase -> Question ;
--3 Wh-questions
--
-- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences,
@@ -715,6 +819,13 @@ oper
imperUtterance : Number -> Imperative -> Utterance = \n,I ->
ss (I.s ! Masc ! n ++ "!") ;
--2 Sentence adverbials
--
-- This class covers adverbials such as "autrement", "donc", which are prefixed
-- to a sentence to form a phrase.
advSentence : SS -> Sentence -> Utterance = \donc,ildort ->
ss (donc.s ++ ildort.s ! Ind ++ ".") ;
--2 Coordination
@@ -770,19 +881,19 @@ oper
-- if and only if all elements are prefix.
ListAdjPhrase : Type =
{s1,s2 : Gender => Number => Str ; p : Bool} ;
{s1,s2 : AForm => Str ; p : Bool} ;
twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y ->
CO.twoTable2 Gender Number x y ** {p = andB x.p y.p} ;
CO.twoTable AForm x y ** {p = andB x.p y.p} ;
consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x ->
CO.consTable2 Gender Number CO.comma xs x ** {p = andB xs.p x.p} ;
CO.consTable AForm CO.comma xs x ** {p = andB xs.p x.p} ;
conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs ->
CO.conjunctTable2 Gender Number c xs ** {p = xs.p} ;
CO.conjunctTable AForm c xs ** {p = xs.p} ;
conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs ->
CO.conjunctDistrTable2 Gender Number c xs ** {p = xs.p} ;
CO.conjunctDistrTable AForm c xs ** {p = xs.p} ;
--3 Coordinating noun phrases
@@ -850,9 +961,10 @@ oper
-- Subjunctions ("si", "quand", etc)
-- are a different way to combine sentences than conjunctions.
-- The main clause can be a sentences, an imperatives, or a question,
-- but the subjoined clause must be a sentence.
-- but the subjoined clause must be a sentence. The inherent mood can be
-- indicative ("si", "quand") or subjunctive ("bien que").
Subjunction = SS ;
Subjunction = {s : Str ; m : Mode} ;
subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence = \si,A,B ->
{s = \\m => subjunctVariants si A (B.s ! m)
@@ -872,12 +984,17 @@ oper
-- and "je m'en vais si tu fume".
subjunctVariants : Subjunction -> Sentence -> Str -> Str = \si,A,B ->
let {As = A.s ! Ind} in
let {As = A.s ! si.m} in
variants {
si.s ++ As ++ B ;
B ++ si.s ++ As
} ;
subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase =
\V, si, A ->
adVerbPhrase V (ss (si.s ++ A.s ! si.m)) ;
--2 One-word utterances
--
-- An utterance can consist of one phrase of almost any category,
@@ -912,7 +1029,7 @@ oper
pronJe, pronTu, pronIl, pronElle, pronNous, pronVous, pronIls, pronElles :
Pronoun ;
chaqueDet, tousDet, quelDet, plupartDet : Determiner ;
chaqueDet, quelDet, plupartDet : Determiner ;
commentAdv, quandAdv, ouAdv, pourquoiAdv : Adverb ;
@@ -921,5 +1038,5 @@ oper
siSubj, quandSubj : Subjunction ;
ouiPhr, noPhr : Utterance ;
}

View File

@@ -36,6 +36,7 @@ oper
accusative : CaseA ;
genitive : CaseA ;
dative : CaseA ;
prepositional : CaseA ;
stressed : CaseA -> NPFormA ;
unstressed : CaseA -> NPFormA ;
@@ -121,12 +122,17 @@ oper
--3 Adjectives
--
-- Adjectives are inflected in gender and number.
-- Adjectives are inflected in gender and number, and there is also an adverbial form
-- (e.g. "infiniment"), which has different paradigms and can even be irregular ("bien").
-- Comparative adjectives are moreover inflected in degree
-- (which in French and Italian is usually syntactic, though).
Adj : Type = {s : Gender => Number => Str} ;
AdjComp : Type = {s : Degree => Gender => Number => Str} ;
param
AForm = AF Gender Number | AA ;
oper
Adj : Type = {s : AForm => Str} ;
AdjComp : Type = {s : Degree => AForm => Str} ;
--3 Verbs
@@ -145,6 +151,7 @@ param
VF =
VFin Mode Number Person
| VImper NumPersI
| VPart Gender Number
| VInfin
;