change in Romance agreement to produce correct number for polite singular pronouns ; linking functions that involve mkClause now takes a long time and should be revised

This commit is contained in:
aarne
2010-04-06 14:08:01 +00:00
parent f6db1ad200
commit d1d1c6215d
27 changed files with 118 additions and 69 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@@ -116,6 +116,18 @@ Separate concrete syntaxes.
<CODE>DisambPhrasebook</CODE>: disambiguation grammars generating feedback phrases if
the input language is ambiguous.
</P>
<P>
Here is the module structure produced by
</P>
<PRE>
&gt; i -retain DisambPhrasebookEng.gf
&gt; dg -only=Phrasebook*,Sentences*,Words*,Greetings*,DiffP*,DisambPhrasebookEng
&gt; ! dot -Tpng _gfdepgraph.dot &gt;pgraph.png
</PRE>
<P></P>
<P>
<IMG ALIGN="middle" SRC="pgraph.png" BORDER="0" ALT="">
</P>
<H1>To Do</H1>
<P>
Improved translation interface

View File

@@ -97,6 +97,15 @@ Separate concrete syntaxes.
``DisambPhrasebook``: disambiguation grammars generating feedback phrases if
the input language is ambiguous.
Here is the module structure produced by
```
> i -retain DisambPhrasebookEng.gf
> dg -only=Phrasebook*,Sentences*,Words*,Greetings*,DiffP*,DisambPhrasebookEng
> ! dot -Tpng _gfdepgraph.dot >pgraph.png
```
[pgraph.png]
=To Do=

View File

@@ -88,10 +88,11 @@ oper
infForm _ _ _ _ = True ;
mkImperative b p vp = {
s = \\pol,aag =>
s = \\pol,agr =>
let
pe = case b of {True => P3 ; _ => p} ;
agr = aag ** {p = pe} ;
---- agr = aag ** {p = pe} ;
aag = verbAgr agr ; ----
clpr = <[],[],False> ; ----e pronArg agr.n agr.p vp.clAcc vp.clDat ;
----e verb = case <aag.n, pol,pe> of {
----e <Sg,Neg,P2> => (vp.s ! VPInfinit Simul clpr.p3).inf ! aag ;

View File

@@ -38,7 +38,7 @@ concrete IdiomCat of Idiom = CatCat **
} ;
ImpPl1 vp = {s =
(mkImperative False P1 vp).s ! Pos ! {n = Pl ; g = Masc} --- fem
(mkImperative False P1 vp).s ! Pos ! Ag Masc Pl P1 ; --- fem
} ;
CleftAdv ad s = mkClause [] True (agrP3 Masc Sg)

View File

@@ -146,7 +146,7 @@ oper
<Sg,Fem> => sa ;
_ => ses
} ;
a = {g = g ; n = n ; p = p} ;
a = Ag g n p ;
hasClit = True
} ;

View File

