resource = resource-1.0

This commit is contained in:
aarne
2006-06-22 22:25:55 +00:00
parent 7e5584b1ab
commit 251bc4c738
881 changed files with 31130 additions and 31130 deletions

View File

@@ -0,0 +1,41 @@
incomplete concrete AdjectiveRomance of Adjective =
CatRomance ** open CommonRomance, ResRomance, Prelude in {
lin
PositA a = {
s = a.s ! Posit ;
isPre = a.isPre
} ;
ComparA a np = {
s = \\af => a.s ! Compar ! af ++ conjThan ++ np.s ! Ton Nom ;
isPre = False
} ;
-- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 adj np = {
s = \\af => adj.s ! Posit ! af ++ appCompl adj.c2 np.s ;
isPre = False
} ;
ReflA2 adj = {
s = \\af =>
adj.s ! Posit ! af ++ adj.c2.s ++
adj.c2.s ++ prepCase adj.c2.c ++ reflPron Sg P3 Nom ; --- agr
isPre = False
} ;
SentAP ap sc = {
s = \\a => ap.s ! a ++ sc.s ; --- mood
isPre = False
} ;
AdAP ada ap = {
s = \\a => ada.s ++ ap.s ! a ;
isPre = ap.isPre
} ;
UseA2 a = a ** {isPre = False} ;
}

View File

@@ -0,0 +1,26 @@
incomplete concrete AdverbRomance of Adverb =
CatRomance ** open CommonRomance, ResRomance, Prelude in {
lin
PositAdvAdj a = {
s = a.s ! Posit ! AA
} ;
ComparAdvAdj cadv a np = {
s = cadv.s ++ a.s ! Posit ! AA ++ conjThan ++ np.s ! Ton Nom
} ;
ComparAdvAdjS cadv a s = {
s = cadv.s ++ a.s ! Posit ! AA ++ conjThan ++ s.s ! Conjunct --- ne
} ;
PrepNP prep np = {s = prep.s ++ np.s ! case2npform prep.c} ;
AdAdv = cc2 ;
SubjS subj s = {
s = subj.s ++ s.s ! subj.m
} ;
AdvSC s = s ;
AdnCAdv cadv = {s = cadv.s ++ conjThan} ;
}

View File

@@ -0,0 +1,95 @@
incomplete concrete CatRomance of Cat =
CommonX - [Tense,TPres,TPast,TFut,TCond]
** open Prelude, CommonRomance, ResRomance, (R = ParamX) in {
flags optimize=all_subs ;
lincat
-- Tensed/Untensed
S = {s : Mood => Str} ;
QS = {s : QForm => Str} ;
RS = {s : Mood => Agr => Str ; c : Case} ;
-- Sentence
Cl = {s : RTense => Anteriority => Polarity => Mood => Str} ;
Slash = {
s : AAgr => RTense => Anteriority => Polarity => Mood => Str ;
c2 : Compl
} ;
Imp = {s : Polarity => AAgr => Str} ;
-- Question
QCl = {s : RTense => Anteriority => Polarity => QForm => Str} ;
IP = {s : Case => Str ; a : AAgr} ;
IComp = {s : AAgr => Str} ;
IDet = {s : Gender => Case => Str ; n : Number} ;
-- Relative
RCl = {
s : Agr => RTense => Anteriority => Polarity => Mood => Str ;
c : Case
} ;
RP = {s : Bool => AAgr => Case => Str ; a : AAgr ; hasAgr : Bool} ;
-- Verb
VP = CommonRomance.VP ;
Comp = {s : Agr => Str} ;
-- Adjective
AP = {s : AForm => Str ; isPre : Bool} ;
-- Noun
CN = {s : Number => Str ; g : Gender} ;
NP,Pron = Pronoun ;
Det = {s : Gender => Case => Str ; n : Number} ;
QuantSg = {s : Gender => Case => Str} ;
QuantPl = {s : Bool => Gender => Case => Str} ;
Quant = {s : Bool => Number => Gender => Case => Str} ;
Predet = {s : AAgr => Case => Str ; c : Case} ; -- la plupart de...
Num = {s : Gender => Str ; isNum : Bool} ;
Ord = {s : AAgr => Str} ;
-- Numeral
Numeral = {s : CardOrd => Str} ;
-- Structural
Conj = {s : Str ; n : Number} ;
DConj = {s1,s2 : Str ; n : Number} ;
Subj = {s : Str ; m : Mood} ;
Prep = {s : Str ; c : Case ; isDir : Bool} ;
-- Open lexical classes, e.g. Lexicon
V, VQ, VA = Verb ;
V2, VV = Verb ** {c2 : Compl} ;
V2A, V3 = Verb ** {c2,c3 : Compl} ;
VS = Verb ** {m : Polarity => Mood} ;
A = {s : Degree => AForm => Str ; isPre : Bool} ;
A2 = {s : Degree => AForm => Str ; c2 : Compl} ;
N = Noun ;
N2 = Noun ** {c2 : Compl} ;
N3 = Noun ** {c2,c3 : Compl} ;
PN = {s : Str ; g : Gender} ;
-- tense augmented with passé simple
Tense = {s : Str ; t : RTense} ;
lin
TPres = {s = []} ** {t = RPres} ;
TPast = {s = []} ** {t = RPast} ; --# notpresent
TFut = {s = []} ** {t = RFut} ; --# notpresent
TCond = {s = []} ** {t = RCond} ; --# notpresent
}

View File

@@ -1,117 +0,0 @@
--# -path=.:../abstract:../../prelude
--1 The Top-Level French Resource Grammar
--
-- Aarne Ranta 2002 -- 2003
--
-- This is the French concrete syntax of the multilingual resource
-- grammar. Most of the work is done in the file
-- $syntax.Romance.gf$, some in $syntax.Fra.gf$.
-- However, for the purpose of documentation, we make here explicit the
-- linearization types of each category, so that their structures and
-- dependencies can be seen.
-- Another substantial part are the linearization rules of some
-- structural words.
--
-- The users of the resource grammar should not look at this file for the
-- linearization rules, which are in fact hidden in the document version.
-- They should use $resource.Abs.gf$ to access the syntactic rules.
-- This file can be consulted in those, hopefully rare, occasions in which
-- one has to know how the syntactic categories are
-- implemented. Most parameter types are defined in $TypesRomance$, some in
-- $TypesFra$ and $TypesIta$.
incomplete concrete CategoriesRomance of Categories =
PredefCnc ** open Prelude, SyntaxRomance in {
flags
startcat=Phr ; optimize=all ;
lincat
N = CommNoun ;
-- = {s : Number => Str ; g : Gender} ;
CN = CommNoun ;
NP = {s : NPFormA => Str ; g : PronGen ;
n : Number ; p : Person ; c : ClitType} ;
PN = {s : Str ; g : Gender} ;
Det = {s : Gender => Str ; n : Number} ;
NDet = {s : Gender => Str} ;
N2 = Function ;
-- = CommNoun ** {s2 : Preposition ; c : CaseA} ;
N3 = Function ** {s3 : Preposition ; c3 : CaseA} ;
Prep = {s : Preposition ; c : CaseA} ;
Num = {s : Gender => Str ; n : Number ; isNo : Bool} ;
A = Adjective ;
-- = {s : AForm => Str ; p : Bool} ;
A2 = Adjective ** {s2 : Preposition ; c : CaseA} ;
ADeg = {s : Degree => AForm => Str ; p : Bool} ;
AP = Adjective ;
AS = Adjective ** {mp,mn : Mode} ; --- "more difficult for him to come than..."
A2S = Adjective ** {mp,mn : Mode ; c : CaseA ; s2 : Preposition} ;
AV = Adjective ** {c : CaseA ; s2 : Preposition} ;
A2V = Adjective ** {c : CaseA ; s2 : Preposition} ;
V = Verb ;
-- = {s : VF => Str} ;
VP = {s : Bool => Gender => VPForm => Str} ;
VPI = {s : VIForm => Gender => Number => Person => Str} ;
VCl = {s : Bool => Anteriority => VIForm => Gender => Number => Person => Str} ;
V2 = TransVerb ;
-- = Verb ** {s2 : Preposition ; c : CaseA} ;
V3 = TransVerb ** {s3 : Preposition ; c3 : CaseA} ;
VS = Verb ** {mp,mn : Mode} ;
VV = Verb ** {c : CaseA} ;
VQ = Verb ;
VA = Verb ;
V2S = TransVerb ** {mp,mn : Mode} ;
V2Q = TransVerb ;
V2V = TransVerb ** {c3 : CaseA ; s3 : Preposition} ;
V2A = TransVerb ;
V0 = Verb ;
TP = {s : Str ; b : Bool ; t : Tense ; a : Anteriority} ; --- s-field is dummy
Tense = {s : Str ; t : Tense} ;
Ant = {s : Str ; a : Anteriority} ;
Pol = {s : Str ; p : Bool} ;
Adv = {s : Str} ;
AdV = {s : Str} ;
AdA = {s : Str} ;
AdC = {s : Str} ;
PP = {s : Str} ;
S = Sentence ;
-- = {s : Mode => Str} ;
Cl = Clause ;
-- = {s : Bool => ClForm => Str} ;
Slash = Clause ** {s2 : Preposition ; c : CaseA} ;
RP = {s : RelForm => Str ; g : RelGen} ;
RS = {s : Mode => Gender => Number => Person => Str} ;
---- RCl = {s : Bool => ClForm => Gender => Number => Person => Str} ;
RCl = {
s1 : Gender => Number => Person => Str ;
s2 : Bool => ClForm => Gender => Number => Person => Str ;
s3 : Bool => Str
} ;
IP = {s : CaseA => Str ; g : Gender ; n : Number} ;
IDet = {s : Gender => Str ; n : Number} ;
QS = {s : QuestForm => Str} ;
QCl = {s : Bool => ClForm => QuestForm => Str} ;
Imp = {s : Gender => Number => Str} ;
Phr = {s : Str} ;
Conj = {s : Str ; n : Number} ;
ConjD = {s1,s2 : Str ; n : Number} ;
ListS = {s1,s2 : Mode => Str} ;
ListAP = {s1,s2 : AForm => Str ; p : Bool} ;
ListNP = {s1,s2 : CaseA => Str ; g : PronGen ; n : Number ; p : Person} ;
ListAdv = {s1,s2 : Str} ;
Subj = {s : Str ; m : Mode} ;
}

View File

