mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 00:22:51 -06:00
scand questions
This commit is contained in:
@@ -19,7 +19,7 @@ incomplete concrete CatScand of Cat =
|
|||||||
-- Constructed in $Verb$.
|
-- Constructed in $Verb$.
|
||||||
|
|
||||||
VP = {
|
VP = {
|
||||||
s : SForm => {
|
s : VPForm => {
|
||||||
fin : Str ; -- V1 har ---s1
|
fin : Str ; -- V1 har ---s1
|
||||||
inf : Str -- V2 sagt ---s4
|
inf : Str -- V2 sagt ---s4
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -5,18 +5,11 @@ interface DiffScand = open ResScand, Prelude in {
|
|||||||
param
|
param
|
||||||
Gender ;
|
Gender ;
|
||||||
|
|
||||||
CardOrd = NCard Gender | NOrd AFormSup ; -- sic! (AFormSup)
|
|
||||||
|
|
||||||
oper
|
oper
|
||||||
neutrum, utrum : Gender ;
|
neutrum, utrum : Gender ;
|
||||||
|
|
||||||
gennum : Gender -> Number -> GenNum ;
|
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".
|
-- This is the form of the noun in "det stora berget"/"det store berg".
|
||||||
|
|
||||||
detDef : Species ;
|
detDef : Species ;
|
||||||
@@ -27,6 +20,8 @@ interface DiffScand = open ResScand, Prelude in {
|
|||||||
conjThan : Str ;
|
conjThan : Str ;
|
||||||
infMark : Str ;
|
infMark : Str ;
|
||||||
|
|
||||||
|
subjIf : Str ;
|
||||||
|
|
||||||
artIndef : Gender => Str ;
|
artIndef : Gender => Str ;
|
||||||
|
|
||||||
verbHave : {s : VForm => Str} ;
|
verbHave : {s : VForm => Str} ;
|
||||||
@@ -37,9 +32,28 @@ interface DiffScand = open ResScand, Prelude in {
|
|||||||
|
|
||||||
negation : Polarity => Str ;
|
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$.
|
-- This function is here because it depends on $verbHave, auxFut, auxCond$.
|
||||||
|
|
||||||
predV : Verb -> VP = \verb ->
|
predV : Verb -> VP = \verb ->
|
||||||
let
|
let
|
||||||
vfin : Tense -> Str = \t -> verb.s ! vFin t Act ;
|
vfin : Tense -> Str = \t -> verb.s ! vFin t Act ;
|
||||||
vsup = verb.s ! VI (VSupin Act) ;
|
vsup = verb.s ! VI (VSupin Act) ;
|
||||||
@@ -54,19 +68,19 @@ interface DiffScand = open ResScand, Prelude in {
|
|||||||
|
|
||||||
in {
|
in {
|
||||||
s = table {
|
s = table {
|
||||||
VFinite t Simul => case t of {
|
VPFinite t Simul => case t of {
|
||||||
Pres | Past => vf (vfin t) [] ;
|
Pres | Past => vf (vfin t) [] ;
|
||||||
Fut => vf auxFut vinf ;
|
Fut => vf auxFut vinf ;
|
||||||
Cond => vf auxCond vinf
|
Cond => vf auxCond vinf
|
||||||
} ;
|
} ;
|
||||||
VFinite t Anter => case t of {
|
VPFinite t Anter => case t of {
|
||||||
Pres | Past => vf (har t) vsup ;
|
Pres | Past => vf (har t) vsup ;
|
||||||
Fut => vf auxFut (ha ++ vsup) ;
|
Fut => vf auxFut (ha ++ vsup) ;
|
||||||
Cond => vf auxCond (ha ++ vsup)
|
Cond => vf auxCond (ha ++ vsup)
|
||||||
} ;
|
} ;
|
||||||
VImperat => vf (verb.s ! VF (VImper Act)) [] ;
|
VPImperat => vf (verb.s ! VF (VImper Act)) [] ;
|
||||||
VInfinit Simul => vf [] vinf ;
|
VPInfinit Simul => vf [] vinf ;
|
||||||
VInfinit Anter => vf [] (ha ++ vsup)
|
VPInfinit Anter => vf [] (ha ++ vsup)
|
||||||
} ;
|
} ;
|
||||||
a1 : Polarity => Str = negation ;
|
a1 : Polarity => Str = negation ;
|
||||||
n2 : Agr => Str = \\_ => [] ;
|
n2 : Agr => Str = \\_ => [] ;
|
||||||
@@ -75,8 +89,5 @@ interface DiffScand = open ResScand, Prelude in {
|
|||||||
en2,ea2,eext : Bool = False -- indicate if the field exists
|
en2,ea2,eext : Bool = False -- indicate if the field exists
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- For determiners; mostly two-valued even in Norwegian.
|
|
||||||
|
|
||||||
genderForms : (x1,x2 : Str) -> Gender => Str ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ param
|
|||||||
| VSupin Voice
|
| VSupin Voice
|
||||||
| VPtPret AFormPos Case ;
|
| VPtPret AFormPos Case ;
|
||||||
|
|
||||||
SForm =
|
VPForm =
|
||||||
VFinite Tense Anteriority
|
VPFinite Tense Anteriority
|
||||||
| VImperat
|
| VPImperat
|
||||||
| VInfinit Anteriority ;
|
| VPInfinit Anteriority ;
|
||||||
|
|
||||||
NPForm = NPNom | NPAcc | NPPoss GenNum ;
|
NPForm = NPNom | NPAcc | NPPoss GenNum ;
|
||||||
--- AdjPronForm = APron GenNum Case ;
|
--- AdjPronForm = APron GenNum Case ;
|
||||||
|
|||||||
@@ -1,54 +1,66 @@
|
|||||||
--concrete QuestionScand of Question = CatScand ** open ResScand in {
|
incomplete concrete QuestionScand of Question =
|
||||||
--
|
CatScand ** open DiffScand, ResScand in {
|
||||||
-- flags optimize=all_subs ;
|
|
||||||
--
|
flags optimize=all_subs ;
|
||||||
-- lin
|
|
||||||
--
|
lin
|
||||||
-- QuestCl cl = {
|
|
||||||
-- s = \\t,a,p =>
|
QuestCl cl = {
|
||||||
-- let cls = cl.s ! t ! a ! p
|
s = \\t,a,p =>
|
||||||
-- in table {
|
let cls = cl.s ! t ! a ! p
|
||||||
-- QDir => cls ! OQuest ;
|
in table {
|
||||||
-- QIndir => "if" ++ cls ! ODir
|
QDir => cls ! Inv ;
|
||||||
-- } ---- "whether" in ExtScand
|
QIndir => subjIf ++ cls ! Sub
|
||||||
-- } ;
|
}
|
||||||
--
|
} ;
|
||||||
-- QuestVP qp vp =
|
|
||||||
-- let cl = mkS (qp.s ! Nom) {n = qp.n ; p = P3} vp.s vp.s2
|
QuestVP qp vp = {
|
||||||
-- in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ;
|
s = \\t,a,b,q =>
|
||||||
--
|
let
|
||||||
-- QuestSlash ip slash = {
|
somo = case q of {
|
||||||
-- s = \\t,a,p =>
|
QIndir => <"som",Sub> ;
|
||||||
-- let
|
_ => <[], Main>
|
||||||
-- cls = slash.s ! t ! a ! p ;
|
} ;
|
||||||
-- who = slash.c2 ++ ip.s ! Acc --- stranding in ExtScand
|
cl = mkClause (qp.s ! nominative ++ somo.p1) {gn = qp.gn ; p = P3} vp
|
||||||
-- in table {
|
in
|
||||||
-- QDir => who ++ cls ! OQuest ;
|
cl.s ! t ! a ! b ! somo.p2
|
||||||
-- QIndir => who ++ cls ! ODir
|
} ;
|
||||||
-- }
|
|
||||||
-- } ;
|
QuestSlash ip slash = {
|
||||||
--
|
s = \\t,a,p =>
|
||||||
-- QuestIAdv iadv cl = {
|
let
|
||||||
-- s = \\t,a,p =>
|
cls = slash.s ! t ! a ! p ;
|
||||||
-- let
|
who = slash.c2 ++ ip.s ! accusative --- stranding in ExtScand
|
||||||
-- cls = cl.s ! t ! a ! p ;
|
in table {
|
||||||
-- why = iadv.s
|
QDir => who ++ cls ! Inv ;
|
||||||
-- in table {
|
QIndir => who ++ cls ! Sub
|
||||||
-- QDir => why ++ cls ! OQuest ;
|
}
|
||||||
-- QIndir => why ++ cls ! ODir
|
} ;
|
||||||
-- }
|
|
||||||
-- } ;
|
QuestIAdv iadv cl = {
|
||||||
--
|
s = \\t,a,p =>
|
||||||
-- PrepIP p ip = {s = p.s ++ ip.s ! Nom} ;
|
let
|
||||||
--
|
cls = cl.s ! t ! a ! p ;
|
||||||
-- AdvIP ip adv = {
|
why = iadv.s
|
||||||
-- s = \\c => ip.s ! c ++ adv.s ;
|
in table {
|
||||||
-- n = ip.n
|
QDir => why ++ cls ! Inv ;
|
||||||
-- } ;
|
QIndir => why ++ cls ! Sub
|
||||||
--
|
}
|
||||||
-- IDetCN idet num ord cn = {
|
} ;
|
||||||
-- s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ;
|
|
||||||
-- n = idet.n
|
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
|
||||||
|
} ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -138,9 +138,9 @@ resource ResScand = ParamScand ** open Prelude in {
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
VP = {
|
VP = {
|
||||||
s : SForm => {
|
s : VPForm => {
|
||||||
fin : Str ; -- V1 har ---s1
|
fin : Str ; -- V1 har ---s1
|
||||||
inf : Str -- V2 sagt ---s4
|
inf : Str -- V2 sagt ---s4
|
||||||
} ;
|
} ;
|
||||||
a1 : Polarity => Str ; -- A1 inte ---s3
|
a1 : Polarity => Str ; -- A1 inte ---s3
|
||||||
n2 : Agr => Str ; -- N2 dig ---s5
|
n2 : Agr => Str ; -- N2 dig ---s5
|
||||||
@@ -188,7 +188,7 @@ resource ResScand = ParamScand ** open Prelude in {
|
|||||||
-- agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
|
-- agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
|
||||||
|
|
||||||
infVP : VP -> Agr -> Str = \vp,a ->
|
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 ->
|
-- agrVerb : Str -> Str -> Agr -> Str = \has,have,agr ->
|
||||||
-- case agr of {
|
-- case agr of {
|
||||||
@@ -236,14 +236,12 @@ resource ResScand = ParamScand ** open Prelude in {
|
|||||||
s : Tense => Anteriority => Polarity => Order => Str
|
s : Tense => Anteriority => Polarity => Order => Str
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkS : Str -> Agr ->
|
mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> {
|
||||||
(SForm => {fin,inf : Str}) -> (Polarity => Str) -> (Agr => Str) -> Clause =
|
|
||||||
\subj,agr,verb,adv,compl0 -> {
|
|
||||||
s = \\t,a,b,o =>
|
s = \\t,a,b,o =>
|
||||||
let
|
let
|
||||||
verb = verb ! VFinite t a ;
|
verb = vp.s ! VPFinite t a ;
|
||||||
neg = adv ! b ;
|
neg = vp.a1 ! b ;
|
||||||
compl = compl0 ! agr
|
compl = vp.n2 ! agr ++ vp.a2 ++ vp.ext
|
||||||
in
|
in
|
||||||
case o of {
|
case o of {
|
||||||
Main => subj ++ verb.fin ++ neg ++ verb.inf ++ compl ;
|
Main => subj ++ verb.fin ++ neg ++ verb.inf ++ compl ;
|
||||||
|
|||||||
@@ -4,35 +4,36 @@ incomplete concrete SentenceScand of Sentence =
|
|||||||
flags optimize=all_subs ;
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
lin
|
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} ;
|
|
||||||
--
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ instance DiffSwe of DiffScand = open ResScand, Prelude in {
|
|||||||
conjThan = "än" ;
|
conjThan = "än" ;
|
||||||
infMark = "att" ;
|
infMark = "att" ;
|
||||||
|
|
||||||
|
subjIf = "om" ;
|
||||||
|
|
||||||
artIndef : Gender => Str = table {
|
artIndef : Gender => Str = table {
|
||||||
Utr => "en" ;
|
Utr => "en" ;
|
||||||
Neutr => "ett"
|
Neutr => "ett"
|
||||||
|
|||||||
2
lib/resource-1.0/swedish/QuestionSwe.gf
Normal file
2
lib/resource-1.0/swedish/QuestionSwe.gf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
concrete QuestionSwe of Question = CatSwe ** QuestionScand with
|
||||||
|
(DiffScand = DiffSwe) ;
|
||||||
@@ -7,7 +7,7 @@ concrete TestSwe of Test =
|
|||||||
AdverbSwe,
|
AdverbSwe,
|
||||||
-- -- NumeralSwe,
|
-- -- NumeralSwe,
|
||||||
SentenceSwe,
|
SentenceSwe,
|
||||||
-- QuestionSwe,
|
QuestionSwe,
|
||||||
-- RelativeSwe,
|
-- RelativeSwe,
|
||||||
-- ConjunctionSwe,
|
-- ConjunctionSwe,
|
||||||
PhraseSwe,
|
PhraseSwe,
|
||||||
|
|||||||
Reference in New Issue
Block a user