worked with Scandinavian VP to get the word order with neg+pron right: jag älskar inte din mamma vs. jag älskar dig inte vs. jag har inte älskat dig

This commit is contained in:
aarne
2016-03-30 18:47:14 +00:00
parent 9f7593734a
commit fc9202a6cb
18 changed files with 164 additions and 116 deletions

View File

@@ -41,11 +41,14 @@ incomplete concrete CatScand of Cat =
VP = {
s : Voice => VPForm => {
fin : Str ; -- V1 har ---s1
inf : Str -- V2 sagt ---s4
inf : Str ; -- V2 sagt ---s4
a1 : Polarity => Agr => Str * Str ; -- A1 inte ---s3 själv/själva/självt
-- p1: with infinite "jag har inte älskat dig",
-- p2: without infinite "jag älskar dig inte"
} ;
sp : PartForm => Str ;
a1 : Polarity => Agr => Str ; -- A1 inte ---s3
n2 : Agr => Str ; -- N2 dig ---s5
n1 : Agr => Str ; -- N2 dig ---s5
n2 : Agr => Str ; -- N2 den där mannen ---s5
a2 : Str ; -- A2 idag ---s6
ext : Str ; -- S-Ext att hon går ---s7
en2,ea2,eext : Bool -- indicate if the field exists
@@ -69,7 +72,8 @@ incomplete concrete CatScand of Cat =
-- as $Quant$.
CN = {s : Number => DetSpecies => Case => Str ; g : NGender ; isMod : Bool} ;
NP,Pron = {s : NPForm => Str ; a : Agr} ;
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool} ;
Pron = {s : NPForm => Str ; a : Agr} ;
Det = {s,sp : Bool => NGender => Str ; n : Number ; det : DetSpecies} ;
Quant = {s,sp : Number => Bool => Bool => NGender => Str ; det : DetSpecies} ;
Predet = {s : Gender => Number => Str ; p : Str ; a : PredetAgr} ;

View File