@@ -1,345 +0,0 @@
--# -path=.:../abstract:../../prelude
incomplete concrete ClauseRomance of Clause = CategoriesRomance **
open Prelude, SyntaxRomance in {
flags optimize=all_subs ; --- parametrize much worse, 15/2
lin
SPredV np v =
sats2clause (mkSats np v) ;
SPredPassV subj v =
sats2clause (mkSatsCopula subj (v.s ! VPart (pgen2gen subj.g) subj.n)) ;
SPredV2 np v y =
sats2clause (mkSatsObject np v y) ;
SPredV3 subj verb obj1 obj2 =
sats2clause (insertObject (mkSatsObject subj verb obj1) verb.c3 verb.s3 obj2) ;
SPredReflV2 subj verb =
sats2clause (
mkSatsObject subj
{s = verb.s ; s2 = [] ; c = accusative ; aux = AEsse}
---- {s = verb.s ; s2 = verb.s2 ; c = verb.c ; aux = AEsse}
---- this produces huge cf - find out why! AR 16/3/2005
(reflPronNounPhrase (pgen2gen subj.g) subj.n subj.p)) ;
SPredVS subj verb sent =
sats2clause (
insertExtrapos (mkSats subj verb)
(\\b => embedConj ++ sent.s ! subordMode verb b)) ; ---- mn
SPredVQ subj verb quest =
sats2clause (
insertExtrapos (mkSats subj verb) (\\_ => quest.s ! IndirQ)) ;
SPredV2S subj verb obj sent =
sats2clause (
insertExtrapos
(mkSatsObject subj verb obj)
(\\b => embedConj ++ sent.s ! subordMode verb b)
) ; ---- mn ;
SPredV2Q subj verb obj quest =
sats2clause (
insertExtrapos
(mkSatsObject subj verb obj)
(\\_ => quest.s ! IndirQ)) ;
SPredVA subj verb adj =
sats2clause (
insertExtrapos (mkSats subj verb) (\\_ => adj.s ! AF (pgen2gen subj.g) subj.n)) ;
SPredV2A subj verb obj adj =
sats2clause (
insertExtrapos
(mkSatsObject subj verb obj)
(\\_ => adj.s ! AF (pgen2gen obj.g) obj.n)) ;
SPredVV subj verb vp =
sats2clause (
insertExtrapos
(mkSats subj verb)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! pgen2gen subj.g ! subj.n ! subj.p)
) ;
SPredObjV2V subj verb obj vp =
sats2clause (
insertExtrapos
(mkSatsObject subj verb obj)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! pgen2gen obj.g ! obj.n ! obj.p)
) ;
SPredSubjV2V subj verb obj vp =
sats2clause (
insertExtrapos
(mkSatsObject subj verb obj)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! pgen2gen subj.g ! subj.n ! subj.p)
) ;
SPredProgVP np vp = sats2clause (progressiveSats np vp) ;
SPredAP subj adj =
sats2clause (mkSatsCopula subj (adj.s ! AF (pgen2gen subj.g) subj.n)) ;
SPredCN subj cn =
sats2clause (mkSatsCopula subj (indefNoun subj.n cn)) ;
SPredNP subj np =
sats2clause (mkSatsCopula subj (np.s ! stressed nominative)) ;
SPredAdv subj adv =
sats2clause (mkSatsCopula subj adv.s) ;
--------
QPredV np v =
sats2quest (mkSats (intNounPhrase np) v) ;
QPredPassV subj v =
sats2quest (mkSatsCopula (intNounPhrase subj) (v.s ! VPart subj.g subj.n)) ;
QPredV2 np v y =
sats2quest (mkSatsObject (intNounPhrase np) v y) ;
QPredV3 subj verb obj1 obj2 =
sats2quest (
insertObject (mkSatsObject (intNounPhrase subj) verb obj1) verb.c3 verb.s3 obj2
) ;
QPredReflV2 subj verb =
sats2quest (
mkSatsObject (intNounPhrase subj)
{s = verb.s ; s2 = [] ; c = accusative ; aux = AEsse}
(reflPronNounPhrase subj.g subj.n P3)) ;
QPredVS subj verb sent =
sats2quest (
insertExtrapos (mkSats (intNounPhrase subj) verb)
(\\b => embedConj ++ sent.s ! subordMode verb b)) ; ---- mn
QPredVQ subj verb quest =
sats2quest (
insertExtrapos (mkSats (intNounPhrase subj) verb) (\\_ => quest.s ! IndirQ)) ;
QPredV2S subj verb obj sent =
sats2quest (
insertExtrapos
(mkSatsObject (intNounPhrase subj) verb obj)
(\\b => embedConj ++ sent.s ! subordMode verb b)
) ; ---- mn ;
QPredV2Q subj verb obj quest =
sats2quest (
insertExtrapos
(mkSatsObject (intNounPhrase subj) verb obj)
(\\_ => quest.s ! IndirQ)) ;
QPredVA subj verb adj =
sats2quest (
insertExtrapos (mkSats (intNounPhrase subj) verb)
(\\_ => adj.s ! AF subj.g subj.n)) ;
QPredV2A subj verb obj adj =
sats2quest (
insertExtrapos
(mkSatsObject (intNounPhrase subj) verb obj)
(\\_ => adj.s ! AF (pgen2gen obj.g) obj.n)) ;
QPredVV subj verb vp =
sats2quest (
insertExtrapos
(mkSats (intNounPhrase subj) verb)
(\\_ => prepCase verb.c ++
vp.s ! VIInfinit ! subj.g ! (intNounPhrase subj).n ! P3)
) ;
QPredObjV2V subj verb obj vp =
sats2quest (
insertExtrapos
(mkSatsObject (intNounPhrase subj) verb obj)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! pgen2gen obj.g ! obj.n ! obj.p)
) ;
QPredSubjV2V subj verb obj vp =
sats2quest (
insertExtrapos
(mkSatsObject (intNounPhrase subj) verb obj)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! subj.g ! subj.n ! P3)
) ;
QPredAP subj adj =
sats2quest (mkSatsCopula (intNounPhrase subj) (adj.s ! AF subj.g subj.n)) ;
QPredCN subj cn =
sats2quest (mkSatsCopula (intNounPhrase subj) (indefNoun subj.n cn)) ;
QPredNP subj np =
sats2quest (mkSatsCopula (intNounPhrase subj) (np.s ! stressed nominative)) ;
QPredAdv subj adv =
sats2quest (mkSatsCopula (intNounPhrase subj) adv.s) ;
QPredProgVP np vp = sats2quest (progressiveSats (intNounPhrase np) vp) ;
-----------
RPredV np v =
sats2rel
(\g,n,p -> mkSats (relNounPhrase np g n p) v) ;
RPredPassV subj v =
sats2rel
(\g,n,p -> mkSatsCopula (relNounPhrase subj g n p)
(v.s ! VPart g n)) ;
RPredV2 np v y =
sats2rel
(\g,n,p -> mkSatsObject (relNounPhrase np g n p) v y) ;
RPredV3 subj verb obj1 obj2 =
sats2rel
(\g,n,p ->
insertObject (mkSatsObject (relNounPhrase subj g n p) verb
obj1) verb.c3 verb.s3 obj2
) ;
---- bracket these just because they are so expensive (25% of gfc)
{- ----
RPredReflV2 subj verb =
sats2rel (\g,n,p ->
mkSatsObject (relNounPhrase subj g n p)
{s = verb.s ; s2 = [] ; c = accusative ; aux = AEsse}
(reflPronNounPhrase g n p)) ;
RPredVS subj verb sent =
sats2rel (\g,n,p ->
insertExtrapos (mkSats (relNounPhrase subj g n p) verb)
(\\b => embedConj ++ sent.s ! subordMode verb b)) ; ---- mn
RPredVQ subj verb quest =
sats2rel (\g,n,p ->
insertExtrapos (mkSats (relNounPhrase subj g n p) verb) (\\_ => quest.s ! IndirQ)) ;
RPredV2S subj verb obj sent =
sats2rel (\g,n,p ->
insertExtrapos
(mkSatsObject (relNounPhrase subj g n p) verb obj)
(\\b => embedConj ++ sent.s ! subordMode verb b)
) ; ---- mn ;
RPredV2Q subj verb obj quest =
sats2rel (\g,n,p ->
insertExtrapos
(mkSatsObject (relNounPhrase subj g n p) verb obj)
(\\_ => quest.s ! IndirQ)) ;
RPredVA subj verb adj =
sats2rel (\g,n,p ->
insertExtrapos (mkSats (relNounPhrase subj g n p) verb)
(\\_ => adj.s ! AF g n)) ;
RPredV2A subj verb obj adj =
sats2rel (\g,n,p ->
insertExtrapos
(mkSatsObject (relNounPhrase subj g n p) verb obj)
(\\_ => adj.s ! AF (pgen2gen obj.g) obj.n)) ;
RPredVV subj verb vp =
sats2rel (\g,n,p ->
insertExtrapos
(mkSats (relNounPhrase subj g n p) verb)
(\\_ => prepCase verb.c ++
vp.s ! VIInfinit ! g ! n ! p)
) ;
RPredObjV2V subj verb obj vp =
sats2rel (\g,n,p ->
insertExtrapos
(mkSatsObject (relNounPhrase subj g n p) verb obj)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! pgen2gen obj.g ! obj.n ! obj.p)
) ;
-}
{- ---- some type error/bug here
RPredSubjV2V subj verb obj vp =
sats2rel (\g,n,p ->
insertExtrapos
(mkSatsObject (relNounPhrase subj g n p) verb obj)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! g ! n ! p)
) ;
-}
RPredAP subj adj =
sats2rel
(\g,n,p -> mkSatsCopula (relNounPhrase subj g n p) (adj.s ! AF g n)) ;
RPredCN subj cn =
sats2rel
(\g,n,p -> mkSatsCopula (relNounPhrase subj g n p) (indefNoun n cn)) ;
RPredNP subj np =
sats2rel
(\g,n,p -> mkSatsCopula (relNounPhrase subj g n p) (np.s ! stressed nominative)) ;
RPredAdv subj adv =
sats2rel
(\g,n,p -> mkSatsCopula (relNounPhrase subj g n p) adv.s) ;
RPredProgVP np vp =
sats2rel
(\g,n,p -> progressiveSats (relNounPhrase np g n p) vp) ;
----- gender and number of Adj
IPredV v =
sats2verbPhrase (mkSats pronImpers v) ;
IPredV2 v y =
sats2verbPhrase (mkSatsObject pronImpers v y) ;
IPredAP adj =
sats2verbPhrase (mkSatsCopula pronImpers (adj.s ! AF Masc Sg)) ;
IPredPassV v =
sats2verbPhrase (mkSatsCopula pronImpers (v.s ! VPart (pgen2gen pronImpers.g) pronImpers.n)) ;
IPredV3 verb obj1 obj2 =
sats2verbPhrase (insertObject (mkSatsObject pronImpers verb obj1) verb.c3 verb.s3 obj2) ;
IPredReflV2 verb =
sats2verbPhrase (
mkSatsObject pronImpers
{s = verb.s ; s2 = [] ; c = accusative ; aux = AEsse}
---- {s = verb.s ; s2 = verb.s2 ; c = verb.c ; aux = AEsse}
---- this produces huge cf - find out why! AR 16/3/2005
(reflPronNounPhrase (pgen2gen pronImpers.g) pronImpers.n pronImpers.p)) ;
IPredVS verb sent =
sats2verbPhrase (
insertExtrapos (mkSats pronImpers verb)
(\\b => embedConj ++ sent.s ! subordMode verb b)) ; ---- mn
IPredVQ verb quest =
sats2verbPhrase (
insertExtrapos (mkSats pronImpers verb) (\\_ => quest.s ! IndirQ)) ;
IPredV2S verb obj sent =
sats2verbPhrase (
insertExtrapos
(mkSatsObject pronImpers verb obj)
(\\b => embedConj ++ sent.s ! subordMode verb b)
) ; ---- mn ;
IPredV2Q verb obj quest =
sats2verbPhrase (
insertExtrapos
(mkSatsObject pronImpers verb obj)
(\\_ => quest.s ! IndirQ)) ;
IPredVA verb adj =
sats2verbPhrase (
insertExtrapos (mkSats pronImpers verb) (\\_ => adj.s ! AF (pgen2gen pronImpers.g) pronImpers.n)) ;
IPredV2A verb obj adj =
sats2verbPhrase (
insertExtrapos
(mkSatsObject pronImpers verb obj)
(\\_ => adj.s ! AF (pgen2gen obj.g) obj.n)) ;
IPredVV verb vp =
sats2verbPhrase (
insertExtrapos
(mkSats pronImpers verb)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! pgen2gen pronImpers.g ! pronImpers.n ! pronImpers.p)
) ;
IPredObjV2V verb obj vp =
sats2verbPhrase (
insertExtrapos
(mkSatsObject pronImpers verb obj)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! pgen2gen obj.g ! obj.n ! obj.p)
) ;
IPredSubjV2V verb obj vp =
sats2verbPhrase (
insertExtrapos
(mkSatsObject pronImpers verb obj)
(\\_ => prepCase verb.c ++ vp.s ! VIInfinit ! pgen2gen pronImpers.g ! pronImpers.n ! pronImpers.p)
) ;
IPredCN cn =
sats2verbPhrase (mkSatsCopula pronImpers (indefNoun pronImpers.n cn)) ;
IPredNP np =
sats2verbPhrase (mkSatsCopula pronImpers (np.s ! stressed nominative)) ;
IPredAdv adv =
sats2verbPhrase (mkSatsCopula pronImpers adv.s) ;
IPredProgVP vp = sats2verbPhrase (progressiveSats pronImpers vp) ;
{-
-- Use VPs
PredVP = predVerbGroupClause ;
IntVP = intVerbPhrase ;
RelVP = relVerbPhrase ;
PosVP tp = predVerbGroup True tp.a ;
NegVP tp = predVerbGroup False tp.a ;
AdvVP = adVerbPhrase ;
SubjVP = subjunctVerbPhrase ;
-}
}

