mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
more on romance
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
resource MorphoFre = open (Predef=Predef), Prelude, TypesFre in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
--3 Front vowels
|
||||
--
|
||||
@@ -242,19 +243,23 @@ oper
|
||||
P3
|
||||
Clit1 ;
|
||||
|
||||
--2 Reflexive pronouns
|
||||
--
|
||||
-- It is simply a function depending on number and person.
|
||||
|
||||
pronRefl : Number -> Person -> Str = \n,p -> case <n,p> of {
|
||||
<Sg,P1> => elision "m" ;
|
||||
<Sg,P2> => elision "t" ;
|
||||
<_, P3> => elision "s" ;
|
||||
<Pl,P1> => "nous" ;
|
||||
<Pl,P2> => "vous"
|
||||
} ;
|
||||
|
||||
personPron : Gender -> Number -> Person -> Pronoun = \g,n,p ->
|
||||
case <n,p> of {
|
||||
<Sg,P1> => pronJe ;
|
||||
<Sg,P2> => pronTu ;
|
||||
<Sg,P3> => case g of {
|
||||
Masc => pronIl ;
|
||||
Fem => pronElle
|
||||
} ;
|
||||
<Pl,P1> => pronNous ;
|
||||
<Pl,P2> => pronVous ;
|
||||
<Pl,P3> => case g of {
|
||||
Masc => pronIls ;
|
||||
Fem => pronElles
|
||||
}
|
||||
} ;
|
||||
|
||||
-- Reflexive pronouns are defined in $SyntaxFre$.
|
||||
|
||||
-- The composable pronoun "lequel" is inflected by varying the definite
|
||||
-- article and the determiner "quel" in the expected way.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
instance SyntaxFre of SyntaxRomance = TypesFre ** open Prelude, (CO=Coordination), MorphoFre in {
|
||||
|
||||
flags optimize=parametrize ;
|
||||
|
||||
oper
|
||||
nameNounPhrase = \jean ->
|
||||
normalNounPhrase
|
||||
@@ -53,6 +55,19 @@ oper
|
||||
} ++ duvin.s ! stressed accusative --- il y en a ; have to define "y"
|
||||
} ;
|
||||
|
||||
|
||||
reflPron : Number => Person => NPFormA => Str = \\n,p =>
|
||||
case p of {
|
||||
P3 => table {
|
||||
Ton x => prepCase x ++ "soi" ;
|
||||
Aton _ => elision "s" ;
|
||||
Poss Sg Masc => "son" ;
|
||||
Poss Sg Fem => "sa" ;
|
||||
Poss Pl _ => "ses"
|
||||
} ;
|
||||
_ => (personPron Masc n p).s
|
||||
} ;
|
||||
|
||||
mkAdjReg : Str -> Bool -> Adjective = \adj,p ->
|
||||
mkAdjective (adjGrand adj) p ;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ concrete TestResourceFre of TestResource =
|
||||
open Prelude, TypesFre, MorphoFre, SyntaxFre in {
|
||||
|
||||
flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ;
|
||||
optimize=all ;
|
||||
|
||||
lin
|
||||
Big = mkAdjDegrReg "grand" adjPre ;
|
||||
|
||||
@@ -55,7 +55,7 @@ lincat
|
||||
V = Verb ;
|
||||
-- = {s : VF => Str} ;
|
||||
VP = {s : Bool => Gender => VPForm => Str} ;
|
||||
VPI = {s : Gender => Number => Person => Str} ;
|
||||
VPI = {s : VIForm => Gender => Number => Person => Str} ;
|
||||
V2 = TransVerb ;
|
||||
-- = Verb ** {s2 : Preposition ; c : CaseA} ;
|
||||
V3 = TransVerb ** {s3 : Preposition ; c3 : CaseA} ;
|
||||
|
||||
@@ -390,9 +390,10 @@ oper
|
||||
param
|
||||
VPForm = VPF Anteriority VF ;
|
||||
Anteriority = Simul | Anter ;
|
||||
VIForm = VIInfinit | VIImperat Bool Number ;
|
||||
|
||||
oper
|
||||
VerbPhrase = {s : Gender => VPForm => Str} ;
|
||||
VerbPhrase = {s : VIForm => Gender => Number => Person => Str} ;
|
||||
VerbGroup = {s : Bool => Gender => VPForm => Str} ;
|
||||
|
||||
vpf2vf : VPForm -> VF = \vpf -> case vpf of {
|
||||
@@ -542,6 +543,24 @@ oper
|
||||
False => {clit = [] ; part = aimee ; compl = Jean}
|
||||
} ;
|
||||
|
||||
----- 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 ! (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}
|
||||
} ;
|
||||
|
||||
reflPron : Number => Person => NPFormA => Str ;
|
||||
|
||||
mkTransVerb : Verb -> Preposition -> CaseA -> TransVerb = \v,p,c ->
|
||||
v ** {s2 = p ; c = c} ;
|
||||
|
||||
@@ -614,10 +633,10 @@ oper
|
||||
-- as well as the position: "est toujours heureux" / "est heureux à Paris".)
|
||||
|
||||
Adverb : Type = SS ;
|
||||
|
||||
{-
|
||||
adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \chante, bien ->
|
||||
{s = \\g,v => chante.s ! g ! v ++ bien.s} ;
|
||||
|
||||
-}
|
||||
-- Adverbs are typically generated by prefixing prepositions.
|
||||
-- The rule for prepositional phrases also comprises the use of prepositions
|
||||
-- treated as cases. Therefore, both a preposition and a case are needed
|
||||
@@ -742,12 +761,14 @@ oper
|
||||
|
||||
SentenceVerb : Type = Verb ** {mp, mn : Mode} ;
|
||||
|
||||
{- -----
|
||||
complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \croire,jeanboit ->
|
||||
{s = \\b,g,w =>
|
||||
let {m = if_then_else Mode b croire.mp croire.mn}
|
||||
in (predVerb croire).s ! b ! g ! w ++ (embedConj ++ jeanboit.s ! m)} ; ----w
|
||||
-}
|
||||
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) ;
|
||||
|
||||
verbSent : Verb -> Mode -> Mode -> SentenceVerb = \v,mp,mn ->
|
||||
v ** {mp = mp ; mn = mn} ;
|
||||
|
||||
@@ -762,12 +783,12 @@ oper
|
||||
-- They can need an oblique case ("à", "de"), but they work like ordinary verbs.
|
||||
|
||||
VerbVerb : Type = Verb ** {c : CaseA} ;
|
||||
{- ----
|
||||
complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \devoir, nager ->
|
||||
{s = \\b,g,v => formVerb devoir b g v ++
|
||||
prepCase devoir.c ++ nager.s ! True ! g ! VPF Simul VInfin ---- anter
|
||||
} ;
|
||||
-}
|
||||
|
||||
complVerbVerb : VerbVerb -> VerbPhrase -> Complemnt = \devoir, nager ->
|
||||
mkCompl
|
||||
devoir
|
||||
(\\g,n,p => prepCase devoir.c ++ nager.s ! VIInfinit ! g ! n ! p) ;
|
||||
|
||||
mkVerbVerbDir : Verb -> VerbVerb = \v -> v ** {c = accusative} ;
|
||||
|
||||
|
||||
@@ -827,12 +848,12 @@ oper
|
||||
|
||||
-- Relative clauses can be formed from both verb phrases ("qui dort") and
|
||||
-- slash expressions ("que je vois", "dont je parle").
|
||||
|
||||
{- -----
|
||||
relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \qui,dort ->
|
||||
{s = \\m,g,n =>
|
||||
allRelForms qui g n nominative ++ dort.s ! g ! VPF Simul (VFin (VPres m) n P3)
|
||||
} ;
|
||||
|
||||
-}
|
||||
relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \dont,jeparle ->
|
||||
{s = \\m,g,n => jeparle.s2 ++ allRelForms dont g n jeparle.c ++ jeparle.s ! m
|
||||
} ;
|
||||
@@ -929,7 +950,7 @@ oper
|
||||
-- The leading "est-ce que" is recognized as a variant, and requires
|
||||
-- direct word order.
|
||||
|
||||
questVerbPhrase : NounPhrase -> VerbPhrase -> Question ;
|
||||
----- questVerbPhrase : NounPhrase -> VerbPhrase -> Question ;
|
||||
|
||||
-- The existence question is treated separately.
|
||||
|
||||
@@ -942,7 +963,7 @@ oper
|
||||
--
|
||||
-- N.B. inversion variants and "est-ce que" are treated as above.
|
||||
|
||||
intVerbPhrase : IntPron -> VerbPhrase -> Question ;
|
||||
----- intVerbPhrase : IntPron -> VerbPhrase -> Question ;
|
||||
|
||||
intSlash : IntPron -> SentenceSlashNounPhrase -> Question ;
|
||||
|
||||
@@ -959,7 +980,7 @@ oper
|
||||
|
||||
IntAdverb = SS ;
|
||||
|
||||
questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question ;
|
||||
----- questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question ;
|
||||
|
||||
|
||||
--2 Imperatives
|
||||
@@ -974,10 +995,11 @@ oper
|
||||
|
||||
Imperative = {s : Gender => Number => Str} ;
|
||||
|
||||
{- -----
|
||||
imperVerbPhrase : VerbPhrase -> Imperative = \dormir ->
|
||||
{s = \\g,n => dormir.s ! g ! VPF Simul (vImper n P2)
|
||||
} ;
|
||||
|
||||
-}
|
||||
imperUtterance : Number -> Imperative -> Utterance = \n,I ->
|
||||
ss (I.s ! Masc ! n ++ "!") ;
|
||||
|
||||
@@ -1152,10 +1174,11 @@ oper
|
||||
B ++ si.s ++ As
|
||||
} ;
|
||||
|
||||
{- -----
|
||||
subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase =
|
||||
\V, si, A ->
|
||||
adVerbPhrase V (ss (si.s ++ A.s ! si.m)) ;
|
||||
|
||||
-}
|
||||
|
||||
--2 One-word utterances
|
||||
--
|
||||
|
||||
@@ -65,7 +65,6 @@ oper
|
||||
|
||||
prepCase : CaseA -> Str ;
|
||||
|
||||
|
||||
adjCompLong : Adj -> AdjComp ;
|
||||
|
||||
relPronForms : CaseA => Str ;
|
||||
|
||||
@@ -129,6 +129,7 @@ term2patt trm = case trm of
|
||||
return (PR (map (uncurry PAss) (zip ll aa')))
|
||||
LI x -> return $ PV x
|
||||
EInt i -> return $ PI i
|
||||
FV (t:_) -> term2patt t ----
|
||||
_ -> prtBad "no pattern corresponds to term" trm
|
||||
|
||||
patt2term :: Patt -> Term
|
||||
|
||||
Reference in New Issue
Block a user