started romance and french

This commit is contained in:
aarne
2006-01-19 16:41:44 +00:00
parent 0b18ccaea4
commit 2b2f6e4925
47 changed files with 4576 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
incomplete concrete AdjectiveRomance of Adjective =
CatRomance ** open DiffRomance, ResRomance, Prelude in {
lin
PositA a = {
s = \\ap => a.s ! AF (APosit ap) Nom ;
isPre = True
} ;
ComparA a np = {
s = \\_ => a.s ! AF ACompar Nom ++ conjThan ++ np.s ! nominative ;
isPre = False
} ;
-- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = {
s = \\ap => a.s ! AF (APosit ap) Nom ++ a.c2 ++ np.s ! accusative ;
isPre = False
} ;
ReflA2 a = {
s = \\ap => a.s ! AF (APosit ap) Nom ++ a.c2 ++
reflPron (agrP3 Utr Sg) ; ----
isPre = False
} ;
SentAP ap sc = {
s = \\a => ap.s ! a ++ sc.s ;
isPre = False
} ;
AdAP ada ap = {
s = \\a => ada.s ++ ap.s ! a ;
isPre = ap.isPre
} ;
UseA2 a = a ;
}

View File

@@ -0,0 +1,28 @@
incomplete concrete AdverbRomance of Adverb = CatRomance ** open DiffRomance, ResRomance, Prelude in {
lin
PositAdvAdj a = {
s = a.s ! adverbForm
} ;
ComparAdvAdj cadv a np = {
s = cadv.s ++ a.s ! adverbForm ++ conjThan ++ np.s ! nominative
} ;
ComparAdvAdjS cadv a s = {
s = cadv.s ++ a.s ! adverbForm ++ conjThan ++ s.s ! Sub
} ;
PrepNP prep np = {s = prep.s ++ np.s ! accusative} ;
AdAdv = cc2 ;
SubjS subj s = {
s = subj.s ++ s.s ! Sub
} ;
AdvSC s = s ;
AdnCAdv cadv = {s = cadv.s ++ conjThan} ;
oper
adverbForm : AForm = AF (APosit (Strong SgNeutr)) Nom ;
}

View File

@@ -0,0 +1,104 @@
incomplete concrete CatRomance of Cat =
open ResRomance, Prelude, DiffRomance, (R = ParamX) in {
flags optimize=all_subs ;
lincat
-- Phrase
Text, Phr, Utt, Voc = {s : Str} ;
-- Tensed/Untensed
S = {s : Mood => Str} ;
QS = {s : QForm => Str} ;
RS = {s : Mood => Agr => Str} ;
-- Sentence
Cl = {s : Tense => Anteriority => Polarity => Mood => Str} ;
Slash = {s : Tense => Anteriority => Polarity => Mood => Str} ** {c2 : Compl} ;
Imp = {s : Polarity => AAgr => Str} ;
-- Question
QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ;
IP = {s : Case => Str ; a : AAgr} ;
IAdv = {s : Str} ;
IDet = {s : Gender => Str ; n : Number} ;
-- Relative
RCl = {s : Tense => Anteriority => Polarity => Mood => Agr => Str} ;
---- RP = {s : AAgr => RelForm => Str ; a : RAgr} ;
-- Verb
VP = {
s : Anteriority => VF => {
fin : Str ; -- ai
inf : Str -- dit
} ;
a1 : Polarity => Str ; -- ne-pas
c1 : Str ; -- le
c2 : Str ; -- lui
n2 : Agr => Str ; -- content(e) ; à ma mère
a2 : Str ; -- hier
ext : Str ; -- que je dors
} ;
Comp = {s : Agr => Str} ;
SC = {s : Str} ;
-- Adjective
AP = {s : AForm => Str ; isPre : Bool} ;
-- Noun
CN = {s : Number => Str ; g : Gender} ;
NP,Pron = {s : NPForm => Str ; a : Agr ; c : ClitType} ;
Det = {s : Gender => Case => Str ; n : Number} ;
QuantSg = {s : Gender => Case => Str} ;
QuantPl = {s : Gender => Case => Str} ;
Predet = {s : AAgr => Str} ;
Num = {s : Gender => Str} ;
Ord = {s : AAgr => Str} ;
-- Adverb
Adv, AdV, AdA, AdS, AdN = {s : Str} ;
-- Numeral
---- Numeral = {s : CardOrd => Str ; n : Number} ;
-- Structural
Conj = {s : Str ; n : Number} ;
DConj = {s1,s2 : Str ; n : Number} ;
PConj = {s : Str} ;
CAdv = {s : Str} ;
Subj = {s : Str ; m : Mood} ;
Prep = {s : Str} ;
-- Open lexical classes, e.g. Basic
V, VS, VQ, VA = Verb ;
V2, VV, V2A = Verb ** {c2 : Compl} ;
V3 = Verb ** {c2,c3 : Compl} ;
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} ;
oper
Noun = {s : Number => Str ; g : Gender} ;
Verb = {s : VF => Str ; aux : VAux ; isRefl : Bool} ;
}