View File

@@ -0,0 +1,213 @@
----1 Auxiliary operations common for Romance languages
--
-- This module contains operations that are shared by the Romance
-- languages. The complete set of auxiliary operations needed to
-- implement [Test Test.html] is defined in [ResRomance ResRomance.html],
-- which depends on [DiffRomance DiffRomance.html].
--
resource CommonRomance = ParamX ** open Prelude in {
flags optimize=all ;
--2 Enumerated parameter types for morphology
--
-- These types are the ones found in school grammars.
-- Their parameter values are atomic.
param
Gender = Masc | Fem ;
Mood = Indic | Conjunct ;
-- 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 Romance is usually syntactic, though).
AForm = AF Gender Number | AA ;
-- Gender is not morphologically determined for first and second person pronouns.
PronGen = PGen Gender | PNoGen ;
-- Cardinal numerals have gender, ordinal numerals have full number as well.
CardOrd = NCard Gender | NOrd Gender Number ;
-- The following coercions are useful:
oper
prongen2gender : PronGen -> Gender = \p -> case p of {
PGen g => g ;
PNoGen => variants {Masc ; Fem} --- the best we can do for je, tu, nous, vous
} ;
aform2gender : AForm -> Gender = \a -> case a of {
AF g _ => g ;
_ => Masc -- "le plus lentement"
} ;
aform2number : AForm -> Number = \a -> case a of {
AF _ n => n ;
_ => Sg -- "le plus lentement"
} ;
conjGender : Gender -> Gender -> Gender = \m,n ->
case <m,n> of {
<Fem,Fem> => Fem ;
_ => Fem
} ;
conjAgr : Agr -> Agr -> Agr = \a,b -> {
g = conjGender a.g b.g ;
n = conjNumber a.n b.n ;
p = conjPerson a.p b.p
} ;
--3 Verbs
--
-- In the current syntax, we use
-- a reduced conjugation with only the present tense infinitive,
-- indicative, subjunctive, and imperative forms.
-- But our morphology has full Bescherelle conjunctions:
-- so we use a coercion between full and reduced verbs.
-- The full conjugations and the coercions are defined separately for French
-- and Italian, since they are not identical. The differences are mostly due
-- to Bescherelle structuring the forms in different groups; the
-- gerund and the present participles show real differences.
--
-- For Italian contracted forms, $VInfin$ should have
-- an alternative form, whose proper place is $Diff$.
param
VF =
VInfin Bool
| VFin TMood Number Person
| VImper NumPersI
| VPart Gender Number
| VGer
;
TMood =
VPres Mood
| VImperf Mood --# notpresent
| VPasse --# notpresent
| VFut --# notpresent
| VCondit --# notpresent
;
NumPersI = SgP2 | PlP1 | PlP2 ;
VPForm =
VPFinite TMood Anteriority
| VPImperat
| VPGerund
| VPInfinit Anteriority Bool ;
RTense =
RPres
| RPast --# notpresent
| RPasse --# notpresent
| RFut --# notpresent
| RCond --# notpresent
;
-- Agreement of adjectives, verb phrases, and relative pronouns.
oper
AAgr : Type = {g : Gender ; n : Number} ;
Agr : Type = AAgr ** {p : Person} ;
param
RAgr = RAg {g : Gender ; n : Number} | RNoAg ; --- AAgr
-- Clitic slots.
CAgr = CPron {g : Gender ; n : Number ; p : Person} | CRefl | CNone ; --- Agr
oper
aagr : Gender -> Number -> AAgr = \g,n ->
{g = g ; n = n} ;
agrP3 : Gender -> Number -> Agr = \g,n ->
aagr g n ** {p = P3} ;
vf2numpers : VF -> (Number * Person) = \v -> case v of {
VFin _ n p => <n,p> ;
_ => <Sg,P3> ----
} ;
presInd = VPres Indic ;
-- The imperative forms depend on number and person.
vImper : Number -> Person -> VF = \n,p -> case <n,p> of {
<Sg,P2> => VImper SgP2 ;
<Pl,P1> => VImper PlP1 ;
<Pl,P2> => VImper PlP2 ;
_ => VInfin False
} ;
---
oper
genForms : Str -> Str -> Gender => Str = \bon,bonne ->
table {
Masc => bon ;
Fem => bonne
} ;
aagrForms : (x1,_,_,x4 : Str) -> (AAgr => Str) = \tout,toute,tous,toutes ->
table {
{g = g ; n = Sg} => genForms tout toute ! g ;
{g = g ; n = Pl} => genForms tous toutes ! g
} ;
Noun = {s : Number => Str ; g : Gender} ;
Adj = {s : AForm => Str} ;
appVPAgr : VPAgr -> AAgr -> AAgr = \vp,agr ->
case vp of {
VPAgrSubj => agr ;
VPAgrClit a => a
} ;
vpAgrNone : VPAgr = VPAgrClit (aagr Masc Sg) ;
oper
mkOrd : {s : Degree => AForm => Str} -> {s : AAgr => Str} ;
mkOrd x = {s = \\ag => x.s ! Posit ! AF ag.g ag.n} ;
-- This is used in Spanish and Italian to bind clitics with preceding verb.
bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ;
param
VPAgr =
VPAgrSubj -- elle est partie, elle s'est vue
| VPAgrClit -- elle a dormi; elle les a vues
{g : Gender ; n : Number} ;
oper
VP : Type = {
s : VPForm => {
fin : Agr => Str ; -- ai
inf : AAgr => Str -- dit
} ;
agr : VPAgr ; -- dit/dite dep. on verb, subj, and clitic
neg : Polarity => (Str * Str) ; -- ne-pas
clAcc : CAgr ; -- le/se
clDat : CAgr ; -- lui
clit2 : Str ; -- y en
comp : Agr => Str ; -- content(e) ; à ma mère ; hier
ext : Polarity => Str ; -- que je dors / que je dorme
} ;
}

View File

@@ -0,0 +1,55 @@
incomplete concrete ConjunctionRomance of Conjunction =
CatRomance ** open CommonRomance, ResRomance, Coordination, Prelude in {
flags optimize=all_subs ;
lin
ConjS conj ss = conjunctTable Mood conj ss ;
DConjS conj ss = conjunctDistrTable Mood conj ss ;
ConjAdv conj ss = conjunctSS conj ss ;
DConjAdv conj ss = conjunctDistrSS conj ss ;
ConjNP conj ss = conjunctTable NPForm conj ss ** {
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ;
hasClit = False
} ;
DConjNP conj ss = conjunctDistrTable NPForm conj ss ** {
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ;
hasClit = False
} ;
ConjAP conj ss = conjunctTable AForm conj ss ** {
isPre = ss.isPre
} ;
DConjAP conj ss = conjunctDistrTable AForm conj ss ** {
isPre = ss.isPre
} ;
-- These fun's are generated from the list cat's.
BaseS = twoTable Mood ;
ConsS = consrTable Mood comma ;
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseNP x y = {
s1 = \\c => x.s ! stressedCase c ;
s2 = \\c => y.s ! (conjunctCase c) ;
a = conjAgr x.a y.a
} ;
ConsNP x xs = {
s1 = \\c => x.s ! stressedCase c ++ comma ++ xs.s1 ! (conjunctCase c) ;
s2 = \\c => xs.s2 ! (conjunctCase c) ;
a = conjAgr x.a xs.a
} ;
BaseAP x y = twoTable AForm x y ** {isPre = andB x.isPre y.isPre} ;
ConsAP xs x = consrTable AForm comma xs x ** {isPre = andB xs.isPre x.isPre} ;
lincat
[S] = {s1,s2 : Mood => Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : NPForm => Str ; a : Agr} ;
[AP] = {s1,s2 : AForm => Str ; isPre : Bool} ;
}

