scand questions

This commit is contained in:
aarne
2005-12-07 20:10:30 +00:00
parent 36c899e975
commit b7cb68eb08
9 changed files with 142 additions and 116 deletions

View File

@@ -19,7 +19,7 @@ incomplete concrete CatScand of Cat =
-- Constructed in $Verb$.
VP = {
s : SForm => {
s : VPForm => {
fin : Str ; -- V1 har ---s1
inf : Str -- V2 sagt ---s4
} ;

View File

@@ -5,18 +5,11 @@ interface DiffScand = open ResScand, Prelude in {
param
Gender ;
CardOrd = NCard Gender | NOrd AFormSup ; -- sic! (AFormSup)
oper
neutrum, utrum : Gender ;
gennum : Gender -> Number -> GenNum ;
agrP3 : Gender -> Number -> Agr = \g,n -> {
gn = gennum g n ;
p = P3
} ;
-- This is the form of the noun in "det stora berget"/"det store berg".
detDef : Species ;
@@ -27,6 +20,8 @@ interface DiffScand = open ResScand, Prelude in {
conjThan : Str ;
infMark : Str ;
subjIf : Str ;
artIndef : Gender => Str ;
verbHave : {s : VForm => Str} ;
@@ -37,9 +32,28 @@ interface DiffScand = open ResScand, Prelude in {
negation : Polarity => Str ;
-- For determiners; mostly two-valued even in Norwegian.
genderForms : (x1,x2 : Str) -> Gender => Str ;
-----------------------------------------------------------------------
--
-- The functions and parameters below are here because they depend on
-- the parametrized constants, but their definitions are fully given
-- here relative to the above.
param
CardOrd = NCard Gender | NOrd AFormSup ; -- sic! (AFormSup)
oper
agrP3 : Gender -> Number -> Agr = \g,n -> {
gn = gennum g n ;
p = P3
} ;
-- This function is here because it depends on $verbHave, auxFut, auxCond$.
predV : Verb -> VP = \verb ->
predV : Verb -> VP = \verb ->
let
vfin : Tense -> Str = \t -> verb.s ! vFin t Act ;
vsup = verb.s ! VI (VSupin Act) ;
@@ -54,19 +68,19 @@ interface DiffScand = open ResScand, Prelude in {
in {
s = table {
VFinite t Simul => case t of {
VPFinite t Simul => case t of {
Pres | Past => vf (vfin t) [] ;
Fut => vf auxFut vinf ;
Cond => vf auxCond vinf
} ;
VFinite t Anter => case t of {
VPFinite t Anter => case t of {
Pres | Past => vf (har t) vsup ;
Fut => vf auxFut (ha ++ vsup) ;
Cond => vf auxCond (ha ++ vsup)
} ;
VImperat => vf (verb.s ! VF (VImper Act)) [] ;
VInfinit Simul => vf [] vinf ;
VInfinit Anter => vf [] (ha ++ vsup)
VPImperat => vf (verb.s ! VF (VImper Act)) [] ;
VPInfinit Simul => vf [] vinf ;
VPInfinit Anter => vf [] (ha ++ vsup)
} ;
a1 : Polarity => Str = negation ;
n2 : Agr => Str = \\_ => [] ;
@@ -75,8 +89,5 @@ interface DiffScand = open ResScand, Prelude in {
en2,ea2,eext : Bool = False -- indicate if the field exists
} ;
-- For determiners; mostly two-valued even in Norwegian.
genderForms : (x1,x2 : Str) -> Gender => Str ;
}

View File

@@ -37,10 +37,10 @@ param
| VSupin Voice
| VPtPret AFormPos Case ;
SForm =
VFinite Tense Anteriority
| VImperat
| VInfinit Anteriority ;
VPForm =
VPFinite Tense Anteriority
| VPImperat
| VPInfinit Anteriority ;
NPForm = NPNom | NPAcc | NPPoss GenNum ;
--- AdjPronForm = APron GenNum Case ;

View File

@@ -1,54 +1,66 @@
--concrete QuestionScand of Question = CatScand ** open ResScand in {
--
-- flags optimize=all_subs ;
--
-- lin
--
-- QuestCl cl = {
-- s = \\t,a,p =>
-- let cls = cl.s ! t ! a ! p
-- in table {
-- QDir => cls ! OQuest ;
-- QIndir => "if" ++ cls ! ODir
-- } ---- "whether" in ExtScand
-- } ;
--
-- QuestVP qp vp =
-- let cl = mkS (qp.s ! Nom) {n = qp.n ; p = P3} vp.s vp.s2
-- in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ;
--
-- QuestSlash ip slash = {
-- s = \\t,a,p =>
-- let
-- cls = slash.s ! t ! a ! p ;
-- who = slash.c2 ++ ip.s ! Acc --- stranding in ExtScand
-- in table {
-- QDir => who ++ cls ! OQuest ;
-- QIndir => who ++ cls ! ODir
-- }
-- } ;
--
-- QuestIAdv iadv cl = {
-- s = \\t,a,p =>
-- let
-- cls = cl.s ! t ! a ! p ;
-- why = iadv.s
-- in table {
-- QDir => why ++ cls ! OQuest ;
-- QIndir => why ++ cls ! ODir
-- }
-- } ;
--
-- PrepIP p ip = {s = p.s ++ ip.s ! Nom} ;
--
-- AdvIP ip adv = {
-- s = \\c => ip.s ! c ++ adv.s ;
-- n = ip.n
-- } ;
--
-- IDetCN idet num ord cn = {
-- s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ;
-- n = idet.n
-- } ;
--
--}
incomplete concrete QuestionScand of Question =
CatScand ** open DiffScand, ResScand in {
flags optimize=all_subs ;
lin
QuestCl cl = {
s = \\t,a,p =>
let cls = cl.s ! t ! a ! p
in table {
QDir => cls ! Inv ;
QIndir => subjIf ++ cls ! Sub
}
} ;
QuestVP qp vp = {
s = \\t,a,b,q =>
let
somo = case q of {
QIndir => <"som",Sub> ;
_ => <[], Main>
} ;
cl = mkClause (qp.s ! nominative ++ somo.p1) {gn = qp.gn ; p = P3} vp
in
cl.s ! t ! a ! b ! somo.p2
} ;
QuestSlash ip slash = {
s = \\t,a,p =>
let
cls = slash.s ! t ! a ! p ;
who = slash.c2 ++ ip.s ! accusative --- stranding in ExtScand
in table {
QDir => who ++ cls ! Inv ;
QIndir => who ++ cls ! Sub
}
} ;
QuestIAdv iadv cl = {
s = \\t,a,p =>
let
cls = cl.s ! t ! a ! p ;
why = iadv.s
in table {
QDir => why ++ cls ! Inv ;
QIndir => why ++ cls ! Sub
}
} ;
PrepIP p ip = {
s = p.s ++ ip.s ! accusative
} ;
AdvIP ip adv = {
s = \\c => ip.s ! c ++ adv.s ;
gn = ip.gn
} ;
IDetCN idet num ord cn = let g = cn.g in {
s = \\c =>
idet.s ! g ++ num.s ! g ++ ord.s ++ cn.s ! idet.n ! idet.det ! caseNP c ;
gn = gennum g idet.n
} ;
}

View File

@@ -138,9 +138,9 @@ resource ResScand = ParamScand ** open Prelude in {
} ;
VP = {
s : SForm => {
fin : Str ; -- V1 har ---s1
inf : Str -- V2 sagt ---s4
s : VPForm => {
fin : Str ; -- V1 har ---s1
inf : Str -- V2 sagt ---s4
} ;
a1 : Polarity => Str ; -- A1 inte ---s3
n2 : Agr => Str ; -- N2 dig ---s5
@@ -188,7 +188,7 @@ resource ResScand = ParamScand ** open Prelude in {
-- agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
infVP : VP -> Agr -> Str = \vp,a ->
(vp.s ! VInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1
(vp.s ! VPInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1
-- agrVerb : Str -> Str -> Agr -> Str = \has,have,agr ->
-- case agr of {
@@ -236,14 +236,12 @@ resource ResScand = ParamScand ** open Prelude in {
s : Tense => Anteriority => Polarity => Order => Str
} ;
mkS : Str -> Agr ->
(SForm => {fin,inf : Str}) -> (Polarity => Str) -> (Agr => Str) -> Clause =
\subj,agr,verb,adv,compl0 -> {
mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> {
s = \\t,a,b,o =>
let
verb = verb ! VFinite t a ;
neg = adv ! b ;
compl = compl0 ! agr
verb = vp.s ! VPFinite t a ;
neg = vp.a1 ! b ;
compl = vp.n2 ! agr ++ vp.a2 ++ vp.ext
in
case o of {
Main => subj ++ verb.fin ++ neg ++ verb.inf ++ compl ;

View File

@@ -4,35 +4,36 @@ incomplete concrete SentenceScand of Sentence =
flags optimize=all_subs ;
lin
PredVP np vp = mkS (np.s ! nominative) np.a vp.s vp.a1 vp.n2 ;
PredVP np vp = mkClause (np.s ! nominative) np.a vp ;
PredSCVP sc vp = mkClause sc.s (agrP3 neutrum Sg) vp ;
ImpVP vp = {
s = \\pol,n =>
let
agr = {gn = gennum utrum n ; p = P2} ;
verb = vp.s ! VPImperat ;
in
verb.fin ++ vp.a1 ! pol ++ verb.inf ++ vp.n2 ! agr ++ vp.a2 ++ vp.ext
} ;
SlashV2 np v2 =
mkClause
(np.s ! nominative) np.a
(predV v2) **
{c2 = v2.c2} ;
SlashVVV2 np vv v2 =
mkClause
(np.s ! nominative) np.a
(insertObj (\\_ => vv.c2 ++ infVP (predV v2) np.a) (predV vv)) **
{c2 = v2.c2} ;
AdvSlash slash adv = {
s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
c2 = slash.c2
} ;
SlashPrep cl prep = cl ** {c2 = prep.s} ;
-- PredSCVP sc vp = mkS sc.s (agrP3 Sg) vp.s vp.s2 ;
--
-- ImpVP vp = {
-- s = \\pol,n =>
-- let
-- agr = {n = n ; p = P2} ;
-- verb = infVP vp agr ;
-- dont = case pol of {
-- Neg => "don't" ;
-- _ => []
-- }
-- in
-- dont ++ verb
-- } ;
--
-- SlashV2 np v2 = mkS (np.s ! Nom) np.a (predV v2).s (\\_ => []) **
-- {c2 = v2.c2} ;
--
-- SlashVVV2 np vv v2 =
-- mkS (np.s ! Nom) np.a (predV vv).s (\\_ => "to" ++ v2.s ! VInf) **
-- {c2 = v2.c2} ;
--
-- AdvSlash slash adv = {
-- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
-- c2 = slash.c2
-- } ;
--
-- SlashPrep cl prep = cl ** {c2 = prep.s} ;
--
}

View File

@@ -24,6 +24,8 @@ instance DiffSwe of DiffScand = open ResScand, Prelude in {
conjThan = "än" ;
infMark = "att" ;
subjIf = "om" ;
artIndef : Gender => Str = table {
Utr => "en" ;
Neutr => "ett"

View File

@@ -0,0 +1,2 @@
concrete QuestionSwe of Question = CatSwe ** QuestionScand with
(DiffScand = DiffSwe) ;

View File

@@ -7,7 +7,7 @@ concrete TestSwe of Test =
AdverbSwe,
-- -- NumeralSwe,
SentenceSwe,
-- QuestionSwe,
QuestionSwe,
-- RelativeSwe,
-- ConjunctionSwe,
PhraseSwe,