View File

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

View File

@@ -0,0 +1,55 @@
interface DiffRomance = open ResRomance, Prelude in {
--2 Parameters.
-- Prepositions that fuse with the article vary.
param
Prep ;
Case = Nom | Acc | CPrep Prep ;
NPForm = Ton Case | Aton Case | Poss AAgr ;
RelForm = RSimple Case | RComplex Gender Number Case ;
VAux ;
oper
Compl : Type = {s : Str ; c : Case} ;
dative : Case ;
genitive : Case ;
prepCase : Case -> Str ;
npform2case : NPForm -> Case = \p -> case p of {
Ton x => x ;
Aton x => x ;
Poss _ => genitive
} ;
case2npform : Case -> NPForm = \c -> case c of {
Nom => Aton Nom ;
Acc => Aton Acc ;
_ => Ton c
} ;
npRelForm : NPForm -> RelForm = \np -> case np of {
Ton c => RSimple c ;
Aton c => RSimple c ;
Poss _ => RSimple genitive
} ;
appCompl : Compl -> (NPForm => Str) -> Str = \comp,np ->
comp.s ++ np ! Ton comp.c ;
artDef : Gender -> Number -> Case -> Str ;
artIndef : Gender -> Number -> Case -> Str ;
partitive : Gender -> Case -> Str ;
}

View File

@@ -0,0 +1,15 @@
abstract ExtEngAbs = Cat ** {
cat
Aux ; -- auxiliary verbs: "can", "must", etc
-- Notice that $Aux$ cannot form $VP$ with infinitive, imperative, etc.
fun
PredAux : NP -> Aux -> VP -> Cl ;
QuestAux : IP -> Aux -> VP -> QCl ;
can_Aux : Aux ;
must_Aux : Aux ;
}

View File

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

View File

@@ -0,0 +1,9 @@
abstract ExtRomanceAbs = Cat ** {
fun
-- Definite form of simple nouns without article; neither $Num$ nor $Ord$ allowed.
DefSgN, DefPlN : Predef -> N -> NP ;
}

View File

@@ -0,0 +1,27 @@
incomplete concrete MathRomance of Math =
CatRomance ** open Prelude, ResRomance, DiffRomance in {
lin
SymbPN i = {s = \\c => i.s ; g = Neutr} ; --- c
IntPN i = {s = \\c => i.s ; g = Neutr} ; --- c
CNIntNP cn i = {
s = \\c => (cn.s ! Sg ! DIndef ! Nom ++ i.s) ;
a = agrP3 cn.g Sg
} ;
CNSymbNP det cn xs = let g = cn.g in {
s = \\c => det.s ! g ++ cn.s ! det.n ! det.det ! caseNP c ++ xs.s ;
a = agrP3 g det.n
} ;
lincat
Symb, SymbList = SS ;
lin
MkSymb s = s ;
BaseSymb = infixSS conjAnd ;
ConsSymb = infixSS "," ;
}