View File

@@ -0,0 +1,106 @@
--1 Differences between Romance languages
interface DiffRomance = open CommonRomance, Prelude in {
-- The first eight constants show the essential differences
-- between French, Italian, and Romance syntaxes (as regards the
-- resource API). The other constants are either derivatively
-- dependent, or have as values strings, which are language-dependent
-- anyway.
--2 Constants whose definitions fundamentally depend on language
-- Prepositions that fuse with the article
-- (Fre, Spa "de", "a"; Ita also "con", "da", "in", "su).
param Prep ;
-- Which types of verbs exist, in terms of auxiliaries.
-- (Fre, Ita "avoir", "être", and refl; Spa only "haber" and refl).
param VType ;
-- Derivatively, if/when the participle agrees to the subject.
-- (Fre "elle est partie", Ita "lei è partita", Spa not)
oper partAgr : VType -> VPAgr ;
-- Whether participle agrees to foregoing clitic.
-- (Fre "je l'ai vue", Spa "yo la he visto")
oper vpAgrClit : Agr -> VPAgr ;
-- Whether a preposition is repeated in conjunction
-- (Fre "la somme de 3 et de 4", Ita "la somma di 3 e 4").
oper conjunctCase : NPForm -> NPForm ;
-- How infinitives and clitics are placed relative to each other
-- (Fre "la voir", Ita "vederla"). The $Bool$ is used for indicating
-- if there are any clitics.
oper clitInf : Bool -> Str -> Str -> Str ;
-- To render pronominal arguments as clitics and/or ordinary complements.
-- Returns $True$ if there are any clitics.
oper pronArg : Number -> Person -> CAgr -> CAgr -> Str * Str * Bool ;
-- To render imperatives (with their clitics etc).
oper mkImperative : Person -> CommonRomance.VP -> {s : Polarity => AAgr => Str} ;
--2 Constants that must derivatively depend on language
param NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr
oper dative : Case ;
oper genitive : Case ;
vRefl : VType ;
isVRefl : VType -> Bool ;
--2 Strings
prepCase : Case -> Str ;
partitive : Gender -> Case -> Str ;
artDef : Gender -> Number -> Case -> Str ;
artIndef : Gender -> Number -> Case -> Str ;
-- This is the definite article in Italian, $prepCase c$ in French and Spanish.
possCase : Gender -> Number -> Case -> Str ;
auxVerb : VType -> (VF => Str) ;
negation : Polarity => (Str * Str) ;
copula : Verb ;
conjThan : Str ;
conjThat : Str ;
relPron : Bool => AAgr => Case => Str ;
pronSuch : AAgr => Str ;
partQIndir : Str ; -- ce, ciò
reflPron : Number -> Person -> Case -> Str ;
-- argPron : Gender -> Number -> Person -> Case -> Str ;
auxPassive : Verb ;
--2 Contants needed in type signatures above
param
Case = Nom | Acc | CPrep Prep ;
oper
Verb = {s : VF => Str ; vtyp : VType} ;
}

View File

@@ -0,0 +1,14 @@
incomplete concrete ExtRomance of ExtRomanceAbs =
CatRomance ** open DiffRomance, ResRomance in {
lin
DefSgN predet noun = let g = noun.g in {
s = \\c => predet.s ! gennum g Sg ++ noun.s ! Sg ! Def ! caseNP c ;
a = agrP3 g Sg
} ;
DefPlN predet noun = let g = noun.g in {
s = \\c => predet.s ! Plg ++ noun.s ! Pl ! Def ! caseNP c ;
a = agrP3 g Sg
} ;
}

View File

@@ -0,0 +1,8 @@
incomplete concrete ExtraRomance of ExtraRomanceAbs = CatRomance **
open
CommonRomance,
ResRomance in {
lin TPasseSimple = {s = []} ** {t = RPasse} ; --# notpresent
}

View File

@@ -0,0 +1,5 @@
abstract ExtraRomanceAbs = Extra ** {
fun TPasseSimple : Tense ; --# notpresent
}

View File

@@ -1,47 +0,0 @@
--# -path=.:../romance:../abstract:../../prelude
incomplete concrete MathRomance of Math = CategoriesRomance **
open Prelude, SyntaxRomance in {
lin
SymbPN i = {s = i.s ; g = Masc} ; --- cannot know gender
IntPN i = {s = i.s ; g = Masc} ;
IntNP cn i = nameNounPhrase {
s = cn.s ! Sg ++ i.s ;
g = cn.g
} ;
IndefSymbNumNP nu cn xs =
addSymbNounPhrase (indefNounPhraseNum nu cn) xs.s ;
DefSymbNumNP nu cn xs =
addSymbNounPhrase (defNounPhraseNum nu cn) xs.s ;
NDetSymbNP det nu cn xs =
addSymbNounPhrase (numDetNounPhrase det nu cn) xs.s ;
lincat
SymbList = SS ;
lin
SymbTwo = infixSS etConj.s ;
SymbMore = infixSS "," ;
LetImp x cn = {
s = \\_,_ => copula.s ! VFin (VPres Con) x.n P3 ++
x.s ! unstressed nominative ++ cn.s ! unstressed nominative
} ;
--- to be replaced by "il existe", "esiste", etc.
ExistNP np = existNounPhrase np ;
-- Moved from $RulesRomance$.
SymbCN cn s =
{s = \\n => cn.s ! n ++ s.s ;
g = cn.g} ;
IntCN cn i =
{s = \\n => cn.s ! n ++ i.s ;
g = cn.g} ;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,122 @@
incomplete concrete NounRomance of Noun =
CatRomance ** open CommonRomance, ResRomance, Prelude in {
flags optimize=all_subs ;
lin
DetCN det cn =
let
g = cn.g ;
n = det.n
in {
s = \\c => det.s ! g ! npform2case c ++ cn.s ! n ;
a = agrP3 g n ;
hasClit = False
} ;
UsePN = pn2np ;
UsePron p = p ;
PredetNP pred np = {
s = \\c => pred.s ! aagr (np.a.g) (np.a.n) ! npform2case c ++ --- subtype
np.s ! case2npform pred.c ;
a = np.a ;
hasClit = False
} ;
PPartNP np v2 = {
s = \\c => np.s ! c ++ v2.s ! VPart np.a.g np.a.n ;
a = np.a ;
hasClit = False
} ;
AdvNP np adv = {
s = \\c => np.s ! c ++ adv.s ;
a = np.a ;
hasClit = False
} ;
DetSg quant ord = {
s = \\g,c => quant.s ! g ! c ++ ord.s ! aagr g Sg ;
n = Sg
} ;
DetPl quant num ord = {
s = \\g,c => quant.s ! num.isNum ! g ! c ++ num.s ! g ++ ord.s ! aagr g Pl ;
n = Pl
} ;
SgQuant q = {s = q.s ! False ! Sg} ;
PlQuant q = {s = \\b => q.s ! b ! Pl} ;
PossPron p = {
s = \\_,n,g,c => possCase g n c ++ p.s ! Poss (aagr g n) ---- il mio!
} ;
NoNum = {s = \\_ => [] ; isNum = False} ;
NoOrd = {s = \\_ => []} ;
NumInt n = {s = \\_ => n.s ; isNum = True} ;
OrdInt n = {s = \\_ => n.s ++ "."} ; ---
NumNumeral numeral = {s = \\g => numeral.s ! NCard g ; isNum = True} ;
OrdNumeral numeral = {s = \\a => numeral.s ! NOrd a.g a.n} ;
AdNum adn num = {s = \\a => adn.s ++ num.s ! a ; isNum = num.isNum} ;
OrdSuperl adj = {s = \\a => adj.s ! Superl ! AF a.g a.n} ;
DefArt = {
s = \\_,n,g,c => artDef g n c
} ;
IndefArt = {
s = \\b,n,g,c => if_then_Str b [] (artIndef g n c) ;
} ;
MassDet = {
s = \\g,c => partitive g c ;
n = Sg
} ;
-- This is based on record subtyping.
UseN, UseN2, UseN3 = \noun -> noun ;
ComplN2 f x = {
s = \\n => f.s ! n ++ appCompl f.c2 x.s ;
g = f.g ;
} ;
ComplN3 f x = {
s = \\n => f.s ! n ++ appCompl f.c2 x.s ;
g = f.g ;
c2 = f.c3
} ;
AdjCN ap cn =
let
g = cn.g
in {
s = \\n => preOrPost ap.isPre (ap.s ! (AF g n)) (cn.s ! n) ;
g = g ;
} ;
RelCN cn rs = let g = cn.g in {
s = \\n => cn.s ! n ++ rs.s ! Indic ! agrP3 g n ; --- mood
g = g
} ;
SentCN cn sc = let g = cn.g in {
s = \\n => cn.s ! n ++ sc.s ;
g = g
} ;
AdvCN cn sc = let g = cn.g in {
s = \\n => cn.s ! n ++ sc.s ;
g = g
} ;
ApposCN cn np = let g = cn.g in {
s = \\n => cn.s ! n ++ np.s ! Ton Nom ;
g = g
} ;
}

View File

@@ -1,2 +0,0 @@
incomplete concrete NumeralsRomance of Numerals = {
}

View File

@@ -0,0 +1,26 @@
incomplete concrete PhraseRomance of Phrase =
CatRomance ** open CommonRomance, ResRomance, Prelude in {
flags optimize = all_subs ;
lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
UttS s = {s = s.s ! Indic} ;
UttQS qs = {s = qs.s ! QDir} ;
UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! aagr Fem Sg} ;
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! aagr Fem Pl} ;
UttIP ip = {s = ip.s ! Nom} ; --- Acc also
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! Ton Nom} ;
UttVP vp = {s = infVP vp (agrP3 Fem Sg)} ; --- Agr
UttAdv adv = adv ;
NoPConj = {s = []} ;
PConjConj conj = conj ;
NoVoc = {s = []} ;
VocNP np = {s = "," ++ np.s ! Ton Nom} ;
}

View File

