refactored Scandinavian NP agreement features

This commit is contained in:
aarne
2010-01-05 23:00:40 +00:00
parent 4db9cd2b70
commit c4cbd1f405
32 changed files with 301 additions and 285 deletions

View File

@@ -40,7 +40,7 @@ incomplete concrete AdjectiveScand of Adjective =
ReflA2 a = {
s = \\ap => a.s ! AF (APosit ap) Nom ++ a.c2.s ++
reflPron (agrP3 utrum Sg) ; ----
reflPron (agrP3 Utr Sg) ; ----
isPre = False
} ;

View File

@@ -22,6 +22,6 @@ incomplete concrete AdverbScand of Adverb = CatScand ** open CommonScand, ResSca
AdnCAdv cadv = {s = cadv.s ++ conjThan} ;
oper
adverbForm : AForm = AF (APosit (Strong SgNeutr)) Nom ;
adverbForm : AForm = AF (APosit (Strong (GSg Neutr))) Nom ;
}

View File

@@ -25,15 +25,15 @@ incomplete concrete CatScand of Cat =
-- Question
QCl = {s : R.Tense => Anteriority => Polarity => QForm => Str} ;
IP = {s : NPForm => Str ; gn : GenNum} ;
IP = {s : NPForm => Str ; g : Gender ; n : Number} ;
IComp = {s : AFormPos => Str} ;
IDet = {s : Gender => Str ; n : Number ; det : DetSpecies} ;
IQuant = {s : Number => Gender => Str ; det : DetSpecies} ;
IDet = {s : NGender => Str ; n : Number ; det : DetSpecies} ;
IQuant = {s : Number => NGender => Str ; det : DetSpecies} ;
-- Relative; the case $c$ is for "det" clefts.
RCl = {s : R.Tense => Anteriority => Polarity => Agr => Str ; c : NPForm} ;
RP = {s : GenNum => RCase => Str ; a : RAgr} ;
RP = {s : Gender => Number => RCase => Str ; a : RAgr} ;
-- Verb
@@ -66,13 +66,13 @@ incomplete concrete CatScand of Cat =
-- permits treating definite articles "huset - de fem husen - det gamla huset"
-- as $Quant$.
CN = {s : Number => DetSpecies => Case => Str ; g : Gender ; isMod : Bool} ;
CN = {s : Number => DetSpecies => Case => Str ; g : NGender ; isMod : Bool} ;
NP,Pron = {s : NPForm => Str ; a : Agr} ;
Det = {s,sp : Bool => Gender => Str ; n : Number ; det : DetSpecies} ;
Quant = {s,sp : Number => Bool => Bool => Gender => Str ; det : DetSpecies} ;
Predet = {s : GenNum => Str} ;
Num = {s : Gender => Str ; isDet : Bool ; n : Number} ;
Card = {s : Gender => Str ; n : Number} ;
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} ;
Num = {s : NGender => Str ; isDet : Bool ; n : Number} ;
Card = {s : NGender => Str ; n : Number} ;
Ord = {s : Str} ;
-- Numeral

View File