View File

@@ -0,0 +1,124 @@
incomplete concrete NounRomance of Noun =
CatRomance ** open DiffRomance, ResRomance, Prelude in {
flags optimize=all_subs ;
lin
DetCN det cn =
let
g = cn.g ;
n = det.n
in {
s = \\c => det.s ! g ! npform2case c ++ cn.s ! n ;
a = agrP3 g n ;
c = Clit0
} ;
UsePN pn = {
s = \\c => prepCase (npform2case c) ++ pn.s ;
a = agrP3 pn.g Sg ;
c = Clit0
} ;
UsePron p = p ;
PredetNP pred np = {
s = \\c => prepCase (npform2case c) ++ pred.s ! np.a ++ np.s ! Ton Acc ;
a = np.a ;
c = Clit0
} ;
DetSg quant ord = {
s = \\g,c => quant.s ! g ! c ++ ord.s ! aagr g Sg ;
n = Sg
} ;
DetPl quant num ord = {
s = \\g,c => quant.s ! g ! c ++ num.s ! g ++ ord.s ! aagr g Sg ;
n = Pl
} ;
PossSg p = {
s = \\g,c => prepCase c ++ p.s ! Poss (aagr g Sg) ;
n = Sg
} ;
PossPl p = {
s = \\g,c => prepCase c ++ p.s ! Poss (aagr g Pl) ;
n = Pl
} ;
NoNum = {s = \\_ => []} ;
NoOrd = {s = \\_ => []} ;
NumInt n = {s = \\_ => n.s} ;
OrdInt n = {s = \\_ => n.s ++ "ème"} ; ---
---- NumNumeral numeral = {s = \\g => numeral.s ! NCard g ; isDet = True} ;
---- OrdNumeral numeral = {s = numeral.s ! NOrd SupWeak ; isDet = True} ;
AdNum adn num = {s = \\a => adn.s ++ num.s ! a} ;
---- OrdSuperl a = {s = a.s ! AF (ASuperl SupWeak) Nom ; isDet = True} ;
DefSg = {
s = \\g,c => artDef g Sg c ;
n = Sg
} ;
DefPl = {
s = \\g,c => artDef g Sg c ;
n = Pl
} ;
IndefSg = {
s = \\g,c => artIndef g Sg c ;
n = Sg
} ;
IndefPl = {
s = \\g,c => artIndef g Pl c ;
n = Pl
} ;
MassDet = {
s = \\g,c => partitive g c ;
n = Sg
} ;
-- This is based on record subtyping.
UseN, UseN2, UseN3 = \noun -> noun ;
ComplN2 f x = {
s = \\n => f.s ! n ++ appCompl f.c2 x.s ;
g = f.g ;
} ;
ComplN3 f x = {
s = \\n => f.s ! n ++ appCompl f.c2 x.s ;
g = f.g ;
c2 = f.c3
} ;
AdjCN ap cn =
let
g = cn.g
in {
s = \\n => preOrPost ap.isPre (ap.s ! (AF g n)) (cn.s ! n) ;
g = g ;
} ;
{-
RelCN cn rs = let g = cn.g in {
s = \\n,d,c => cn.s ! n ! d ! c ++ rs.s ! agrP3 g n ;
g = g ;
isMod = cn.isMod
} ;
SentCN cn sc = let g = cn.g in {
s = \\n,d,c => cn.s ! n ! d ! c ++ sc.s ;
g = g ;
isMod = cn.isMod
} ;
AdvCN cn sc = let g = cn.g in {
s = \\n,d,c => cn.s ! n ! d ! c ++ sc.s ;
g = g ;
isMod = cn.isMod
} ;
-}
}

View File