@@ -0,0 +1,74 @@
incomplete concrete QuestionRomance of Question =
CatRomance ** open CommonRomance, ResRomance in {
flags optimize=all_subs ;
lin
QuestCl cl = {
s = \\t,a,p =>
let cls = cl.s ! t ! a ! p
in table {
QDir => cls ! Indic ;
QIndir => "si" ++ cls ! Indic ---- subjIf
}
} ;
QuestVP qp vp = {
s = \\t,a,b,_ =>
let
cl = mkClause (qp.s ! Nom) (agrP3 qp.a.g qp.a.n) vp
in
cl.s ! t ! a ! b ! Indic
} ;
QuestSlash ip slash = {
s = \\t,a,p =>
let
cls = slash.s ! ip.a ! t ! a ! p ! Indic ;
who = slash.c2.s ++ ip.s ! slash.c2.c
in table {
QDir => who ++ cls ;
QIndir => partQIndir ++ who ++ cls
}
} ;
QuestIAdv iadv cl = {
s = \\t,a,p,_ =>
let
cls = cl.s ! t ! a ! p ! Indic ;
why = iadv.s
in why ++ cls
} ;
QuestIComp icomp np = {
s = \\t,a,p,_ =>
let
vp = predV copula ;
cls = (mkClause (np.s ! Aton Nom) np.a vp).s ! t ! a ! p ! Indic ;
why = icomp.s ! {g = np.a.g ; n = np.a.n}
in why ++ cls
} ;
PrepIP p ip = {
s = p.s ++ ip.s ! accusative
} ;
AdvIP ip adv = {
s = \\c => ip.s ! c ++ adv.s ;
a = ip.a
} ;
IDetCN idet num ord cn =
let
g = cn.g ;
n = idet.n ;
a = aagr g n
in {
s = \\c => idet.s ! g ! c ++ num.s ! g ++ ord.s ! a ++ cn.s ! n ;
a = a
} ;
CompIAdv a = {s = \\_ => a.s} ;
}

View File

@@ -0,0 +1,49 @@
incomplete concrete RelativeRomance of Relative =
CatRomance ** open Prelude, CommonRomance, ResRomance in {
flags optimize=all_subs ;
lin
RelCl cl = {
s = \\ag,t,a,p,m => pronSuch ! ag ++ conjThat ++ cl.s ! t ! a ! p ! m ;
c = Nom
} ;
--- more efficient to compile than case inside mkClause; see log.txt
RelVP rp vp = case rp.hasAgr of {
True => {s = \\ag =>
(mkClause
(rp.s ! False ! {g = ag.g ; n = ag.n} ! Nom)
{g = rp.a.g ; n = rp.a.n ; p = P3}
vp).s ; c = Nom} ;
False => {s = \\ag =>
(mkClause
(rp.s ! False ! {g = ag.g ; n = ag.n} ! Nom)
ag
vp).s ; c = Nom
}
} ;
RelSlash rp slash = {
s = \\ag,t,a,p,m =>
let aag = {g = ag.g ; n = ag.n}
in
slash.c2.s ++
rp.s ! False ! aag ! slash.c2.c ++
slash.s ! aag ! t ! a ! p ! m ; --- ragr
c = Acc
} ;
FunRP p np rp = {
s = \\_,a,c => np.s ! Ton Nom ++ p.s ++ rp.s ! True ! a ! p.c ;
a = {g = np.a.g ; n = np.a.n} ;
hasAgr = True
} ;
IdRP = {
s = relPron ;
a = {g = Masc ; n = Sg} ;
hasAgr = False
} ;
}

View File

@@ -0,0 +1,238 @@
--1 Romance auxiliary operations.
--
interface ResRomance = DiffRomance ** open CommonRomance, Prelude in {
flags optimize=all ;
--2 Constants uniformly defined in terms of language-dependent constants
oper
nominative : Case = Nom ;
accusative : Case = Acc ;
Pronoun = {s : NPForm => Str ; a : Agr ; hasClit : Bool} ;
Compl : Type = {s : Str ; c : Case ; isDir : Bool} ;
complAcc : Compl = {s = [] ; c = accusative ; isDir = True} ;
complGen : Compl = {s = [] ; c = genitive ; isDir = False} ;
complDat : Compl = {s = [] ; c = dative ; isDir = True} ;
pn2np : {s : Str ; g : Gender} -> Pronoun = \pn -> {
s = \\c => prepCase (npform2case c) ++ pn.s ;
a = agrP3 pn.g Sg ;
hasClit = False
} ;
npform2case : NPForm -> Case = \p -> case p of {
Ton x => x ;
Poss _ => genitive ;
Aton x => x
} ;
case2npform : Case -> NPForm = \c -> case c of {
Nom => Ton Nom ;
Acc => Ton Acc ;
_ => Ton c
} ;
-- Pronouns in $NP$ lists are always in stressed forms.
stressedCase : NPForm -> NPForm = \c -> case c of {
Aton k => Ton k ;
_ => c
} ;
appCompl : Compl -> (NPForm => Str) -> Str = \comp,np ->
comp.s ++ np ! Ton comp.c ;
predV : Verb -> VP = \verb ->
let
vfin : TMood -> Agr -> Str = \tm,a -> verb.s ! VFin tm a.n a.p ;
vpart : AAgr -> Str = \a -> verb.s ! VPart a.g a.n ;
vinf : Bool -> Str = \b -> verb.s ! VInfin b ;
vger = verb.s ! VGer ;
typ = verb.vtyp ;
aux = auxVerb typ ;
habet : TMood -> Agr -> Str = \tm,a -> aux ! VFin tm a.n a.p ;
habere : Str = aux ! VInfin False ;
vimp : Agr -> Str = \a -> verb.s ! VImper (case <a.n,a.p> of {
<Pl,P1> => PlP1 ;
<Sg,_> => SgP2 ;
<Pl,_> => PlP2
}) ;
vf : (Agr -> Str) -> (AAgr -> Str) -> {
fin : Agr => Str ;
inf : AAgr => Str
} =
\fin,inf -> {
fin = \\a => fin a ;
inf = \\a => inf a
} ;
in {
s = table {
VPFinite t Simul => vf (vfin t) (\_ -> []) ;
VPFinite t Anter => vf (habet t) vpart ; --# notpresent
VPInfinit Anter _=> vf (\_ -> []) (\a -> habere ++ vpart a) ; --# notpresent
VPImperat => vf vimp (\_ -> []) ;
VPGerund => vf (\_ -> []) (\_ -> vger) ;
VPInfinit Simul b=> vf (\_ -> []) (\_ -> vinf b)
} ;
agr = partAgr typ ;
neg = negation ;
clAcc = case isVRefl typ of {
True => CRefl ;
_ => CNone
} ;
clDat = CNone ; --- no dative refls
clit2 = [] ;
comp = \\a => [] ;
ext = \\p => []
} ;
insertObject : Compl -> Pronoun -> VP -> VP = \c,np,vp ->
let
vpacc = vp.clAcc ;
vpdat = vp.clDat ;
vpagr = vp.agr ;
npa = np.a ;
noNewClit = <vpacc, vpdat, appCompl c np.s, vpagr> ;
cc : CAgr * CAgr * Str * VPAgr = case <np.hasClit,c.isDir> of {
<True,True> => case c.c of {
Acc => <CPron npa, vpdat, [], vpAgrClit npa> ;
_ => <vpacc, CPron npa, [], vpagr> -- must be dat
} ;
_ => noNewClit
} ;
in {
s = vp.s ;
agr = cc.p4 ;
clAcc = cc.p1 ;
clDat = cc.p2 ;
clit2 = vp.clit2 ;
neg = vp.neg ;
comp = \\a => vp.comp ! a ++ cc.p3 ;
ext = vp.ext ;
} ;
insertComplement : (Agr => Str) -> VP -> VP = \co,vp -> {
s = vp.s ;
agr = vp.agr ;
clAcc = vp.clAcc ;
clDat = vp.clDat ;
clit2 = vp.clit2 ;
neg = vp.neg ;
comp = \\a => vp.comp ! a ++ co ! a ;
ext = vp.ext ;
} ;
-- Agreement with preceding relative or interrogative:
-- "les femmes que j'ai aimées"
insertAgr : AAgr -> VP -> VP = \ag,vp -> {
s = vp.s ;
agr = vpAgrClit (agrP3 ag.g ag.n) ;
clAcc = vp.clAcc ;
clDat = vp.clDat ;
clit2 = vp.clit2 ;
neg = vp.neg ;
comp = vp.comp ;
ext = vp.ext ;
} ;
insertAdv : Str -> VP -> VP = \co,vp -> {
s = vp.s ;
agr = vp.agr ;
clAcc = vp.clAcc ;
clDat = vp.clDat ;
clit2 = vp.clit2 ;
neg = vp.neg ;
comp = \\a => vp.comp ! a ++ co ;
ext = vp.ext ;
} ;
insertAdV : Str -> VP -> VP = \co,vp -> {
s = vp.s ;
agr = vp.agr ;
clAcc = vp.clAcc ;
clDat = vp.clDat ;
clit2 = vp.clit2 ;
neg = \\b => let vpn = vp.neg ! b in {p1 = vpn.p1 ; p2 = vpn.p2 ++ co} ;
comp = vp.comp ;
ext = vp.ext ;
} ;
insertClit2 : Str -> VP -> VP = \co,vp -> {
s = vp.s ;
agr = vp.agr ;
clAcc = vp.clAcc ;
clDat = vp.clDat ;
clit2 = vp.clit2 ++ co ; ---- y en
neg = vp.neg ;
comp = vp.comp ;
ext = vp.ext ;
} ;
insertExtrapos : (Polarity => Str) -> VP -> VP = \co,vp -> {
s = vp.s ;
agr = vp.agr ;
clAcc = vp.clAcc ;
clDat = vp.clDat ;
clit2 = vp.clit2 ;
neg = vp.neg ;
comp = vp.comp ;
ext = \\p => vp.ext ! p ++ co ! p ;
} ;
mkClause : Str -> Agr -> VP ->
{s : RTense => Anteriority => Polarity => Mood => Str} =
\subj,agr,vp -> {
s = \\t,a,b,m =>
let
tm = case t of {
RPast => VImperf m ; --# notpresent
RFut => VFut ; --# notpresent
RCond => VCondit ; --# notpresent
RPasse => VPasse ; --# notpresent
RPres => VPres m
} ;
vps = vp.s ! VPFinite tm a ;
verb = vps.fin ! agr ;
inf = vps.inf ! (appVPAgr vp.agr (aagr agr.g agr.n)) ; --- subtype bug
neg = vp.neg ! b ;
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! b
in
subj ++ neg.p1 ++ clpr.p1 ++ vp.clit2 ++ verb ++ neg.p2 ++ inf ++ compl
} ;
infVP : VP -> Agr -> Str = \vp,agr ->
let
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
inf = (vp.s ! VPInfinit Simul clpr.p3).inf ! (aagr agr.g agr.n) ;
neg = vp.neg ! Pos ; --- Neg not in API
obj = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! Pos ---- pol
in
clitInf clpr.p3 (clpr.p1 ++ vp.clit2) inf ++ obj ;
}
-- insertObject:
-- p -cat=Cl -tr "la femme te l' envoie"
-- PredVP (DetCN (DetSg DefSg NoOrd) (UseN woman_N))
-- (ComplV3 send_V3 (UsePron he_Pron) (UsePron thou_Pron))
-- la femme te l' a envoyé
--
-- p -cat=Cl -tr "la femme te lui envoie"
-- PredVP (DetCN (DetSg DefSg NoOrd) (UseN woman_N))
-- (ComplV3 send_V3 (UsePron thou_Pron) (UsePron he_Pron))
-- la femme te lui a envoyée

