mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Romance clitics almost OK ; bug fix in tb -c
This commit is contained in:
@@ -4,6 +4,7 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in {
|
||||
|
||||
param
|
||||
Prep = P_de | P_a ;
|
||||
NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr
|
||||
VType = VHabere | VEsse | VRefl ;
|
||||
|
||||
oper
|
||||
@@ -56,6 +57,14 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in {
|
||||
vpAgrClit : Agr -> VPAgr = \a ->
|
||||
VPAgrClit (aagr a.g a.n) ; --- subty
|
||||
|
||||
placeNewClitic = \ci,c,pro,isc,old ->
|
||||
let new = if_then_Str isc (pro.s ! Aton c) []
|
||||
in
|
||||
case pro.a.p of {
|
||||
P1 | P2 => new ++ old ;
|
||||
_ => old ++ new
|
||||
} ;
|
||||
|
||||
negation : Polarity => (Str * Str) = table {
|
||||
Pos => <[],[]> ;
|
||||
Neg => <elisNe,"pas">
|
||||
|
||||
@@ -161,8 +161,8 @@ oper
|
||||
-- The use of "en" as atonic genitive is debatable.
|
||||
|
||||
mkPronoun : (_,_,_,_,_,_,_ : Str) ->
|
||||
Gender -> Number -> Person -> ClitType -> Pronoun =
|
||||
\il,le,lui,Lui,son,sa,ses,g,n,p,c ->
|
||||
Gender -> Number -> Person -> Pronoun =
|
||||
\il,le,lui,Lui,son,sa,ses,g,n,p ->
|
||||
{s = table {
|
||||
Ton x => prepCase x ++ Lui ;
|
||||
Aton Nom => il ;
|
||||
@@ -174,128 +174,13 @@ oper
|
||||
Poss {n = Pl} => ses
|
||||
} ;
|
||||
a = {g = g ; n = n ; p = p} ;
|
||||
c = c
|
||||
hasClit = True
|
||||
} ;
|
||||
|
||||
elisPoss : Str -> Str = \s ->
|
||||
pre {s + "a" ; s + "on" / voyelle} ;
|
||||
{-
|
||||
pronJe = mkPronoun
|
||||
(elision "j")
|
||||
(elision "m")
|
||||
(elision "m")
|
||||
"moi"
|
||||
"mon" (elisPoss "m") "mes"
|
||||
PNoGen -- gender cannot be known from pronoun alone
|
||||
Sg
|
||||
P1
|
||||
Clit1 ;
|
||||
|
||||
pronTu = mkPronoun
|
||||
"tu"
|
||||
(elision "t")
|
||||
(elision "t")
|
||||
"toi"
|
||||
"ton" (elisPoss "t") "tes"
|
||||
PNoGen
|
||||
Sg
|
||||
P2
|
||||
Clit1 ;
|
||||
|
||||
pronIl = mkPronoun
|
||||
"il"
|
||||
(elision "l")
|
||||
"lui"
|
||||
"lui"
|
||||
"son" (elisPoss "s") "ses"
|
||||
(PGen Masc)
|
||||
Sg
|
||||
P3
|
||||
Clit2 ;
|
||||
|
||||
---- A hack to get the dative form "y".
|
||||
pronY = mkPronoun
|
||||
"il"
|
||||
(elision "l")
|
||||
"y"
|
||||
"lui"
|
||||
"en" "en" "en"
|
||||
(PGen Masc)
|
||||
Sg
|
||||
P3
|
||||
Clit2 ;
|
||||
|
||||
pronElle = mkPronoun
|
||||
"elle"
|
||||
elisLa
|
||||
"lui"
|
||||
"elle"
|
||||
"son" (elisPoss "s") "ses"
|
||||
(PGen Fem)
|
||||
Sg
|
||||
P3
|
||||
Clit2 ;
|
||||
|
||||
pronNous = mkPronoun
|
||||
"nous"
|
||||
"nous"
|
||||
"nous"
|
||||
"nous"
|
||||
"notre" "notre" "nos"
|
||||
PNoGen
|
||||
Pl
|
||||
P1
|
||||
Clit3 ;
|
||||
|
||||
pronVous = mkPronoun
|
||||
"vous"
|
||||
"vous"
|
||||
"vous"
|
||||
"vous"
|
||||
"votre" "votre" "vos"
|
||||
PNoGen
|
||||
Pl --- depends!
|
||||
P2
|
||||
Clit3 ;
|
||||
|
||||
pronIls = mkPronoun
|
||||
"ils"
|
||||
"les"
|
||||
"leur"
|
||||
"eux"
|
||||
"leur" "leur" "leurs"
|
||||
(PGen Masc)
|
||||
Pl
|
||||
P3
|
||||
Clit1 ;
|
||||
|
||||
pronElles = mkPronoun
|
||||
"elles"
|
||||
"les"
|
||||
"leur"
|
||||
"elles"
|
||||
"leur" "leur" "leurs"
|
||||
(PGen Fem)
|
||||
Pl
|
||||
P3
|
||||
Clit1 ;
|
||||
|
||||
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
|
||||
}
|
||||
} ;
|
||||
-}
|
||||
--2 Determiners
|
||||
--
|
||||
-- Determiners, traditionally called indefinite pronouns, are inflected
|
||||
|
||||
@@ -167,10 +167,6 @@ oper
|
||||
|
||||
compADeg : A -> A ;
|
||||
|
||||
-- From a given $A$, it is possible to get back to $A$.
|
||||
|
||||
adegA : A -> A ;
|
||||
|
||||
-- For prefixed adjectives, the following function is
|
||||
-- provided.
|
||||
|
||||
@@ -259,7 +255,6 @@ oper
|
||||
mkV2Q : V -> Preposition -> V2Q ;
|
||||
|
||||
mkAS : A -> AS ;
|
||||
subjAS : A -> AS ;
|
||||
mkA2S : A -> Preposition -> A2S ;
|
||||
mkAV : A -> Preposition -> AV ;
|
||||
mkA2V : A -> Preposition -> Preposition -> A2V ;
|
||||
@@ -301,7 +296,7 @@ oper
|
||||
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ;
|
||||
|
||||
mkPN x g = {s = x ; g = g} ** {lock_PN = <>} ;
|
||||
mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; c = Clit0} ** {lock_NP = <>} ;
|
||||
mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; hasClit = False} ** {lock_NP = <>} ;
|
||||
|
||||
mkA a b c d = compADeg {s = \\_ => (mkAdj a c b d).s ; isPre = False ; lock_A = <>} ;
|
||||
regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ; lock_A = <>} ;
|
||||
|
||||
@@ -36,7 +36,7 @@ lin
|
||||
he_Pron =
|
||||
mkPronoun
|
||||
"il" (elision "l") "lui" "lui" "son" (elisPoss "s") "ses"
|
||||
Masc Sg P3 Clit2 ;
|
||||
Masc Sg P3 ;
|
||||
here7from_Adv = ss "d'ici" ;
|
||||
here7to_Adv = ss "ici" ;
|
||||
here_Adv = ss "ici" ;
|
||||
@@ -47,12 +47,12 @@ lin
|
||||
i_Pron =
|
||||
mkPronoun
|
||||
(elision "j") (elision "m") (elision "m") "moi" "mon" (elisPoss "m") "mes"
|
||||
Fem Sg P1 Clit1 ;
|
||||
Fem Sg P1 ;
|
||||
in_Prep = mkPreposition "dans" ;
|
||||
it_Pron =
|
||||
mkPronoun
|
||||
"il" (elision "l") "lui" "lui" "son" (elisPoss "s") "ses"
|
||||
Masc Sg P3 Clit2 ;
|
||||
Masc Sg P3 ;
|
||||
less_CAdv = ss "moins" ;
|
||||
many_Det = {s = \\_,c => prepCase c ++ "plusieurs" ; n = Pl} ;
|
||||
more_CAdv = ss "plus" ;
|
||||
@@ -72,7 +72,7 @@ lin
|
||||
she_Pron =
|
||||
mkPronoun
|
||||
"elle" elisLa "lui" "elle" "son" (elisPoss "s") "ses"
|
||||
Fem Sg P3 Clit2 ;
|
||||
Fem Sg P3 ;
|
||||
|
||||
so_AdA = ss "si" ;
|
||||
somebody_NP = pn2np (mkPN ["quelqu'un"] Masc) ;
|
||||
@@ -94,7 +94,7 @@ lin
|
||||
these_NP = mkNP ["celles-ci"] Fem Pl ;
|
||||
they_Pron = mkPronoun
|
||||
"elles" "les" "leur" "eux" "leur" "leur" "leurs"
|
||||
Fem Pl P3 Clit1 ;
|
||||
Fem Pl P3 ;
|
||||
this_Quant = {s =
|
||||
table {
|
||||
Sg => \\g,c => prepCase c ++ genForms "ce" "cette" ! g ; ---- cet ; ci
|
||||
@@ -111,7 +111,7 @@ lin
|
||||
want_VV = mkVV (vouloir_V2 ** {lock_V = <>}) ;
|
||||
we_Pron =
|
||||
mkPronoun "nous" "nous" "nous" "nous" "notre" "notre" "nos"
|
||||
Fem Pl P1 Clit3 ;
|
||||
Fem Pl P1 ;
|
||||
whatSg_IP = {s = \\c => prepCase c ++ "quoi" ; a = aagr Fem Sg} ;
|
||||
whatPl_IP = {s = \\c => prepCase c ++ "quoi" ; a = aagr Fem Pl} ;
|
||||
when_IAdv = ss "quand" ;
|
||||
@@ -127,11 +127,11 @@ lin
|
||||
yes_Phr = ss "oui" ; --- si
|
||||
youSg_Pron = mkPronoun
|
||||
"tu" (elision "t") (elision "t") "toi" "ton" (elisPoss "t") "tes"
|
||||
Fem Sg P2 Clit1 ;
|
||||
Fem Sg P2 ;
|
||||
youPl_Pron, youPol_Pron =
|
||||
mkPronoun
|
||||
"vous" "vous" "vous" "vous" "votre" "votre" "vos"
|
||||
Fem Pl P2 Clit3 ;
|
||||
Fem Pl P2 ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud
|
||||
|
||||
param
|
||||
Prep = P_di | P_a | P_da | P_in | P_su | P_con ;
|
||||
NPForm = Ton Case | Aton Case | PreClit | Poss {g : Gender ; n : Number} ; --- AAgr
|
||||
VType = VHabere | VEsse | VRefl ;
|
||||
|
||||
oper
|
||||
@@ -76,6 +77,15 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud
|
||||
vpAgrClit : Agr -> VPAgr = \a ->
|
||||
vpAgrNone ;
|
||||
|
||||
--- This assumes that Acc clitics are in place before Dat.
|
||||
|
||||
placeNewClitic = \ci,c,pro,isc,old ->
|
||||
case <ci.p1,c,isc> of {
|
||||
<Acc,CPrep P_a, True> => pro.s ! PreClit ++ old ; -- there is an old clitic
|
||||
{p3 = True} => pro.s ! Aton c ; -- no old but a new
|
||||
_ => [] -- no clitics
|
||||
} ;
|
||||
|
||||
negation : Polarity => (Str * Str) = table {
|
||||
Pos => <[],[]> ;
|
||||
Neg => <"non",[]>
|
||||
|
||||
@@ -132,9 +132,9 @@ oper
|
||||
-- The use of "ne" as atonic genitive is debatable.
|
||||
-- We follow the rule that the atonic nominative is empty.
|
||||
|
||||
mkPronoun : (_,_,_,_,_,_,_,_ : Str) ->
|
||||
Gender -> Number -> Person -> ClitType -> Pronoun =
|
||||
\il,le,lui,Lui,son,sa,ses,see,g,n,p,c ->
|
||||
mkPronoun : (_,_,_,_,_,_,_,_,_ : Str) ->
|
||||
Gender -> Number -> Person -> Pronoun =
|
||||
\il,le,lui,glie,Lui,son,sa,ses,see,g,n,p ->
|
||||
{s = table {
|
||||
Ton Nom => il ;
|
||||
Ton x => prepCase x ++ Lui ;
|
||||
@@ -142,14 +142,15 @@ oper
|
||||
Aton Acc => le ;
|
||||
Aton (CPrep P_di) => "ne" ; --- hmm
|
||||
Aton (CPrep P_a) => lui ;
|
||||
Aton q => prepCase q ++ Lui ; ---- GF bug with c or p!
|
||||
Aton q => prepCase q ++ Lui ; ---- GF bug with c or p!
|
||||
PreClit => glie ;
|
||||
Poss {n = Sg ; g = Masc} => son ;
|
||||
Poss {n = Sg ; g = Fem} => sa ;
|
||||
Poss {n = Pl ; g = Masc} => ses ;
|
||||
Poss {n = Pl ; g = Fem} => see
|
||||
} ;
|
||||
a = {g = g ; n = n ; p = p} ;
|
||||
c = c
|
||||
hasClit = True
|
||||
} ;
|
||||
|
||||
--2 Determiners
|
||||
|
||||
@@ -299,7 +299,7 @@ oper
|
||||
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ;
|
||||
|
||||
mkPN x g = {s = x ; g = g} ** {lock_PN = <>} ;
|
||||
mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; c = Clit0} ** {lock_NP = <>} ;
|
||||
mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; hasClit = False} ** {lock_NP = <>} ;
|
||||
|
||||
mkA a b c d e =
|
||||
compADeg {s = \\_ => (mkAdj a b c d e).s ; isPre = False ; lock_A = <>} ;
|
||||
|
||||
@@ -35,8 +35,8 @@ lin
|
||||
from_Prep = complGen ; ---
|
||||
he_Pron =
|
||||
mkPronoun
|
||||
"lui" "lo" "gli" "lui" "suo" "sua" "suoi" "sue"
|
||||
Masc Sg P3 Clit2 ;
|
||||
"lui" "lo" "gli" "glie" "lui" "suo" "sua" "suoi" "sue"
|
||||
Masc Sg P3 ;
|
||||
here7from_Adv = ss ["da quì"] ;
|
||||
here7to_Adv = ss "quì" ;
|
||||
here_Adv = ss "quì" ;
|
||||
@@ -46,13 +46,13 @@ lin
|
||||
in8front_Prep = mkPreposition "davanti" ;
|
||||
i_Pron =
|
||||
mkPronoun
|
||||
"io" "mi" "mi" "me" "mio" "mia" "miei" "mie"
|
||||
Fem Sg P1 Clit1 ;
|
||||
"io" "mi" "mi" "me" "me" "mio" "mia" "miei" "mie"
|
||||
Fem Sg P1 ;
|
||||
in_Prep = {s = [] ; c = CPrep P_in} ;
|
||||
it_Pron =
|
||||
mkPronoun
|
||||
"lui" "lo" "gli" "lui" "suo" "sua" "suoi" "sue"
|
||||
Masc Sg P3 Clit2 ;
|
||||
"lui" "lo" "gli" "glie" "lui" "suo" "sua" "suoi" "sue"
|
||||
Masc Sg P3 ;
|
||||
less_CAdv = ss "meno" ;
|
||||
many_Det = {s = \\g,c => prepCase c ++ genForms "molti" "molte" ! g ; n = Pl} ;
|
||||
more_CAdv = ss "più" ;
|
||||
@@ -71,8 +71,8 @@ lin
|
||||
quite_Adv = ss "assai" ;
|
||||
she_Pron =
|
||||
mkPronoun
|
||||
"lei" "la" "le" "lei" "suo" "sua" "suoi" "sue"
|
||||
Fem Sg P3 Clit2 ;
|
||||
"lei" "la" "le" "glie" "lei" "suo" "sua" "suoi" "sue"
|
||||
Fem Sg P3 ;
|
||||
so_AdA = ss "così" ;
|
||||
somebody_NP = pn2np (mkPN ["qualcuno"] Masc) ;
|
||||
somePl_Det = {s = \\_,c => prepCase c ++ "qualche" ; n = Pl} ;
|
||||
@@ -92,8 +92,8 @@ lin
|
||||
therefore_PConj = ss "quindi" ;
|
||||
these_NP = mkNP ["queste"] Fem Pl ;
|
||||
they_Pron = mkPronoun
|
||||
"loro" "loro" "li" "loro" "loro" "loro" "loro" "loro"
|
||||
Fem Pl P3 Clit1 ;
|
||||
"loro" "loro" "li" "glie" "loro" "loro" "loro" "loro" "loro"
|
||||
Fem Pl P3 ;
|
||||
this_Quant = {
|
||||
s = table {
|
||||
Sg => \\g,c => prepCase c ++ genForms "questo" "questa" ! g ;
|
||||
@@ -109,8 +109,8 @@ lin
|
||||
very_AdA = ss "molto" ;
|
||||
want_VV = mkVV (verboV (volere_96 "volere")) ;
|
||||
we_Pron =
|
||||
mkPronoun "noi" "ci" "ci" "noi" "nostro" "nostra" "nostri" "nostre"
|
||||
Fem Pl P1 Clit3 ;
|
||||
mkPronoun "noi" "ci" "ci" "ce" "noi" "nostro" "nostra" "nostri" "nostre"
|
||||
Fem Pl P1 ;
|
||||
whatSg_IP = {s = \\c => prepCase c ++ ["che cosa"] ; a = aagr Fem Sg} ;
|
||||
whatPl_IP = {s = \\c => prepCase c ++ ["che cose"] ; a = aagr Fem Pl} ; ---
|
||||
when_IAdv = ss "quando" ;
|
||||
@@ -125,16 +125,16 @@ lin
|
||||
with_Prep = {s = [] ; c = CPrep P_con} ;
|
||||
yes_Phr = ss "sì" ;
|
||||
youSg_Pron = mkPronoun
|
||||
"tu" "ti" "ti" "te" "tuo" "tua" "tuoi" "tue"
|
||||
Fem Sg P2 Clit1 ;
|
||||
"tu" "ti" "ti" "te" "te" "tuo" "tua" "tuoi" "tue"
|
||||
Fem Sg P2 ;
|
||||
youPl_Pron =
|
||||
mkPronoun
|
||||
"voi" "vi" "vi" "voi" "vostro" "vostra" "vostri" "vostre"
|
||||
Fem Pl P2 Clit3 ;
|
||||
"voi" "vi" "vi" "ve" "voi" "vostro" "vostra" "vostri" "vostre"
|
||||
Fem Pl P2 ;
|
||||
youPol_Pron =
|
||||
mkPronoun
|
||||
"Lei" "La" "Le" "Lei" "Suo" "Sua" "Suoi" "Sue"
|
||||
Fem Sg P3 Clit2 ;
|
||||
"Lei" "La" "Le" "Glie" "Lei" "Suo" "Sua" "Suoi" "Sue"
|
||||
Fem Sg P3 ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
@@ -4,6 +4,7 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud
|
||||
|
||||
param
|
||||
Prep = P_de | P_a ;
|
||||
NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr
|
||||
VType = VHabere | VRefl ;
|
||||
|
||||
oper
|
||||
@@ -51,6 +52,26 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud
|
||||
vpAgrClit : Agr -> VPAgr = \a ->
|
||||
vpAgrNone ;
|
||||
|
||||
--- This assumes that Acc clitics are in place before Dat.
|
||||
|
||||
placeNewClitic = \ci,c,pro,isc,old ->
|
||||
if_then_Str isc (
|
||||
case <ci.p3, pro.a.p> of {
|
||||
<P2,P1> => old ++ pro.s ! Aton c ; -- te me, ---se me
|
||||
<P3,P3> => "se" ++ old ; -- se lo
|
||||
_ => pro.s ! Aton c ++ old -- indirect first
|
||||
}) [] ; -- no clitics
|
||||
|
||||
{-
|
||||
placeNewClitic = \ci,c,pro,isc,old ->
|
||||
case <ci.p1, ci.p2, ci.p3, pro.a.p, isc> of {
|
||||
<Acc, Sg, P2, P1, True> => old ++ pro.s ! Aton c ; -- te me, ---se me
|
||||
<Acc, _, P3, P3, True> => "se" ++ old ; -- se lo
|
||||
{p5 = True} => pro.s ! Aton c ++ old ; -- indirect first
|
||||
_ => [] -- no clitics
|
||||
} ;
|
||||
-}
|
||||
|
||||
negation : Polarity => (Str * Str) = table {
|
||||
Pos => <[],[]> ;
|
||||
Neg => <"no",[]>
|
||||
|
||||
@@ -92,8 +92,8 @@ oper
|
||||
-- We follow the rule that the atonic nominative is empty.
|
||||
|
||||
mkPronoun : (_,_,_,_,_,_,_,_ : Str) ->
|
||||
Gender -> Number -> Person -> ClitType -> Pronoun =
|
||||
\il,le,lui,Lui,son,sa,ses,see,g,n,p,c ->
|
||||
Gender -> Number -> Person -> Pronoun =
|
||||
\il,le,lui,Lui,son,sa,ses,see,g,n,p ->
|
||||
{s = table {
|
||||
Ton Nom => il ;
|
||||
Ton x => prepCase x ++ Lui ;
|
||||
@@ -107,35 +107,8 @@ oper
|
||||
Poss {n = Pl ; g = Fem} => see
|
||||
} ;
|
||||
a = {g = g ; n = n ; p = p} ;
|
||||
c = c
|
||||
hasClit = True
|
||||
} ;
|
||||
{-
|
||||
-- used in constructions like "(no) hay ..."
|
||||
|
||||
pronEmpty : Number -> Pronoun = \n -> mkPronoun
|
||||
[]
|
||||
[]
|
||||
[]
|
||||
[]
|
||||
[] [] [] []
|
||||
(PGen Masc)
|
||||
n
|
||||
P3
|
||||
Clit2 ;
|
||||
|
||||
--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> => "me" ;
|
||||
<Sg,P2> => "te" ;
|
||||
<_, P3> => "se" ;
|
||||
<Pl,P1> => "nos" ;
|
||||
<Pl,P2> => "vos"
|
||||
} ;
|
||||
|
||||
-}
|
||||
|
||||
|
||||
--2 Determiners
|
||||
|
||||
@@ -302,7 +302,7 @@ oper
|
||||
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ;
|
||||
|
||||
mkPN x g = {s = x ; g = g} ** {lock_PN = <>} ;
|
||||
mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; c = Clit0} ** {lock_NP = <>} ;
|
||||
mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; hasClit = False} ** {lock_NP = <>} ;
|
||||
|
||||
mkA a b c d e =
|
||||
compADeg {s = \\_ => (mkAdj a b c d e).s ; isPre = False ; lock_A = <>} ;
|
||||
|
||||
@@ -37,7 +37,7 @@ lin
|
||||
mkPronoun
|
||||
"el" "lo" "le" "él"
|
||||
"su" "su" "sus" "sus"
|
||||
Masc Sg P3 Clit2 ;
|
||||
Masc Sg P3 ;
|
||||
here_Adv = mkAdv "aquí" ; -- acá
|
||||
here7to_Adv = mkAdv ["para acá"] ;
|
||||
here7from_Adv = mkAdv ["de acá"] ;
|
||||
@@ -50,13 +50,13 @@ lin
|
||||
mkPronoun
|
||||
"yo" "me" "me" "mí"
|
||||
"mi" "mi" "mis" "mis"
|
||||
Fem Sg P1 Clit1 ;
|
||||
Fem Sg P1 ;
|
||||
in_Prep = mkPreposition "en" ;
|
||||
it_Pron =
|
||||
mkPronoun
|
||||
"el" "lo" "le" "él"
|
||||
"su" "su" "sus" "sus"
|
||||
Masc Sg P3 Clit2 ;
|
||||
Masc Sg P3 ;
|
||||
less_CAdv = ss "meno" ; ----
|
||||
many_Det = {s = \\g,c => prepCase c ++ genForms "muchos" "muchas" ! g ; n = Pl} ;
|
||||
more_CAdv = ss "mas" ;
|
||||
@@ -77,7 +77,7 @@ lin
|
||||
mkPronoun
|
||||
"ella" "la" "le" "ella"
|
||||
"su" "su" "sus" "sus"
|
||||
Fem Sg P3 Clit2 ;
|
||||
Fem Sg P3 ;
|
||||
so_AdA = ss "tanto" ;
|
||||
somebody_NP = pn2np (mkPN ["algún"] Masc) ;
|
||||
somePl_Det = {s = \\g,c => prepCase c ++ genForms "algunos" "algunas" ! g ; n = Pl} ;
|
||||
@@ -99,7 +99,7 @@ lin
|
||||
they_Pron = mkPronoun
|
||||
"ellas" "las" "les" "ellas"
|
||||
"su" "su" "sus" "sus"
|
||||
Fem Pl P3 Clit1 ;
|
||||
Fem Pl P3 ;
|
||||
this_Quant = {
|
||||
s = table {
|
||||
Sg => \\g,c => prepCase c ++ genForms "este" "esta" ! g ;
|
||||
@@ -118,7 +118,7 @@ lin
|
||||
mkPronoun
|
||||
"nosotras" "nos" "nos" "nosotras"
|
||||
"nuestro" "nuestra" "nuestros" "nuestras"
|
||||
Fem Pl P1 Clit3 ;
|
||||
Fem Pl P1 ;
|
||||
whatSg_IP = {s = \\c => prepCase c ++ ["qué"] ; a = aagr Masc Sg} ;
|
||||
whatPl_IP = {s = \\c => prepCase c ++ ["qué"] ; a = aagr Masc Pl} ; ---
|
||||
when_IAdv = ss "cuando" ;
|
||||
@@ -135,17 +135,17 @@ lin
|
||||
youSg_Pron = mkPronoun
|
||||
"tu" "te" "te" "tí"
|
||||
"tu" "tu" "tus" "tus"
|
||||
Fem Sg P2 Clit1 ;
|
||||
Fem Sg P2 ;
|
||||
youPl_Pron =
|
||||
mkPronoun
|
||||
"vosotras" "vos" "vos" "vosotras"
|
||||
"vuestro" "vuestra" "vuestros" "vuestras"
|
||||
Fem Pl P2 Clit3 ;
|
||||
Fem Pl P2 ;
|
||||
youPol_Pron =
|
||||
mkPronoun
|
||||
"usted" "la" "le" "usted"
|
||||
"su" "su" "sus" "sus"
|
||||
Fem Pl P2 Clit3 ;
|
||||
Fem Pl P2 ;
|
||||
|
||||
oper
|
||||
etConj : {s : Str ; n : Number} = {s = pre {
|
||||
|
||||
@@ -49,15 +49,16 @@ mkTreebank opts sh com trees = putInXML opts "treebank" comm (concatMap mkItem t
|
||||
tris = zip trees [1..]
|
||||
|
||||
testTreebank :: Options -> ShellState -> String -> Res
|
||||
testTreebank opts sh = putInXML opts "diff" [] . concatMap testOne . getTreebank . lines
|
||||
testTreebank opts sh = putInXML opts "testtreebank" [] . concatMap testOne . getTreebank . lines
|
||||
where
|
||||
testOne (e,lang,str) = do
|
||||
testOne (e,lang,str0) = do
|
||||
let tr = annot gr e
|
||||
let str0 = linearize sh lang tr
|
||||
if str == str0 then ret else putInXML opts "diff" [] $ do
|
||||
putInXML opts "tree" [] (puts $ showTree tr)
|
||||
putInXML opts "old" (" lang=" ++ show (prt_ (zIdent lang))) $ puts str0
|
||||
let str = linearize sh lang tr
|
||||
if str == str0 then ret else putInXML opts "diff" [] $ concat [
|
||||
putInXML opts "tree" [] (puts $ showTree tr),
|
||||
putInXML opts "old" (" lang=" ++ show (prt_ (zIdent lang))) $ puts str0,
|
||||
putInXML opts "new" (" lang=" ++ show (prt_ (zIdent lang))) $ puts str
|
||||
]
|
||||
gr = firstStateGrammar sh
|
||||
|
||||
-- string vs. IO
|
||||
|
||||
Reference in New Issue
Block a user