@@ -0,0 +1,126 @@
--1 Romance Word Classes and Morphological Parameters
--
resource ParamRomance = ParamX ** open Prelude in {
-- This is a resource module for Romance grammars, currently instantiated for
-- French, Italian, and Spanish. It defines the
-- morphological parameters that are common to all Romance languages.
-- 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.
-- Those parameters that differ are defined in [DiffRomance DiffRomance.html].
-- Some parameters are shared even more widely, such as $Number$ and $Person$.
-- They are defined in [ParamX ParamX.html].
--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 ;
-- There are different types of clicic pronouns (as for position).
-- Examples of each: "Giovanni" ; "io" ; "lui" ; "noi".
ClitType = Clit0 | Clit1 | Clit2 | Clit3 ;
-- 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 ;
-- 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"
} ;
--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 TMood Number Person
| VImper NumPersI
| VPart Gender Number
| VGer
;
TMood =
VPres Mood
| VImperf Mood
| VPasse
| VFut
| VCondit
;
NumPersI = SgP2 | PlP1 | PlP2 ;
-- Agreement of adjectives, verb phrases, and relative pronouns.
oper
AAgr : Type = {g : Gender ; n : Number} ;
Agr : Type = AAgr ** {p : Person} ;
param
RAgr = RAg AAgr | RNoAg ;
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
} ;
}

View File

@@ -0,0 +1,24 @@
incomplete concrete PhraseRomance of Phrase =
CatRomance, TenseX ** open DiffRomance, ResRomance, Prelude in {
lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
UttS s = {s = s.s ! Main} ;
UttQS qs = {s = qs.s ! QDir} ;
UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ;
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ;
UttIP ip = {s = ip.s ! nominative} ; --- Acc also
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! accusative} ;
UttVP vp = {s = infMark ++ infVP vp (agrP3 Utr Sg)} ;
UttAdv adv = adv ;
NoPConj = {s = []} ;
PConjConj conj = conj ;
NoVoc = {s = []} ;
VocNP np = {s = "," ++ np.s ! nominative} ;
}

View File

@@ -0,0 +1,66 @@
incomplete concrete QuestionRomance of Question =
CatRomance ** open DiffRomance, ResRomance in {
flags optimize=all_subs ;
lin
QuestCl cl = {
s = \\t,a,p =>
let cls = cl.s ! t ! a ! p
in table {
QDir => cls ! Inv ;
QIndir => subjIf ++ cls ! Sub
}
} ;
QuestVP qp vp = {
s = \\t,a,b,q =>
let
somo = case q of {
QIndir => <"som",Sub> ;
_ => <[], Main>
} ;
cl = mkClause (qp.s ! nominative ++ somo.p1) {gn = qp.gn ; p = P3} vp
in
cl.s ! t ! a ! b ! somo.p2
} ;
QuestSlash ip slash = {
s = \\t,a,p =>
let
cls = slash.s ! t ! a ! p ;
who = slash.c2 ++ ip.s ! accusative --- stranding in ExtRomance
in table {
QDir => who ++ cls ! Inv ;
QIndir => who ++ cls ! Sub
}
} ;
QuestIAdv iadv cl = {
s = \\t,a,p =>
let
cls = cl.s ! t ! a ! p ;
why = iadv.s
in table {
QDir => why ++ cls ! Inv ;
QIndir => why ++ cls ! Sub
}
} ;
PrepIP p ip = {
s = p.s ++ ip.s ! accusative
} ;
AdvIP ip adv = {
s = \\c => ip.s ! c ++ adv.s ;
gn = ip.gn
} ;
IDetCN idet num ord cn = let g = cn.g in {
s = \\c =>
idet.s ! g ++ num.s ! g ++ ord.s ++ cn.s ! idet.n ! idet.det ! caseNP c ;
gn = gennum g idet.n
} ;
}

View File