View File

@@ -1,194 +0,0 @@
--# -path=.:../abstract:../../prelude
incomplete concrete RulesRomance of Rules = CategoriesRomance **
open Prelude, SyntaxRomance in {
flags optimize = all_subs ;
lin
UseN = noun2CommNounPhrase ;
UsePN = nameNounPhrase ;
IndefOneNP = indefNounPhrase singular ;
IndefNumNP = indefNounPhraseNum ;
DefOneNP = defNounPhrase singular ;
DefNumNP = defNounPhraseNum ;
DetNP = detNounPhrase ;
NDetNP = numDetNounPhrase ;
NDetNum = justNumDetNounPhrase ;
MassNP = partitiveNounPhrase singular ;
AppN2 = appFunComm ;
AppN3 = appFun2 ;
UseN2 = funAsCommNounPhrase ; -- [SyntaxFra.noun2CommNounPhrase]
ModAP = modCommNounPhrase ;
CNthatS = nounThatSentence ;
ModGenOne = npGenDet singular ;
ModGenNum = npGenDetNum ;
UseInt i = {s = \\_ => i.s ; n = Pl ; isNo = False} ; ---- n
NoNum = noNum ;
UseA = adj2adjPhrase ;
ComplA2 = complAdj ;
ComplAV v x = complVerbAdj v x ;
ComplObjA2V v x y = complVerbAdj2 True v x y ;
PositADeg = positAdjPhrase ;
ComparADeg = comparAdjPhrase ;
SuperlADeg = superlAdjPhrase ;
PredAS = predAdjSent ;
PredV0 rain = predVerb0 rain ;
-- Partial saturation.
UseV2 = transAsVerb ;
ComplA2S = predAdjSent2 ; ---- clitics get lost
AdjPart = adjPastPart ;
UseV2V x = x ** {isAux = False} ;
UseV2S x = x ;
UseV2Q x = x ;
UseA2S x = x ;
UseA2V x = x ;
-- Formation of fixed-tense fixed-polarity clauses.
UseCl tp cl =
{s = \\m => tp.s ++ cl.s ! tp.b ! useClForm tp.t tp.a m} ;
UseRCl tp cl =
{s = \\m,g,n,p => tp.s ++
cl.s1 ! g ! n ! p ++
cl.s2 ! tp.b ! useClForm tp.t tp.a m ! g ! n ! p ++
cl.s3 ! tp.b
} ;
UseQCl tp cl =
{s = \\q => tp.s ++ cl.s ! tp.b ! useClForm tp.t tp.a Ind ! q} ;
UseVCl po a cl =
{s = \\v,g,n,p => po.s ++ a.s ++ cl.s ! po.p ! a.a ! v ! g ! n ! p} ;
PosTP t a = {s = t.s ++ a.s ; b = True ; t = t.t ; a = a.a} ;
NegTP t a = {s = t.s ++ a.s ; b = False ; t = t.t ; a = a.a} ;
TPresent = {s = [] ; t = Present} ;
TPast = {s = [] ; t = Past} ;
TFuture = {s = [] ; t = Future} ;
TConditional = {s = [] ; t = Condit} ;
ASimul = {s = [] ; a = Simul} ;
AAnter = {s = [] ; a = Anter} ;
PPos = {s = [] ; p = True} ;
PNeg = {s = [] ; p = False} ;
-- Adverbs.
AdjAdv a = {s = a.s ! AA} ;
---- AdvVP = adVerbPhrase ;
AdvPP p = p ;
PrepNP = prepNounPhrase ;
AdvCN = advCommNounPhrase ;
AdvAP = advAdjPhrase ;
AdvAdv = cc2 ;
--- Here the $np$ should become always stressed.
AdvNP np adv = <np : {g : PronGen ; n : Number ; p : Person}> **
{s = \\f => np.s ! f ++ adv.s ; c = Clit0} ;
--3 Sentences and relative clauses
--
SlashV2 = slashTransVerb ;
SlashVV2 = slashVerbVerb ;
SlashAdv = slashAdverb ;
IdRP = identRelPron ;
FunRP = funRelPron ;
RelSlash = relSlash ;
ModRS = modRelClause ;
RelCl = relSuch ;
--!
--3 Questions and imperatives
--
IDetCN d n = let np = detNounPhrase d n in {
s = \\c => np.s ! case2pform c ;
g = pgen2gen np.g ;
n = np.n
} ;
FunIP = funIntPron ;
QuestCl = questClause ;
IntSlash = intSlash ;
QuestAdv = questAdverbial ;
PosImpVP = imperVerbPhrase True ;
NegImpVP = imperVerbPhrase False ;
IndicPhrase = indicUtt ;
QuestPhrase = interrogUtt ;
ImperOne = imperUtterance singular ;
ImperMany = imperUtterance plural ;
AdvCl = advClause ;
AdvVPI = advVerbPhrase ;
AdCPhr = advSentence ;
AdvPhr = advSentence ;
TwoS = twoSentence ;
ConsS = consSentence ;
ConjS = conjunctSentence ;
ConjDS = conjunctDistrSentence ; -- [Coordination.conjunctDistrTable]
TwoAP = twoAdjPhrase ;
ConsAP = consAdjPhrase ;
ConjAP = conjunctAdjPhrase ;
ConjDAP = conjunctDistrAdjPhrase ;
TwoNP = twoNounPhrase ;
ConsNP = consNounPhrase ;
ConjNP = conjunctNounPhrase ;
ConjDNP = conjunctDistrNounPhrase ;
TwoAdv = twoAdverb ;
ConsAdv = consAdverb ;
ConjAdv = conjunctAdverb ;
ConjDAdv = conjunctDistrAdverb ;
SubjS = subjunctSentence ; -- stack
SubjImper = subjunctImperative ;
SubjQS = subjunctQuestion ;
----- SubjVP = subjunctVerbPhrase ;
AdvSubj if A = {s = if.s ++ A.s ! if.m} ;
PhrNP = useNounPhrase ;
PhrOneCN = useCommonNounPhrase singular ;
PhrManyCN = useCommonNounPhrase plural ;
PhrIP ip = postfixSS "?" ip ;
PhrIAdv ia = postfixSS "?" ia ;
PhrVPI = verbUtterance ;
OnePhr p = p ;
ConsPhr = cc2 ;
-----------------------
-- special constructions
OneNP = nounPhraseOn ;
ExistCN A = existNounPhrase (indefNounPhrase Sg A) ;
ExistNumCN nu A = existNounPhrase (indefNounPhraseNum nu A) ;
}

View File