@@ -1,9 +1,7 @@
--1 Auxiliary operations common for Scandinavian languages.
--
-- This module contains operations that are shared by the Scandinavian
-- languages. The complete set of auxiliary operations needed to
-- implement [Test Test.html] is defined in [ResScandinavian ResScandinavian.html],
-- which depends on [DiffScandinavian DiffScandinavian.html].
-- languages, without dependence on parameters.
resource CommonScand = ParamX ** open Prelude in {
@@ -14,11 +12,23 @@ param
Case = Nom | Gen ;
Voice = Act | Pass ;
-- The principal word orders in predication: main clause, inverted, subordinate.
Order = Main | Inv | Sub ;
-- The types of noun definiteness required by determiners. Examples:
-- "ett stort hus" (DIndef), "mitt stora hus" (DDef Indef),
-- "det stora huset" (DDed Def).
DetSpecies = DIndef | DDef Species ;
GenNum = SgUtr | SgNeutr | Plg ;
-- These are the gender-number combinations needed for adjective inflection,
-- minimizing the number of forms in the lexicon: there is no gender dependency
-- in the plural, and only two genders in the singular even in Norwegian.
GenNum = GSg Gender | GPl ;
Gender = Utr | Neutr ;
AForm = AF AFormGrad Case ;
@@ -56,17 +66,17 @@ param
VType = VAct | VPass | VRefl ;
NPForm = NPNom | NPAcc | NPPoss GenNum ;
--- AdjPronForm = APron GenNum Case ;
--- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ;
RCase = RNom | RGen | RPrep Bool ;
RAgr = RNoAg | RAg {gn : GenNum ; p : Person} ;
RAgr = RNoAg | RAg Gender Number Person ;
PredetAgr = PNoAg | PAg Number ;
oper
Complement : Type = {s : Str ; hasPrep : Bool} ;
Agr : PType = {gn : GenNum ; p : Person} ;
Agr : PType = {g : Gender ; n : Number ; p : Person} ;
nominative : NPForm = NPNom ;
accusative : NPForm = NPAcc ;
@@ -88,16 +98,27 @@ oper
_ => True
}
} ;
-- Used in $Noun.AdjCN$.
----- agrAdj : GenNum -> DetSpecies -> AFormPos = \gn,d -> Strong gn ; --- debug
agrAdjNP : Agr -> DetSpecies -> AFormPos = \a ->
agrAdj (gennumAgr a) ;
agrAdj : GenNum -> DetSpecies -> AFormPos = \gn,d ->
case <<gn,d> : GenNum * DetSpecies> of {
<_, DIndef> => Strong gn ;
<Plg,DDef _> => Weak Pl ;
<GPl,DDef _> => Weak Pl ;
_ => Weak Sg
} ;
gennum : Gender -> Number -> GenNum = \g,n ->
case n of {
Sg => GSg g ;
Pl => GPl
} ;
gennumAgr : Agr -> GenNum = \a -> gennum a.g a.n ;
-- Used in $DiffScand.predV$.
vFin : Tense -> Voice -> VForm = \t,v -> case t of {
@@ -109,16 +130,15 @@ oper
-- Used in $ConjunctionScand$.
conjGenNum : (_,_ : GenNum) -> GenNum = \g,h -> case <g,h> of {
<SgUtr,SgUtr> => SgUtr ;
<Plg, _> => Plg ;
<_, Plg> => Plg ;
_ => SgNeutr
conjGender : Gender -> Gender -> Gender = \g,h -> case g of {
Utr => h ;
_ => Neutr
} ;
conjAgr : (_,_ : Agr) -> Agr = \a,b -> {
gn = conjGenNum a.gn b.gn ;
p = conjPerson a.p b.p
g = conjGender a.g b.g ;
n = conjNumber a.n b.n ;
p = conjPerson a.p b.p
} ;
---
@@ -178,9 +198,9 @@ oper
\a, liten, litet, lilla, sma ->
case a of {
Strong gn => case gn of {
SgUtr => liten ;
SgNeutr => litet ;
Plg => sma
GSg Utr => liten ;
GSg Neutr => litet ;
GPl => sma
} ;
Weak Sg => lilla ;
Weak Pl => sma
@@ -199,29 +219,33 @@ oper
artDef : GenNum -> Str = \gn -> gennumForms "den" "det" "de" ! gn ;
mkNP : (x1,_,_,_,x5 : Str) -> GenNum -> Person ->
{s : NPForm => Str ; a : Agr} = \du,dig,din,ditt,dina,gn,p -> {
mkNP : (x1,_,_,_,x5 : Str) -> Gender -> Number -> Person ->
{s : NPForm => Str ; a : Agr} = \du,dig,din,ditt,dina,g,n,p -> {
s = table {
NPNom => du ;
NPAcc => dig ;
NPPoss g => gennumForms din ditt dina ! g
NPPoss h => gennumForms din ditt dina ! h
} ;
a = {
gn = gn ;
p = p
g = g ;
n = n ;
p = p
}
} ;
gennumForms : (x1,x2,x3 : Str) -> GenNum => Str = \den,det,de ->
table {
SgUtr => den ;
SgNeutr => det ;
GSg Utr => den ;
GSg Neutr => det ;
_ => de
} ;
regNP : Str -> Str -> GenNum -> {s : NPForm => Str ; a : Agr} =
\det,dess,gn ->
mkNP det det dess dess dess gn P3 ;
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} =
\det,dess,g,n ->
mkNP det det dess dess dess g n P3 ;
-- For $Verb$.

View File

@@ -10,7 +10,7 @@ incomplete concrete ConjunctionScand of Conjunction =
ConjAdv conj ss = conjunctDistrSS conj ss ;
ConjNP conj ss = conjunctDistrTable NPForm conj ss ** {
a = {gn = conjGenNum (gennum utrum conj.n) ss.a.gn ; p = ss.a.p}
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p}
} ;
ConjAP conj ss = conjunctDistrTable AFormPos conj ss ** {

View File

@@ -4,13 +4,14 @@ interface DiffScand = open CommonScand, Prelude in {
-- Norway has three genders, Danish and Swedish have two.
param
Gender ;
oper
neutrum, utrum : Gender ;
NGender : PType ;
ngen2gen : NGender -> Gender ;
gennum : Gender -> Number -> GenNum ;
neutrum, utrum : NGender ;
--- gennum : Gender -> Number -> GenNum ;
-- This is the form of the noun in "det stora berget"/"det store berg".
@@ -33,7 +34,7 @@ interface DiffScand = open CommonScand, Prelude in {
subjIf : Str ;
artIndef : Gender => Str ;
artIndef : NGender => Str ;
detIndefPl : Str ;
verbHave : Verb ;
@@ -48,11 +49,11 @@ interface DiffScand = open CommonScand, Prelude in {
-- For determiners; mostly two-valued even in Norwegian.
genderForms : (x1,x2 : Str) -> Gender => Str ;
genderForms : (x1,x2 : Str) -> NGender => Str ;
-- The forms of a relative pronoun ("som", "vars", "i vilken").
relPron : GenNum => RCase => Str ;
relPron : Gender => Number => RCase => Str ;
-- Pronoun "sådan" used in $Relative.RelCl$.

View File

@@ -2,7 +2,7 @@ incomplete concrete ExtraScand of ExtraScandAbs = CatScand **
open CommonScand,Coordination,ResScand in {
lin
GenNP np = {
s,sp = \\n,_,_,g => np.s ! NPPoss (gennum g n) ;
s,sp = \\n,_,_,g => np.s ! NPPoss (gennum (ngen2gen g) n) ;
det = DDef Indef
} ;
@@ -10,7 +10,7 @@ incomplete concrete ExtraScand of ExtraScandAbs = CatScand **
StrandRelSlash rp slash = {
s = \\t,a,p,ag =>
rp.s ! ag.gn ! RNom ++ slash.s ! t ! a ! p ! Sub ++ slash.c2.s ;
rp.s ! ag.g ! ag.n ! RNom ++ slash.s ! t ! a ! p ! Sub ++ slash.c2.s ;
c = NPAcc
} ;
EmptyRelSlash slash = {

View File

@@ -20,7 +20,7 @@ incomplete concrete NounScand of Noun =
in {
s = \\c => det.s ! m ! g ++
cn.s ! det.n ! dd ! caseNP c ;
a = agrP3 g det.n
a = agrP3 (ngen2gen g) det.n
} ;
UsePN pn = {
@@ -31,12 +31,12 @@ incomplete concrete NounScand of Noun =
UsePron p = p ;
PredetNP pred np = {
s = \\c => pred.s ! np.a.gn ++ np.s ! c ;
a = np.a
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}
} ;
PPartNP np v2 = {
s = \\c => np.s ! c ++ v2.s ! (VI (VPtPret (agrAdj np.a.gn DIndef) Nom)) ;
s = \\c => np.s ! c ++ v2.s ! (VI (VPtPret (agrAdjNP np.a DIndef) Nom)) ;
a = np.a
} ;
@@ -72,15 +72,15 @@ incomplete concrete NounScand of Noun =
DetNP det =
let
g = Neutr ; ----
g = neutrum ; ----
m = True ; ---- is this needed for other than Art?
in {
s = \\c => det.sp ! m ! g ;
a = agrP3 g det.n
a = agrP3 (ngen2gen g) det.n
} ;
PossPron p = {
s,sp = \\n,_,_,g => p.s ! NPPoss (gennum g n) ;
s,sp = \\n,_,_,g => p.s ! NPPoss (gennum (ngen2gen g) n) ;
det = DDef Indef
} ;
@@ -106,8 +106,8 @@ incomplete concrete NounScand of Noun =
} ;
DefArt = {
s = \\n,bm,bn,g => if_then_Str (orB bm bn) (artDef (gennum g n)) [] ;
sp = \\n,bm,bn,g => artDef (gennum g n) ;
s = \\n,bm,bn,g => if_then_Str (orB bm bn) (artDef (gennum (ngen2gen g) n)) [] ;
sp = \\n,bm,bn,g => artDef (gennum (ngen2gen g) n) ;
det = DDef Def
} ;
@@ -125,7 +125,7 @@ incomplete concrete NounScand of Noun =
MassNP cn = {
s = \\c => cn.s ! Sg ! DIndef ! caseNP c ;
a = agrP3 cn.g Sg
a = agrP3 (ngen2gen cn.g) Sg
} ;
UseN, UseN2 = \noun -> {
@@ -166,14 +166,14 @@ incomplete concrete NounScand of Noun =
AdjCN ap cn = let g = cn.g in {
s = \\n,d,c =>
preOrPost ap.isPre
(ap.s ! agrAdj (gennum g n) d)
(ap.s ! agrAdj (gennum (ngen2gen g) n) d)
(cn.s ! n ! d ! c) ;
g = g ;
isMod = True
} ;
RelCN cn rs = let g = cn.g in {
s = \\n,d,c => cn.s ! n ! d ! c ++ rs.s ! agrP3 g n ;
s = \\n,d,c => cn.s ! n ! d ! c ++ rs.s ! agrP3 (ngen2gen g) n ;
g = g ;
isMod = cn.isMod
} ;

View File

@@ -13,7 +13,7 @@ incomplete concrete PhraseScand of Phrase =
UttIP ip = {s = ip.s ! nominative} ; --- Acc also
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! accusative} ;
UttVP vp = {s = infMark ++ infVP vp (agrP3 utrum Sg)} ;
UttVP vp = {s = infMark ++ infVP vp (agrP3 Utr Sg)} ;
UttAdv adv = adv ;
NoPConj = {s = []} ;

View File

@@ -21,7 +21,7 @@ incomplete concrete QuestionScand of Question =
QIndir => <"som",Sub> ;
_ => <[], Main>
} ;
cl = mkClause (qp.s ! nominative ++ somo.p1) {gn = qp.gn ; p = P3} vp
cl = mkClause (qp.s ! nominative ++ somo.p1) {g = qp.g ; n = qp.n ; p = P3} vp
in
cl.s ! t ! a ! b ! somo.p2
} ;
@@ -29,7 +29,7 @@ incomplete concrete QuestionScand of Question =
QuestSlash ip slash = {
s = \\t,a,p =>
let
agr = {gn = ip.gn ; p = P3} ;
agr = agrP3 ip.g ip.n ;
cls : Order => Str = \\o => slash.s ! t ! a ! p ! o ++ slash.n3 ! agr ;
who = slash.c2.s ++ ip.s ! accusative --- stranding in ExtScand
in table {
@@ -54,7 +54,7 @@ incomplete concrete QuestionScand of Question =
let
cls =
(mkClause (np.s ! nominative) np.a (predV verbBe)).s ! t ! a ! p ;
why = icomp.s ! agrAdj np.a.gn DIndef
why = icomp.s ! agrAdjNP np.a DIndef
in table {
QDir => why ++ cls ! Inv ;
QIndir => why ++ cls ! Sub
@@ -67,22 +67,25 @@ incomplete concrete QuestionScand of Question =
AdvIP ip adv = {
s = \\c => ip.s ! c ++ adv.s ;
gn = ip.gn
g = ip.g ;
n = ip.n
} ;
IdetCN idet cn = let g = cn.g in {
s = \\c =>
s = \\c =>
idet.s ! g ++ cn.s ! idet.n ! idet.det ! caseNP c ;
gn = gennum g idet.n
g = ngen2gen g ;
n = idet.n
} ;
IdetIP idet =
let
g = Neutr ;
g = neutrum ; ---- g
in {
s = \\c => idet.s ! g ;
gn = (agrP3 g idet.n).gn
} ;
s = \\c => idet.s ! g ;
g = ngen2gen g ;
n = idet.n
} ;
IdetQuant idet num = {
s = \\g => idet.s ! num.n ! g ++ num.s ! g ;

View File

@@ -6,7 +6,8 @@ incomplete concrete RelativeScand of Relative =
lin
RelCl cl = {
s = \\t,a,p,ag => pronSuch ! ag.gn ++ conjThat ++ cl.s ! t ! a ! p ! Sub ;
s = \\t,a,p,ag =>
pronSuch ! gennumAgr ag ++ conjThat ++ cl.s ! t ! a ! p ! Sub ;
c = NPAcc
} ;
@@ -15,9 +16,9 @@ incomplete concrete RelativeScand of Relative =
let
agr = case rp.a of {
RNoAg => ag ;
RAg a => a
RAg g n p => {g = g ; n = n ; p = p}
} ;
cl = mkClause (rp.s ! ag.gn ! RNom) agr vp
cl = mkClause (rp.s ! ag.g ! ag.n ! RNom) agr vp
in
cl.s ! t ! ant ! b ! Sub ;
c = NPNom
@@ -32,10 +33,10 @@ incomplete concrete RelativeScand of Relative =
let
agr = case rp.a of {
RNoAg => ag ;
RAg agg => agg
RAg g n pr => {g = g ; n = n ; p = pr}
}
in
slash.c2.s ++ rp.s ! ag.gn ! RPrep slash.c2.hasPrep ++
slash.c2.s ++ rp.s ! ag.g ! ag.n ! RPrep slash.c2.hasPrep ++
slash.s ! t ! a ! p ! Sub ++ slash.n3 ! agr ;
c = NPAcc
} ;
@@ -43,8 +44,8 @@ incomplete concrete RelativeScand of Relative =
--- The case here could be genitive.
FunRP p np rp = {
s = \\gn,c => np.s ! nominative ++ p.s ++ rp.s ! gn ! RPrep True ;
a = RAg np.a
s = \\g,n,c => np.s ! nominative ++ p.s ++ rp.s ! g ! n ! RPrep True ;
a = RAg np.a.g np.a.n np.a.p
} ;
IdRP = {s = relPron ; a = RNoAg} ;

View File

@@ -5,15 +5,16 @@ interface ResScand = DiffScand ** open CommonScand, Prelude in {
--2 Constants uniformly defined in terms of language-dependent constants
param
CardOrd = NCard Gender | NOrd AFormSup ; -- sic! (AFormSup)
CardOrd = NCard NGender | NOrd AFormSup ; -- sic! (AFormSup)
oper
agrP3 : Gender -> Number -> Agr = \g,n -> {
gn = gennum g n ;
g = g ;
n = n ;
p = P3
} ;
Noun = {s : Number => Species => Case => Str ; g : Gender} ;
Noun = {s : Number => Species => Case => Str ; g : NGender} ;
-- This function is here because it depends on $verbHave, auxFut, auxCond$.
@@ -58,7 +59,7 @@ interface ResScand = DiffScand ** open CommonScand, Prelude in {
VPInfinit Simul => vf [] vinf
} ;
a1 : Polarity => Str = negation ;
n2 : Agr => Str = \\a => case verb.vtype of {
n2 : Agr => Str = \\a => case verb.vtype of {
VRefl => reflPron a ;
_ => []
} ;

View File

@@ -6,12 +6,12 @@ incomplete concrete SentenceScand of Sentence =
lin
PredVP np vp = mkClause (np.s ! nominative) np.a vp ;
PredSCVP sc vp = mkClause sc.s (agrP3 neutrum Sg) vp ;
PredSCVP sc vp = mkClause sc.s (agrP3 Neutr Sg) vp ;
ImpVP vp = {
s = \\pol,n =>
let
agr = {gn = gennum utrum n ; p = P2} ;
agr = {g = Utr ; n = n ; p = P2} ;
verb = vp.s ! VPImperat ;
in
verb.fin ++ vp.a1 ! pol ++ verb.inf ++ vp.n2 ! agr ++ vp.a2 ++ vp.ext
@@ -39,7 +39,7 @@ incomplete concrete SentenceScand of Sentence =
EmbedS s = {s = conjThat ++ s.s ! Sub} ;
EmbedQS qs = {s = qs.s ! QIndir} ;
EmbedVP vp = {s = infMark ++ infVP vp (agrP3 utrum Sg)} ; --- agr
EmbedVP vp = {s = infMark ++ infVP vp (agrP3 Utr Sg)} ; --- agr
UseCl t p cl = {
s = \\o => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! o

View File

@@ -8,15 +8,15 @@ 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 cn.g Sg
a = agrP3 (ngen2gen cn.g) Sg
} ;
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 g det.n
a = agrP3 (ngen2gen g) det.n
} ;
CNNumNP cn i = {
s = \\c => (cn.s ! Sg ! DIndef ! Nom ++ i.s ! neutrum) ;
a = agrP3 cn.g Sg
a = agrP3 (ngen2gen cn.g) Sg
} ;
SymbS sy = {s = \\_ => sy.s} ;

View File

@@ -18,7 +18,7 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand i
ComplVV v vp = insertObj (\\a => v.c2.s ++ infVP vp a) (predV v) ;
ComplVS v s = insertObj (\\_ => conjThat ++ s.s ! Sub) (predV v) ;
ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
ComplVA v ap = insertObj (\\a => ap.s ! agrAdj a.gn DIndef) (predV v) ;
ComplVA v ap = insertObj (\\a => ap.s ! agrAdjNP a DIndef) (predV v) ;
SlashV2V v vp = predV v ** {
n3 = \\a => v.c3.s ++ infVP vp a ;
@@ -33,7 +33,7 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand i
c2 = v.c2
} ;
SlashV2A v ap = predV v ** {
n3 = \\a => ap.s ! agrAdj a.gn DIndef ;
n3 = \\a => ap.s ! agrAdjNP a DIndef ;
c2 = v.c2
} ;
@@ -49,7 +49,8 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand i
(\\a => v.c2.s ++ np.s ! accusative ++ v.c3.s ++ infVP vp a) (predV v)
** {n3 = vp.n3 ; c2 = v.c2} ;
UseComp comp = insertObj (\\a => comp.s ! agrAdj a.gn DIndef) (predV verbBe) ;
UseComp comp = insertObj
(\\a => comp.s ! agrAdjNP a DIndef) (predV verbBe) ;
CompAP ap = ap ;
CompNP np = {s = \\_ => np.s ! accusative} ;
@@ -63,7 +64,7 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand i
PassV2 v =
insertObj
(\\a => v.s ! VI (VPtPret (agrAdj a.gn DIndef) Nom))
(\\a => v.s ! VI (VPtPret (agrAdjNP a DIndef) Nom))
(predV verbBecome) ;
}