@@ -0,0 +1,44 @@
incomplete concrete RelativeRomance of Relative =
CatRomance ** open DiffRomance, ResRomance in {
flags optimize=all_subs ;
lin
RelCl cl = {
s = \\t,a,p,ag => pronSuch ! ag.gn ++ conjThat ++ cl.s ! t ! a ! p ! Sub
} ;
RelVP rp vp = {
s = \\t,ant,b,ag =>
let
agr = case rp.a of {
RNoAg => ag ;
RAg a => a
} ;
cl = mkClause (rp.s ! ag.gn ! RNom) agr vp
in
cl.s ! t ! ant ! b ! Sub
} ;
--- We make this easy by using "som" and preposition stranding. It would be
--- a proble to determine whether $slash$ takes a direct object, since
--- $slash.c2$ is defined to be just a string.
--
-- The empty relative is left to $ExtRomance$.
RelSlash rp slash = {
s = \\t,a,p,ag =>
rp.s ! ag.gn ! RNom ++ slash.s ! t ! a ! p ! Sub ++ slash.c2
} ;
--- The case here could be genitive.
FunRP p np rp = {
s = \\gn,c => np.s ! nominative ++ p.s ++ rp.s ! gn ! RPrep ;
a = RAg np.a
} ;
IdRP = {s = relPron ; a = RNoAg} ;
}

View File

@@ -0,0 +1,205 @@
----1 Romance auxiliary operations.
--
---- This module contains operations that are needed to make the
---- resource syntax work. To define everything that is needed to
---- implement $Test$, it moreover contains regular lexical
---- patterns needed for $Lex$.
--
resource ResRomance = ParamRomance ** open Prelude in {
flags optimize=all ;
oper
genForms : Str -> Str -> Gender => Str = \bon,bonne ->
table {
Masc => bon ;
Fem => bonne
} ;
}
{-
oper
-- For $Lex$.
-- For each lexical category, here are the worst-case constructors.
--
-- But $mkNoun$ is fully defined only for each language, since
-- $Gender$ varies.
nounForms : (x1,_,_,x4 : Str) -> (Number => Species => Case => Str) =
\man,mannen,men,mennen -> \\n,d,c => case <n,d> of {
<Sg,Indef> => mkCase c man ;
<Sg,Def> => mkCase c mannen ;
<Pl,Indef> => mkCase c men ;
<Pl,Def> => mkCase c mennen
} ;
Adjective : Type = {s : AForm => Str} ;
mkAdjective : (x1,_,_,_,_,_,x7 : Str) -> {s : AForm => Str} =
\liten, litet, lilla, sma, mindre, minst, minsta -> {
s = table {
AF (APosit a) c => mkCase c (mkAdjPos a liten litet lilla sma) ;
AF ACompar c => mkCase c mindre ;
AF (ASuperl SupStrong) c => mkCase c minst ;
AF (ASuperl SupWeak) c => mkCase c minsta
}
} ;
mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> {s : VForm => Str ; vtype : VType} =
\finna,finner,finn,fann,funnit,funnen,funnet,funna -> {
s = table {
VF (VPres Act) => finner ;
VF (VPres Pass) => mkVoice Pass finn ;
VF (VPret v) => mkVoice v fann ;
VF (VImper v) => mkVoice v finn ;
VI (VInfin v) => mkVoice v finna ;
VI (VSupin v) => mkVoice v funnit ;
VI (VPtPret a c)=> mkCase c (mkAdjPos a funnen funnet funna funna)
} ;
vtype = VAct
} ;
-- These are useful auxiliaries.
mkCase : Case -> Str -> Str = \c,f -> case c of {
Nom => f ;
Gen => f + case last f of {
"s" | "x" => [] ;
_ => "s"
}
} ;
mkAdjPos : AFormPos -> (s1,_,_,s4 : Str) -> Str =
\a, liten, litet, lilla, sma ->
case a of {
Strong gn => case gn of {
SgUtr => liten ;
SgNeutr => litet ;
Plg => sma
} ;
Weak Sg => lilla ;
Weak Pl => sma
} ;
mkVoice : Voice -> Str -> Str = \v,s -> case v of {
Act => s ;
Pass => s + case last s of {
"s" => "es" ;
_ => "s"
}
} ;
-- For $Noun$.
artDef : GenNum -> Str = \gn -> gennumForms "den" "det" "de" ! gn ;
mkNP : (x1,_,_,_,x5 : Str) -> GenNum -> Person ->
{s : NPForm => Str ; a : Agr} = \du,dig,din,ditt,dina,gn,p -> {
s = table {
NPNom => du ;
NPAcc => dig ;
NPPoss g => gennumForms din ditt dina ! g
} ;
a = {
gn = gn ;
p = p
}
} ;
gennumForms : (x1,x2,x3 : Str) -> GenNum => Str = \den,det,de ->
table {
SgUtr => den ;
SgNeutr => det ;
_ => de
} ;
regNP : Str -> Str -> GenNum -> {s : NPForm => Str ; a : Agr} =
\det,dess,gn ->
mkNP det det dess dess dess gn P3 ;
-- For $Verb$.
Verb : Type = {
s : VForm => Str ;
vtype : VType
} ;
VP = {
s : VPForm => {
fin : Str ; -- V1 har ---s1
inf : Str -- V2 sagt ---s4
} ;
a1 : Polarity => Str ; -- A1 inte ---s3
n2 : Agr => Str ; -- N2 dig ---s5
a2 : Str ; -- A2 idag ---s6
ext : Str ; -- S-Ext att hon går ---s7
--- ea1,ev2, --- these depend on params of v and a1
en2,ea2,eext : Bool -- indicate if the field exists
} ;
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
s = vp.s ;
a1 = vp.a1 ;
n2 = \\a => vp.n2 ! a ++ obj ! a ;
a2 = vp.a2 ;
ext = vp.ext ;
en2 = True ;
ea2 = vp.ea2 ;
eext = vp.eext
} ;
insertAdv : Str -> VP -> VP = \adv,vp -> {
s = vp.s ;
a1 = vp.a1 ;
n2 = vp.n2 ;
a2 = vp.a2 ++ adv ;
ext = vp.ext ;
en2 = vp.en2 ;
ea2 = True ;
eext = vp.eext
} ;
insertAdV : Str -> VP -> VP = \adv,vp -> {
s = vp.s ;
a1 = \\b => vp.a1 ! b ++ adv ;
n2 = vp.n2 ;
a2 = vp.a2 ;
ext = vp.ext ;
en2 = vp.en2 ;
ea2 = vp.ea2 ;
eext = vp.eext
} ;
infVP : VP -> Agr -> Str = \vp,a ->
(vp.s ! VPInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1
-- For $Sentence$.
Clause : Type = {
s : Tense => Anteriority => Polarity => Order => Str
} ;
mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> {
s = \\t,a,b,o =>
let
verb = vp.s ! VPFinite t a ;
neg = vp.a1 ! b ;
compl = vp.n2 ! agr ++ vp.a2 ++ vp.ext
in
case o of {
Main => subj ++ verb.fin ++ neg ++ verb.inf ++ compl ;
Inv => verb.fin ++ subj ++ neg ++ verb.inf ++ compl ;
Sub => subj ++ neg ++ verb.fin ++ verb.inf ++ compl
}
} ;
}
-}