@@ -0,0 +1,53 @@
incomplete concrete SentenceRomance of Sentence =
CatRomance ** open Prelude, CommonRomance, ResRomance in {
flags optimize=all_subs ;
lin
PredVP np vp = mkClause (np.s ! Aton Nom) np.a vp ;
PredSCVP sc vp = mkClause sc.s (agrP3 Masc Sg) vp ;
ImpVP = mkImperative P2 ;
SlashV2 np v2 =
{s = \\ag =>case <v2.c2.c,v2.c2.isDir> of {
<Acc,True> =>
(mkClause (np.s ! Aton Nom) np.a
(insertAgr ag (predV v2))).s ;
_ => (mkClause (np.s ! Aton Nom) np.a (predV v2)).s
} ;
c2 = v2.c2
} ;
SlashVVV2 np vv v2 =
{s = \\_ =>
(mkClause
(np.s ! Aton Nom) np.a
(insertComplement
(\\a => prepCase vv.c2.c ++ v2.s ! VInfin False) (predV vv))).s ;
c2 = v2.c2
} ;
AdvSlash slash adv = {
s = \\ag,t,a,b,m => slash.s ! ag ! t ! a ! b ! m ++ adv.s ;
c2 = slash.c2
} ;
SlashPrep cl prep = {
s = \\_ => cl.s ;
c2 = {s = prep.s ; c = prep.c ; isDir = False}
} ;
EmbedS s = {s = conjThat ++ s.s ! Indic} ; --- mood
EmbedQS qs = {s = qs.s ! QIndir} ;
EmbedVP vp = {s = infVP vp (agrP3 Masc Sg)} ; --- agr ---- compl
UseCl t a p cl = {s = \\o => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! o} ;
UseQCl t a p cl = {s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q} ;
UseRCl t a p cl = {
s = \\r,ag => t.s ++ a.s ++ p.s ++ cl.s ! ag ! t.t ! a.a ! p.p ! r ;
c = cl.c
} ;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,307 +0,0 @@
--1 A Small Romance Resource Syntax
--
-- Aarne Ranta 2002
--
-- This resource grammar contains definitions needed to construct
-- indicative, interrogative, and imperative sentences in Romance languages.
-- We try to share as much as possible. Even if the definitions of certain
-- operations are different in $syntax.Fra.gf$ and $syntax.Ita.gf$, we can
-- often give their type signatures in this file.
--
-- The following files are presupposed:
interface SyntaxRomanceVP = SyntaxRomance ** open Prelude in {
--3 Transitive verbs
--
-- Transitive verbs are verbs with a preposition for the complement,
-- in analogy with two-place adjectives and functions.
-- One might prefer to use the term "2-place verb", since
-- "transitive" traditionally means that the inherent preposition is empty.
-- Such a verb is one with a *direct object* - which may still be accusative,
-- dative, or genitive.
--
-- In complementation, we do need some dispatching of clitic types:
-- "aime Jean" ; "n'aime pas Jean" ; "l'aime" ; "ne l'aime pas".
-- More will be needed when we add ditransitive verbs.
oper
complTransVerb : TransVerb -> NounPhrase -> Complemnt = \aime,jean ->
complTransVerbGen aime jean (\\_,_,_ => []) ;
complTransVerbGen : TransVerb -> NounPhrase ->
(Gender => Number => Person => Str) -> Complemnt =
\aime,jean,ici ->
let
clit = andB (isNounPhraseClit jean) (isTransVerbClit aime) ;
Jean = jean.s ! (case2pformClit aime.c) ;
aimee = if_then_Str clit
(aime.s ! VPart (pgen2gen jean.g) jean.n)
(aime.s ! VPart Masc Sg)
in
\\g,n,p =>
let Ici = ici ! g ! n ! p
in
case clit of {
True => {clit = Jean ; part = aimee ; compl = Ici} ;
False => {clit = [] ; part = aimee ; compl = Jean ++ Ici}
} ;
----- add auxVerb to Complemnt to switch to $esse$ in refl ?
reflTransVerb : TransVerb -> Complemnt = \aime ->
let
clit = isTransVerbClit aime ;
in
\\g,n,p =>
let
soi = reflPron ! n ! p ! unstressed accusative ; ---- (case2pformClit aime.c) ;
aimee = aime.s ! VPart g n
in
case clit of {
True => {clit = soi ; part = aimee ; compl = []} ;
False => {clit = [] ; part = aimee ; compl = soi}
} ;
--2 Sentences
--
-- Sentences depend on a *mode parameter* selecting between
-- indicative and subjunctive forms.
oper
VerbGroup : Type = {s : Bool => Gender => VPForm => Str} ;
predVerbGroup : Bool -> {s : Str ; a : Anteriority} -> VerbGroup -> VerbPhrase =
\b,ant,vg ->
{s = \\vi,g,n,p => ant.s ++ vg.s ! b ! g ! VPF ant.a VInfin ---- imper
} ;
cl2vp : ClForm -> Number -> Person -> VPForm = \c,n,p -> case c of {
ClPres a m => VPF a (VFin (VPres m) n p) ;
ClImperf a m => VPF a (VFin (VImperf m) n p) ;
ClPasse a => VPF a (VFin VPasse n p) ;
ClFut a => VPF a (VFin VFut n p) ;
ClCondit a => VPF a (VFin VCondit n p) ;
ClInfinit a => VPF a VInfin
} ;
vp2cl : VPForm -> ClForm = \vf -> case vf of {
VPF a (VFin (VPres m) _ _) => ClPres a m ;
VPF a (VFin (VImperf m) _ _) => ClImperf a m ;
VPF a (VFin (VPasse) _ _) => ClPasse a ;
VPF a (VFin (VFut) _ _) => ClFut a ;
VPF a (VFin (VCondit) _ _) => ClCondit a ;
VPF a VInfin => ClInfinit a ;
_ => ClInfinit Simul ---- imper
} ;
-- Predication is language-dependent in the negative case.
complVerb : Verb -> Complemnt = \verb ->
mkCompl verb (\\_,_,_ => []) ;
mkCompl : Verb -> (Gender => Number => Person => Str) -> Complemnt =
\verb,comp -> complNoClit (
\\g,n,p => <verb.s ! (case verb.aux of {
AEsse => VPart g n ;
AHabere => VPart Masc Sg
}),
comp ! g ! n ! p
>) ;
complNoClit : (Gender => Number => Person => (Str*Str)) -> Complemnt =
\comp -> \\g,n,p =>
let com = comp ! g ! n ! p in
{clit = [] ; part = com.p1 ; compl = com.p2} ;
complCopula : (Gender => Number => Person => Str) -> Complemnt =
mkCompl copula ;
predCopula : NounPhrase -> Complemnt -> Clause = \np,co ->
predVerbClause np copula co ;
Complemnt = Gender => Number => Person => {clit, part, compl : Str} ; ---- ment
predVerbClause : NounPhrase -> Verb -> Complemnt -> Clause = \np,verb,comp ->
let nv = predVerbClauseGen np verb comp in
{s = \\b,cl => let nvg = nv ! b ! cl in nvg.p1 ++ nvg.p2} ;
predVerbClauseGen : NounPhrase -> Verb -> Complemnt ->
(Bool => ClForm => (Str * Str)) = \np,verb,comp ->
let
jean = np.s ! unstressed nominative ;
co = comp ! pgen2gen np.g ! np.n ! np.p ;
la = co.clit ;
ici = co.compl ;
aimee = co.part ;
aime : TMode -> Str = \t -> verb.s ! (VFin t np.n np.p) ;
avoir : TMode -> Str = \t -> (auxVerb verb).s ! (VFin t np.n np.p) ;
aimer = verb.s ! VInfin ;
avoirr = (auxVerb verb).s ! VInfin
in
\\b => table {
ClPres Simul m => <jean, posNeg b (la ++ aime (VPres m)) ici> ;
ClPres a m => <jean, posNeg b (la ++ avoir (VPres m)) (aimee ++ ici)> ;
ClImperf Simul m => <jean, posNeg b (la ++ aime (VImperf m)) ici> ;
ClImperf a m => <jean, posNeg b (la ++ avoir (VImperf m)) (aimee ++ ici)> ;
ClPasse Simul => <jean, posNeg b (la ++ aime VPasse) ici> ;
ClPasse a => <jean, posNeg b (la ++ avoir VPasse) (aimee ++ ici)> ;
ClFut Simul => <jean, posNeg b (la ++ aime VFut) ici> ;
ClFut a => <jean, posNeg b (la ++ avoir VFut) (aimee ++ ici)> ;
ClCondit Simul => <jean, posNeg b (la ++ aime VFut) ici> ;
ClCondit a => <jean, posNeg b (la ++ avoir VFut) (aimee ++ ici)> ;
ClInfinit Simul => <jean, posNeg b (la ++ aimer) ici> ;
ClInfinit a => <jean, posNeg b (la ++ avoirr) (aimee ++ ici)>
} ;
-- These three function are just to restore the $VerbGroup$ ($VP$) based structure.
predVerbGroupClause : NounPhrase -> VerbGroup -> Clause = \np,vp ->
let
it = np.s ! unstressed nominative
in
{s = \\b,cf => it ++ vp.s ! b ! pgen2gen np.g ! cl2vp cf np.n np.p} ;
predClauseGroup : Verb -> Complemnt -> VerbGroup = \verb,comp ->
let
nvg : PronGen -> Number -> Person -> (Bool => ClForm => (Str * Str)) =
\g,n,p ->
predVerbClauseGen {s = \\_ => [] ; g=g ; n=n ; p=p ; c=Clit0} verb comp
-- clit type irrelevant in subject position
in
{s = \\b,g,vf =>
(nvg (PGen g) (nombreVerbPhrase vf) (personVerbPhrase vf) ! b ! (vp2cl vf)).p2
} ;
predClauseBeGroup : Complemnt -> VerbGroup =
predClauseGroup copula ;
--3 Sentence-complement verbs
--
-- Sentence-complement verbs take sentences as complements.
-- The mode of the complement depends on the verb, and can be different
-- for positive and negative uses of the verb
-- ("je crois qu'elle vient" -"je ne crois pas qu'elle vienne"),
complSentVerb : SentenceVerb -> Sentence -> Complemnt = \croire,jeanboit ->
mkCompl
croire
(\\g,n,p =>
----- add Bool to Complemnt ?
----- let m = if_then_else Mode b croire.mp croire.mn
embedConj ++ jeanboit.s ! croire.mp) ;
complDitransSentVerb :
(TransVerb ** {mp, mn : Mode}) -> NounPhrase -> Sentence -> Complemnt =
\dire,lui,jeanboit ->
complTransVerbGen
dire lui
(\\g,n,p =>
embedConj ++ jeanboit.s ! dire.mp) ;
complQuestVerb : Verb -> QuestionSent -> Complemnt = \demander,sijeanboit ->
mkCompl
demander
(\\g,n,p => sijeanboit.s ! IndirQ) ;
complDitransQuestVerb : TransVerb -> NounPhrase -> QuestionSent -> Complemnt =
\dire,lui,jeanboit ->
complTransVerbGen
dire lui
(\\g,n,p => jeanboit.s ! IndirQ) ;
complAdjVerb : Verb -> AdjPhrase -> Complemnt = \sent,bon ->
mkCompl sent (\\g,n,_ => bon.s ! AF g n) ;
-- The third rule is overgenerating: "est chaque homme" has to be ruled out
-- on semantic grounds.
complAdjective : AdjPhrase -> Complemnt = \bon ->
complCopula (\\g,n,_ => bon.s ! AF g n) ;
complCommNoun : CommNounPhrase -> Complemnt = \homme ->
complCopula (\\_,n,_ => indefNoun n homme) ;
complNounPhrase : NounPhrase -> Complemnt = \jean ->
complCopula (\\_,_,_ => jean.s ! stressed nominative) ;
complAdverb : Adverb -> Complemnt = \dehors ->
complCopula (\\_,_,_ => dehors.s) ;
complVerbAdj : AdjCompl -> VerbPhrase -> AdjPhrase = \facile,ouvrir ->
{s = \\gn => ---- p
facile.s ! gn ++ prepCase facile.c ++ facile.s2 ++
ouvrir.s ! VIInfinit ! Masc ! Sg ! P3 ;
p = False
} ;
complVerbAdj2 : Bool -> AdjCompl -> NounPhrase -> VerbPhrase -> AdjPhrase =
\b,facile,lui,nager ->
{s = \\gn => ---- p
facile.s ! gn ++
lui.s ! stressed dative ++ ---- also "pour lui" ?
prepCase facile.c ++ facile.s2 ++
nager.s ! VIInfinit ! pgen2gen lui.g ! lui.n ! P3 ; ---- agr dep on b
p = False
} ;
--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.
complVerbVerb : VerbVerb -> VerbPhrase -> Complemnt = \devoir, nager ->
mkCompl
devoir
(\\g,n,p => prepCase devoir.c ++ nager.s ! VIInfinit ! g ! n ! p) ;
progressiveVerbPhrase : VerbPhrase -> VerbGroup = \vp ->
predClauseBeGroup
(complCopula (\\g,n,p =>
"en" ++ "train" ++ elisDe ++ vp.s ! VIInfinit ! g ! n ! p)) ;
--- This must be completed to account for the order of the clitics.
--- In the rule below, the last argument cannot get cliticized.
complDitransVerb :
DitransVerb -> NounPhrase -> NounPhrase -> Complemnt = \donner,jean,vin ->
complTransVerbGen
donner jean
(\\_,_,_ => donner.s3 ++ vin.s ! case2pform donner.c3) ;
complDitransVerbVerb :
Bool -> DitransVerbVerb -> NounPhrase -> VerbPhrase -> Complemnt =
\obj, demander, toi, nager ->
complTransVerbGen demander toi
(\\g,n,p =>
let
agr : Gender * Number * Person = case obj of {
True => <pgen2gen toi.g, toi.n, toi.p> ;
False => <g, n, p>
}
in
prepCase demander.c ++
nager.s ! VIInfinit ! agr.p1 ! agr.p2 ! agr.p3) ;
complDitransAdjVerb :
TransVerb -> NounPhrase -> AdjPhrase -> Complemnt = \rend,toi,sec ->
complTransVerbGen rend toi (\\g,n,_ => sec.s ! AF g n) ;
adVerbPhrase : VerbGroup -> Adverb -> VerbGroup = \chante, bien ->
{s = \\b,g,v => chante.s ! b ! g ! v ++ bien.s} ;
intVerbPhrase : IntPron -> VerbGroup -> Question = \ip,vg ->
questClause (predVerbGroupClause (intNounPhrase ip) vg) ;
-- Passivization is like adjectival predication.
passVerb : Verb -> Complemnt = \aimer ->
complCopula (\\g,n,_ => aimer.s ! VPart g n) ;
subjunctVerbPhrase : VerbGroup -> Subjunction -> Sentence -> VerbGroup =
\V, si, A ->
adVerbPhrase V (ss (si.s ++ A.s ! si.m)) ;
}

View File

@@ -1,209 +0,0 @@
--1 Romance Word Classes and Morphological Parameters
--
-- This is a resource module for French and Italian morphology, defining the
-- morphological parameters and parts of speech of Romance languages.
-- It is used as the major part of language-specific type systems,
-- defined in $types.Fra.gf$ and $types.Ita.gf$. The guiding principle has been
-- to share as much as possible, which has two advantages: it saves work in
-- encoding, and it shows how the languages are related.
interface TypesRomance = {
--2 Enumerated parameter types for morphology
--
-- These types are the ones found in school grammars.
-- Their parameter values are atomic.
param
Number = Sg | Pl ;
Gender = Masc | Fem ;
Person = P1 | P2 | P3 ;
Mode = Ind | Con ;
Degree = Pos | Comp ;
-- The case must be made an abstract type, since it varies from language to
-- language. The same concerns those parameter types that depend on case.
-- Certain cases can however be defined.
oper
RelGen = PronGen ;
RNoGen = PNoGen ;
RG = PGen ;
oper
CaseA : PType ;
NPFormA : PType ;
nominative : CaseA ;
accusative : CaseA ;
genitive : CaseA ;
dative : CaseA ;
prepositional : CaseA ;
stressed : CaseA -> NPFormA ;
unstressed : CaseA -> NPFormA ;
RelFormA : PType ;
npRelForm : NPFormA -> RelFormA ;
-- The genitive and dative cases are expressed by prepositions, except for
-- clitic pronouns. The accusative case only makes a difference for pronouns.
-- Personal pronouns are the following type:
oper
Pronoun : Type = {
s : NPFormA => Str ;
g : PronGen ;
n : Number ;
p : Person ;
c : ClitType
} ;
-- The following coercions are useful:
oper
pform2case : NPFormA -> CaseA ;
case2pform, case2pformClit : CaseA -> NPFormA ;
prepCase : CaseA -> Str ;
adjCompLong : Adj -> AdjComp ;
relPronForms : CaseA => Str ;
-- For abstraction and API compatibility, we define two synonyms:
oper
singular = Sg ;
plural = Pl ;
--2 Word classes and hierarchical parameter types
--
-- Real parameter types (i.e. ones on which words and phrases depend)
-- are mostly hierarchical. The alternative is cross-products of
-- simple parameters, but this cannot be always used since it overgenerates.
--
--3 Common nouns
--
-- Common nouns are inflected in number, and they have an inherent gender.
CNom : Type = {s : Number => Str ; g : Gender} ;
--3 Pronouns
--
-- Pronouns are an example - the worst-case one of noun phrases,
-- which are defined in $syntax.Ita.gf$.
-- Their inflection tables has tonic and atonic forms, as well as
-- the possessive forms, which are inflected like determiners.
--
-- Example: "lui, de lui, à lui" - "il,le,lui" - "son,sa,ses".
-- Tonic forms are divided into four classes of clitic type.
-- The first value is used for never-clitic noun phrases.
--
-- Examples of each: "Giovanni" ; "io" ; "lui" ; "noi".
param ClitType = Clit0 | Clit1 | Clit2 | Clit3 ;
-- Gender is not morphologically determined for first and second person pronouns.
PronGen = PGen Gender | PNoGen ;
-- The following coercion is useful:
oper
pgen2gen : PronGen -> Gender = \p -> case p of {
PGen g => g ;
PNoGen => variants {Masc ; Fem} --- the best we can do for je, tu, nous, vous
} ;
--3 Adjectives
--
-- 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).
param
AForm = AF Gender Number | AA ;
oper
Adj : Type = {s : AForm => Str} ;
AdjComp : Type = {s : Degree => AForm => Str} ;
genAForm : AForm -> Gender = \a -> case a of {
AF g _ => g ;
_ => Masc -- "le plus lentement"
} ;
numAForm : AForm -> Number = \a -> case a of {
AF _ n => n ;
_ => Sg -- "le plus lentement"
} ;
--3 Verbs
--
-- In the current syntax, we use
-- a reduced conjugation with only the present tense infinitive,
-- indicative, subjunctive, and imperative forms.
-- But our morphology has full Bescherelle conjunctions:
-- so we use a coercion between full and reduced verbs.
-- The full conjugations and the coercions are defined separately for French
-- and Italian, since they are not identical. The differences are mostly due
-- to Bescherelle structuring the forms in different groups; the
-- gerund and the present participles show real differences.
param
VF =
VInfin
| VFin TMode Number Person
| VImper NumPersI
| VPart Gender Number
| VGer
;
TMode =
VPres Mode
| VImperf Mode
| VPasse
| VFut
| VCondit
;
NumPersI = SgP2 | PlP1 | PlP2 ;
-- It is sometimes useful to derive the number of a verb form.
oper
nombreVerb : VF -> Number = \v -> case v of {
VFin _ n _ => n ;
_ => singular ---
} ;
personVerb : VF -> Person = \v -> case v of {
VFin _ _ p => p ;
_ => P3 ---
} ;
presInd = VPres Ind ;
-- The imperative forms depend on number and person.
vImper : Number -> Person -> VF = \n,p -> case <n,p> of {
<Sg,P2> => VImper SgP2 ;
<Pl,P1> => VImper PlP1 ;
<Pl,P2> => VImper PlP2 ;
_ => VInfin
} ;
Verbum : Type ;
Verb : Type = {s : VF => Str ; aux : VAux} ;
verbPres : Verbum -> VAux -> Verb ;
param VAux = AEsse | AHabere ;
}

