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