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,117 @@
--# -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

@@ -0,0 +1,345 @@
--# -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,47 @@
--# -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,2 @@
incomplete concrete NumeralsRomance of Numerals = {
}

View File

@@ -0,0 +1,194 @@
--# -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) ;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,307 @@
--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

@@ -0,0 +1,209 @@
--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,64 @@
--# -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 ;
}