mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-11 13:59:31 -06:00
fine-tuning Romance for efficiency
This commit is contained in:
@@ -63,7 +63,28 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in {
|
||||
vpAgrClit : Agr -> VPAgr = \a ->
|
||||
VPAgrClit (aagr a.g a.n) ; --- subty
|
||||
|
||||
pronArg = pronArgGen Neg ;
|
||||
---- pronArg = pronArgGen Neg ; --- takes more space and time
|
||||
|
||||
pronArg : Number -> Person -> CAgr -> CAgr -> Str * Str = \n,p,acc,dat ->
|
||||
let
|
||||
pacc = case acc of {
|
||||
CRefl => case p of {
|
||||
P3 => elision "s" ; --- use of reflPron incred. expensive
|
||||
_ => argPron Fem n p Acc
|
||||
} ;
|
||||
CPron a => argPron a.g a.n a.p Acc ;
|
||||
_ => []
|
||||
} ;
|
||||
pdat = case dat of {
|
||||
CPron a => argPron a.g a.n a.p dative ;
|
||||
_ => []
|
||||
} ;
|
||||
in
|
||||
case dat of {
|
||||
CPron {p = P3} => <pacc ++ pdat,[]> ;
|
||||
_ => <pdat ++ pacc, []>
|
||||
} ;
|
||||
|
||||
|
||||
-- Positive polarity is used in the imperative: stressed for 1st and
|
||||
-- 2nd persons.
|
||||
@@ -99,11 +120,11 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in {
|
||||
verb = (vp.s ! VPImperat).fin ! agr ;
|
||||
neg = vp.neg ! pol ;
|
||||
clpr = pronArgGen pol agr.n agr.p vp.clAcc vp.clDat ;
|
||||
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
compl = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
in
|
||||
case pol of {
|
||||
Pos => verb ++ clpr.p1 ++ compl ;
|
||||
Neg => neg.p1 ++ clpr.p1 ++ verb ++ neg.p2 ++ compl
|
||||
Neg => neg.p1 ++ clpr.p1 ++ verb ++ compl
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
|
||||
instance ResFre of ResRomance = DiffFre ** open CommonRomance, Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
flags optimize=noexpand ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -111,7 +111,7 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud
|
||||
} ;
|
||||
neg = vp.neg ! pol ;
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
compl = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
in
|
||||
neg.p1 ++ verb ++ clpr.p1 ++ compl ;
|
||||
} ;
|
||||
|
||||
@@ -85,7 +85,7 @@ lin
|
||||
Pl => \\g,c => prepCase c ++ genForms "quelli" "quelle" ! g ---- quegli
|
||||
}
|
||||
} ;
|
||||
that_NP = mkNP ["questo"] Masc Sg ;
|
||||
that_NP = mkNP ["quello"] Masc Sg ;
|
||||
there7from_Adv = ss ["di là"] ;
|
||||
there7to_Adv = ss "là" ; --- ci
|
||||
there_Adv = ss "là" ;
|
||||
|
||||
@@ -30,7 +30,7 @@ incomplete concrete CatRomance of Cat =
|
||||
|
||||
-- Relative
|
||||
|
||||
RCl = {s : Tense => Anteriority => Polarity => Mood => Agr => Str} ;
|
||||
RCl = {s : Agr => Tense => Anteriority => Polarity => Mood => Str} ;
|
||||
RP = {s : Bool => AAgr => Case => Str ; a : RAgr} ;
|
||||
|
||||
-- Verb
|
||||
|
||||
@@ -6,29 +6,28 @@ incomplete concrete RelativeRomance of Relative =
|
||||
lin
|
||||
|
||||
RelCl cl = {
|
||||
s = \\t,a,p,m,ag => pronSuch ! ag ++ conjThat ++ cl.s ! t ! a ! p ! m
|
||||
s = \\ag,t,a,p,m => pronSuch ! ag ++ conjThat ++ cl.s ! t ! a ! p ! m
|
||||
} ;
|
||||
|
||||
RelVP rp vp = {
|
||||
s = \\t,ant,b,m,ag =>
|
||||
let
|
||||
agr = case rp.a of {
|
||||
RNoAg => ag ;
|
||||
RAg a => a ** {p = P3}
|
||||
} ;
|
||||
cl = mkClause (rp.s ! False ! {g = ag.g ; n = ag.n} ! Nom) agr vp
|
||||
in
|
||||
cl.s ! t ! ant ! b ! m
|
||||
s = \\ag =>
|
||||
(mkClause
|
||||
(rp.s ! False ! {g = ag.g ; n = ag.n} ! Nom)
|
||||
(
|
||||
case rp.a of {
|
||||
RNoAg => ag ;
|
||||
RAg a => a ** {p = P3}
|
||||
}) vp).s
|
||||
} ;
|
||||
|
||||
RelSlash rp slash = {
|
||||
s = \\t,a,p,m,ag =>
|
||||
s = \\ag,t,a,p,m =>
|
||||
slash.c2.s ++ rp.s ! False ! ag ! slash.c2.c ++ slash.s ! t ! a ! p ! m
|
||||
} ;
|
||||
|
||||
FunRP p np rp = {
|
||||
s = \\_,a,c => np.s ! Ton Nom ++ p.s ++ rp.s ! True ! a ! p.c ;
|
||||
a = RAg np.a
|
||||
a = RAg {g = np.a.g ; n = np.a.n}
|
||||
} ;
|
||||
IdRP = {
|
||||
s = relPron ;
|
||||
|
||||
@@ -145,6 +145,17 @@ oper
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
insertAdV : Str -> VP -> VP = \co,vp -> {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clAcc = vp.clAcc ;
|
||||
clDat = vp.clDat ;
|
||||
clit2 = vp.clit2 ;
|
||||
neg = \\b => let vpn = vp.neg ! b in {p1 = vpn.p1 ; p2 = vpn.p2 ++ co} ;
|
||||
comp = vp.comp ;
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
insertClit2 : Str -> VP -> VP = \co,vp -> {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
@@ -193,7 +204,7 @@ oper
|
||||
inf = (vp.s ! VPInfinit Simul).inf ! (aagr agr.g agr.n) ;
|
||||
neg = vp.neg ! Pos ; --- Neg not in API
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
obj = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! Pos ---- pol
|
||||
obj = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! Pos ---- pol
|
||||
in
|
||||
clitInf (clpr.p1 ++ vp.clit2) inf ++ obj ;
|
||||
|
||||
|
||||
@@ -36,6 +36,6 @@ incomplete concrete SentenceRomance of Sentence =
|
||||
UseCl t a p cl = {s = \\o => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! o} ;
|
||||
UseQCl t a p cl = {s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q} ;
|
||||
UseRCl t a p cl =
|
||||
{s = \\r,ag => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r ! ag} ;
|
||||
{s = \\r,ag => t.s ++ a.s ++ p.s ++ cl.s ! ag ! t.t ! a.a ! p.p ! r} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ incomplete concrete VerbRomance of Verb =
|
||||
CompAdv a = {s = \\_ => a.s} ;
|
||||
|
||||
AdvVP vp adv = insertAdv adv.s vp ;
|
||||
AdVVP adv vp = insertAdv adv.s vp ;
|
||||
AdVVP adv vp = insertAdV adv.s vp ;
|
||||
|
||||
ReflV2 v = case v.c2.isDir of {
|
||||
True => predV {s = v.s ; vtyp = vRefl} ;
|
||||
|
||||
@@ -84,7 +84,7 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud
|
||||
} ;
|
||||
neg = vp.neg ! pol ;
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
compl = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
in
|
||||
neg.p1 ++ verb ++ clpr.p1 ++ compl ;
|
||||
} ;
|
||||
|
||||
Reference in New Issue
Block a user