mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-12 12:42:50 -06:00
Romance clitics almost OK ; bug fix in tb -c
This commit is contained in:
@@ -35,7 +35,7 @@ incomplete concrete CatRomance of Cat =
|
||||
|
||||
-- Verb
|
||||
|
||||
VP = CommonRomance.VP ;
|
||||
VP = ResRomance.VP ;
|
||||
Comp = {s : Agr => Str} ;
|
||||
SC = {s : Str} ;
|
||||
|
||||
|
||||
@@ -21,11 +21,6 @@ param
|
||||
|
||||
Mood = Indic | Conjunct ;
|
||||
|
||||
-- There are different types of clitic 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").
|
||||
@@ -160,19 +155,6 @@ oper
|
||||
|
||||
Adj = {s : AForm => Str} ;
|
||||
|
||||
VP : Type = {
|
||||
s : VPForm => {
|
||||
fin : Agr => Str ; -- ai
|
||||
inf : AAgr => Str -- dit
|
||||
} ;
|
||||
agr : VPAgr ; -- dit/dite dep. on verb, subj, and clitic
|
||||
neg : Polarity => (Str * Str) ; -- ne-pas
|
||||
clit1 : Agr => Str ; -- se
|
||||
clit2 : Str ; -- lui
|
||||
comp : Agr => Str ; -- content(e) ; à ma mère ; hier
|
||||
ext : Polarity => Str ; -- que je dors / que je dorme
|
||||
} ;
|
||||
|
||||
appVPAgr : VPAgr -> AAgr -> AAgr = \vp,agr ->
|
||||
case vp of {
|
||||
VPAgrSubj => agr ;
|
||||
|
||||
@@ -13,11 +13,11 @@ incomplete concrete ConjunctionRomance of Conjunction =
|
||||
|
||||
ConjNP conj ss = conjunctTable NPForm conj ss ** {
|
||||
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ;
|
||||
c = Clit0
|
||||
hasClit = False
|
||||
} ;
|
||||
DConjNP conj ss = conjunctDistrTable NPForm conj ss ** {
|
||||
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ;
|
||||
c = Clit0
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
ConjAP conj ss = conjunctTable AForm conj ss ** {
|
||||
|
||||
@@ -15,6 +15,11 @@ interface DiffRomance = open CommonRomance, Prelude in {
|
||||
|
||||
param Prep ;
|
||||
|
||||
-- Forms of noun phrases. Spanish and Italian have special forms for
|
||||
-- fronted clitics.
|
||||
|
||||
param NPForm ;
|
||||
|
||||
-- Which types of verbs exist, in terms of auxiliaries.
|
||||
-- (Fre, Ita "avoir", "être", and refl; Spa only "haber" and refl).
|
||||
|
||||
@@ -40,11 +45,24 @@ interface DiffRomance = open CommonRomance, Prelude in {
|
||||
|
||||
oper clitInf : Str -> Str -> Str ;
|
||||
|
||||
-- If a new clitic is placed before an existing one.
|
||||
-- (Fre "le lui", Ita "glie lo").
|
||||
|
||||
placeNewClitic :
|
||||
(Case * Number * Person) -> -- info on old clit
|
||||
Case -> -- case of new clit
|
||||
{s : NPForm => Str ; a : Agr ; hasClit : Bool} -> -- new clit
|
||||
Bool -> -- whether to clit'ze
|
||||
Str -> -- old clit
|
||||
Str ; -- old + new (or rev.)
|
||||
|
||||
|
||||
--2 Constants that must derivatively depend on language
|
||||
|
||||
dative : Case ;
|
||||
genitive : Case ;
|
||||
---- nominative : Case ;
|
||||
---- accusative : Case ;
|
||||
dative : Case ;
|
||||
genitive : Case ;
|
||||
|
||||
vRefl : VType ;
|
||||
isVRefl : VType -> Bool ;
|
||||
@@ -80,7 +98,6 @@ interface DiffRomance = open CommonRomance, Prelude in {
|
||||
|
||||
param
|
||||
Case = Nom | Acc | CPrep Prep ;
|
||||
NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr
|
||||
|
||||
oper
|
||||
Verb = {s : VF => Str ; vtyp : VType} ;
|
||||
|
||||
@@ -11,7 +11,7 @@ incomplete concrete NounRomance of Noun =
|
||||
in {
|
||||
s = \\c => det.s ! g ! npform2case c ++ cn.s ! n ;
|
||||
a = agrP3 g n ;
|
||||
c = Clit0
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
UsePN = pn2np ;
|
||||
@@ -22,7 +22,7 @@ incomplete concrete NounRomance of Noun =
|
||||
s = \\c => pred.s ! aagr (np.a.g) (np.a.n) ! npform2case c ++ --- subtype
|
||||
np.s ! case2npform pred.c ;
|
||||
a = np.a ;
|
||||
c = Clit0
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
DetSg quant ord = {
|
||||
|
||||
@@ -11,7 +11,7 @@ oper
|
||||
nominative : Case = Nom ;
|
||||
accusative : Case = Acc ;
|
||||
|
||||
Pronoun = {s : NPForm => Str ; a : Agr ; c : ClitType} ;
|
||||
Pronoun = {s : NPForm => Str ; a : Agr ; hasClit : Bool} ;
|
||||
|
||||
Compl : Type = {s : Str ; c : Case ; isDir : Bool} ;
|
||||
|
||||
@@ -22,13 +22,14 @@ oper
|
||||
pn2np : {s : Str ; g : Gender} -> Pronoun = \pn -> {
|
||||
s = \\c => prepCase (npform2case c) ++ pn.s ;
|
||||
a = agrP3 pn.g Sg ;
|
||||
c = Clit0
|
||||
hasClit = False
|
||||
} ;
|
||||
|
||||
npform2case : NPForm -> Case = \p -> case p of {
|
||||
Ton x => x ;
|
||||
Poss _ => genitive ;
|
||||
Aton x => x ;
|
||||
Poss _ => genitive
|
||||
_ => dative ---- Ita PreClit
|
||||
} ;
|
||||
|
||||
case2npform : Case -> NPForm = \c -> case c of {
|
||||
@@ -38,6 +39,20 @@ oper
|
||||
} ;
|
||||
|
||||
|
||||
VP : Type = {
|
||||
s : VPForm => {
|
||||
fin : Agr => Str ; -- ai
|
||||
inf : AAgr => Str -- dit
|
||||
} ;
|
||||
agr : VPAgr ; -- dit/dite dep. on verb, subj, and clitic
|
||||
neg : Polarity => (Str * Str) ; -- ne-pas
|
||||
clit1 : Agr => Str ; -- se lui
|
||||
clInfo : Case * Number * Person ; -- whether and what fills clit1 (Nom = none)
|
||||
clit2 : Str ; -- y en
|
||||
comp : Agr => Str ; -- content(e) ; à ma mère ; hier
|
||||
ext : Polarity => Str ; -- que je dors / que je dorme
|
||||
} ;
|
||||
|
||||
appCompl : Compl -> (NPForm => Str) -> Str = \comp,np ->
|
||||
comp.s ++ np ! Ton comp.c ;
|
||||
|
||||
@@ -62,6 +77,11 @@ oper
|
||||
inf = \\a => inf a
|
||||
} ;
|
||||
|
||||
cli : (Agr => Str) * (Case * Number * Person) = case isVRefl typ of {
|
||||
True => <\\a => reflPron ! a.n ! a.p ! Acc,<Acc,Sg,P3>> ; --- n,p
|
||||
_ => <\\_ => [], <Nom,Sg,P1>> -- not care
|
||||
} ;
|
||||
|
||||
in {
|
||||
s = table {
|
||||
VPFinite t Simul => vf (vfin t) (\_ -> []) ;
|
||||
@@ -70,34 +90,32 @@ oper
|
||||
VPInfinit Simul => vf (\_ -> []) (\_ -> vinf) ;
|
||||
VPInfinit Anter => vf (\_ -> []) (\a -> habere ++ vpart a)
|
||||
} ;
|
||||
agr = partAgr typ ;
|
||||
neg = negation ;
|
||||
clit1 = \\a => case isVRefl typ of {
|
||||
True => reflPron ! a.n ! a.p ! Acc ;
|
||||
_ => []
|
||||
} ;
|
||||
clit2 = [] ;
|
||||
comp = \\a => [] ;
|
||||
ext = \\p => []
|
||||
agr = partAgr typ ;
|
||||
neg = negation ;
|
||||
clit1 = cli.p1 ;
|
||||
clInfo = cli.p2 ;
|
||||
clit2 = [] ;
|
||||
comp = \\a => [] ;
|
||||
ext = \\p => []
|
||||
} ;
|
||||
|
||||
insertObject : Compl -> Pronoun -> VP -> VP = \c,np,vp ->
|
||||
let
|
||||
cc : Str * Str * VPAgr = case <c.isDir, c.c, np.c> of {
|
||||
cc : Bool * Str * VPAgr = case <c.isDir, c.c, np.hasClit> of {
|
||||
<False,_,_> |
|
||||
<_,_,Clit0> => <[], c.s ++ np.s ! Ton c.c, vp.agr> ;
|
||||
<_,Acc,_> => <np.s ! Aton c.c, [], vpAgrClit np.a> ;
|
||||
_ => <np.s ! Aton c.c, [], vp.agr>
|
||||
} ;
|
||||
high = case np.c of { -- whether the new clitic comes closer to verb
|
||||
Clit0 | Clit1 => False ; ---- approximation; should look at the old clit too
|
||||
_ => True
|
||||
<_,_,False> => <False, c.s ++ np.s ! Ton c.c, vp.agr> ;
|
||||
<_,Acc,_> => <True, [], vpAgrClit np.a> ;
|
||||
_ => <True, [], vp.agr>
|
||||
} ;
|
||||
in {
|
||||
s = vp.s ;
|
||||
agr = cc.p3 ;
|
||||
clit1 = vp.clit1 ; ---- just a reflexive
|
||||
clit2 = preOrPost high vp.clit2 cc.p1 ;
|
||||
clit1 = \\a => placeNewClitic vp.clInfo c.c np cc.p1 (vp.clit1 ! a) ;
|
||||
clInfo = case cc.p1 of {
|
||||
False => vp.clInfo ; -- no new clitic
|
||||
_ => <c.c, np.a.n, np.a.p>
|
||||
} ;
|
||||
clit2 = vp.clit2 ;
|
||||
neg = vp.neg ;
|
||||
comp = \\a => vp.comp ! a ++ cc.p2 ;
|
||||
ext = vp.ext ;
|
||||
@@ -107,6 +125,7 @@ oper
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clit1 = vp.clit1 ;
|
||||
clInfo = vp.clInfo ;
|
||||
clit2 = vp.clit2 ;
|
||||
neg = vp.neg ;
|
||||
comp = \\a => vp.comp ! a ++ co ! a ;
|
||||
@@ -116,6 +135,7 @@ oper
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clit1 = vp.clit1 ;
|
||||
clInfo = vp.clInfo ;
|
||||
clit2 = vp.clit2 ;
|
||||
neg = vp.neg ;
|
||||
comp = \\a => vp.comp ! a ++ co ;
|
||||
@@ -125,6 +145,7 @@ oper
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clit1 = vp.clit1 ;
|
||||
clInfo = vp.clInfo ;
|
||||
clit2 = vp.clit2 ;
|
||||
neg = vp.neg ;
|
||||
comp = vp.comp ;
|
||||
|
||||
Reference in New Issue
Block a user