View File

@@ -0,0 +1,50 @@
incomplete concrete VerbRomance of Verb =
CatRomance ** open Prelude, CommonRomance, ResRomance in {
flags optimize=all_subs ;
lin
UseV = predV ;
ComplV2 v np1 = insertObject v.c2 np1 (predV v) ;
ComplV3 v np1 np2 = insertObject v.c3 np2 (insertObject v.c2 np1 (predV v)) ;
ComplVV v vp =
insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v) ;
ComplVS v s = insertExtrapos (\\b => conjThat ++ s.s ! (v.m ! b)) (predV v) ;
ComplVQ v q = insertExtrapos (\\_ => q.s ! QIndir) (predV v) ;
ComplVA v ap =
insertComplement (\\a => ap.s ! AF a.g a.n) (predV v) ;
ComplV2A v np ap =
let af = case v.c3.isDir of {
True => AF np.a.g np.a.n ; -- ... bleues
_ => AF Masc Sg -- il les peint en bleu
}
in
insertComplement
(\\a => v.c3.s ++ prepCase v.c3.c ++ ap.s ! af)
(insertObject v.c2 np (predV v)) ;
UseComp comp = insertComplement comp.s (predV copula) ;
CompAP ap = {s = \\ag => ap.s ! AF ag.g ag.n} ;
CompNP np = {s = \\_ => np.s ! Ton Acc} ;
CompAdv a = {s = \\_ => a.s} ;
AdvVP vp adv = insertAdv adv.s vp ;
AdVVP adv vp = insertAdV adv.s vp ;
ReflV2 v = case v.c2.isDir of {
True => predV {s = v.s ; vtyp = vRefl} ;
False => insertComplement
(\\a => v.c2.s ++ reflPron a.n a.p v.c2.c) (predV v)
} ;
PassV2 v = insertComplement (\\a => v.s ! VPart a.g a.n) (predV auxPassive) ;
UseVS, UseVQ = \vv -> {s = vv.s ; c2 = complAcc ; vtyp = vv.vtyp} ;
}

View File

@@ -1,64 +0,0 @@
--# -path=.:../romance:../abstract:../../prelude
--1 The Top-Level Romance Resource Grammar: Verb Phrase Combination Rules
--
-- Aarne Ranta 2002 -- 2003
--
-- This is the English concrete syntax of the multilingual resource
-- grammar. Most of the work is done in the file $syntax.Eng.gf$.
-- However, for the purpose of documentation, we make here explicit the
-- linearization types of each category, so that their structures and
-- dependencies can be seen.
-- Another substantial part are the linearization rules of some
-- structural words.
--
-- The users of the resource grammar should not look at this file for the
-- linearization rules, which are in fact hidden in the document version.
-- They should use $resource.Abs.gf$ to access the syntactic rules.
-- This file can be consulted in those, hopefully rare, occasions in which
-- one has to know how the syntactic categories are
-- implemented. The parameter types are defined in $TypesEng.gf$.
incomplete concrete VerbphraseRomance of Verbphrase = CategoriesRomance **
open Prelude, SyntaxRomanceVP in {
flags optimize=all_subs ;
lin
UseV v = predClauseGroup v (complVerb v) ;
UsePassV v = predClauseBeGroup (passVerb v) ;
ComplV2 v x = predClauseGroup v (complTransVerb v x) ;
ComplV3 v x y = predClauseGroup v (complDitransVerb v x y) ;
ComplReflV2 v = predClauseGroup v (reflTransVerb v) ;
ComplVS v x = predClauseGroup v (complSentVerb v x) ;
ComplVV v x = predClauseGroup v (complVerbVerb v x) ;
ComplVQ v x = predClauseGroup v (complQuestVerb v x) ;
ComplVA v x = predClauseGroup v (complAdjVerb v x) ;
ComplV2A v x y = predClauseGroup v (complDitransAdjVerb v x y) ;
ComplSubjV2V v x y = predClauseGroup v (complDitransVerbVerb False v x y) ;
ComplObjV2V v x y = predClauseGroup v (complDitransVerbVerb True v x y) ;
ComplV2S v x y = predClauseGroup v (complDitransSentVerb v x y) ;
ComplV2Q v x y = predClauseGroup v (complDitransQuestVerb v x y) ;
PredAP v = predClauseBeGroup (complAdjective v) ;
PredCN v = predClauseBeGroup (complCommNoun v) ;
PredNP v = predClauseBeGroup (complNounPhrase v) ;
PredAdv v = predClauseBeGroup (complAdverb v) ;
PredProgVP = progressiveVerbPhrase ;
-- Use VPs
PredVP = predVerbGroupClause ;
RelVP = variants {} ; ----- relVerbPhrase ;
IntVP = intVerbPhrase ;
-- PosVP tp = predVerbGroup True tp ;
-- NegVP tp = predVerbGroup False tp ;
UseVP = variants {} ;
AdvVP = adVerbPhrase ;
SubjVP = subjunctVerbPhrase ;
}