@@ -145,7 +145,7 @@ oper
} ;
-- Used in $DiffScand.predV$.
-- Used in $ResScand.predV$.
vFin : STense -> Voice -> VForm = \t,v -> case t of {
SPres => VF (VPres v)
@@ -276,9 +276,9 @@ oper
detForms : (x1,x2,x3 : Str) -> Gender => Number => Str = \den,det,de ->
\\g,n => gennumForms den det de ! gennum g n ;
regNP : Str -> Str -> Gender -> Number -> {s : NPForm => Str ; a : Agr} =
regNP : Str -> Str -> Gender -> Number -> {s : NPForm => Str ; a : Agr ; isPron : Bool} =
\det,dess,g,n ->
mkNP det det dess dess dess g n P3 ;
mkNP det det dess dess dess g n P3 ** {isPron = False} ;
-- For $Verb$.
@@ -286,11 +286,14 @@ oper
VP = {
s : Voice => VPForm => {
fin : Str ; -- V1 har ---s1
inf : Str -- V2 sagt ---s4
inf : Str ; -- V2 sagt ---s4
a1 : Polarity => Agr => Str * Str ; -- A1 inte ---s3 själv/själva/självt
-- p1: with infinite "jag har inte älskat dig",
-- p2: without infinite "jag älskar dig inte"
} ;
sp : PartForm => Str ; -- present or past participle
a1 : Polarity => Agr => Str ; -- A1 inte ---s3 själv/själva/självt
n2 : Agr => Str ; -- N2 dig ---s5
n1 : Agr => Str ; -- N1 sig/dig ---s5
n2 : Agr => Str ; -- N2 den här mannen ---s5
a2 : Str ; -- A2 idag ---s6
ext : Str ; -- S-Ext att hon går ---s7
--- ea1,ev2, --- these depend on params of v and a1
@@ -298,11 +301,14 @@ oper
} ;
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> vp ** {
n2 = \\a => obj ! a ++ vp.n2 ! a ;
en2 = True ;
insertObjPron : Bool -> (Agr => Str) -> VP -> VP = \isPron,obj,vp -> vp ** {
n1 = \\a => if_then_Str isPron (obj ! a ++ vp.n2 ! a) [] ;
n2 = \\a => if_then_Str isPron [] (obj ! a ++ vp.n2 ! a) ;
en2 = notB isPron ;
} ;
insertObj : (Agr => Str) -> VP -> VP = insertObjPron False ;
insertObjPost : (Agr => Str) -> VP -> VP = \obj,vp -> vp ** {
n2 = \\a => vp.n2 ! a ++ obj ! a ;
en2 = True ;
@@ -324,27 +330,23 @@ oper
a1 = \\b,a => vp.a1 ! b ! a ++ adv ! a ;
} ;
passiveVP : VP -> VP = \vp -> {
passiveVP : VP -> VP = \vp -> vp ** {
s = \\_ => vp.s ! Pass ; -- forms the s-passive
sp = vp.sp ;
a1 = vp.a1 ;
n2 = vp.n2 ;
a2 = vp.a2 ;
ext = vp.ext ;
en2 = vp.en2 ;
ea2 = vp.ea2 ;
eext = vp.eext
} ;
infVP : VP -> Agr -> Str = \vp,a -> infVPPlus vp a Simul Pos ;
infVPPlus : VP -> Agr -> Anteriority -> Polarity -> Str = \vp,a,ant,pol ->
vp.a1 ! pol ! a ++ (vp.s ! Act ! VPInfinit ant).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1
infVPPlus : VP -> Agr -> Anteriority -> Polarity -> Str = \vp,a,ant,pol ->
let negs = (vp.s ! Act ! VPInfinit Simul).a1 ! pol ! a
in negs.p1 ++ negs.p2 ++ (vp.s ! Act ! VPInfinit ant).inf ++ vp.n1 ! a ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1
partVPPlus : VP -> PartForm -> Agr -> Polarity -> Str = \vp,pf,a,pol ->
vp.a1 ! pol ! a ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ++ vp.sp ! pf ; -- verb final: i sängen liggande
partVPPlusPost : VP -> PartForm -> Agr -> Polarity -> Str = \vp,pf,a,pol ->
vp.a1 ! pol ! a ++ vp.sp ! pf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; -- verb first: liggande i sängen
let negs = (vp.s ! Act ! VPInfinit Simul).a1 ! pol ! a
in negs.p1 ++ negs.p2 ++ vp.n1 ! a ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ++ vp.sp ! pf ; -- verb final: i sängen liggande
partVPPlusPost : VP -> PartForm -> Agr -> Polarity -> Str = \vp,pf,a,pol ->
let negs = (vp.s ! Act ! VPInfinit Simul).a1 ! pol ! a
in negs.p1 ++ negs.p2 ++ vp.sp ! pf ++ vp.n1 ! a ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; -- verb first: liggande i sängen
-- For $Sentence$.
@@ -357,14 +359,21 @@ oper
s = \\t,a,b,o =>
let
verb = vp.s ! Act ! VPFinite t a ;
neg = vp.a1 ! b ! agr ;
compl = vp.n2 ! agr ++ vp.a2 ++ vp.ext
neg = verb.a1 ! b ! agr ;
pron = vp.n1 ! agr ;
compl = vp.n2 ! agr ++ vp.a2 ++ vp.ext ;
pronneg = neg.p1 ++ verb.inf ++ pron ++ neg.p2 ++ compl ; -- jag älskar dig inte
in
case o of {
Main => subj ++ verb.fin ++ neg ++ verb.inf ++ compl ;
Inv => verb.fin ++ subj ++ neg ++ verb.inf ++ compl ;
Sub => subj ++ neg ++ verb.fin ++ verb.inf ++ compl
Main => subj ++ verb.fin ++ pronneg ;
Inv => verb.fin ++ subj ++ pronneg ;
Sub => subj ++ neg.p1 ++ neg.p2 ++ verb.fin ++ verb.inf ++ pron ++ compl
}
} ;
}
-- har inte älskat dig
-- älskar dig inte
-- har jag inte älskat dig
-- älskar jag dig inte

View File

@@ -13,7 +13,8 @@ incomplete concrete ConjunctionScand of Conjunction =
ConjAdv conj ss = conjunctDistrSS conj ss ;
ConjNP conj ss = conjunctDistrTable NPForm conj ss ** {
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p}
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ;
isPron = False
} ;
ConjAP conj ss = conjunctDistrTable AFormPos conj ss ** {

View File

@@ -77,13 +77,14 @@ incomplete concrete ExtraScand of ExtraScandAbs = CatScand **
MkVPS t p vp = {
s = \\o,a =>
let
neg = vp.a1 ! p.p ! a ;
verb = vp.s ! Act ! VPFinite t.t t.a ;
compl = verb.inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ;
verb = vp.s ! Act ! VPFinite t.t t.a ;
neg = verb.a1 ! p.p ! a ;
compl = vp.n2 ! a ++ vp.a2 ++ vp.ext ;
pron = vp.n1 ! a
in t.s ++ p.s ++ case o of {
Main => verb.fin ++ neg ++ compl ;
Inv => verb.fin ++ neg ++ compl ; ----
Sub => neg ++ verb.fin ++ compl
Main => verb.fin ++ neg.p1 ++ verb.inf ++ pron ++ neg.p2 ++ compl ;
Inv => verb.fin ++ neg.p1 ++ verb.inf ++ pron ++ neg.p2 ++ compl ; ----
Sub => neg.p1 ++ neg.p2 ++ verb.fin ++ verb.inf ++ pron ++ compl
}
} ;

View File

@@ -2,7 +2,7 @@ incomplete concrete MarkupScand of Markup = CatScand, MarkHTMLX ** open ResScand
lin
MarkupCN m cn = {s = \\n,d,c => appMark m (cn.s ! n ! d ! c) ; g = cn.g ; isMod = cn.isMod} ;
MarkupNP m np = {s = \\c => appMark m (np.s ! c) ; a = np.a} ;
MarkupNP m np = {s = \\c => appMark m (np.s ! c) ; a = np.a ; isPron = np.isPron} ;
MarkupAP m ap = {s = \\a => appMark m (ap.s ! a) ; isPre = ap.isPre} ;
MarkupAdv m adv = {s = appMark m adv.s} ;
MarkupS m s = {s = \\o => appMark m (s.s ! o)} ;

View File

@@ -20,34 +20,40 @@ incomplete concrete NounScand of Noun =
in {
s = \\c => det.s ! m ! g ++
cn.s ! det.n ! dd ! caseNP c ;
a = agrP3 (ngen2gen g) det.n
a = agrP3 (ngen2gen g) det.n ;
isPron = False
} ;
UsePN pn = {
s = \\c => pn.s ! caseNP c ;
a = agrP3 pn.g Sg
a = agrP3 pn.g Sg ;
isPron = False
} ;
UsePron p = p ;
UsePron p = p ** {isPron = True} ;
PredetNP pred np = {
s = \\c => pred.s ! np.a.g ! np.a.n ++ pred.p ++ np.s ! c ;
a = case pred.a of {PAg n => agrP3 np.a.g n ; _ => np.a}
a = case pred.a of {PAg n => agrP3 np.a.g n ; _ => np.a} ;
isPron = False
} ;
PPartNP np v2 = {
s = \\c => np.s ! c ++ v2.s ! (VI (VPtPret (agrAdjNP np.a DIndef) Nom)) ;
a = np.a
a = np.a ;
isPron = False
} ;
AdvNP np adv = {
s = \\c => np.s ! c ++ adv.s ;
a = np.a
a = np.a ;
isPron = False
} ;
ExtAdvNP np adv = {
s = \\c => np.s ! c ++ embedInCommas adv.s ;
a = np.a
a = np.a ;
isPron = False
} ;
DetQuantOrd quant num ord = {
@@ -84,7 +90,8 @@ incomplete concrete NounScand of Noun =
m = True ; ---- is this needed for other than Art?
in {
s = \\c => det.sp ! m ! g ; ---- case of det!
a = agrP3 (ngen2gen g) det.n
a = agrP3 (ngen2gen g) det.n ;
isPron = False
} ;
PossPron p = {
@@ -141,7 +148,8 @@ incomplete concrete NounScand of Noun =
MassNP cn = {
s = \\c => cn.s ! Sg ! DIndef ! caseNP c ;
a = agrP3 (ngen2gen cn.g) Sg
a = agrP3 (ngen2gen cn.g) Sg ;
isPron = False
} ;
UseN, UseN2 = \noun -> {
@@ -200,7 +208,7 @@ incomplete concrete NounScand of Noun =
RelNP np rs = {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ! RNom ;
a = np.a ;
isMod = np.isMod
isPron = False
} ;
AdvCN cn sc = let g = cn.g in {
@@ -238,7 +246,8 @@ incomplete concrete NounScand of Noun =
m = True ; ---- see DetNP above
in {
s = \\c => det.sp ! m ! ng ++ av_Prep ++ np.s ! NPAcc ;
a = agrP3 g det.n
a = agrP3 g det.n ;
isPron = False
} ;
AdjDAP det ap = {

View File

@@ -1,5 +1,5 @@
incomplete concrete QuestionScand of Question =
CatScand ** open CommonScand, ResScand in {
CatScand ** open CommonScand, ResScand, Prelude in {
flags optimize=all_subs ;

View File

@@ -37,44 +37,49 @@ interface ResScand = DiffScand ** open CommonScand, Prelude in {
True => verbBe.s ;
_ => verbHave.s
} ;
har : STense -> Str = \t -> auxv ! vFin t Act ;
ha : Str = auxv ! VI (VInfin Act) ;
vf : Str -> Str -> {fin,inf : Str} = \fin,inf -> {
fin = fin ; inf = inf ++ verb.part --- not always right after the verb: hon ser (inte) vacker ut ; spotta ut snusen
vf : Bool -> Str -> Str -> {fin,inf : Str ; a1 : Polarity => Agr => Str * Str} = \hasInf, fin,inf -> {
fin = fin ;
inf = inf ++ verb.part ; --- not always right after the verb: hon ser (inte) vacker ut ; spotta ut snusen
a1 : Polarity => Agr => Str*Str = \\p,a => case hasInf of {
True => <negation ! p, []> ;
False => <[], negation ! p>
}
} ;
in {
s = \\d => table {
VPFinite t Simul => case t of {
-- SPres | SPast => vf (vfin d t) [] ; -- the general rule
SPast => vf (vfin d t) [] ; --# notpresent
SFut => vf auxFut (vinf d) ; --# notpresent
SFutKommer => vf auxFutKommer (auxFutPart ++ infMark ++ vinf d) ; --# notpresent
SCond => vf auxCond (vinf d) ; --# notpresent
SPres => vf (vfin d t) []
SPast => vf False (vfin d t) [] ; --# notpresent
SFut => vf True auxFut (vinf d) ; --# notpresent
SFutKommer => vf True auxFutKommer (auxFutPart ++ infMark ++ vinf d) ; --# notpresent
SCond => vf True auxCond (vinf d) ; --# notpresent
SPres => vf False (vfin d t) []
} ;
VPFinite t Anter => case t of { --# notpresent
SPres | SPast => vf (har t) (vsup d) ; --# notpresent
SFut => vf auxFut (ha ++ vsup d) ; --# notpresent
SFutKommer => vf auxFutKommer (auxFutPart ++ infMark ++ ha ++ vsup d) ; --# notpresent
SCond => vf auxCond (ha ++ vsup d) --# notpresent
SPres | SPast => vf True (har t) (vsup d) ; --# notpresent
SFut => vf True auxFut (ha ++ vsup d) ; --# notpresent
SFutKommer => vf True auxFutKommer (auxFutPart ++ infMark ++ ha ++ vsup d) ; --# notpresent
SCond => vf True auxCond (ha ++ vsup d) --# notpresent
} ; --# notpresent
VPImperat => vf (verb.s ! VF (VImper (diath d))) [] ;
VPInfinit Anter => vf [] (ha ++ vsup d) ; --# notpresent
VPInfinit Simul => vf [] (vinf d)
VPImperat => vf False (verb.s ! VF (VImper (diath d))) [] ;
VPInfinit Anter => vf True [] (ha ++ vsup d) ; --# notpresent
VPInfinit Simul => vf True [] (vinf d)
} ;
sp = table {
PartPret a c => verb.s ! (VI (VPtPret a c)) ;
PartPres n s c => verb.s ! (VI (VPtPres n s c))
} ;
a1 : Polarity => Agr => Str = \\p,a => negation ! p ;
n2 : Agr => Str = \\a => case verb.vtype of {
VRefl => reflPron a ;
_ => []
} ;
n1 : Agr => Str = \\a => case verb.vtype of {
VRefl => reflPron a ;
_ => []
} ;
n2 : Agr => Str = \\a => [] ;
a2 : Str = [] ;
ext : Str = [] ;
en2,ea2,eext : Bool = False -- indicate if the field exists

View File

@@ -13,8 +13,10 @@ incomplete concrete SentenceScand of Sentence =
let
agr = {g = Utr ; n = n ; p = P2} ;
verb = vp.s ! Act ! VPImperat ;
neg = verb.a1 ! pol ! agr ;
pron = vp.n1 ! agr
in
verb.fin ++ vp.a1 ! pol ! agr ++ verb.inf ++ vp.n2 ! agr ++ vp.a2 ++ vp.ext
verb.fin ++ neg.p1 ++ verb.inf ++ pron ++ neg.p2 ++ vp.n2 ! agr ++ vp.a2 ++ vp.ext
} ;
SlashVP np vp =

View File

@@ -8,15 +8,18 @@ lin
NumPN i = {s = \\c => i.s!neutrum ; g = Neutr} ; --- c
CNIntNP cn i = {
s = \\c => (cn.s ! Sg ! DIndef ! Nom ++ i.s) ;
a = agrP3 (ngen2gen cn.g) Sg
a = agrP3 (ngen2gen cn.g) Sg ;
isPron = False
} ;
CNSymbNP det cn xs = let g = cn.g in {
s = \\c => det.s ! cn.isMod ! g ++ cn.s ! det.n ! det.det ! caseNP c ++ xs.s ;
a = agrP3 (ngen2gen g) det.n
a = agrP3 (ngen2gen g) det.n ;
isPron = False
} ;
CNNumNP cn i = {
s = \\c => (cn.s ! Sg ! DIndef ! Nom ++ i.s ! neutrum) ;
a = agrP3 (ngen2gen cn.g) Sg
a = agrP3 (ngen2gen cn.g) Sg ;
isPron = False
} ;
SymbS sy = {s = \\_ => sy.s} ;

View File

@@ -8,7 +8,7 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand,
SlashV2a v = predV v ** {n3 = \\_ => [] ; c2 = v.c2} ;
Slash2V3 v np =
insertObj (\\_ => v.c2.s ++ np.s ! accusative) (predV v) **
insertObjPron np.isPron (\\_ => v.c2.s ++ np.s ! accusative) (predV v) **
{n3 = \\_ => [] ; c2 = v.c3} ; -- to preserve the order of args
Slash3V3 v np = predV v ** {
n3 = \\_ => v.c3.s ++ np.s ! accusative ;
@@ -37,19 +37,20 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand,
c2 = v.c2
} ;
ComplSlash vp np =
insertObjPost
(\\_ => vp.c2.s ++ np.s ! accusative ++ vp.n3 ! np.a) vp ;
ComplSlash vp np =
insertObjPost (\\_ => vp.n3 ! np.a)
(insertObjPron (andB np.isPron (notB vp.c2.hasPrep)) (\\_ => vp.c2.s ++ np.s ! accusative)
vp) ;
SlashVV v vp =
insertObj (\\a => v.c2.s ++ infVP vp a) (predV v) ** {n3 = vp.n3 ; c2 = vp.c2} ;
SlashV2VNP v np vp =
insertObj
insertObj
(\\a => v.c2.s ++ np.s ! accusative ++ v.c3.s ++ infVP vp a) (predV v)
** {n3 = vp.n3 ; c2 = v.c2} ;
UseComp comp = insertObj
UseComp comp = insertObj
comp.s (predV verbBe) ;
CompAP ap = {s = \\a => ap.s ! agrAdjNP a DIndef} ;
@@ -59,12 +60,12 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand,
AdvVP vp adv = insertAdv adv.s vp ;
AdVVP adv vp = insertAdV adv.s vp ;
ReflVP vp = insertObj (\\a => vp.c2.s ++ reflPron a ++ vp.n3 ! a) vp ;
ReflVP vp = insertObjPron (notB vp.c2.hasPrep) (\\a => reflPron a) (insertObj (\\a => vp.c2.s ++ vp.n3 ! a) vp) ;
VPSlashPrep vp prep = vp ** {n3 = \\_ => [] ; c2 = {s = prep.s ; hasPrep = True}} ;
PassV2 v =
insertObj
insertObj
(\\a => v.s ! VI (VPtPret (agrAdjNP a DIndef) Nom))
(predV verbBecome) ;