mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 19:22:50 -06:00
next-lib renamed to lib, lib to old-lib
This commit is contained in:
59
lib/src/romance/AdjectiveRomance.gf
Normal file
59
lib/src/romance/AdjectiveRomance.gf
Normal file
@@ -0,0 +1,59 @@
|
||||
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 ! Nom).ton ;
|
||||
isPre = False
|
||||
} ;
|
||||
CAdvAP ad ap np = {
|
||||
s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ (np.s ! Nom).ton ;
|
||||
isPre = False
|
||||
} ;
|
||||
UseComparA a = {
|
||||
s = \\af => a.s ! Compar ! af ;
|
||||
isPre = a.isPre
|
||||
} ;
|
||||
AdjOrd ord = {
|
||||
s = \\af => ord.s ! (case af of {
|
||||
AF g n => aagr g n ;
|
||||
_ => aagr Masc Sg ----
|
||||
}) ;
|
||||
isPre = False ----
|
||||
} ;
|
||||
|
||||
-- $SuperlA$ belongs to determiner syntax in $Noun$.
|
||||
|
||||
ComplA2 adj np = {
|
||||
s = \\af => adj.s ! Posit ! af ++ appCompl adj.c2 np ;
|
||||
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 = {
|
||||
s = a.s ! Posit ;
|
||||
isPre = False ---- A2 has no isPre
|
||||
} ;
|
||||
|
||||
}
|
||||
25
lib/src/romance/AdverbRomance.gf
Normal file
25
lib/src/romance/AdverbRomance.gf
Normal file
@@ -0,0 +1,25 @@
|
||||
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 ++ cadv.p ++ (np.s ! Nom).ton
|
||||
} ;
|
||||
ComparAdvAdjS cadv a s = {
|
||||
s = cadv.s ++ a.s ! Posit ! AA ++ cadv.p ++ s.s ! Conjunct --- ne
|
||||
} ;
|
||||
|
||||
PrepNP prep np = {s = prep.s ++ (np.s ! prep.c).ton} ;
|
||||
|
||||
AdAdv = cc2 ;
|
||||
|
||||
SubjS subj s = {
|
||||
s = subj.s ++ s.s ! subj.m
|
||||
} ;
|
||||
|
||||
AdnCAdv cadv = {s = cadv.s ++ conjThan} ;
|
||||
|
||||
}
|
||||
115
lib/src/romance/CatRomance.gf
Normal file
115
lib/src/romance/CatRomance.gf
Normal file
@@ -0,0 +1,115 @@
|
||||
incomplete concrete CatRomance of Cat =
|
||||
CommonX - [Temp,TTAnt,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} ;
|
||||
SSlash = {
|
||||
s : AAgr => Mood => Str ;
|
||||
c2 : Compl
|
||||
} ;
|
||||
|
||||
|
||||
-- Sentence
|
||||
|
||||
Cl = {s : Direct => RTense => Anteriority => Polarity => Mood => Str} ;
|
||||
ClSlash = {
|
||||
s : AAgr => Direct => RTense => Anteriority => Polarity => Mood => Str ;
|
||||
c2 : Compl
|
||||
} ;
|
||||
Imp = {s : Polarity => ImpForm => Gender => 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} ;
|
||||
IQuant = {s : Number => Gender => Case => Str} ;
|
||||
|
||||
-- Relative
|
||||
|
||||
RCl = {
|
||||
s : Agr => RTense => Anteriority => Polarity => Mood => Str ;
|
||||
c : Case
|
||||
} ;
|
||||
RP = {s : Bool => AAgr => Case => Str ; a : AAgr ; hasAgr : Bool} ;
|
||||
|
||||
-- Verb
|
||||
|
||||
VP = ResRomance.VP ;
|
||||
VPSlash = ResRomance.VP ** {c2 : Compl} ;
|
||||
Comp = {s : Agr => Str} ;
|
||||
|
||||
-- Adjective
|
||||
|
||||
AP = {s : AForm => Str ; isPre : Bool} ;
|
||||
|
||||
-- Noun
|
||||
|
||||
CN = {s : Number => Str ; g : Gender} ;
|
||||
Pron = Pronoun ;
|
||||
NP = NounPhrase ;
|
||||
Det = {
|
||||
s : Gender => Case => Str ;
|
||||
n : Number ;
|
||||
s2 : Str ; -- -ci
|
||||
sp : Gender => Case => Str -- substantival: mien, mienne
|
||||
} ;
|
||||
Quant = {
|
||||
s : Bool => Number => Gender => Case => Str ;
|
||||
s2 : Str ;
|
||||
sp : Number => Gender => Case => Str
|
||||
} ;
|
||||
Predet = {s : AAgr => Case => Str ; c : Case} ; -- c : la plupart de
|
||||
Num = {s : Gender => Str ; isNum : Bool ; n : Number} ;
|
||||
Card = {s : Gender => Str ; n : Number} ;
|
||||
Ord = {s : AAgr => Str} ;
|
||||
|
||||
-- Numeral
|
||||
|
||||
Numeral = {s : CardOrd => Str ; n : Number} ;
|
||||
Digits = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
-- Structural
|
||||
|
||||
---b Conj = {s : Str ; n : Number} ;
|
||||
---b DConj = {s1,s2 : Str ; n : Number} ;
|
||||
Conj = {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, V2S, V2Q = Verb ** {c2 : Compl} ;
|
||||
V3, V2A, V2V = 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
|
||||
|
||||
Temp = {s : Str ; t : RTense ; a : Anteriority} ;
|
||||
Tense = {s : Str ; t : RTense} ;
|
||||
lin
|
||||
TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ;
|
||||
TPres = {s = []} ** {t = RPres} ;
|
||||
TPast = {s = []} ** {t = RPast} ; --# notpresent
|
||||
TFut = {s = []} ** {t = RFut} ; --# notpresent
|
||||
TCond = {s = []} ** {t = RCond} ; --# notpresent
|
||||
|
||||
}
|
||||
215
lib/src/romance/CommonRomance.gf
Normal file
215
lib/src/romance/CommonRomance.gf
Normal file
@@ -0,0 +1,215 @@
|
||||
----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 ;
|
||||
|
||||
Direct = DDir | DInv ;
|
||||
|
||||
-- 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 of {
|
||||
Fem => n ;
|
||||
_ => Masc
|
||||
} ;
|
||||
|
||||
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 Gender Number Person | CRefl | CNone ; --- Agr
|
||||
--- 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 g n => {g = g ; n = n}
|
||||
} ;
|
||||
|
||||
vpAgrNone : VPAgr = VPAgrClit 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 Gender Number ; -- elle a dormi; elle les a vues
|
||||
|
||||
oper
|
||||
VPC : 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
|
||||
clit1 : Str ; -- le/se
|
||||
clit2 : Str ; -- lui
|
||||
clit3 : Str ; -- y en
|
||||
comp : Agr => Str ; -- content(e) ; à ma mère ; hier
|
||||
ext : Polarity => Str ; -- que je dors / que je dorme
|
||||
} ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
52
lib/src/romance/ConjunctionRomance.gf
Normal file
52
lib/src/romance/ConjunctionRomance.gf
Normal file
@@ -0,0 +1,52 @@
|
||||
incomplete concrete ConjunctionRomance of Conjunction =
|
||||
CatRomance ** open CommonRomance, ResRomance, Coordination, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
ConjS conj ss = conjunctDistrTable Mood conj ss ;
|
||||
|
||||
ConjAdv conj ss = conjunctDistrSS conj ss ;
|
||||
|
||||
ConjNP conj ss = heavyNP (conjunctDistrTable Case conj ss ** {
|
||||
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ;
|
||||
hasClit = False
|
||||
}) ;
|
||||
ConjAP conj ss = conjunctDistrTable AForm conj ss ** {
|
||||
isPre = ss.isPre
|
||||
} ;
|
||||
ConjRS conj ss = conjunctDistrTable2 Mood Agr conj ss ** {
|
||||
c = ss.c
|
||||
} ;
|
||||
|
||||
|
||||
-- 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 ! c).ton ;
|
||||
s2 = \\c => (y.s ! c).ton ; ----e (conjunctCase c) ;
|
||||
a = conjAgr x.a y.a
|
||||
} ;
|
||||
ConsNP x xs = {
|
||||
s1 = \\c => (x.s ! c).ton ++ comma ++ xs.s1 ! c ; ----e (conjunctCase c) ;
|
||||
s2 = \\c => xs.s2 ! c ; ----e (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} ;
|
||||
BaseRS x y = twoTable2 Mood Agr x y ** {c = y.c} ;
|
||||
ConsRS xs x = consrTable2 Mood Agr comma xs x ** {c = xs.c} ;
|
||||
|
||||
lincat
|
||||
[S] = {s1,s2 : Mood => Str} ;
|
||||
[Adv] = {s1,s2 : Str} ;
|
||||
[NP] = {s1,s2 : Case => Str ; a : Agr} ;
|
||||
[AP] = {s1,s2 : AForm => Str ; isPre : Bool} ;
|
||||
[RS] = {s1,s2 : Mood => Agr => Str ; c : Case} ;
|
||||
|
||||
}
|
||||
115
lib/src/romance/DiffRomance.gf
Normal file
115
lib/src/romance/DiffRomance.gf
Normal file
@@ -0,0 +1,115 @@
|
||||
--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 Prepos ;
|
||||
|
||||
-- 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 : Bool -> Person -> VPC -> {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 ;
|
||||
|
||||
subjIf : 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 Prepos ;
|
||||
|
||||
oper
|
||||
Verb = {s : VF => Str ; vtyp : VType} ;
|
||||
|
||||
--2 Workarounds, to be eliminated
|
||||
|
||||
-- This should be provided by $pronArg$ above, but causes trouble in compilation.
|
||||
-- (AR 16/8/2008)
|
||||
|
||||
oper infForm : Number -> Person -> CAgr -> CAgr -> Bool ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
14
lib/src/romance/ExtRomance.gf
Normal file
14
lib/src/romance/ExtRomance.gf
Normal 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
|
||||
} ;
|
||||
|
||||
}
|
||||
21
lib/src/romance/ExtraRomance.gf
Normal file
21
lib/src/romance/ExtraRomance.gf
Normal file
@@ -0,0 +1,21 @@
|
||||
incomplete concrete ExtraRomance of ExtraRomanceAbs = CatRomance **
|
||||
open
|
||||
CommonRomance,
|
||||
Coordination,
|
||||
ResRomance in {
|
||||
|
||||
lin TPasseSimple = {s = []} ** {t = RPasse} ; --# notpresent
|
||||
|
||||
lincat
|
||||
VPI = {s : Str} ;
|
||||
[VPI] = {s1,s2 : Str} ;
|
||||
lin
|
||||
BaseVPI = twoSS ;
|
||||
ConsVPI = consrSS comma ;
|
||||
|
||||
MkVPI vp = {s = infVP vp (agrP3 Masc Sg)} ;
|
||||
ConjVPI = conjunctDistrSS ;
|
||||
ComplVPIVV v vpi =
|
||||
insertComplement (\\a => prepCase v.c2.c ++ vpi.s) (predV v) ;
|
||||
|
||||
}
|
||||
7
lib/src/romance/ExtraRomanceAbs.gf
Normal file
7
lib/src/romance/ExtraRomanceAbs.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
abstract ExtraRomanceAbs = Cat, Extra[
|
||||
VPI,ListVPI,BaseVPI,ConsVPI,MkVPI,ComplVPIVV,ConjVPI,
|
||||
VV,VP,Conj] ** {
|
||||
|
||||
fun TPasseSimple : Tense ; --# notpresent
|
||||
|
||||
}
|
||||
159
lib/src/romance/NounRomance.gf
Normal file
159
lib/src/romance/NounRomance.gf
Normal file
@@ -0,0 +1,159 @@
|
||||
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 heavyNP {
|
||||
s = \\c => det.s ! g ! c ++ cn.s ! n ++ det.s2 ;
|
||||
a = agrP3 g n ;
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
UsePN = pn2np ;
|
||||
|
||||
UsePron p = p ;
|
||||
|
||||
PredetNP pred np = heavyNP {
|
||||
s = \\c => pred.s ! aagr (np.a.g) (np.a.n) ! c ++ (np.s ! pred.c).ton ;
|
||||
a = np.a ;
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
PPartNP np v2 = heavyNP {
|
||||
s = \\c => (np.s ! c).ton ++ v2.s ! VPart np.a.g np.a.n ;
|
||||
a = np.a ;
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
RelNP np rs = heavyNP {
|
||||
s = \\c => (np.s ! c).ton ++ rs.s ! Indic ! np.a ;
|
||||
a = np.a ;
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
AdvNP np adv = heavyNP {
|
||||
s = \\c => (np.s ! c).ton ++ adv.s ;
|
||||
a = np.a ;
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
DetQuantOrd quant num ord = {
|
||||
s,sp = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ++
|
||||
ord.s ! aagr g num.n ;
|
||||
s2 = quant.s2 ;
|
||||
n = num.n
|
||||
} ;
|
||||
|
||||
DetQuant quant num = {
|
||||
s = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ;
|
||||
sp = \\g,c => case num.isNum of {
|
||||
True => quant.s ! True ! num.n ! g ! c ++ num.s ! g ;
|
||||
False => quant.sp ! num.n ! g ! c ++ num.s ! g
|
||||
} ;
|
||||
s2 = quant.s2 ;
|
||||
n = num.n
|
||||
} ;
|
||||
|
||||
DetNP det =
|
||||
let
|
||||
g = Masc ; ---- Fem in Extra
|
||||
n = det.n
|
||||
in heavyNP {
|
||||
s = det.sp ! g ;
|
||||
a = agrP3 g n ;
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
PossPron p = {
|
||||
s = \\_,n,g,c => possCase g n c ++ p.poss ! n ! g ; ---- il mio!
|
||||
sp = \\ n,g,c => possCase g n c ++ p.poss ! n ! g ; ---- not for Fre
|
||||
s2 = []
|
||||
} ;
|
||||
|
||||
NumSg = {s = \\_ => [] ; isNum = False ; n = Sg} ;
|
||||
NumPl = {s = \\_ => [] ; isNum = False ; n = Pl} ;
|
||||
|
||||
NumCard n = n ** {isNum = True} ;
|
||||
|
||||
NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ;
|
||||
OrdDigits nu = {s = \\a => nu.s ! NOrd a.g a.n} ;
|
||||
|
||||
NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ;
|
||||
OrdNumeral nu = {s = \\a => nu.s ! NOrd a.g a.n} ;
|
||||
|
||||
AdNum adn num = {s = \\a => adn.s ++ num.s ! a ; isNum = num.isNum ; n = num.n} ;
|
||||
|
||||
OrdSuperl adj = {s = \\a => adj.s ! Superl ! AF a.g a.n} ;
|
||||
|
||||
DefArt = {
|
||||
s = \\_,n,g,c => artDef g n c ;
|
||||
sp = \\n,g,c => artDef g n c ; ---- not for Fre
|
||||
s2 = []
|
||||
} ;
|
||||
|
||||
IndefArt = {
|
||||
s = \\b,n,g,c => if_then_Str b (prepCase c) (artIndef g n c) ;
|
||||
sp = \\n,g,c => artIndef g n c ; ---- not for Fre
|
||||
s2 = []
|
||||
} ;
|
||||
|
||||
MassNP cn = let
|
||||
g = cn.g ;
|
||||
n = Sg
|
||||
in heavyNP {
|
||||
s = \\c => partitive g c ++ cn.s ! n ;
|
||||
a = agrP3 g n ;
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
-- This is based on record subtyping.
|
||||
|
||||
UseN, UseN2 = \noun -> noun ;
|
||||
|
||||
Use2N3 f = f ;
|
||||
|
||||
Use3N3 f = f ** {c2 = f.c3} ;
|
||||
|
||||
ComplN2 f x = {
|
||||
s = \\n => f.s ! n ++ appCompl f.c2 x ;
|
||||
g = f.g ;
|
||||
} ;
|
||||
|
||||
ComplN3 f x = {
|
||||
s = \\n => f.s ! n ++ appCompl f.c2 x ;
|
||||
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 ! Nom).ton ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
}
|
||||
27
lib/src/romance/PhraseRomance.gf
Normal file
27
lib/src/romance/PhraseRomance.gf
Normal file
@@ -0,0 +1,27 @@
|
||||
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 ! ImpF Sg False ! Fem} ;
|
||||
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Pl False ! Fem} ;
|
||||
UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg True ! Fem} ;
|
||||
|
||||
UttIP ip = {s = ip.s ! Nom} ; --- Acc also
|
||||
UttIAdv iadv = iadv ;
|
||||
UttNP np = {s = (np.s ! Nom).ton} ;
|
||||
UttVP vp = {s = infVP vp (agrP3 Fem Sg)} ; --- Agr
|
||||
UttAdv adv = adv ;
|
||||
|
||||
NoPConj = {s = []} ;
|
||||
PConjConj conj = {s = conj.s2} ;
|
||||
|
||||
NoVoc = {s = []} ;
|
||||
VocNP np = {s = "," ++ (np.s ! Nom).ton} ;
|
||||
|
||||
}
|
||||
113
lib/src/romance/QuestionRomance.gf
Normal file
113
lib/src/romance/QuestionRomance.gf
Normal file
@@ -0,0 +1,113 @@
|
||||
incomplete concrete QuestionRomance of Question =
|
||||
CatRomance ** open CommonRomance, ResRomance, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
QuestCl cl = {
|
||||
s = \\t,a,p =>
|
||||
let cls = cl.s ! DDir ! t ! a ! p ---- DInv?
|
||||
in table {
|
||||
QDir => cls ! Indic ;
|
||||
QIndir => subjIf ++ cls ! Indic
|
||||
}
|
||||
} ;
|
||||
|
||||
QuestVP qp vp = {
|
||||
s = \\t,a,b,_ =>
|
||||
let
|
||||
cl = mkClause (qp.s ! Nom) False (agrP3 qp.a.g qp.a.n) vp
|
||||
in
|
||||
cl.s ! DDir ! t ! a ! b ! Indic
|
||||
} ;
|
||||
|
||||
QuestSlash ip slash = {
|
||||
s = \\t,a,p =>
|
||||
let
|
||||
cls : Direct -> Str =
|
||||
\d -> slash.s ! ip.a ! d ! t ! a ! p ! Indic ;
|
||||
who = slash.c2.s ++ ip.s ! slash.c2.c
|
||||
in table {
|
||||
QDir => who ++ cls DInv ;
|
||||
QIndir => who ++ cls DDir
|
||||
}
|
||||
} ;
|
||||
|
||||
QuestIAdv iadv cl = {
|
||||
s = \\t,a,p,q =>
|
||||
let
|
||||
ord = case q of {
|
||||
QDir => DInv ;
|
||||
QIndir => DDir
|
||||
} ;
|
||||
cls = cl.s ! ord ! 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 ! Nom).comp np.hasClit np.a vp).s !
|
||||
DInv ! 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 ! p.c
|
||||
} ;
|
||||
|
||||
AdvIP ip adv = {
|
||||
s = \\c => ip.s ! c ++ adv.s ;
|
||||
a = ip.a
|
||||
} ;
|
||||
|
||||
IdetCN idet cn =
|
||||
let
|
||||
g = cn.g ;
|
||||
n = idet.n ;
|
||||
a = aagr g n
|
||||
in {
|
||||
s = \\c => idet.s ! g ! c ++ cn.s ! n ;
|
||||
a = a
|
||||
} ;
|
||||
|
||||
IdetIP idet =
|
||||
let
|
||||
g = Masc ; ---- Fem in Extra
|
||||
n = idet.n ;
|
||||
a = aagr g n
|
||||
in {
|
||||
s = \\c => idet.s ! g ! c ;
|
||||
a = a
|
||||
} ;
|
||||
|
||||
IdetQuant idet num =
|
||||
let
|
||||
n = num.n ;
|
||||
in {
|
||||
s = \\g,c => idet.s ! n ! g ! c ++ num.s ! g ;
|
||||
n = n
|
||||
} ;
|
||||
|
||||
|
||||
CompIAdv a = {s = \\_ => a.s} ;
|
||||
|
||||
CompIP p = {s = \\_ => p.s ! Nom} ;
|
||||
|
||||
}
|
||||
|
||||
{- ---b
|
||||
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
|
||||
} ;
|
||||
-}
|
||||
50
lib/src/romance/RelativeRomance.gf
Normal file
50
lib/src/romance/RelativeRomance.gf
Normal file
@@ -0,0 +1,50 @@
|
||||
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 ! DDir ! 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) False
|
||||
{g = rp.a.g ; n = rp.a.n ; p = P3}
|
||||
vp).s ! DDir ; c = Nom} ;
|
||||
False => {s = \\ag =>
|
||||
(mkClause
|
||||
(rp.s ! False ! {g = ag.g ; n = ag.n} ! Nom) False
|
||||
ag
|
||||
vp).s ! DDir ; 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 ! DDir ! t ! a ! p ! m ; --- ragr
|
||||
c = Acc
|
||||
} ;
|
||||
|
||||
FunRP p np rp = {
|
||||
s = \\_,a,c => (np.s ! Nom).ton ++ 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
|
||||
} ;
|
||||
|
||||
}
|
||||
328
lib/src/romance/ResRomance.gf
Normal file
328
lib/src/romance/ResRomance.gf
Normal file
@@ -0,0 +1,328 @@
|
||||
--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 ;
|
||||
|
||||
--e Pronoun = {s : NPForm => Str ; a : Agr ; hasClit : Bool} ;
|
||||
NounPhrase : Type = {
|
||||
s : Case => {c1,c2,comp,ton : Str} ;
|
||||
a : Agr ;
|
||||
hasClit : Bool
|
||||
} ;
|
||||
Pronoun : Type = NounPhrase ** {
|
||||
poss : Number => Gender => Str ---- also: substantival
|
||||
} ;
|
||||
|
||||
heavyNP : {s : Case => Str ; a : Agr} -> NounPhrase = \np -> {
|
||||
s = \\c => {comp,ton = np.s ! c ; c1,c2 = []} ;
|
||||
a = np.a ;
|
||||
hasClit = False
|
||||
} ;
|
||||
--e
|
||||
|
||||
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} ;
|
||||
|
||||
--e
|
||||
pn2np : {s : Str ; g : Gender} -> NounPhrase = \pn -> heavyNP {
|
||||
s = \\c => prepCase c ++ pn.s ;
|
||||
a = agrP3 pn.g Sg
|
||||
} ;
|
||||
|
||||
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 -> NounPhrase -> Str = \comp,np ->
|
||||
comp.s ++ (np.s ! comp.c).ton ;
|
||||
--e appCompl : Compl -> (NPForm => Str) -> Str = \comp,np ->
|
||||
--e comp.s ++ np ! Ton comp.c ;
|
||||
|
||||
oper
|
||||
|
||||
VP : Type = {
|
||||
s : Verb ;
|
||||
agr : VPAgr ; -- dit/dite dep. on verb, subj, and clitic
|
||||
neg : Polarity => (Str * Str) ; -- ne-pas
|
||||
clit1 : Str ; -- le/se
|
||||
clit2 : Str ; -- lui
|
||||
clit3 : Str ; -- y en
|
||||
comp : Agr => Str ; -- content(e) ; à ma mère ; hier
|
||||
ext : Polarity => Str ; -- que je dors / que je dorme
|
||||
} ;
|
||||
|
||||
|
||||
useVP : VP -> VPC = \vp ->
|
||||
let
|
||||
verb = vp.s ;
|
||||
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 -> case <a.n,a.p> of {
|
||||
<Pl,P1> => verb.s ! VImper PlP1 ;
|
||||
<_, P3> => verb.s ! VFin (VPres Conjunct) a.n P3 ;
|
||||
<Sg,_> => verb.s ! VImper SgP2 ;
|
||||
<Pl,_> => verb.s ! VImper 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 b=> vf (\_ -> []) (\a -> habere ++ vpart a) ; --# notpresent
|
||||
VPImperat => vf vimp (\_ -> []) ;
|
||||
VPGerund => vf (\_ -> []) (\_ -> vger) ;
|
||||
VPInfinit Simul b=> vf (\_ -> []) (\_ -> vinf b)
|
||||
} ;
|
||||
agr = vp.agr ;
|
||||
neg = vp.neg ;
|
||||
clit1 = vp.clit1 ;
|
||||
clit2 = vp.clit2 ;
|
||||
clit3 = vp.clit3 ;
|
||||
comp = vp.comp ;
|
||||
ext = vp.ext
|
||||
} ;
|
||||
|
||||
predV : Verb -> VP = \verb ->
|
||||
let
|
||||
typ = verb.vtyp ;
|
||||
in {
|
||||
s = {s = verb.s ; vtyp = typ} ;
|
||||
agr = partAgr typ ;
|
||||
neg = negation ;
|
||||
{- ----e
|
||||
clAcc = case isVRefl typ of {
|
||||
True => CRefl ;
|
||||
_ => CNone
|
||||
} ;
|
||||
-}
|
||||
clit1 = [] ;
|
||||
clit2 = [] ;
|
||||
clit3 = [] ;
|
||||
comp = \\a => [] ;
|
||||
ext = \\p => []
|
||||
} ;
|
||||
|
||||
insertObject : Compl -> NounPhrase -> VP -> VP = \c,np,vp ->
|
||||
let
|
||||
obj = np.s ! c.c ;
|
||||
|
||||
{- ----e
|
||||
vpacc = vp.clAcc ;
|
||||
vpdat = vp.clDat ;
|
||||
vpagr = vp.agr ;
|
||||
npa = np.a ;
|
||||
cpron = CPron npa.g npa.n npa.p ;
|
||||
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, vpdat, [], vpAgrClit npa> ;
|
||||
_ => <vpacc, cpron, [], vpagr> -- must be dat
|
||||
} ;
|
||||
_ => noNewClit
|
||||
} ;
|
||||
-} ----e
|
||||
|
||||
in {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ; ----e
|
||||
clit1 = vp.clit1 ++ obj.c1 ;
|
||||
clit2 = vp.clit2 ++ obj.c2 ;
|
||||
clit3 = vp.clit3 ;
|
||||
comp = \\a => vp.comp ! a ++ c.s ++ obj.comp ;
|
||||
----e agr = cc.p4 ;
|
||||
---- clAcc = cc.p1 ;
|
||||
---- clDat = cc.p2 ;
|
||||
----e comp = \\a => cc.p3 ++ vp.comp ! a ;
|
||||
neg = vp.neg ;
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
insertComplement : (Agr => Str) -> VP -> VP = \co,vp -> {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clit1 = vp.clit1 ;
|
||||
clit2 = vp.clit2 ;
|
||||
clit3 = vp.clit3 ;
|
||||
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) ;
|
||||
clit1 = vp.clit1 ;
|
||||
clit2 = vp.clit2 ;
|
||||
clit3 = vp.clit3 ;
|
||||
neg = vp.neg ;
|
||||
comp = vp.comp ;
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
----e
|
||||
insertRefl : VP -> VP = \vp -> {
|
||||
s = {s = vp.s.s ; vtyp = vRefl} ;
|
||||
agr = vp.agr ;
|
||||
clit1 = vp.clit1 ;
|
||||
clit2 = vp.clit2 ;
|
||||
clit3 = vp.clit3 ;
|
||||
neg = vp.neg ;
|
||||
comp = vp.comp ;
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
insertAdv : Str -> VP -> VP = \co,vp -> {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clit1 = vp.clit1 ;
|
||||
clit2 = vp.clit2 ;
|
||||
clit3 = vp.clit3 ;
|
||||
neg = vp.neg ;
|
||||
comp = \\a => vp.comp ! a ++ co ;
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
insertAdV : Str -> VP -> VP = \co,vp -> {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clit1 = vp.clit1 ;
|
||||
clit2 = vp.clit2 ;
|
||||
clit3 = vp.clit3 ;
|
||||
neg = \\b => let vpn = vp.neg ! b in {p1 = vpn.p1 ; p2 = vpn.p2 ++ co} ;
|
||||
comp = vp.comp ;
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
insertClit3 : Str -> VP -> VP = \co,vp -> {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clit1 = vp.clit1 ;
|
||||
clit2 = vp.clit2 ;
|
||||
clit3 = vp.clit3 ++ co ;
|
||||
neg = vp.neg ;
|
||||
comp = vp.comp ;
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
insertExtrapos : (Polarity => Str) -> VP -> VP = \co,vp -> {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clit1 = vp.clit1 ;
|
||||
clit2 = vp.clit2 ;
|
||||
clit3 = vp.clit3 ;
|
||||
neg = vp.neg ;
|
||||
comp = vp.comp ;
|
||||
ext = \\p => vp.ext ! p ++ co ! p ;
|
||||
} ;
|
||||
|
||||
mkVPSlash : Compl -> VP -> VP ** {c2 : Compl} = \c,vp -> vp ** {c2 = c} ;
|
||||
|
||||
mkClause : Str -> Bool -> Agr -> VP ->
|
||||
{s : Direct => RTense => Anteriority => Polarity => Mood => Str} =
|
||||
\subj,hasClit,agr,vpr -> {
|
||||
s = \\d,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
|
||||
} ;
|
||||
vp = useVP vpr ;
|
||||
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 ;
|
||||
--e clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
--e compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! b
|
||||
clit = vp.clit1 ++ vp.clit2 ++ vp.clit3 ;
|
||||
compl = vp.comp ! agr ++ vp.ext ! b
|
||||
in
|
||||
case d of {
|
||||
DDir =>
|
||||
subj ++ neg.p1 ++ clit ++ verb ++ neg.p2 ++ inf ;
|
||||
DInv =>
|
||||
neg.p1 ++ clit ++ verb ++ preOrPost hasClit subj (neg.p2 ++ inf)
|
||||
}
|
||||
++ compl
|
||||
} ;
|
||||
--- in French, pronouns should
|
||||
--- have a "-" with possibly a special verb form with "t":
|
||||
--- "comment fera-t-il" vs. "comment fera Pierre"
|
||||
|
||||
infVP : VP -> Agr -> Str = \vpr,agr ->
|
||||
let
|
||||
vp = useVP vpr ;
|
||||
----e clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
----e iform = infForm agr.n agr.p vp.clAcc vp.clDat ;
|
||||
clpr = <vp.clit1,vp.clit2, False> ; ----e
|
||||
iform = False ; ----e
|
||||
inf = (vp.s ! VPInfinit Simul iform).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.clit3) 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
|
||||
76
lib/src/romance/SentenceRomance.gf
Normal file
76
lib/src/romance/SentenceRomance.gf
Normal file
@@ -0,0 +1,76 @@
|
||||
incomplete concrete SentenceRomance of Sentence =
|
||||
CatRomance ** open Prelude, CommonRomance, ResRomance in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
PredVP np vp = mkClause (np.s ! Nom).comp np.hasClit np.a vp ;
|
||||
|
||||
PredSCVP sc vp = mkClause sc.s False (agrP3 Masc Sg) vp ;
|
||||
|
||||
ImpVP vpr = let vp = useVP vpr in {
|
||||
s = \\p,i,g => case i of {
|
||||
ImpF n b => (mkImperative b P2 vp).s ! p ! (aagr g n)
|
||||
}
|
||||
} ;
|
||||
|
||||
SlashVP np v2 =
|
||||
-- agreement decided afterwards: la fille qu'il a trouvée
|
||||
{s = \\ag =>
|
||||
let
|
||||
vp = v2
|
||||
----e vp = case <v2.c2.c, v2.c2.isDir> of {
|
||||
---- <Acc,True> => insertAgr ag v2 ;
|
||||
---- _ => v2
|
||||
----e }
|
||||
in (mkClause (np.s ! Nom).comp np.hasClit np.a vp).s ;
|
||||
c2 = v2.c2
|
||||
} ;
|
||||
|
||||
AdvSlash slash adv = {
|
||||
s = \\ag,d,t,a,b,m => slash.s ! ag ! d ! t ! a ! b ! m ++ adv.s ;
|
||||
c2 = slash.c2
|
||||
} ;
|
||||
|
||||
SlashPrep cl prep = {
|
||||
s = \\_ => cl.s ;
|
||||
c2 = {s = prep.s ; c = prep.c ; isDir = False}
|
||||
} ;
|
||||
|
||||
SlashVS np vs slash =
|
||||
{s = \\ag =>
|
||||
(mkClause
|
||||
(np.s ! Nom).comp np.hasClit np.a
|
||||
(insertExtrapos (\\b => conjThat ++ slash.s ! ag ! (vs.m ! b))
|
||||
(predV vs))
|
||||
).s ;
|
||||
c2 = slash.c2
|
||||
} ;
|
||||
|
||||
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 p cl = {
|
||||
s = \\o => t.s ++ p.s ++ cl.s ! DDir ! t.t ! t.a ! p.p ! o
|
||||
} ;
|
||||
UseQCl t p cl = {
|
||||
s = \\q => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! q
|
||||
} ;
|
||||
UseRCl t p cl = {
|
||||
s = \\r,ag => t.s ++ p.s ++ cl.s ! ag ! t.t ! t.a ! p.p ! r ;
|
||||
c = cl.c
|
||||
} ;
|
||||
UseSlash t p cl = {
|
||||
s = \\ag,mo =>
|
||||
t.s ++ p.s ++ cl.s ! ag ! DDir ! t.t ! t.a ! p.p ! mo ;
|
||||
c2 = cl.c2
|
||||
} ;
|
||||
|
||||
AdvS a s = {s = \\o => a.s ++ "," ++ s.s ! o} ;
|
||||
|
||||
RelS s r = {
|
||||
s = \\o => s.s ! o ++ "," ++ partQIndir ++ r.s ! Indic ! agrP3 Masc Sg
|
||||
} ;
|
||||
|
||||
}
|
||||
41
lib/src/romance/SymbolRomance.gf
Normal file
41
lib/src/romance/SymbolRomance.gf
Normal file
@@ -0,0 +1,41 @@
|
||||
incomplete concrete SymbolRomance of Symbol =
|
||||
CatRomance ** open Prelude, CommonRomance, ResRomance in {
|
||||
|
||||
lin
|
||||
SymbPN i = {s = i.s ; g = Masc} ;
|
||||
IntPN i = {s = i.s ; g = Masc} ;
|
||||
FloatPN i = {s = i.s ; g = Masc} ;
|
||||
NumPN i = {s = i.s!Masc ; g = Masc} ;
|
||||
|
||||
CNIntNP cn i = heavyNP {
|
||||
s = \\c => prepCase c ++ cn.s ! Sg ++ i.s ;
|
||||
a = agrP3 cn.g Sg ;
|
||||
hasClit = False
|
||||
} ;
|
||||
CNSymbNP det cn xs = let g = cn.g in heavyNP {
|
||||
s = \\c => det.s ! g ! c ++ cn.s ! det.n ++ xs.s ;
|
||||
a = agrP3 g det.n ;
|
||||
hasClit = False
|
||||
} ;
|
||||
CNNumNP cn i = heavyNP {
|
||||
s = \\c => artDef cn.g Sg c ++ cn.s ! Sg ++ i.s ! Masc ;
|
||||
a = agrP3 cn.g Sg ;
|
||||
hasClit = False
|
||||
} ;
|
||||
SymbS sy = {s = \\_ => sy.s} ;
|
||||
|
||||
SymbNum n = {s = \\_ => n.s ; isNum = True ; n = Pl} ;
|
||||
SymbOrd n = {s = \\_ => n.s ++ "."} ; ---
|
||||
|
||||
lincat
|
||||
|
||||
Symb, [Symb] = SS ;
|
||||
|
||||
lin
|
||||
|
||||
MkSymb s = s ;
|
||||
|
||||
BaseSymb = infixSS "et" ; ----
|
||||
ConsSymb = infixSS "," ;
|
||||
|
||||
}
|
||||
119
lib/src/romance/VerbRomance.gf
Normal file
119
lib/src/romance/VerbRomance.gf
Normal file
@@ -0,0 +1,119 @@
|
||||
incomplete concrete VerbRomance of Verb =
|
||||
CatRomance ** open Prelude, CommonRomance, ResRomance in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
UseV = predV ;
|
||||
|
||||
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) ;
|
||||
|
||||
SlashV2a v = mkVPSlash v.c2 (predV v) ;
|
||||
|
||||
Slash2V3 v np = mkVPSlash v.c3 (insertObject v.c2 np (predV v)) ;
|
||||
Slash3V3 v np = mkVPSlash v.c2 (insertObject v.c3 np (predV v)) ;
|
||||
|
||||
SlashV2V v vp =
|
||||
mkVPSlash v.c2
|
||||
(insertComplement
|
||||
(\\a => prepCase v.c2.c ++ infVP vp a)
|
||||
(predV v)) ;
|
||||
|
||||
SlashV2S v s =
|
||||
mkVPSlash v.c2
|
||||
(insertExtrapos
|
||||
(\\b => conjThat ++ s.s ! Indic) ---- mood
|
||||
(predV v)) ;
|
||||
|
||||
SlashV2Q v q =
|
||||
mkVPSlash v.c2
|
||||
(insertExtrapos
|
||||
(\\_ => q.s ! QIndir)
|
||||
(predV v)) ;
|
||||
|
||||
{- ---- lincat should be fixed
|
||||
SlashV2A v 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
|
||||
}
|
||||
-}
|
||||
|
||||
SlashV2A v ap =
|
||||
let af = AF Masc Sg
|
||||
in
|
||||
mkVPSlash v.c2
|
||||
(insertComplement
|
||||
(\\_ => v.c3.s ++ prepCase v.c3.c ++ ap.s ! af)
|
||||
(predV v)) ;
|
||||
|
||||
ComplSlash vp np = insertObject vp.c2 np vp ;
|
||||
|
||||
ReflVP v = case v.c2.isDir of {
|
||||
True => insertRefl v ;
|
||||
False => insertComplement
|
||||
(\\a => v.c2.s ++ reflPron a.n a.p v.c2.c) v
|
||||
} ;
|
||||
|
||||
SlashVV v vp =
|
||||
mkVPSlash vp.c2
|
||||
(insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v)) ;
|
||||
|
||||
SlashV2VNP v np vp =
|
||||
mkVPSlash vp.c2
|
||||
(insertComplement
|
||||
(\\a => prepCase v.c2.c ++ infVP vp a)
|
||||
(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 ! Nom).ton} ;
|
||||
CompAdv a = {s = \\_ => a.s} ;
|
||||
|
||||
AdvVP vp adv = insertAdv adv.s vp ;
|
||||
AdVVP adv vp = insertAdV adv.s vp ;
|
||||
|
||||
PassV2 v = insertComplement (\\a => v.s ! VPart a.g a.n) (predV auxPassive) ;
|
||||
|
||||
}
|
||||
|
||||
{---b
|
||||
ComplV2 v np1 = insertObject v.c2 np1 (predV v) ;
|
||||
ComplV3 v np1 np2 = insertObject v.c3 np2 (insertObject v.c2 np1 (predV v)) ;
|
||||
|
||||
ComplV2V v np vp =
|
||||
insertComplement (\\a => prepCase v.c2.c ++ infVP vp a)
|
||||
(insertObject v.c2 np (predV v)) ;
|
||||
ComplV2S v np s =
|
||||
insertExtrapos (\\b => s.s ! Indic) ---- mood
|
||||
(insertObject v.c2 np (predV v)) ;
|
||||
ComplV2Q v np q =
|
||||
insertExtrapos (\\_ => q.s ! QIndir)
|
||||
(insertObject v.c2 np (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)) ;
|
||||
|
||||
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)
|
||||
} ;
|
||||
|
||||
UseVS, UseVQ = \vv -> {s = vv.s ; c2 = complAcc ; vtyp = vv.vtyp} ;
|
||||
-}
|
||||
|
||||
Reference in New Issue
Block a user