View File

@@ -0,0 +1,43 @@
incomplete concrete SentenceRomance of Sentence =
CatRomance ** open DiffRomance, ResRomance in {
flags optimize=all_subs ;
lin
PredVP np vp = mkClause (np.s ! nominative) np.a vp ;
PredSCVP sc vp = mkClause sc.s (agrP3 neutrum Sg) vp ;
ImpVP vp = {
s = \\pol,n =>
let
agr = {gn = gennum utrum n ; p = P2} ;
verb = vp.s ! VPImperat ;
in
verb.fin ++ vp.a1 ! pol ++ verb.inf ++ vp.n2 ! agr ++ vp.a2 ++ vp.ext
} ;
SlashV2 np v2 =
mkClause
(np.s ! nominative) np.a
(predV v2) **
{c2 = v2.c2} ;
SlashVVV2 np vv v2 =
mkClause
(np.s ! nominative) np.a
(insertObj (\\_ => vv.c2 ++ infVP (predV v2) np.a) (predV vv)) **
{c2 = v2.c2} ;
AdvSlash slash adv = {
s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
c2 = slash.c2
} ;
SlashPrep cl prep = cl ** {c2 = prep.s} ;
EmbedS s = {s = conjThat ++ s.s ! Sub} ;
EmbedQS qs = {s = qs.s ! QIndir} ;
EmbedVP vp = {s = infVP vp (agrP3 utrum Sg)} ; --- agr
}

