From 4ba116d1252c5ada24fcf3dc45736ca460b2d2b7 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 21 Nov 2013 08:48:08 +0000 Subject: [PATCH] a shortcut in SentenceRomance.SlashVP to make it more easily compilable. This compromises the correctness of negation with polarity elements (e.g. the omission of "pas" in French when "rien" is present) in slash-type questions and polarity items. The correct version is left in a comment and waiting for optimizations that would enable compiling it into PMCFG. --- lib/src/romance/ResRomance.gf | 13 ++-- lib/src/romance/SentenceRomance.gf | 120 ++++++++++++++++++++++++++--- 2 files changed, 118 insertions(+), 15 deletions(-) diff --git a/lib/src/romance/ResRomance.gf b/lib/src/romance/ResRomance.gf index 19d441b67..bc01c81fe 100644 --- a/lib/src/romance/ResRomance.gf +++ b/lib/src/romance/ResRomance.gf @@ -216,6 +216,7 @@ oper => polNegDirSubj ; _ => b } ; + neg = vp.neg ! pol ; gen = agr.g ; @@ -226,20 +227,22 @@ oper True => vp.comp ! {g = gen ; n = Sg ; p = per} ; _ => vp.comp ! agr } ; - ext = vp.ext ! pol ; + ext = vp.ext ! b ; vtyp = vp.s.vtyp ; refl = case isVRefl vtyp of { True => reflPron num per Acc ; ---- case ? _ => [] } ; - clit = refl ++ vp.clit1 ++ vp.clit2 ++ vp.clit3.s ; ---- refl first? + clit = refl ++ vp.clit1 ++ vp.clit2 ++ vp.clit3.s ; ---- refl first? verb = vp.s.s ; vaux = auxVerb vp.s.vtyp ; - vagr = appVPAgr vp.agr (aagr gen num) ; --- subtype bug - part = verb ! VPart vagr.g vagr.n ; + part = case vp.agr of { + VPAgrSubj => verb ! VPart agr.g agr.n ; + VPAgrClit g n => verb ! VPart g n + } ; vps : Str * Str = case of { => ; --# notpresent @@ -261,9 +264,7 @@ oper DDir => subj ++ neg.p1 ++ clit ++ fin ++ neg.p2 ++ inf ++ compl ++ ext ; DInv => ----- neg.p1 ++ clit ++ fin ++ neg.p2 ++ inf ++ compl ++ subj ++ ext invertedClause vp.s.vtyp hasClit neg clit fin inf compl subj ext ----- neg.p1 ++ clit ++ fin ++ preOrPost hasClit subj (neg.p2 ++ inf) ++ compl ++ ext ---- } } ; diff --git a/lib/src/romance/SentenceRomance.gf b/lib/src/romance/SentenceRomance.gf index 56742fe26..76e75a525 100644 --- a/lib/src/romance/SentenceRomance.gf +++ b/lib/src/romance/SentenceRomance.gf @@ -14,19 +14,121 @@ incomplete concrete SentenceRomance of Sentence = } } ; - SlashVP np v2 = +{- + SlashVP np vps = -- agreement decided afterwards: la fille qu'il a trouvée - {s = \\a => + {s = \\agr => let ------ vp = v2 - vp = case of { - => insertAgr a v2 ; - _ => v2 + vp = case of { + => insertAgr agr vps ; -- la fille qu'il a trouvée decided here + _ => vps } - in (mkClausePol np.isNeg (np.s ! Nom).comp False np.isPol np.a vp).s ; ------ in (mkClausePol np.isNeg (np.s ! Nom).comp np.hasClit np.isPol np.a vp).s ; - c2 = v2.c2 + in (mkClausePol np.isNeg (np.s ! Nom).comp np.hasClit np.isPol np.a vp).s ; -- à qui montre-t-il sa maison + c2 = vps.c2 -- np.hasClit decides inversion } ; +-} + +--- inlined mkClausePol to make compilation possible AR 21/11/2013 +---- one shortcut left: polarity change from negative elements ("rien" etc) ignored +---- thus we get "la fille que personne ne voit pas" + + SlashVP np vps = { + + c2 = vps.c2 ; + + s = \\agr0,d,te,a,b,m => + let + isNeg = np.isNeg ; + subj = (np.s ! Nom).comp ; + hasClit = np.hasClit ; + isPol = np.isPol ; + agr = np.a ; + vp : VP = case of { + => insertAgr agr0 vps ; -- la fille qu'il a trouvée is decided here + _ => vps + } ; + +{- slow to compile + pol : RPolarity = case of { + <_,True,RPos,_> => RNeg True ; + => RNeg True ; + => polNegDirSubj ; + _ => b + } ; +-} --pol = b ; ---- + + neg = vp.neg ! b ; + +{- also too slow + neg : Str * Str = case b of { + RNeg _ => vp.neg ! b ; + RPos => case vp.isNeg of { + True => vp.neg ! RNeg True ; + False => case isNeg of { + True => case d of { + DInv => vp.neg ! RNeg True ; + _ => vp.neg ! polNegDirSubj + } ; + False => vp.neg ! b + } + } + } ; +-} + + gen = agr.g ; + num = agr.n ; + per = agr.p ; + + compl = case isPol of { + True => vp.comp ! {g = gen ; n = Sg ; p = per} ; + _ => vp.comp ! agr + } ; + + ext = vp.ext ! b ; + + vtyp = vp.s.vtyp ; + + refl = case isVRefl vtyp of { + True => reflPron num per Acc ; ---- case ? + _ => [] + } ; + + clit = refl ++ vp.clit1 ++ vp.clit2 ++ vp.clit3.s ; ---- refl first? + + verb = vp.s.s ; + vaux = auxVerb vp.s.vtyp ; + + part = case vp.agr of { + VPAgrSubj => verb ! VPart agr.g agr.n ; + VPAgrClit g n => verb ! VPart g n + } ; + + vps : Str * Str = case of { + => ; --# notpresent + => ; --# notpresent + => ; --# notpresent + => ; --# notpresent + => ; --# notpresent + => ; --# notpresent + => ; --# notpresent + => ; --# notpresent + => ; --# notpresent + => + } ; + + fin = vps.p1 ; + inf = vps.p2 ; + in + + case d of { + DDir => + subj ++ neg.p1 ++ clit ++ fin ++ neg.p2 ++ inf ++ compl ++ ext ; + DInv => + invertedClause vp.s.vtyp hasClit neg clit fin inf compl subj ext + } + } ; + + AdvSlash slash adv = { s = \\ag,d,t,a,b,m => slash.s ! ag ! d ! t ! a ! b ! m ++ adv.s ;