@@ -31,9 +31,10 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
RelExistNP prep rp np = {
s = \\t,ant,bo,ag =>
let cl =
mkClause
(\_ -> appCompl True Pos prep (rp2np ag.n rp))
let
n = complNumAgr ag ;
cl = mkClause
(\_ -> appCompl True Pos prep (rp2np n rp))
np.a
(insertObj
(\\_,b,_ => np.s ! NPCase Nom)
@@ -71,7 +72,7 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
vai_Conj = {s1 = [] ; s2 = "vai" ; n = Sg} ;
CompPartAP ap = {
s = \\agr => ap.s ! False ! NCase agr.n Part
s = \\agr => ap.s ! False ! NCase (complNumAgr agr) Part
} ;
}

View File

@@ -62,7 +62,8 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in {
_ => VPAgrSubj
} ;
vpAgrClit : Agr -> VPAgr = \a ->
vpAgrClit : Agr -> VPAgr = \a0 ->
let a = complAgr a0 in
VPAgrClit a.g a.n ;
---- pronArg = pronArgGen Neg ; --- takes more space and time
@@ -118,14 +119,14 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in {
} ;
mkImperative b p vp = {
s = \\pol,aag =>
s = \\pol,ag =>
let
num = if_then_else Number b Pl aag.n ;
agr = {g = aag.g ; n = num ; p = p} ;
verb = vp.s.s ! vImperForm agr ;
agr = verbAgr ag ;
num = if_then_else Number b Pl agr.n ;
verb = vp.s.s ! vImperForm ag ;
neg = vp.neg ! pol ;
clpr = <vp.clit1 ++ vp.clit2, False> ; ---- TODO: True if clit
compl = vp.comp ! agr ++ vp.ext ! pol
compl = vp.comp ! ag ++ vp.ext ! pol
in
case pol of {
Pos => verb ++ if_then_Str clpr.p2 "-" [] ++ clpr.p1 ++ compl ;

View File

@@ -42,9 +42,8 @@ concrete ExtraFre of ExtraFreAbs = ExtraRomanceFre **
Fem Sg P2 ;
youPl8fem_Pron,
youPol8fem_Pron =
mkPronoun
"vous" "vous" "vous" "vous" "votre" "votre" "vos"
Fem Pl P2 ;
let vous = mkPronoun "vous" "vous" "vous" "vous" "votre" "votre" "vos" Masc Pl P2
in {s = vous.s ; hasClit = vous.hasClit ; poss = vous.poss ; a = AgPol Fem} ;
oper
prepQue : Case -> Str = \c -> case c of {

View File

@@ -34,7 +34,7 @@ concrete IdiomFre of Idiom = CatFre **
(predV copula) ;
ImpPl1 vp = {s =
(mkImperative False P1 vp).s ! Pos ! {n = Pl ; g = Masc} --- fem
(mkImperative False P1 vp).s ! Pos ! Ag Masc Pl P1 --- fem
} ;
ImpP3 np vp = {

View File

@@ -177,7 +177,7 @@ oper
<Sg,Fem> => sa ;
_ => ses
} ;
a = {g = g ; n = n ; p = p} ;
a = Ag g n p ;
hasClit = True
} ;

View File

@@ -166,10 +166,13 @@ lin
youSg_Pron = mkPronoun
"tu" (elision "t") (elision "t") "toi" "ton" (elisPoss "t") "tes"
Masc Sg P2 ;
youPl_Pron, youPol_Pron =
youPl_Pron =
mkPronoun
"vous" "vous" "vous" "vous" "votre" "votre" "vos"
Masc Pl P2 ;
youPol_Pron =
let vous = mkPronoun "vous" "vous" "vous" "vous" "votre" "votre" "vos" Masc Pl P2
in {s = vous.s ; hasClit = vous.hasClit ; poss = vous.poss ; a = AgPol Masc} ;
not_Predet = {s = \\a,c => prepCase c ++ "pas" ; c = Nom ; a = PNoAg} ;

View File

@@ -77,8 +77,9 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud
_ => VPAgrSubj
} ;
vpAgrClit : Agr -> VPAgr = \a ->
VPAgrClit a.g a.n ; --- subty
vpAgrClit : Agr -> VPAgr = \a0 ->
let a = complAgr a0 in
VPAgrClit a.g a.n ;
pronArg = \n,p,acc,dat ->
let
@@ -108,10 +109,11 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud
infForm n p x y = (pronArg n p x y).p3 ;
mkImperative b p vp = {
s = \\pol,aag =>
s = \\pol,agr =>
let
pe = case b of {True => P3 ; _ => p} ;
agr = aag ** {p = pe} ;
---- agr = aag ** {p = pe} ;
aag = verbAgr agr ; ----
clpr = <vp.clit1 ++ vp.clit2,[],False> ; ---- TODO: True is clit
verb = case <aag.n, pol,pe> of {
<Sg,Neg,P2> => vp.s.s ! VInfin clpr.p3 ; ---- ! aag ;

View File

@@ -18,7 +18,8 @@ concrete IdiomIta of Idiom = CatIta **
(insertComplement (\\_ => ad.s) (predV copula))) ;
ExistNP np =
mkClause [] True (agrP3 np.a.g np.a.n)
let npa = complAgr np.a in
mkClause [] True (agrP3 npa.g npa.n)
(insertClit3 (elision "ci" "c'" "ci")
(insertComplement (\\_ => (np.s ! Nom).ton)
(predV copula))) ;
@@ -43,7 +44,7 @@ concrete IdiomIta of Idiom = CatIta **
(predV (essereV (verboV (stare_16 "stare")))) ;
ImpPl1 vp = {s =
(mkImperative False P1 vp).s ! Pos ! {n = Pl ; g = Masc} --- fem
(mkImperative False P1 vp).s ! Pos ! Ag Masc Pl P1 --- fem
} ;
}

View File

@@ -154,7 +154,7 @@ oper
<Pl,Masc> => ses ;
<Pl,Fem> => see
} ;
a = {g = g ; n = n ; p = p} ;
a = Ag g n p ;
hasClit = True
} ;

