mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-23 01:52:50 -06:00
resturcturing french resource
This commit is contained in:
81
lib/resource/romance/CategoriesRomance.gf
Normal file
81
lib/resource/romance/CategoriesRomance.gf
Normal file
@@ -0,0 +1,81 @@
|
||||
--# -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 =
|
||||
open Prelude, SyntaxRomance in {
|
||||
|
||||
flags
|
||||
startcat=Phr ;
|
||||
|
||||
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} ;
|
||||
A1 = Adjective ;
|
||||
-- = {s : AForm => Str ; p : Bool} ;
|
||||
A2 = Adjective ** {s2 : Preposition ; c : CaseA} ;
|
||||
ADeg = {s : Degree => AForm => Str ; p : Bool} ;
|
||||
AP = Adjective ;
|
||||
N2 = Function ;
|
||||
-- = CommNoun ** {s2 : Preposition ; c : CaseA} ;
|
||||
N3 = Function ** {s3 : Preposition ; c3 : CaseA} ;
|
||||
Prep = {s : Preposition ; c : CaseA} ;
|
||||
Num = {s : Gender => Str} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VF => Str} ;
|
||||
VG = {s : Bool => Gender => VF => Str} ;
|
||||
VP = {s : Gender => VF => Str} ;
|
||||
V2 = TransVerb ;
|
||||
-- = Verb ** {s2 : Preposition ; c : CaseA} ;
|
||||
V3 = TransVerb ** {s3 : Preposition ; c3 : CaseA} ;
|
||||
VS = Verb ** {mp,mn : Mode} ;
|
||||
VV = Verb ** {c : CaseA} ;
|
||||
Adv = {s : Str} ;
|
||||
PP = {s : Str} ;
|
||||
|
||||
S = Sentence ;
|
||||
-- = {s : Mode => Str} ;
|
||||
Slash = Sentence ** {s2 : Preposition ; c : CaseA} ;
|
||||
|
||||
RP = {s : RelForm => Str ; g : RelGen} ;
|
||||
RC = {s : Mode => Gender => Number => Str} ;
|
||||
|
||||
IP = {s : CaseA => Str ; g : Gender ; n : Number} ;
|
||||
Qu = {s : 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} ;
|
||||
|
||||
Subj = {s : Str ; m : Mode} ;
|
||||
}
|
||||
2
lib/resource/romance/NumeralsRomance.gf
Normal file
2
lib/resource/romance/NumeralsRomance.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
incomplete concrete NumeralsRomance of Numerals = {
|
||||
}
|
||||
126
lib/resource/romance/RulesRomance.gf
Normal file
126
lib/resource/romance/RulesRomance.gf
Normal file
@@ -0,0 +1,126 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
incomplete concrete RulesRomance of Rules = CategoriesRomance **
|
||||
open Prelude, SyntaxRomance in {
|
||||
|
||||
lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
ModGenOne = npGenDet singular ;
|
||||
ModGenNum = npGenDetNum ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseN2 = funAsCommNounPhrase ; -- [SyntaxFra.noun2CommNounPhrase]
|
||||
AppN2 = appFunComm ;
|
||||
AppN3 = appFun2 ;
|
||||
UseA1 = adj2adjPhrase ;
|
||||
ComplA2 = complAdj ;
|
||||
PositADeg = positAdjPhrase ;
|
||||
ComparADeg = comparAdjPhrase ;
|
||||
SuperlADeg = superlAdjDegr ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefNumNP = indefNounPhraseNum ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefNumNP = defNounPhraseNum ;
|
||||
MassNP = partitiveNounPhrase singular ;
|
||||
UseInt i = {s = \\_ => i.s} ;
|
||||
NoNum = noNum ;
|
||||
|
||||
SymbPN i = {s = i.s ; g = Masc} ; --- cannot know gender
|
||||
SymbCN cn s =
|
||||
{s = \\n => cn.s ! n ++ s.s ;
|
||||
g = cn.g} ;
|
||||
|
||||
CNthatS = nounThatSentence ;
|
||||
|
||||
PredVP = predVerbPhrase ;
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
|
||||
PredV = predVerb ;
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredV2 = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdv = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
PredPassV = predPassVerb ;
|
||||
VTrans = transAsVerb ;
|
||||
|
||||
AdjAdv a = {s = a.s ! AA} ;
|
||||
AdvVP = adVerbPhrase ;
|
||||
AdvPP p = p ;
|
||||
PrepNP = prepNounPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
ThereNP = existNounPhrase ;
|
||||
|
||||
PosSlashV2 = slashTransVerb True ;
|
||||
NegSlashV2 = slashTransVerb False ;
|
||||
OneVP = predVerbPhrase nounPhraseOn ;
|
||||
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
RelVP = relVerbPhrase ;
|
||||
RelSlash = relSlash ;
|
||||
ModRC = modRelClause ;
|
||||
RelSuch = relSuch ;
|
||||
|
||||
WhoOne = intPronWho singular ;
|
||||
WhoMany = intPronWho plural ;
|
||||
WhatOne = intPronWhat singular ;
|
||||
WhatMany = intPronWhat plural ;
|
||||
FunIP = funIntPron ;
|
||||
NounIPOne = nounIntPron singular ;
|
||||
NounIPMany = nounIntPron plural ;
|
||||
|
||||
QuestVP = questVerbPhrase ;
|
||||
IntVP = intVerbPhrase ;
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
IsThereNP = existNounPhraseQuest ;
|
||||
|
||||
ImperVP = imperVerbPhrase ;
|
||||
|
||||
IndicPhrase = indicUtt ;
|
||||
QuestPhrase = interrogUtt ;
|
||||
ImperOne = imperUtterance singular ;
|
||||
ImperMany = imperUtterance plural ;
|
||||
|
||||
PrepS p = p ;
|
||||
AdvS = 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 ;
|
||||
|
||||
SubjS = subjunctSentence ; -- stack
|
||||
SubjImper = subjunctImperative ;
|
||||
SubjQu = subjunctQuestion ;
|
||||
SubjVP = subjunctVerbPhrase ;
|
||||
|
||||
PhrNP = useNounPhrase ;
|
||||
PhrOneCN = useCommonNounPhrase singular ;
|
||||
PhrManyCN = useCommonNounPhrase plural ;
|
||||
PhrIP ip = ip ;
|
||||
PhrIAdv ia = ia ;
|
||||
|
||||
OnePhr p = p ;
|
||||
ConsPhr = cc2 ;
|
||||
}
|
||||
1053
lib/resource/romance/SyntaxRomance.gf
Normal file
1053
lib/resource/romance/SyntaxRomance.gf
Normal file
File diff suppressed because it is too large
Load Diff
188
lib/resource/romance/TypesRomance.gf
Normal file
188
lib/resource/romance/TypesRomance.gf
Normal file
@@ -0,0 +1,188 @@
|
||||
--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 | Sup ;
|
||||
|
||||
-- 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.
|
||||
|
||||
param
|
||||
RelGen = RNoGen | RG Gender ;
|
||||
|
||||
oper
|
||||
CaseA : PType ;
|
||||
NPFormA : PType ;
|
||||
|
||||
nominative : CaseA ;
|
||||
accusative : CaseA ;
|
||||
genitive : CaseA ;
|
||||
dative : CaseA ;
|
||||
prepositional : CaseA ;
|
||||
|
||||
stressed : CaseA -> NPFormA ;
|
||||
unstressed : CaseA -> NPFormA ;
|
||||
|
||||
RelFormA : PType ;
|
||||
|
||||
-- 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 =
|
||||
VFin Mode Number Person
|
||||
| VImper NumPersI
|
||||
| VPart Gender Number
|
||||
| VInfin
|
||||
;
|
||||
|
||||
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 ---
|
||||
} ;
|
||||
|
||||
-- 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 ;
|
||||
|
||||
VerbPres : Type = {s : VF => Str} ;
|
||||
|
||||
verbPres : Verbum -> VerbPres ;
|
||||
}
|
||||
Reference in New Issue
Block a user