View File

@@ -0,0 +1,41 @@
--concrete SeqConjunctionRomance of Conjunction =
-- CatRomance ** open ResRomance, Coordination, Prelude in {
--
-- lin
--
-- ConjS conj ss = {s = conjunctX conj ss} ;
-- DConjS conj ss = {s = conjunctDistrX conj ss} ;
--
-- ConjAdv conj ss = {s = conjunctX conj ss} ;
-- DConjAdv conj ss = {s = conjunctDistrX conj ss} ;
--
-- ConjNP conj ss = conjunctTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
-- DConjNP conj ss = conjunctDistrTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
--
-- ConjAP conj ss = conjunctTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
-- DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
--
-- TwoS = twoSS ;
-- AddS = consSS comma ;
-- TwoAdv = twoSS ;
-- AddAdv = consSS comma ;
-- TwoNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
-- AddNP xs x = consTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
-- TwoAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
-- AddAP xs x = consTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
--
-- lincat
-- SeqS = {s1,s2 : Str} ;
-- SeqAdv = {s1,s2 : Str} ;
-- SeqNP = {s1,s2 : Case => Str ; a : Agr} ;
-- SeqAP = {s1,s2 : Agr => Str ; isPre : Bool} ;
--
--}

View File

@@ -0,0 +1,11 @@
incomplete concrete TensedRomance of Tensed = CatRomance, TenseX **
open ResRomance in {
flags optimize=all_subs ;
lin
UseCl t a p cl = {s = \\o => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! o} ;
UseQCl t a p cl = {s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q} ;
UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ;
}

View File

@@ -0,0 +1,15 @@
incomplete concrete UntensedRomance of Untensed = CatRomance ** open ResRomance in {
flags optimize=all_subs ;
lin
PosCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
NegCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
PosQCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
NegQCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
PosRCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
NegRCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
}

View File

@@ -0,0 +1,43 @@
incomplete concrete VerbRomance of Verb = CatRomance ** open DiffRomance, ResRomance in {
flags optimize=all_subs ;
lin
UseV = predV ;
ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! accusative) (predV v) ;
ComplV3 v np np2 =
insertObj
(\\_ => v.c2 ++ np.s ! accusative ++ v.c3 ++ np2.s ! accusative)
(predV v) ;
ComplVV v vp = insertObj (\\a => v.c2 ++ infVP vp a) (predV v) ;
ComplVS v s = insertObj (\\_ => conjThat ++ s.s ! Sub) (predV v) ;
ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
ComplVA v ap =
insertObj (\\a => ap.s ! agrAdj a.gn DIndef) (predV v) ;
ComplV2A v np ap =
insertAdv
(ap.s ! agrAdj np.a.gn DIndef)
(insertObj (\\_ => v.c2 ++ np.s ! accusative) (predV v)) ;
UseComp comp = insertObj (\\a => comp.s ! agrAdj a.gn DIndef) (predV verbBe) ;
CompAP ap = ap ;
CompNP np = {s = \\_ => np.s ! accusative} ;
CompAdv a = {s = \\_ => a.s} ;
AdvVP vp adv = insertAdv adv.s vp ;
AdVVP adv vp = insertAdV adv.s vp ;
ReflV2 v = insertObj (\\a => v.c2 ++ reflPron a) (predV v) ;
PassV2 v =
insertObj
(\\a => v.s ! VI (VPtPret (agrAdj a.gn DIndef) Nom))
(predV verbBecome) ;
UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; vtype = vv.vtype} ;
}