View File

@@ -63,12 +63,12 @@ oper
_ => 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
} ;
conjAgr : Agr -> Agr -> Agr = \a,b -> case <a,b> of {
<Ag g n p, Ag h m q> => Ag (conjGender g h) (conjNumber n m) (conjPerson p q) ;
<Ag g n p, AgPol h> => Ag (conjGender g h) Pl (conjPerson p P2) ;
<AgPol h, Ag g n p> => Ag (conjGender g h) Pl (conjPerson p P2) ;
<AgPol g, AgPol h> => AgPol (conjGender g h)
} ;
--3 Verbs
--
@@ -122,7 +122,19 @@ param
oper
AAgr : Type = {g : Gender ; n : Number} ;
Agr : Type = AAgr ** {p : Person} ;
param
Agr = Ag Gender Number Person | AgPol Gender ;
oper
complAgr : Agr -> {g : Gender ; n : Number} = \a -> case a of {
Ag g n _ => {g = g ; n = n} ;
AgPol g => {g = g ; n = Sg} -- vous êtes fatiguée
} ;
verbAgr : Agr -> {g : Gender ; n : Number ; p : Person} = \a -> case a of {
Ag g n p => {g = g ; n = n ; p = p} ;
AgPol g => {g = g ; n = Pl ; p = P2}
} ;
param
RAgr = RAg {g : Gender ; n : Number} | RNoAg ; --- AAgr
@@ -137,7 +149,7 @@ oper
aagr : Gender -> Number -> AAgr = \g,n ->
{g = g ; n = n} ;
agrP3 : Gender -> Number -> Agr = \g,n ->
aagr g n ** {p = P3} ;
Ag g n P3 ;
vf2numpers : VF -> (Number * Person) = \v -> case v of {
@@ -156,11 +168,11 @@ oper
_ => VInfin False
} ;
vImperForm : Agr -> VF = \a -> case <a.n,a.p> of {
<Pl,P1> => VImper PlP1 ;
<_, P3> => VFin (VPres Conjunct) a.n P3 ;
<Sg,_> => VImper SgP2 ;
<Pl,_> => VImper PlP2
vImperForm : Agr -> VF = \a -> case a of {
Ag _ Pl P1 => VImper PlP1 ;
Ag _ n P3 => VFin (VPres Conjunct) n P3 ;
Ag _ Sg _ => VImper SgP2 ;
_ => VImper PlP2 -- covers French AgPol
} ;

View File

@@ -10,7 +10,7 @@ incomplete concrete ConjunctionRomance of Conjunction =
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} ;
a = conjAgr (Ag Masc conj.n P3) ss.a ;
hasClit = False
}) ;
ConjAP conj ss = conjunctDistrTable AForm conj ss ** {

View File

@@ -49,7 +49,7 @@ interface DiffRomance = open CommonRomance, Prelude in {
-- To render imperatives (with their clitics etc).
oper mkImperative : Bool -> Person -> VP -> {s : Polarity => AAgr => Str} ;
oper mkImperative : Bool -> Person -> VP -> {s : Polarity => Agr => Str} ;
--2 Constants that must derivatively depend on language

View File

@@ -18,16 +18,20 @@ incomplete concrete NounRomance of Noun =
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 = case pred.a of {PAg n => agrP3 np.a.g n ; _ => np.a} ;
hasClit = False
PredetNP pred np =
let agr = complAgr np.a in
heavyNP {
s = \\c => pred.s ! agr ! c ++ (np.s ! pred.c).ton ;
a = case pred.a of {PAg n => agrP3 agr.g n ; _ => 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
PPartNP np v2 =
let agr = complAgr np.a in
heavyNP {
s = \\c => (np.s ! c).ton ++ v2.s ! VPart agr.g agr.n ;
a = np.a ;
hasClit = False
} ;
RelNP np rs = heavyNP {

View File

@@ -52,7 +52,7 @@ incomplete concrete QuestionRomance of Question =
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}
why = icomp.s ! complAgr np.a ;
in why ++ cls
} ;

View File

@@ -6,7 +6,7 @@ incomplete concrete RelativeRomance of Relative =
lin
RelCl cl = {
s = \\ag,t,a,p,m => pronSuch ! {g=ag.g; n=ag.n} ++ conjThat ++
s = \\ag,t,a,p,m => pronSuch ! complAgr ag ++ conjThat ++
cl.s ! DDir ! t ! a ! p ! m ;
c = Nom
} ;
@@ -15,12 +15,12 @@ incomplete concrete RelativeRomance of Relative =
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}
(rp.s ! False ! complAgr ag ! Nom) False
(Ag rp.a.g rp.a.n P3)
vp).s ! DDir ; c = Nom} ;
False => {s = \\ag =>
(mkClause
(rp.s ! False ! {g = ag.g ; n = ag.n} ! Nom) False
(rp.s ! False ! complAgr ag ! Nom) False
ag
vp).s ! DDir ; c = Nom
}
@@ -28,7 +28,7 @@ incomplete concrete RelativeRomance of Relative =
RelSlash rp slash = {
s = \\ag,t,a,p,m =>
let aag = {g = ag.g ; n = ag.n}
let aag = complAgr ag
in
slash.c2.s ++
rp.s ! False ! aag ! slash.c2.c ++
@@ -38,7 +38,7 @@ incomplete concrete RelativeRomance of Relative =
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} ;
a = complAgr np.a ;
hasAgr = True
} ;
IdRP = {

View File

@@ -190,12 +190,13 @@ oper
mkClause : Str -> Bool -> Agr -> VP ->
{s : Direct => RTense => Anteriority => Polarity => Mood => Str} =
\subj, hasClit, agr, vp -> {
\subj, hasClit, ag, vp -> {
s = \\d,te,a,b,m =>
let
neg = vp.neg ! b ;
compl = vp.comp ! agr ++ vp.ext ! b ;
compl = vp.comp ! ag ++ vp.ext ! b ;
agr = verbAgr ag ;
gen = agr.g ;
num = agr.n ;
per = agr.p ;

View File

@@ -10,13 +10,13 @@ incomplete concrete SentenceRomance of Sentence =
ImpVP vp = {
s = \\p,i,g => case i of {
ImpF n b => (mkImperative b P2 vp).s ! p ! (aagr g n)
ImpF n b => (mkImperative b P2 vp).s ! p ! (Ag g n P2) ---- AgPol ?
}
} ;
SlashVP np v2 =
-- agreement decided afterwards: la fille qu'il a trouvée
{s = \\ag =>
{s = \\_ =>
let
vp = v2
----e vp = case <v2.c2.c, v2.c2.isDir> of {

View File

@@ -11,7 +11,7 @@ incomplete concrete VerbRomance of Verb =
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) ;
insertComplement (\\a => let agr = complAgr a in ap.s ! AF agr.g agr.n) (predV v) ;
SlashV2a v = mkVPSlash v.c2 (predV v) ;
@@ -58,7 +58,7 @@ incomplete concrete VerbRomance of Verb =
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
(\\a => let agr = verbAgr a in v.c2.s ++ reflPron agr.n agr.p v.c2.c) v
} ;
SlashVV v vp =
@@ -73,14 +73,15 @@ incomplete concrete VerbRomance of Verb =
UseComp comp = insertComplement comp.s (predV copula) ;
CompAP ap = {s = \\ag => ap.s ! AF ag.g ag.n} ;
CompAP ap = {s = \\ag => let agr = complAgr ag in ap.s ! AF agr.g agr.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) ;
PassV2 v = insertComplement
(\\a => let agr = complAgr a in v.s ! VPart agr.g agr.n) (predV auxPassive) ;
}

View File

@@ -91,10 +91,12 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud
infForm _ _ _ _ = True ;
mkImperative b p vp = {
s = \\pol,aag =>
s = \\pol,agr =>
let
pe = case b of {True => P3 ; _ => p} ;
agr = aag ** {p = pe} ;
---- agr = aag ** {p = pe} ;
aag = verbAgr agr ; ----
clpr = <[],[],False> ; ----e pronArg agr.n agr.p vp.clAcc vp.clDat ;
----e verb = case <aag.n, pol,pe> of {
----e <Sg,Neg,P2> => (vp.s ! VPInfinit Simul clpr.p3).inf ! aag ;

View File

@@ -39,7 +39,7 @@ concrete IdiomSpa of Idiom = CatSpa **
(predV (verboV (estar_2 "estar"))) ;
ImpPl1 vp = {s =
(mkImperative False P1 vp).s ! Pos ! {n = Pl ; g = Masc} --- fem
(mkImperative False P1 vp).s ! Pos ! Ag Masc Pl P1 ; --- fem
} ;
}

View File

@@ -110,7 +110,7 @@ oper
<Pl,Fem> => see
} ;
a = {g = g ; n = n ; p = p} ;
a = Ag g n p ;
hasClit = True
} ;