mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-31 21:58:54 -06:00
resource = resource-1.0
This commit is contained in:
44
lib/resource/scandinavian/AdjectiveScand.gf
Normal file
44
lib/resource/scandinavian/AdjectiveScand.gf
Normal file
@@ -0,0 +1,44 @@
|
||||
incomplete concrete AdjectiveScand of Adjective =
|
||||
CatScand ** open CommonScand, ResScand, Prelude in {
|
||||
|
||||
lin
|
||||
|
||||
PositA a = {
|
||||
s = \\ap => a.s ! AF (APosit ap) Nom ;
|
||||
isPre = True
|
||||
} ;
|
||||
ComparA a np = {
|
||||
s = \\ap => case a.isComp of {
|
||||
True => compMore ++ a.s ! AF (APosit ap) Nom ;
|
||||
_ => a.s ! AF ACompar Nom
|
||||
}
|
||||
++ conjThan ++ np.s ! nominative ;
|
||||
isPre = False
|
||||
} ;
|
||||
|
||||
-- $SuperlA$ belongs to determiner syntax in $Noun$.
|
||||
|
||||
ComplA2 a np = {
|
||||
s = \\ap => a.s ! AF (APosit ap) Nom ++ a.c2 ++ np.s ! accusative ;
|
||||
isPre = False
|
||||
} ;
|
||||
|
||||
ReflA2 a = {
|
||||
s = \\ap => a.s ! AF (APosit ap) Nom ++ a.c2 ++
|
||||
reflPron (agrP3 utrum Sg) ; ----
|
||||
isPre = False
|
||||
} ;
|
||||
|
||||
SentAP ap sc = {
|
||||
s = \\a => ap.s ! a ++ sc.s ;
|
||||
isPre = False
|
||||
} ;
|
||||
|
||||
AdAP ada ap = {
|
||||
s = \\a => ada.s ++ ap.s ! a ;
|
||||
isPre = ap.isPre
|
||||
} ;
|
||||
|
||||
UseA2 a = a ;
|
||||
|
||||
}
|
||||
28
lib/resource/scandinavian/AdverbScand.gf
Normal file
28
lib/resource/scandinavian/AdverbScand.gf
Normal file
@@ -0,0 +1,28 @@
|
||||
incomplete concrete AdverbScand of Adverb = CatScand ** open CommonScand, ResScand, Prelude in {
|
||||
|
||||
lin
|
||||
PositAdvAdj a = {
|
||||
s = a.s ! adverbForm
|
||||
} ;
|
||||
ComparAdvAdj cadv a np = {
|
||||
s = cadv.s ++ a.s ! adverbForm ++ conjThan ++ np.s ! nominative
|
||||
} ;
|
||||
ComparAdvAdjS cadv a s = {
|
||||
s = cadv.s ++ a.s ! adverbForm ++ conjThan ++ s.s ! Sub
|
||||
} ;
|
||||
|
||||
PrepNP prep np = {s = prep.s ++ np.s ! accusative} ;
|
||||
|
||||
AdAdv = cc2 ;
|
||||
|
||||
SubjS subj s = {
|
||||
s = subj.s ++ s.s ! Sub
|
||||
} ;
|
||||
AdvSC s = s ;
|
||||
|
||||
AdnCAdv cadv = {s = cadv.s ++ conjThan} ;
|
||||
|
||||
oper
|
||||
adverbForm : AForm = AF (APosit (Strong SgNeutr)) Nom ;
|
||||
|
||||
}
|
||||
96
lib/resource/scandinavian/CatScand.gf
Normal file
96
lib/resource/scandinavian/CatScand.gf
Normal file
@@ -0,0 +1,96 @@
|
||||
incomplete concrete CatScand of Cat =
|
||||
CommonX ** open ResScand, Prelude, CommonScand, (R = ParamX) in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lincat
|
||||
|
||||
-- Tensed/Untensed
|
||||
|
||||
S = {s : Order => Str} ;
|
||||
QS = {s : QForm => Str} ;
|
||||
RS = {s : Agr => Str ; c : NPForm} ;
|
||||
|
||||
-- Sentence
|
||||
|
||||
Cl = {s : Tense => Anteriority => Polarity => Order => Str} ;
|
||||
Slash = {s : Tense => Anteriority => Polarity => Order => Str} ** {c2 : Str} ;
|
||||
Imp = {s : Polarity => Number => Str} ;
|
||||
|
||||
-- Question
|
||||
|
||||
QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ;
|
||||
IP = {s : NPForm => Str ; gn : GenNum} ;
|
||||
IComp = {s : AFormPos => Str} ;
|
||||
IDet = {s : Gender => Str ; n : Number ; det : DetSpecies} ;
|
||||
|
||||
-- Relative; the case $c$ is for "det" clefts.
|
||||
|
||||
RCl = {s : Tense => Anteriority => Polarity => Agr => Str ; c : NPForm} ;
|
||||
RP = {s : GenNum => RCase => Str ; a : RAgr} ;
|
||||
|
||||
-- Verb
|
||||
|
||||
VP = {
|
||||
s : VPForm => {
|
||||
fin : Str ; -- V1 har ---s1
|
||||
inf : Str -- V2 sagt ---s4
|
||||
} ;
|
||||
a1 : Polarity => Str ; -- A1 inte ---s3
|
||||
n2 : Agr => Str ; -- N2 dig ---s5
|
||||
a2 : Str ; -- A2 idag ---s6
|
||||
ext : Str ; -- S-Ext att hon går ---s7
|
||||
en2,ea2,eext : Bool -- indicate if the field exists
|
||||
} ;
|
||||
Comp = {s : AFormPos => Str} ;
|
||||
|
||||
|
||||
-- Adjective
|
||||
|
||||
AP = {s : AFormPos => Str ; isPre : Bool} ;
|
||||
|
||||
-- Noun
|
||||
|
||||
-- The fields $isMod$ and $isDet$, and the boolean parameter of
|
||||
-- determiners, are a hack (the simples possible we found) that
|
||||
-- permits treating definite articles "huset - de fem husen - det gamla huset"
|
||||
-- as $Quant$.
|
||||
|
||||
CN = {s : Number => DetSpecies => Case => Str ; g : Gender ; isMod : Bool} ;
|
||||
NP,Pron = {s : NPForm => Str ; a : Agr} ;
|
||||
Det = {s : Bool => Gender => Str ; n : Number ; det : DetSpecies} ;
|
||||
QuantSg = {s : Bool => Gender => Str ; det : DetSpecies} ;
|
||||
QuantPl = {s : Bool => Gender => Str ; det : DetSpecies} ;
|
||||
Quant = {s : Number => Bool => Gender => Str ; det : DetSpecies} ;
|
||||
Predet = {s : GenNum => Str} ;
|
||||
Num = {s : Gender => Str ; isDet : Bool} ;
|
||||
Ord = {s : Str ; isDet : Bool} ;
|
||||
|
||||
-- Numeral
|
||||
|
||||
Numeral = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
-- Structural
|
||||
|
||||
Conj = {s : Str ; n : Number} ;
|
||||
DConj = {s1,s2 : Str ; n : Number} ;
|
||||
Subj = {s : Str} ;
|
||||
Prep = {s : Str} ;
|
||||
|
||||
-- Open lexical classes, e.g. Lexicon
|
||||
|
||||
V, VS, VQ, VA = Verb ;
|
||||
V2, VV, V2A = Verb ** {c2 : Str} ;
|
||||
V3 = Verb ** {c2,c3 : Str} ;
|
||||
|
||||
A = Adjective ** {isComp : Bool} ;
|
||||
-- {s : AForm => Str} ;
|
||||
A2 = Adjective ** {isComp : Bool ; c2 : Str} ;
|
||||
|
||||
N = Noun ;
|
||||
-- {s : Number => Species => Case => Str ; g : Gender} ;
|
||||
N2 = Noun ** {c2 : Str} ;
|
||||
N3 = Noun ** {c2,c3 : Str} ;
|
||||
PN = {s : Case => Str ; g : Gender} ;
|
||||
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
incomplete concrete CategoriesScand of Categories =
|
||||
PredefCnc ** open Prelude, SyntaxScand in {
|
||||
|
||||
lincat
|
||||
CN = {s : Number => SpeciesP => Case => Str ; g : NounGender ;
|
||||
p : IsComplexCN} ;
|
||||
N = CommNoun ;
|
||||
-- = {s : Number => Species => Case => Str ; g : NounGender} ;
|
||||
NP = NounPhrase ;
|
||||
-- = {s : NPForm => Str ; g : Gender ; n : Number ; p : Person} ;
|
||||
PN = {s : Case => Str ; g : NounGender} ;
|
||||
Det = {s : NounGender => Str ; n : Number ; b : SpeciesP} ;
|
||||
NDet = {s : NounGender => Str ; b : SpeciesP} ;
|
||||
N2 = Function ;
|
||||
-- = CommNoun ** {s2 : Preposition} ;
|
||||
N3 = Function ** {s3 : Preposition} ;
|
||||
Num = {s : Gender => Case => Str ; n : Number} ;
|
||||
Prep = {s : Str} ;
|
||||
|
||||
A = Adjective ;
|
||||
-- = {s : AdjFormPos => Case => Str} ;
|
||||
A2 = Adjective ** {s2 : Preposition} ;
|
||||
ADeg = {s : AdjForm => Str} ;
|
||||
AP = Adjective ** {p : IsPostfixAdj} ;
|
||||
AS = Adjective ; --- "more difficult for him to come than..."
|
||||
A2S = Adjective ** {s2 : Preposition} ;
|
||||
AV = Adjective ;
|
||||
A2V = Adjective ** {s2 : Preposition} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VerbForm => Str ; s1 : Str} ;
|
||||
VP = VerbGroup ;
|
||||
VCl = {s : Bool => Anteriority => VIForm => Gender => Number => Person => Str} ;
|
||||
VPI = {s : VIForm => Gender => Number => Person => Str} ;
|
||||
V2 = TransVerb ;
|
||||
-- = Verb ** {s2 : Preposition} ;
|
||||
V3 = TransVerb ** {s3 : Preposition} ;
|
||||
|
||||
VS = Verb ;
|
||||
VQ = Verb ;
|
||||
VV = Verb ** {isAux : Bool} ;
|
||||
VA = Verb ;
|
||||
|
||||
V2S = TransVerb ;
|
||||
V2Q = TransVerb ;
|
||||
V2V = DitransVerbVerb ;
|
||||
V2A = DitransAdjVerb ;
|
||||
V0 = Verb ;
|
||||
|
||||
TP = {s : Str ; b : Bool ; t : Tense ; a : Anteriority} ; --- the Str field is dummy
|
||||
Tense = {s : Str ; t : Tense} ;
|
||||
Pol = {s : Str ; p : Bool} ;
|
||||
Ant = {s : Str ; a : Anteriority} ;
|
||||
|
||||
|
||||
Adv = Adverb ;
|
||||
-- = {s : Str} ;
|
||||
AdV = Adverb ;
|
||||
AdA = Adverb ;
|
||||
AdC = Adverb ;
|
||||
PP = Adverb ;
|
||||
|
||||
S = Sentence ;
|
||||
-- = {s : Order => Str} ;
|
||||
Cl = Clause ;
|
||||
-- = {s : Bool => ClForm => Str} ;
|
||||
Slash = Clause ** {s2 : Preposition} ;
|
||||
|
||||
RP = {s : RelCase => GenNum => Str ; g : RelGender} ;
|
||||
RS = {s : GenNum => Person => Str} ;
|
||||
RCl = {s : Bool => SForm => GenNum => Person => Str} ;
|
||||
|
||||
IP = IntPron ; -- = NounPhrase ;
|
||||
IDet = {s : NounGender => Str ; n : Number ; b : SpeciesP} ;
|
||||
QS = {s : QuestForm => Str} ;
|
||||
QCl = {s : Bool => SForm => QuestForm => Str} ;
|
||||
Imp = {s : Number => Str} ;
|
||||
|
||||
Phr = {s : Str} ;
|
||||
|
||||
Conj = {s : Str ; n : Number} ;
|
||||
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
|
||||
|
||||
ListS = {s1,s2 : Order => Str} ;
|
||||
ListAP = {s1,s2 : AdjFormPos => Case => Str ; p : Bool} ;
|
||||
ListNP = {s1,s2 : NPForm => Str ; g : Gender ; n : Number ; p : Person} ;
|
||||
ListAdv = {s1,s2 : Str} ;
|
||||
|
||||
Subj = {s : Str} ;
|
||||
|
||||
}
|
||||
288
lib/resource/scandinavian/CommonScand.gf
Normal file
288
lib/resource/scandinavian/CommonScand.gf
Normal file
@@ -0,0 +1,288 @@
|
||||
--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].
|
||||
|
||||
resource CommonScand = ParamX ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
param
|
||||
Species = Indef | Def ;
|
||||
Case = Nom | Gen ;
|
||||
Voice = Act | Pass ;
|
||||
|
||||
Order = Main | Inv | Sub ;
|
||||
|
||||
DetSpecies = DIndef | DDef Species ;
|
||||
|
||||
GenNum = SgUtr | SgNeutr | Plg ;
|
||||
|
||||
AForm = AF AFormGrad Case ;
|
||||
|
||||
AFormGrad =
|
||||
APosit AFormPos
|
||||
| ACompar
|
||||
| ASuperl AFormSup ;
|
||||
|
||||
-- The $Number$ in $Weak$ only matters in "lilla"/"små".
|
||||
|
||||
AFormPos = Strong GenNum | Weak Number ;
|
||||
AFormSup = SupStrong | SupWeak ;
|
||||
|
||||
VForm =
|
||||
VF VFin
|
||||
| VI VInf ;
|
||||
|
||||
VFin =
|
||||
VPres Voice
|
||||
| VPret Voice --# notpresent
|
||||
| VImper Voice
|
||||
;
|
||||
|
||||
VInf =
|
||||
VInfin Voice
|
||||
| VSupin Voice --# notpresent
|
||||
| VPtPret AFormPos Case
|
||||
;
|
||||
|
||||
VPForm =
|
||||
VPFinite Tense Anteriority
|
||||
| VPImperat
|
||||
| VPInfinit Anteriority ;
|
||||
|
||||
VType = VAct | VPass | VRefl ;
|
||||
|
||||
NPForm = NPNom | NPAcc | NPPoss GenNum ;
|
||||
--- AdjPronForm = APron GenNum Case ;
|
||||
--- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ;
|
||||
|
||||
RCase = RNom | RGen | RPrep ;
|
||||
|
||||
RAgr = RNoAg | RAg {gn : GenNum ; p : Person} ;
|
||||
|
||||
oper
|
||||
Agr : PType = {gn : GenNum ; p : Person} ;
|
||||
|
||||
nominative : NPForm = NPNom ;
|
||||
accusative : NPForm = NPAcc ;
|
||||
|
||||
caseNP : NPForm -> Case = \np -> case np of {
|
||||
NPPoss _ => Gen ;
|
||||
_ => Nom
|
||||
} ;
|
||||
|
||||
specDet : DetSpecies -> Species = \d -> case d of {
|
||||
DDef Def => Def ;
|
||||
_ => Indef
|
||||
} ;
|
||||
|
||||
-- Used in $Noun.AdjCN$.
|
||||
|
||||
agrAdj : GenNum -> DetSpecies -> AFormPos = \gn,d -> case <gn,d> of {
|
||||
<_, DIndef> => Strong gn ;
|
||||
<Plg,DDef _> => Weak Pl ;
|
||||
_ => Weak Sg
|
||||
} ;
|
||||
|
||||
-- Used in $DiffScand.predV$.
|
||||
|
||||
vFin : Tense -> Voice -> VForm = \t,v -> case t of {
|
||||
Pres => VF (VPres v) ;
|
||||
Past => VF (VPret v) ; --# notpresent
|
||||
_ => VI (VInfin v) --- not to be used?
|
||||
} ;
|
||||
|
||||
-- Used in $ConjunctionScand$.
|
||||
|
||||
conjGenNum : (_,_ : GenNum) -> GenNum = \g,h -> case <g,h> of {
|
||||
<SgUtr,SgUtr> => SgUtr ;
|
||||
<Plg, _> => Plg ;
|
||||
<_, Plg> => Plg ;
|
||||
_ => SgNeutr
|
||||
} ;
|
||||
|
||||
conjAgr : (_,_ : Agr) -> Agr = \a,b -> {
|
||||
gn = conjGenNum a.gn b.gn ;
|
||||
p = conjPerson a.p b.p
|
||||
} ;
|
||||
|
||||
---
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
-- For each lexical category, here are the worst-case constructors.
|
||||
--
|
||||
-- But $mkNoun$ is fully defined only for each language, since
|
||||
-- $Gender$ varies.
|
||||
|
||||
nounForms : (x1,_,_,x4 : Str) -> (Number => Species => Case => Str) =
|
||||
\man,mannen,men,mennen -> \\n,d,c => case <n,d> of {
|
||||
<Sg,Indef> => mkCase c man ;
|
||||
<Sg,Def> => mkCase c mannen ;
|
||||
<Pl,Indef> => mkCase c men ;
|
||||
<Pl,Def> => mkCase c mennen
|
||||
} ;
|
||||
|
||||
Adjective : Type = {s : AForm => Str} ;
|
||||
|
||||
mkAdjective : (x1,_,_,_,_,_,x7 : Str) -> {s : AForm => Str} =
|
||||
\liten, litet, lilla, sma, mindre, minst, minsta -> {
|
||||
s = table {
|
||||
AF (APosit a) c => mkCase c (mkAdjPos a liten litet lilla sma) ;
|
||||
AF ACompar c => mkCase c mindre ;
|
||||
AF (ASuperl SupStrong) c => mkCase c minst ;
|
||||
AF (ASuperl SupWeak) c => mkCase c minsta
|
||||
}
|
||||
} ;
|
||||
|
||||
mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> {s : VForm => Str ; vtype : VType} =
|
||||
\finna,finner,finn,fann,funnit,funnen,funnet,funna -> {
|
||||
s = table {
|
||||
VF (VPres Act) => finner ;
|
||||
VF (VPres Pass) => mkVoice Pass finn ;
|
||||
VF (VPret v) => mkVoice v fann ; --# notpresent
|
||||
VF (VImper v) => mkVoice v finn ;
|
||||
VI (VInfin v) => mkVoice v finna ;
|
||||
VI (VSupin v) => mkVoice v funnit ; --# notpresent
|
||||
VI (VPtPret a c)=> mkCase c (mkAdjPos a funnen funnet funna funna)
|
||||
} ;
|
||||
vtype = VAct
|
||||
} ;
|
||||
|
||||
-- These are useful auxiliaries.
|
||||
|
||||
mkCase : Case -> Str -> Str = \c,f -> case c of {
|
||||
Nom => f ;
|
||||
Gen => f + case last f of {
|
||||
"s" | "x" => [] ;
|
||||
_ => "s"
|
||||
}
|
||||
} ;
|
||||
|
||||
mkAdjPos : AFormPos -> (s1,_,_,s4 : Str) -> Str =
|
||||
\a, liten, litet, lilla, sma ->
|
||||
case a of {
|
||||
Strong gn => case gn of {
|
||||
SgUtr => liten ;
|
||||
SgNeutr => litet ;
|
||||
Plg => sma
|
||||
} ;
|
||||
Weak Sg => lilla ;
|
||||
Weak Pl => sma
|
||||
} ;
|
||||
|
||||
mkVoice : Voice -> Str -> Str = \v,s -> case v of {
|
||||
Act => s ;
|
||||
Pass => s + case last s of {
|
||||
"s" => "es" ;
|
||||
_ => "s"
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
-- For $Noun$.
|
||||
|
||||
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 -> {
|
||||
s = table {
|
||||
NPNom => du ;
|
||||
NPAcc => dig ;
|
||||
NPPoss g => gennumForms din ditt dina ! g
|
||||
} ;
|
||||
a = {
|
||||
gn = gn ;
|
||||
p = p
|
||||
}
|
||||
} ;
|
||||
|
||||
gennumForms : (x1,x2,x3 : Str) -> GenNum => Str = \den,det,de ->
|
||||
table {
|
||||
SgUtr => den ;
|
||||
SgNeutr => det ;
|
||||
_ => de
|
||||
} ;
|
||||
|
||||
regNP : Str -> Str -> GenNum -> {s : NPForm => Str ; a : Agr} =
|
||||
\det,dess,gn ->
|
||||
mkNP det det dess dess dess gn P3 ;
|
||||
|
||||
|
||||
-- For $Verb$.
|
||||
|
||||
VP = {
|
||||
s : VPForm => {
|
||||
fin : Str ; -- V1 har ---s1
|
||||
inf : Str -- V2 sagt ---s4
|
||||
} ;
|
||||
a1 : Polarity => Str ; -- A1 inte ---s3
|
||||
n2 : Agr => Str ; -- N2 dig ---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
|
||||
en2,ea2,eext : Bool -- indicate if the field exists
|
||||
} ;
|
||||
|
||||
|
||||
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = vp.a1 ;
|
||||
n2 = \\a => vp.n2 ! a ++ obj ! a ;
|
||||
a2 = vp.a2 ;
|
||||
ext = vp.ext ;
|
||||
en2 = True ;
|
||||
ea2 = vp.ea2 ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
insertAdv : Str -> VP -> VP = \adv,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = vp.a1 ;
|
||||
n2 = vp.n2 ;
|
||||
a2 = vp.a2 ++ adv ;
|
||||
ext = vp.ext ;
|
||||
en2 = vp.en2 ;
|
||||
ea2 = True ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
insertAdV : Str -> VP -> VP = \adv,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = \\b => vp.a1 ! b ++ adv ;
|
||||
n2 = vp.n2 ;
|
||||
a2 = vp.a2 ;
|
||||
ext = vp.ext ;
|
||||
en2 = vp.en2 ;
|
||||
ea2 = vp.ea2 ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
infVP : VP -> Agr -> Str = \vp,a ->
|
||||
vp.a1 ! Pos ++ (vp.s ! VPInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1
|
||||
|
||||
|
||||
-- For $Sentence$.
|
||||
|
||||
Clause : Type = {
|
||||
s : Tense => Anteriority => Polarity => Order => Str
|
||||
} ;
|
||||
|
||||
mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> {
|
||||
s = \\t,a,b,o =>
|
||||
let
|
||||
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 ;
|
||||
Inv => verb.fin ++ subj ++ neg ++ verb.inf ++ compl ;
|
||||
Sub => subj ++ neg ++ verb.fin ++ verb.inf ++ compl
|
||||
}
|
||||
} ;
|
||||
|
||||
}
|
||||
45
lib/resource/scandinavian/ConjunctionScand.gf
Normal file
45
lib/resource/scandinavian/ConjunctionScand.gf
Normal file
@@ -0,0 +1,45 @@
|
||||
incomplete concrete ConjunctionScand of Conjunction =
|
||||
CatScand ** open CommonScand, ResScand, Coordination, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
ConjS conj ss = conjunctTable Order conj ss ;
|
||||
DConjS conj ss = conjunctDistrTable Order conj ss ;
|
||||
|
||||
ConjAdv conj ss = conjunctSS conj ss ;
|
||||
DConjAdv conj ss = conjunctDistrSS conj ss ;
|
||||
|
||||
ConjNP conj ss = conjunctTable NPForm conj ss ** {
|
||||
a = {gn = conjGenNum (gennum utrum conj.n) ss.a.gn ; p = ss.a.p}
|
||||
} ;
|
||||
DConjNP conj ss = conjunctDistrTable NPForm conj ss ** {
|
||||
a = {gn = conjGenNum (gennum utrum conj.n) ss.a.gn ; p = ss.a.p}
|
||||
} ;
|
||||
|
||||
ConjAP conj ss = conjunctTable AFormPos conj ss ** {
|
||||
isPre = ss.isPre
|
||||
} ;
|
||||
DConjAP conj ss = conjunctDistrTable AFormPos conj ss ** {
|
||||
isPre = ss.isPre
|
||||
} ;
|
||||
|
||||
-- These fun's are generated from the list cat's.
|
||||
|
||||
BaseS = twoTable Order ;
|
||||
ConsS = consrTable Order comma ;
|
||||
BaseAdv = twoSS ;
|
||||
ConsAdv = consrSS comma ;
|
||||
BaseNP x y = twoTable NPForm x y ** {a = conjAgr x.a y.a} ;
|
||||
ConsNP xs x = consrTable NPForm comma xs x ** {a = conjAgr xs.a x.a} ;
|
||||
BaseAP x y = twoTable AFormPos x y ** {isPre = andB x.isPre y.isPre} ;
|
||||
ConsAP xs x = consrTable AFormPos comma xs x ** {isPre = andB xs.isPre x.isPre} ;
|
||||
|
||||
lincat
|
||||
[S] = {s1,s2 : Order => Str} ;
|
||||
[Adv] = {s1,s2 : Str} ;
|
||||
[NP] = {s1,s2 : NPForm => Str ; a : Agr} ;
|
||||
[AP] = {s1,s2 : AFormPos => Str ; isPre : Bool} ;
|
||||
|
||||
}
|
||||
63
lib/resource/scandinavian/DiffScand.gf
Normal file
63
lib/resource/scandinavian/DiffScand.gf
Normal file
@@ -0,0 +1,63 @@
|
||||
interface DiffScand = open CommonScand, Prelude in {
|
||||
|
||||
--1 Differences between Scandinavian languages
|
||||
|
||||
-- Norway has three genders, Danish and Swedish have two.
|
||||
|
||||
param
|
||||
Gender ;
|
||||
|
||||
oper
|
||||
neutrum, utrum : Gender ;
|
||||
|
||||
gennum : Gender -> Number -> GenNum ;
|
||||
|
||||
-- This is the form of the noun in "det stora berget"/"det store berg".
|
||||
|
||||
detDef : Species ;
|
||||
|
||||
-- Danish and Norwegian verbs, but not Swedish verbs,
|
||||
-- have two possible compound-tense auxiliaries ("have" or "være").
|
||||
|
||||
Verb : Type ;
|
||||
|
||||
hasAuxBe : Verb -> Bool ;
|
||||
|
||||
-- The rest of the parameters are function words used in the syntax modules.
|
||||
|
||||
conjThat : Str ;
|
||||
conjThan : Str ;
|
||||
compMore : Str ;
|
||||
conjAnd : Str ;
|
||||
infMark : Str ;
|
||||
|
||||
subjIf : Str ;
|
||||
|
||||
artIndef : Gender => Str ;
|
||||
|
||||
verbHave : Verb ;
|
||||
verbBe : Verb ;
|
||||
|
||||
verbBecome : Verb ;
|
||||
|
||||
auxFut : Str ;
|
||||
auxCond : Str ;
|
||||
|
||||
negation : Polarity => Str ;
|
||||
|
||||
-- For determiners; mostly two-valued even in Norwegian.
|
||||
|
||||
genderForms : (x1,x2 : Str) -> Gender => Str ;
|
||||
|
||||
-- The forms of a relative pronoun ("som", "vars", "i vilken").
|
||||
|
||||
relPron : GenNum => RCase => Str ;
|
||||
|
||||
-- Pronoun "sådan" used in $Relative.RelCl$.
|
||||
|
||||
pronSuch : GenNum => Str ;
|
||||
|
||||
reflPron : Agr -> Str ;
|
||||
|
||||
}
|
||||
|
||||
15
lib/resource/scandinavian/ExtEngAbs.gf
Normal file
15
lib/resource/scandinavian/ExtEngAbs.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
abstract ExtEngAbs = Cat ** {
|
||||
|
||||
cat
|
||||
Aux ; -- auxiliary verbs: "can", "must", etc
|
||||
|
||||
-- Notice that $Aux$ cannot form $VP$ with infinitive, imperative, etc.
|
||||
|
||||
fun
|
||||
PredAux : NP -> Aux -> VP -> Cl ;
|
||||
QuestAux : IP -> Aux -> VP -> QCl ;
|
||||
|
||||
can_Aux : Aux ;
|
||||
must_Aux : Aux ;
|
||||
|
||||
}
|
||||
50
lib/resource/scandinavian/ExtraScand.gf
Normal file
50
lib/resource/scandinavian/ExtraScand.gf
Normal file
@@ -0,0 +1,50 @@
|
||||
incomplete concrete ExtraScand of ExtraScandAbs = CatScand **
|
||||
open CommonScand,Coordination,ResScand in {
|
||||
lin
|
||||
GenNP np = {
|
||||
s = \\n,_,g => np.s ! NPPoss (gennum g n) ;
|
||||
det = DDef Indef
|
||||
} ;
|
||||
|
||||
ComplBareVS v s = insertObj (\\_ => s.s ! Sub) (predV v) ;
|
||||
|
||||
StrandRelSlash rp slash = {
|
||||
s = \\t,a,p,ag =>
|
||||
rp.s ! ag.gn ! RNom ++ slash.s ! t ! a ! p ! Sub ++ slash.c2 ;
|
||||
c = NPAcc
|
||||
} ;
|
||||
EmptyRelSlash rp slash = {
|
||||
s = \\t,a,p,ag =>
|
||||
slash.s ! t ! a ! p ! Sub ++ slash.c2 ;
|
||||
c = NPAcc
|
||||
} ;
|
||||
|
||||
StrandQuestSlash ip slash = {
|
||||
s = \\t,a,p =>
|
||||
let
|
||||
cls = slash.s ! t ! a ! p ;
|
||||
who = ip.s ! accusative
|
||||
in table {
|
||||
QDir => who ++ cls ! Inv ++ slash.c2 ;
|
||||
QIndir => who ++ cls ! Sub ++ slash.c2
|
||||
}
|
||||
} ;
|
||||
|
||||
lincat
|
||||
VPI = {s : VPIForm => Agr => Str} ;
|
||||
[VPI] = {s1,s2 : VPIForm => Agr => Str} ;
|
||||
|
||||
param
|
||||
VPIForm = VPIInf | VPISup ; ---- sup not yet used
|
||||
|
||||
lin
|
||||
BaseVPI = twoTable2 VPIForm Agr ;
|
||||
ConsVPI = consrTable2 VPIForm Agr comma ;
|
||||
|
||||
MkVPI vp = {
|
||||
s = \\v,a => infVP vp a ---- no sup
|
||||
} ;
|
||||
ConjVPI = conjunctTable2 VPIForm Agr ;
|
||||
ComplVPIVV vv vpi = insertObj (\\a => vv.c2 ++ vpi.s ! VPIInf ! a) (predV vv) ;
|
||||
|
||||
}
|
||||
3
lib/resource/scandinavian/ExtraScandAbs.gf
Normal file
3
lib/resource/scandinavian/ExtraScandAbs.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
abstract ExtraScandAbs = Extra ** {
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
--# -path=.:../../prelude
|
||||
|
||||
abstract LangSats =
|
||||
Rules,
|
||||
Sats,
|
||||
Structural,
|
||||
Basic,
|
||||
Time,
|
||||
Country
|
||||
|
||||
** {
|
||||
fun
|
||||
|
||||
-- Mount $Time$.
|
||||
|
||||
AdvDate : Date -> Adv ;
|
||||
AdvTime : Time -> Adv ;
|
||||
NWeekday : Weekday -> N ;
|
||||
PNWeekday : Weekday -> PN ;
|
||||
|
||||
-- Mount $Country$.
|
||||
|
||||
PNCountry : Country -> PN ;
|
||||
ANationality : Nationality -> A ;
|
||||
NLanguage : Language -> N ;
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
incomplete concrete MathScand of Math = CategoriesScand **
|
||||
open Prelude, SyntaxScand in {
|
||||
|
||||
lin
|
||||
SymbPN i = {s = \\_ => i.s ; g = NNeutr} ; --- cannot know gender
|
||||
IntPN i = {s = \\_ => i.s ; g = NNeutr} ;
|
||||
IntNP cn i = nameNounPhrase {
|
||||
s = \\c => cn.s ! Sg ! DefP Def ! Nom ++ i.s ;
|
||||
g = cn.g
|
||||
} ;
|
||||
|
||||
IndefSymbNumNP nu cn xs =
|
||||
addSymbNounPhrase (indefNounPhraseNum plural nu cn) xs.s ;
|
||||
DefSymbNumNP nu cn xs =
|
||||
addSymbNounPhrase (defNounPhraseNum plural nu cn) xs.s ;
|
||||
NDetSymbNP det nu cn xs =
|
||||
addSymbNounPhrase (numDetNounPhrase det nu cn) xs.s ;
|
||||
|
||||
lincat
|
||||
SymbList = SS ;
|
||||
|
||||
lin
|
||||
SymbTwo = infixSS conjEt ;
|
||||
SymbMore = infixSS "," ;
|
||||
|
||||
|
||||
LetImp x np = {
|
||||
s = \\_ => letImp ++ x.s ! PNom ++ verbVara.s ! VI (Inf Act) ++ np.s ! PNom
|
||||
} ;
|
||||
|
||||
--- to be replaced by "det existerar", etc.
|
||||
|
||||
ExistNP np = predVerbGroupClause npDet
|
||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas))
|
||||
np) ;
|
||||
|
||||
-- Moved from $RulesScand$.
|
||||
|
||||
SymbCN cn s =
|
||||
{s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
|
||||
g = cn.g ;
|
||||
p = cn.p
|
||||
} ;
|
||||
IntCN cn s =
|
||||
{s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
|
||||
g = cn.g ;
|
||||
p = cn.p
|
||||
} ;
|
||||
|
||||
}
|
||||
160
lib/resource/scandinavian/NounScand.gf
Normal file
160
lib/resource/scandinavian/NounScand.gf
Normal file
@@ -0,0 +1,160 @@
|
||||
incomplete concrete NounScand of Noun =
|
||||
CatScand ** open CommonScand, ResScand, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
-- The rule defines $Det Quant Num Ord CN$ where $Det$ is empty if
|
||||
-- it is the definite article ($DefSg$ or $DefPl$) and both $Num$ and
|
||||
-- $Ord$ are empty and $CN$ is not adjectivally modified
|
||||
-- ($AdjCN$). Thus we get $huset$ but $de fem husen$, $det gamla huset$.
|
||||
|
||||
lin
|
||||
DetCN det cn =
|
||||
let
|
||||
g = cn.g ;
|
||||
m = cn.isMod ;
|
||||
dd = case <det.det,detDef,m> of {
|
||||
<DDef Def, Indef, True> => DDef Indef ;
|
||||
<d,_,_> => d
|
||||
}
|
||||
in {
|
||||
s = \\c => det.s ! m ! g ++
|
||||
cn.s ! det.n ! dd ! caseNP c ;
|
||||
a = agrP3 g det.n
|
||||
} ;
|
||||
|
||||
UsePN pn = {
|
||||
s = \\c => pn.s ! caseNP c ;
|
||||
a = agrP3 pn.g Sg
|
||||
} ;
|
||||
|
||||
UsePron p = p ;
|
||||
|
||||
PredetNP pred np = {
|
||||
s = \\c => pred.s ! np.a.gn ++ np.s ! c ;
|
||||
a = np.a
|
||||
} ;
|
||||
|
||||
PPartNP np v2 = {
|
||||
s = \\c => np.s ! c ++ v2.s ! (VI (VPtPret (agrAdj np.a.gn DIndef) Nom)) ;
|
||||
a = np.a
|
||||
} ;
|
||||
|
||||
AdvNP np adv = {
|
||||
s = \\c => np.s ! c ++ adv.s ;
|
||||
a = np.a
|
||||
} ;
|
||||
|
||||
DetSg quant ord = {
|
||||
s = \\b,g => quant.s ! (orB b ord.isDet) ! g ++ ord.s ;
|
||||
n = Sg ;
|
||||
det = quant.det
|
||||
} ;
|
||||
DetPl quant num ord = {
|
||||
s = \\b,g => quant.s ! (orB b (orB num.isDet ord.isDet)) ! g ++
|
||||
num.s ! g ++ ord.s ;
|
||||
n = Pl ;
|
||||
det = quant.det
|
||||
} ;
|
||||
|
||||
SgQuant quant = {
|
||||
s = quant.s ! Sg ;
|
||||
n = Sg ;
|
||||
det = quant.det
|
||||
} ;
|
||||
PlQuant quant = {
|
||||
s = quant.s ! Pl ;
|
||||
n = Pl ;
|
||||
det = quant.det
|
||||
} ;
|
||||
|
||||
PossPron p = {
|
||||
s = \\n,_,g => p.s ! NPPoss (gennum g n) ;
|
||||
det = DDef Indef
|
||||
} ;
|
||||
|
||||
NoNum = {s = \\_ => [] ; isDet = False} ;
|
||||
NoOrd = {s = [] ; isDet = False} ;
|
||||
|
||||
NumInt n = {s = \\_ => n.s ; isDet = True} ;
|
||||
OrdInt n = {s = n.s ++ ":e" ; isDet = True} ; ---
|
||||
|
||||
NumNumeral numeral = {s = \\g => numeral.s ! NCard g ; isDet = True} ;
|
||||
OrdNumeral numeral = {s = numeral.s ! NOrd SupWeak ; isDet = True} ;
|
||||
|
||||
AdNum adn num = {s = \\g => adn.s ++ num.s ! g ; isDet = True} ;
|
||||
|
||||
OrdSuperl a = {
|
||||
s = case a.isComp of {
|
||||
True => "mest" ++ a.s ! AF (APosit (Weak Sg)) Nom ;
|
||||
_ => a.s ! AF (ASuperl SupWeak) Nom
|
||||
} ;
|
||||
isDet = True
|
||||
} ;
|
||||
|
||||
DefArt = {
|
||||
s = \\n,b,g => if_then_Str b (artDef (gennum g n)) [] ;
|
||||
det = DDef Def
|
||||
} ;
|
||||
|
||||
IndefArt = {
|
||||
s = table {
|
||||
Sg => \\_ => artIndef ;
|
||||
Pl => \\_,_ => []
|
||||
} ;
|
||||
det = DIndef
|
||||
} ;
|
||||
|
||||
MassDet = {s = \\_,_ => [] ; n = Sg ; det = DIndef} ;
|
||||
|
||||
UseN, UseN2, UseN3 = \noun -> {
|
||||
s = \\n,d => noun.s ! n ! specDet d ;
|
||||
g = noun.g ;
|
||||
isMod = False
|
||||
} ;
|
||||
|
||||
-- The genitive of this $NP$ is not correct: "sonen till mig" (not "migs").
|
||||
|
||||
ComplN2 f x = {
|
||||
s = \\n,d,c => f.s ! n ! specDet d ! Nom ++ f.c2 ++ x.s ! accusative ;
|
||||
g = f.g ;
|
||||
isMod = False
|
||||
} ;
|
||||
ComplN3 f x = {
|
||||
s = \\n,d,c => f.s ! n ! d ! Nom ++ f.c2 ++ x.s ! accusative ;
|
||||
g = f.g ;
|
||||
c2 = f.c3 ;
|
||||
isMod = False
|
||||
} ;
|
||||
|
||||
AdjCN ap cn = let g = cn.g in {
|
||||
s = \\n,d,c =>
|
||||
preOrPost ap.isPre
|
||||
(ap.s ! agrAdj (gennum 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 ;
|
||||
g = g ;
|
||||
isMod = cn.isMod
|
||||
} ;
|
||||
AdvCN cn sc = let g = cn.g in {
|
||||
s = \\n,d,c => cn.s ! n ! d ! c ++ sc.s ;
|
||||
g = g ;
|
||||
isMod = cn.isMod
|
||||
} ;
|
||||
SentCN cn sc = let g = cn.g in {
|
||||
s = \\n,d,c => cn.s ! n ! d ! c ++ sc.s ;
|
||||
g = g ;
|
||||
isMod = cn.isMod
|
||||
} ;
|
||||
ApposCN cn np = let g = cn.g in {
|
||||
s = \\n,d,c => cn.s ! n ! d ! Nom ++ np.s ! NPNom ; --c
|
||||
g = g ;
|
||||
isMod = cn.isMod
|
||||
} ;
|
||||
|
||||
}
|
||||
24
lib/resource/scandinavian/PhraseScand.gf
Normal file
24
lib/resource/scandinavian/PhraseScand.gf
Normal file
@@ -0,0 +1,24 @@
|
||||
incomplete concrete PhraseScand of Phrase =
|
||||
CatScand ** open CommonScand, ResScand, Prelude in {
|
||||
|
||||
lin
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||
|
||||
UttS s = {s = s.s ! Main} ;
|
||||
UttQS qs = {s = qs.s ! QDir} ;
|
||||
UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ;
|
||||
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ;
|
||||
|
||||
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)} ;
|
||||
UttAdv adv = adv ;
|
||||
|
||||
NoPConj = {s = []} ;
|
||||
PConjConj conj = conj ;
|
||||
|
||||
NoVoc = {s = []} ;
|
||||
VocNP np = {s = "," ++ np.s ! nominative} ;
|
||||
|
||||
}
|
||||
80
lib/resource/scandinavian/QuestionScand.gf
Normal file
80
lib/resource/scandinavian/QuestionScand.gf
Normal file
@@ -0,0 +1,80 @@
|
||||
incomplete concrete QuestionScand of Question =
|
||||
CatScand ** open CommonScand, 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
|
||||
}
|
||||
} ;
|
||||
|
||||
QuestIComp icomp np = {
|
||||
s = \\t,a,p =>
|
||||
let
|
||||
cls =
|
||||
(mkClause (np.s ! nominative) np.a (predV verbBe)).s ! t ! a ! p ;
|
||||
why = icomp.s ! agrAdj np.a.gn DIndef
|
||||
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
|
||||
} ;
|
||||
|
||||
CompIAdv a = {s = \\_ => a.s} ;
|
||||
|
||||
}
|
||||
45
lib/resource/scandinavian/RelativeScand.gf
Normal file
45
lib/resource/scandinavian/RelativeScand.gf
Normal file
@@ -0,0 +1,45 @@
|
||||
incomplete concrete RelativeScand of Relative =
|
||||
CatScand ** open CommonScand, ResScand in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
RelCl cl = {
|
||||
s = \\t,a,p,ag => pronSuch ! ag.gn ++ conjThat ++ cl.s ! t ! a ! p ! Sub ;
|
||||
c = NPAcc
|
||||
} ;
|
||||
|
||||
RelVP rp vp = {
|
||||
s = \\t,ant,b,ag =>
|
||||
let
|
||||
agr = case rp.a of {
|
||||
RNoAg => ag ;
|
||||
RAg a => a
|
||||
} ;
|
||||
cl = mkClause (rp.s ! ag.gn ! RNom) agr vp
|
||||
in
|
||||
cl.s ! t ! ant ! b ! Sub ;
|
||||
c = NPNom
|
||||
} ;
|
||||
|
||||
-- This rule uses pied piping ("huset i vilket hon bor")
|
||||
-- Preposition stranding ("huset som hon bor i")
|
||||
-- and the empty relative ("huset hon bor i") are defined in $ExtraScand$.
|
||||
|
||||
RelSlash rp slash = {
|
||||
s = \\t,a,p,ag =>
|
||||
slash.c2 ++ rp.s ! ag.gn ! RPrep ++ slash.s ! t ! a ! p ! Sub ;
|
||||
c = NPAcc
|
||||
} ;
|
||||
|
||||
--- The case here could be genitive.
|
||||
|
||||
FunRP p np rp = {
|
||||
s = \\gn,c => np.s ! nominative ++ p.s ++ rp.s ! gn ! RPrep ;
|
||||
a = RAg np.a
|
||||
} ;
|
||||
|
||||
IdRP = {s = relPron ; a = RNoAg} ;
|
||||
|
||||
}
|
||||
70
lib/resource/scandinavian/ResScand.gf
Normal file
70
lib/resource/scandinavian/ResScand.gf
Normal file
@@ -0,0 +1,70 @@
|
||||
--1 Scandinavian auxiliary operations
|
||||
|
||||
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)
|
||||
|
||||
oper
|
||||
agrP3 : Gender -> Number -> Agr = \g,n -> {
|
||||
gn = gennum g n ;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
Noun = {s : Number => Species => Case => Str ; g : Gender} ;
|
||||
|
||||
-- This function is here because it depends on $verbHave, auxFut, auxCond$.
|
||||
|
||||
predV : Verb -> VP = \verb ->
|
||||
let
|
||||
diath = case verb.vtype of {
|
||||
VPass => Pass ;
|
||||
_ => Act
|
||||
} ;
|
||||
vfin : Tense -> Str = \t -> verb.s ! vFin t diath ;
|
||||
vsup = verb.s ! VI (VSupin diath) ; --# notpresent
|
||||
vinf = verb.s ! VI (VInfin diath) ;
|
||||
|
||||
auxv = case hasAuxBe verb of {
|
||||
True => verbBe.s ;
|
||||
_ => verbHave.s
|
||||
} ;
|
||||
|
||||
har : Tense -> 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
|
||||
} ;
|
||||
|
||||
in {
|
||||
s = table {
|
||||
VPFinite t Simul => case t of {
|
||||
-- Pres | Past => vf (vfin t) [] ; -- the general rule
|
||||
Past => vf (vfin t) [] ; --# notpresent
|
||||
Fut => vf auxFut vinf ; --# notpresent
|
||||
Cond => vf auxCond vinf ; --# notpresent
|
||||
Pres => vf (vfin t) []
|
||||
} ;
|
||||
VPFinite t Anter => case t of { --# notpresent
|
||||
Pres | Past => vf (har t) vsup ; --# notpresent
|
||||
Fut => vf auxFut (ha ++ vsup) ; --# notpresent
|
||||
Cond => vf auxCond (ha ++ vsup) --# notpresent
|
||||
} ; --# notpresent
|
||||
VPImperat => vf (verb.s ! VF (VImper diath)) [] ;
|
||||
VPInfinit Anter => vf [] (ha ++ vsup) ; --# notpresent
|
||||
VPInfinit Simul => vf [] vinf
|
||||
} ;
|
||||
a1 : Polarity => Str = negation ;
|
||||
n2 : Agr => Str = \\a => case verb.vtype of {
|
||||
VRefl => reflPron a ;
|
||||
_ => []
|
||||
} ;
|
||||
a2 : Str = [] ;
|
||||
ext : Str = [] ;
|
||||
en2,ea2,eext : Bool = False -- indicate if the field exists
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
incomplete concrete RulesScand of Rules = CategoriesScand **
|
||||
open Prelude, SyntaxScand in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
UsePN = nameNounPhrase ;
|
||||
|
||||
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefNumNP = indefNounPhraseNum plural ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefNumNP = defNounPhraseNum plural ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
NDetNP = numDetNounPhrase ;
|
||||
NDetNum = justNumDetNounPhrase ;
|
||||
MassNP = detNounPhrase (mkDeterminerSg (detSgInvar []) IndefP) ;
|
||||
|
||||
AppN2 = appFunComm ;
|
||||
AppN3 = appFun2 ;
|
||||
UseN2 = funAsCommNounPhrase ;
|
||||
|
||||
ModAP = modCommNounPhrase ;
|
||||
CNthatS = nounThatSentence ;
|
||||
|
||||
ModGenOne = npGenDet singular noNum ;
|
||||
ModGenNum = npGenDet plural ;
|
||||
|
||||
UseInt i = {s = \\_ => table {Nom => i.s ; Gen => i.s ++ "s"} ; n = Pl} ; ---
|
||||
NoNum = noNum ;
|
||||
|
||||
UseA = adj2adjPhrase ;
|
||||
ComplA2 = complAdj ;
|
||||
ComplAV = complVerbAdj ;
|
||||
ComplObjA2V = complVerbAdj2 True ;
|
||||
|
||||
PositADeg = positAdjPhrase ;
|
||||
ComparADeg = comparAdjPhrase ;
|
||||
SuperlADeg = superlAdjPhrase ;
|
||||
|
||||
-- verbs and verb phrases mostly in $Clause$
|
||||
|
||||
PredAS = predAdjSent ;
|
||||
PredV0 = predVerb0 ;
|
||||
|
||||
-- Partial saturation.
|
||||
|
||||
UseV2 = transAsVerb ;
|
||||
---- ComplV3 = complDitransVerb ;
|
||||
|
||||
ComplA2S = predAdjSent2 ;
|
||||
|
||||
AdjPart = adjPastPart ;
|
||||
|
||||
UseV2V x = x ** {isAux = False} ;
|
||||
UseV2S x = x ;
|
||||
UseV2Q x = x ;
|
||||
UseA2S x = x ;
|
||||
UseA2V x = x ;
|
||||
|
||||
-- Formation of infinitival phrases.
|
||||
|
||||
UseCl tp cl = {s = \\o => tp.s ++ cl.s ! tp.b ! ClFinite tp.t tp.a o} ;
|
||||
UseRCl tp cl =
|
||||
{s = \\gn,p => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! gn ! p} ;
|
||||
UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! q} ;
|
||||
UseVCl po a cl = {
|
||||
s = \\v,g,n,p => po.s ++ a.s ++ cl.s ! po.p ! a.a ! v ! g ! n ! p ;
|
||||
} ;
|
||||
|
||||
PosTP t a = {s = t.s ++ a.s ; b = True ; t = t.t ; a = a.a} ;
|
||||
NegTP t a = {s = t.s ++ a.s ; b = False ; t = t.t ; a = a.a} ;
|
||||
|
||||
TPresent = {s = [] ; t = Present} ;
|
||||
TPast = {s = [] ; t = Past} ;
|
||||
TFuture = {s = [] ; t = Future} ;
|
||||
TConditional = {s = [] ; t = Condit} ;
|
||||
|
||||
ASimul = {s = [] ; a = Simul} ;
|
||||
AAnter = {s = [] ; a = Anter} ;
|
||||
|
||||
PPos = {s = [] ; p = True} ;
|
||||
PNeg = {s = [] ; p = False} ;
|
||||
|
||||
-- Adverbs.
|
||||
|
||||
AdjAdv a = advPost (a.s ! adverbForm ! Nom) ;
|
||||
AdvPP p = p ;
|
||||
PrepNP p = prepPhrase p.s ; ---
|
||||
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
AdvAdv = cc2 ;
|
||||
AdvNP np adv = <np : {g : Gender ; n : Number ; p : Person}> **
|
||||
{s = \\f => np.s ! f ++ adv.s} ;
|
||||
|
||||
--3 Sentences and relative clauses
|
||||
--
|
||||
|
||||
SlashV2 = slashTransVerb ;
|
||||
SlashVV2 = slashVerbVerb ;
|
||||
SlashAdv cl p = slashAdverb cl p.s ;
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
RelSlash = relSlash ;
|
||||
ModRS = modRelClause ;
|
||||
RelCl = relSuch ;
|
||||
|
||||
|
||||
--!
|
||||
--3 Questions and imperatives
|
||||
--
|
||||
|
||||
IDetCN d n = detNounPhrase d n ;
|
||||
FunIP = funIntPron ;
|
||||
|
||||
QuestCl = questClause ;
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
|
||||
PosImpVP = imperVerbPhrase True ;
|
||||
NegImpVP = imperVerbPhrase False ;
|
||||
|
||||
IndicPhrase = indicUtt ;
|
||||
QuestPhrase = interrogUtt ;
|
||||
ImperOne = imperUtterance singular ;
|
||||
ImperMany = imperUtterance plural ;
|
||||
|
||||
AdvCl = advClause ;
|
||||
AdvVPI = advVerbPhrase ;
|
||||
AdvPhr = advSentence ;
|
||||
AdCPhr = advSentence ;
|
||||
|
||||
|
||||
--!
|
||||
--3 Coordination
|
||||
--
|
||||
|
||||
TwoS = twoSentence ;
|
||||
ConsS = consSentence ;
|
||||
ConjS = conjunctSentence ;
|
||||
ConjDS = conjunctDistrSentence ;
|
||||
|
||||
TwoAP = twoAdjPhrase ;
|
||||
ConsAP = consAdjPhrase ;
|
||||
ConjAP = conjunctAdjPhrase ;
|
||||
ConjDAP = conjunctDistrAdjPhrase ;
|
||||
|
||||
TwoNP = twoNounPhrase ;
|
||||
ConsNP = consNounPhrase ;
|
||||
ConjNP = conjunctNounPhrase ;
|
||||
ConjDNP = conjunctDistrNounPhrase ;
|
||||
|
||||
TwoAdv = twoAdverb ;
|
||||
ConsAdv = consAdverb ;
|
||||
ConjAdv = conjunctAdverb ;
|
||||
ConjDAdv = conjunctDistrAdverb ;
|
||||
|
||||
SubjS = subjunctSentence ;
|
||||
SubjImper = subjunctImperative ;
|
||||
SubjQS = subjunctQuestion ;
|
||||
AdvSubj if A = {s = if.s ++ A.s ! Sub} ;
|
||||
|
||||
PhrNP = useNounPhrase ;
|
||||
PhrOneCN = useCommonNounPhrase singular ;
|
||||
PhrManyCN = useCommonNounPhrase plural ;
|
||||
PhrIP ip = ip ;
|
||||
PhrIAdv ia = ia ;
|
||||
PhrVPI = verbUtterance ;
|
||||
|
||||
OnePhr p = p ;
|
||||
ConsPhr = cc2 ;
|
||||
|
||||
-----------------------
|
||||
-- special constructions
|
||||
|
||||
OneNP = npMan ;
|
||||
|
||||
ExistCN A = predVerbGroupClause npDet
|
||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas))
|
||||
(indefNounPhrase singular A)) ;
|
||||
ExistNumCN nu A = predVerbGroupClause npDet
|
||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas))
|
||||
(indefNounPhraseNum plural nu A)) ;
|
||||
|
||||
|
||||
} ;
|
||||
@@ -1,162 +0,0 @@
|
||||
--1 Topological structure of Scandinavian sentences.
|
||||
--
|
||||
-- This is an alternative, more 'native' analysis than $Clause$ and
|
||||
-- $Verbphrase$, due to Diderichsen.
|
||||
--
|
||||
-- Sources:
|
||||
-- N. Jörgensen & J. Svensson, "Nusvensk grammatik" (Gleerups, 2001);
|
||||
-- R. Zola Christensen, "Dansk grammatik for svenskere"
|
||||
-- (Studentlitteratur 1999).
|
||||
|
||||
incomplete concrete SatsScand of Sats = CategoriesScand **
|
||||
open Prelude, SyntaxScand in {
|
||||
|
||||
flags optimize=parametrize ;
|
||||
|
||||
-- The analysis is based on the notions of fundament, nexus, and
|
||||
-- content ("innehåll") fields. Nexus and content are both divided into
|
||||
-- two subfields - a verb, a noun phrase, and an adverbial.
|
||||
-- In addition, there is a field for an extraposed sentence.
|
||||
-- Each of these subfields can in a main clause be 'moved' to the
|
||||
-- sentence-initial fundament position.
|
||||
|
||||
lincat
|
||||
Sats = {
|
||||
s1 : SForm => Str ; -- V1 har
|
||||
s2 : Str ; -- N1 jag
|
||||
s3 : Bool => Str ; -- A1 inte
|
||||
s4 : SForm => Str ; -- V2 sett
|
||||
s5 : Str ; -- N2 dig
|
||||
s6 : Str ; -- A2 idag
|
||||
s7 : Str ; -- S att... (extraposed sentence)
|
||||
e3,e4,e5,e6,e7 : Bool -- indicate if the field exists
|
||||
} ;
|
||||
|
||||
-- Thus the fundament is not a part of the $Sats$, but it is only
|
||||
-- created when the $Sats$ is used as a $Main$ clause.
|
||||
-- In an $Inv$erted clause, no fundament is created.
|
||||
-- In a $Sub$ordinate clause, the order is rigid as well.
|
||||
|
||||
lin
|
||||
ClSats sats = {s = \\b,cf =>
|
||||
let
|
||||
osf = cl2s cf ;
|
||||
har = sats.s1 ! osf.sf ;
|
||||
jag = sats.s2 ;
|
||||
inte = sats.s3 ! b ;
|
||||
sagt = sats.s4 ! osf.sf ;
|
||||
dig = sats.s5 ;
|
||||
idag = sats.s6 ;
|
||||
exts = sats.s7
|
||||
in case osf.o of {
|
||||
Main => variants {
|
||||
jag ++ har ++ inte ++ sagt ++ dig ++ idag ++ exts ;
|
||||
onlyIf (orB sats.e3 (notB b))
|
||||
(inte ++ har ++ jag ++ sagt ++ dig ++ idag ++ exts) ;
|
||||
onlyIf (orB sats.e4 (isCompoundClForm cf))
|
||||
(sagt ++ har ++ jag ++ inte ++ dig ++ idag ++ exts) ;
|
||||
onlyIf sats.e5
|
||||
(dig ++ har ++ jag ++ inte ++ sagt ++ idag ++ exts) ;
|
||||
onlyIf sats.e6
|
||||
(idag ++ har ++ jag ++ inte ++ sagt ++ dig ++ exts) ;
|
||||
onlyIf sats.e7
|
||||
(exts ++ har ++ jag ++ inte ++ sagt ++ dig ++ idag)
|
||||
} ;
|
||||
Inv =>
|
||||
har ++ jag ++ inte ++ sagt ++ dig ++ idag ++ exts ;
|
||||
Sub =>
|
||||
jag ++ inte ++ har ++ sagt ++ dig ++ idag ++ exts
|
||||
}
|
||||
} ;
|
||||
|
||||
-- The following rules show how the fields are filled in a
|
||||
-- predication, with different subcategorization patterns.
|
||||
|
||||
SatsV = mkSats ;
|
||||
|
||||
SatsV2 subj verb obj =
|
||||
mkSatsObject subj verb (verb.s2 ++ obj.s ! PAcc) ;
|
||||
|
||||
SatsV3 subj verb obj1 obj2 =
|
||||
mkSatsObject subj verb (verb.s2 ++ obj1.s ! PAcc ++ verb.s3 ++ obj2.s ! PAcc) ;
|
||||
|
||||
SatsReflV2 subj verb =
|
||||
mkSatsObject subj verb (verb.s2 ++ reflPron subj.n subj.p) ;
|
||||
|
||||
SatsVS subj verb sent =
|
||||
insertExtrapos (mkSats subj verb) (optStr infinAtt ++ sent.s ! Sub) ;
|
||||
|
||||
SatsVQ subj verb quest =
|
||||
insertExtrapos (mkSats subj verb) (quest.s ! IndirQ) ;
|
||||
|
||||
SatsV2S subj verb obj sent =
|
||||
insertExtrapos
|
||||
(mkSatsObject subj verb (verb.s2 ++ obj.s ! PAcc))
|
||||
(optStr infinAtt ++ sent.s ! Sub) ;
|
||||
|
||||
SatsV2Q subj verb obj quest =
|
||||
insertExtrapos
|
||||
(mkSatsObject subj verb (verb.s2 ++ obj.s ! PAcc))
|
||||
(quest.s ! IndirQ) ;
|
||||
|
||||
SatsAP subj adj =
|
||||
mkSatsCopula subj (adj.s ! predFormAdj subj.g subj.n ! Nom) ;
|
||||
|
||||
SatsCN subj cn =
|
||||
mkSatsCopula subj (indefNoun subj.n cn) ;
|
||||
|
||||
SatsNP subj np =
|
||||
mkSatsCopula subj (np.s ! PNom) ;
|
||||
|
||||
SatsAdv subj adv =
|
||||
mkSatsCopula subj adv.s ;
|
||||
|
||||
-- No problem to insert a verb-complement verb:
|
||||
---- (another rule needed for complement in perfect: "jag vill ha gått")
|
||||
|
||||
VVSats sats vv =
|
||||
let
|
||||
harvelat = verbSForm vv Act
|
||||
in
|
||||
{s1 = \\sf => (harvelat sf).fin ;
|
||||
s2 = sats.s2 ;
|
||||
s3 = sats.s3 ;
|
||||
s4 = \\sf => (harvelat sf).inf ++ sats.s4 ! VInfinit Simul ;
|
||||
s5 = sats.s5 ;
|
||||
s6 = sats.s6 ;
|
||||
s7 = sats.s7 ;
|
||||
e3 = sats.e3 ;
|
||||
e4 = True ;
|
||||
e5 = sats.e5 ;
|
||||
e6 = sats.e6 ;
|
||||
e7 = sats.e7
|
||||
} ;
|
||||
|
||||
-- This is where sentence adverbials are inserted.
|
||||
|
||||
AdVSats sats adv = {
|
||||
s1 = sats.s1 ;
|
||||
s2 = sats.s2 ;
|
||||
s3 = \\b => sats.s3 ! b ++ adv.s ;
|
||||
s4 = sats.s4 ;
|
||||
s5 = sats.s5 ;
|
||||
s6 = sats.s6 ;
|
||||
s7 = sats.s7 ;
|
||||
e3 = True ;
|
||||
e4 = sats.e4 ;
|
||||
e5 = sats.e5 ;
|
||||
e6 = sats.e6 ;
|
||||
e7 = sats.e7
|
||||
} ;
|
||||
|
||||
-- This is where other adverbials ('TSR') are inserted. There is an
|
||||
-- operation for this, since this place is used for many more things
|
||||
-- than the sentence adverbial place
|
||||
|
||||
AdvSats sats adv = insertAdverb sats adv.s ;
|
||||
|
||||
-- with proper means in GF, this would become even nicer:
|
||||
|
||||
--- AdVSats sats adv = sats ** {s3 = sats.s3 ++ adv.s ; e3 = True} ;
|
||||
|
||||
}
|
||||
50
lib/resource/scandinavian/SentenceScand.gf
Normal file
50
lib/resource/scandinavian/SentenceScand.gf
Normal file
@@ -0,0 +1,50 @@
|
||||
incomplete concrete SentenceScand of Sentence =
|
||||
CatScand ** open CommonScand, ResScand in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
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} ;
|
||||
|
||||
EmbedS s = {s = conjThat ++ s.s ! Sub} ;
|
||||
EmbedQS qs = {s = qs.s ! QIndir} ;
|
||||
EmbedVP vp = {s = infMark ++ infVP vp (agrP3 utrum Sg)} ; --- agr
|
||||
|
||||
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 => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r ;
|
||||
c = cl.c
|
||||
} ;
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,160 +0,0 @@
|
||||
--1 Scandinavian Word Classes and Morphological Parameters
|
||||
--
|
||||
-- This is a resource module for Swedish morphology, defining the
|
||||
-- morphological parameters and word classes of Swedish. It is aimed
|
||||
-- to be complete w.r.t. the description of word forms.
|
||||
-- However, it does not include those parameters that are not needed for
|
||||
-- analysing individual words: such parameters are defined in syntax modules.
|
||||
--
|
||||
-- This GF grammar was obtained from the functional morphology file TypesSw.hs
|
||||
-- semi-automatically. The GF inflection engine obtained was obtained automatically.
|
||||
|
||||
interface TypesScand = {
|
||||
|
||||
--
|
||||
|
||||
--2 Enumerated parameter types
|
||||
--
|
||||
-- These types are the ones found in school grammars.
|
||||
-- Their parameter values are atomic.
|
||||
|
||||
param
|
||||
Gender ;
|
||||
Number = Sg | Pl ;
|
||||
Species = Indef | Def ;
|
||||
Case = Nom | Gen ;
|
||||
Sex = NoMasc | Masc ;
|
||||
Mode = Ind | Cnj ;
|
||||
Voice = Act | Pass ;
|
||||
Degree = Pos | Comp | Sup ;
|
||||
Person = P1 | P2 | P3 ;
|
||||
|
||||
--2 Word classes and hierarchical parameter types
|
||||
--
|
||||
-- Real parameter types (i.e. ones on which words and phrases depend)
|
||||
-- are mostly hierarchical. The alternative would be cross-products of
|
||||
-- simple parameters, but this would usually overgenerate.
|
||||
--
|
||||
|
||||
--3 Substantives
|
||||
--
|
||||
-- Substantives (= common nouns) have a parameter of type SubstForm.
|
||||
|
||||
param SubstForm = SF Number Species Case ;
|
||||
|
||||
-- Substantives moreover have an inherent gender.
|
||||
|
||||
oper Subst : Type = {s : SubstForm => Str ; h1 : Gender} ;
|
||||
|
||||
neutrum, utrum : Gender ;
|
||||
|
||||
--3 Adjectives
|
||||
--
|
||||
-- Adjectives are a very complex class, and the full table has as many as
|
||||
-- 18 different forms. The major division is between the comparison degrees;
|
||||
-- the comparative has only the 2 case forms, whereas the positive has 12 forms.
|
||||
|
||||
param
|
||||
AdjForm = AF AdjFormGrad Case ;
|
||||
|
||||
-- The positive strong forms depend on gender: "en stor bil" - "ett stort hus".
|
||||
-- But the weak forms depend on sex: "den stora bilen" - "den store mannen".
|
||||
-- The plural never makes a gender-sex distinction.
|
||||
|
||||
GenNum = ASg Gender | APl ;
|
||||
SexNum = AxSg Sex | AxPl ;
|
||||
|
||||
-- This parameter is different from $Gender$ only for Swedish.
|
||||
|
||||
param
|
||||
NounGender ;
|
||||
|
||||
oper
|
||||
genNoun : NounGender -> Gender ;
|
||||
sexNoun : NounGender -> Sex ;
|
||||
gen2nounGen : Gender -> NounGender ;
|
||||
|
||||
param
|
||||
AdjFormPos ;
|
||||
AdjFormSup = SupStrong | SupWeak ;
|
||||
|
||||
AdjFormGrad =
|
||||
Posit AdjFormPos
|
||||
| Compar
|
||||
| Super AdjFormSup ;
|
||||
|
||||
oper
|
||||
Adj : Type = {s : AdjForm => Str} ;
|
||||
|
||||
adverbForm : AdjFormPos = Strong (ASg neutrum) ;
|
||||
|
||||
--3 Verbs
|
||||
--
|
||||
-- Verbs have 9 finite forms and as many as 18 infinite forms; the large number
|
||||
-- of the latter comes from adjectives.
|
||||
|
||||
oper Verbum : Type = {s : VerbForm => Str} ;
|
||||
|
||||
param
|
||||
VFin =
|
||||
Pres Voice
|
||||
| Pret Voice
|
||||
| Imper Voice ;
|
||||
|
||||
VInf =
|
||||
Inf Voice
|
||||
| Supin Voice
|
||||
| PtPret AdjFormPos Case
|
||||
;
|
||||
|
||||
VerbForm =
|
||||
VF VFin
|
||||
| VI VInf ;
|
||||
|
||||
-- However, the syntax only needs a simplified verb category, with
|
||||
-- present tense only. Such a verb can be extracted from the full verb,
|
||||
-- and a choice can be made between an active and a passive (deponent) verb.
|
||||
-- Active verbs continue to have passive forms. But we add an extra field $s1$
|
||||
-- for a verb particle, as e.g. in "se upp".
|
||||
|
||||
oper
|
||||
Verb : Type = {s : VerbForm => Str ; s1 : Str} ;
|
||||
|
||||
vNopart : Verbum -> Verb = \v -> v ** {s1 = []} ;
|
||||
|
||||
--3 Other open classes
|
||||
--
|
||||
-- Proper names, adverbs (Adv having comparison forms and AdvIn not having them),
|
||||
-- and interjections are the remaining open classes.
|
||||
|
||||
oper
|
||||
PNm : Type = {s : Case => Str ; h1 : Gender} ;
|
||||
--- Adv : Type = {s : Degree => Str} ;
|
||||
AdvInv : Type = {s : Str} ;
|
||||
Interj : Type = {s : Str} ;
|
||||
|
||||
--3 Closed classes
|
||||
--
|
||||
-- The rest of the Swedish word classes are closed, i.e. not extensible by new
|
||||
-- lexical entries. Thus we don't have to know how to build them, but only
|
||||
-- how to use them, i.e. which parameters they have.
|
||||
--
|
||||
-- The most important distinction is between proper-name-like pronouns and
|
||||
-- adjective-like pronouns, which are inflected in completely different parameters.
|
||||
|
||||
param
|
||||
NPForm = PNom | PAcc | PGen GenNum ;
|
||||
AdjPronForm = APron GenNum Case ;
|
||||
AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ;
|
||||
|
||||
oper
|
||||
ProPN : Type = {s : NPForm => Str ; h1 : Gender ; h2 : Number ; h3 : Person} ;
|
||||
ProAdj : Type = {s : AdjPronForm => Str} ;
|
||||
Prep : Type = {s : Str} ;
|
||||
Conjunct : Type = {s : Str} ;
|
||||
Subjunct : Type = {s : Str} ;
|
||||
Art : Type = {s : GenNum => Str} ;
|
||||
Part : Type = {s : Str} ;
|
||||
Infin : Type = {s : Str} ;
|
||||
VAux : Type = {s : AuxVerbForm => Str} ;
|
||||
}
|
||||
44
lib/resource/scandinavian/VerbScand.gf
Normal file
44
lib/resource/scandinavian/VerbScand.gf
Normal file
@@ -0,0 +1,44 @@
|
||||
incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
UseV = predV ;
|
||||
ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! accusative) (predV v) ;
|
||||
ComplV3 v np np2 =
|
||||
insertObj
|
||||
(\\_ => v.c2 ++ np.s ! accusative ++ v.c3 ++ np2.s ! accusative)
|
||||
(predV v) ;
|
||||
|
||||
ComplVV v vp = insertObj (\\a => v.c2 ++ 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) ;
|
||||
ComplV2A v np ap =
|
||||
insertAdv
|
||||
(ap.s ! agrAdj np.a.gn DIndef)
|
||||
(insertObj (\\_ => v.c2 ++ np.s ! accusative) (predV v)) ;
|
||||
|
||||
UseComp comp = insertObj (\\a => comp.s ! agrAdj a.gn DIndef) (predV verbBe) ;
|
||||
|
||||
CompAP ap = ap ;
|
||||
CompNP np = {s = \\_ => np.s ! accusative} ;
|
||||
CompAdv a = {s = \\_ => a.s} ;
|
||||
|
||||
AdvVP vp adv = insertAdv adv.s vp ;
|
||||
AdVVP adv vp = insertAdV adv.s vp ;
|
||||
|
||||
|
||||
ReflV2 v = insertObj (\\a => v.c2 ++ reflPron a) (predV v) ;
|
||||
|
||||
PassV2 v =
|
||||
insertObj
|
||||
(\\a => v.s ! VI (VPtPret (agrAdj a.gn DIndef) Nom))
|
||||
(predV verbBecome) ;
|
||||
|
||||
UseVS, UseVQ = \vv ->
|
||||
vv ** {c2 = []} ;
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level English Resource Grammar: Combination Rules
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2003
|
||||
--
|
||||
-- This is the English concrete syntax of the multilingual resource
|
||||
-- grammar. Most of the work is done in the file $syntax.Eng.gf$.
|
||||
-- However, for the purpose of documentation, we make here explicit the
|
||||
-- linearization types of each category, so that their structures and
|
||||
-- dependencies can be seen.
|
||||
-- Another substantial part are the linearization rules of some
|
||||
-- structural words.
|
||||
--
|
||||
-- The users of the resource grammar should not look at this file for the
|
||||
-- linearization rules, which are in fact hidden in the document version.
|
||||
-- They should use $resource.Abs.gf$ to access the syntactic rules.
|
||||
-- This file can be consulted in those, hopefully rare, occasions in which
|
||||
-- one has to know how the syntactic categories are
|
||||
-- implemented. The parameter types are defined in $TypesEng.gf$.
|
||||
|
||||
incomplete concrete VerbphraseScand of Verbphrase = CategoriesScand **
|
||||
open Prelude, SyntaxScand in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
UseV = predVerb ;
|
||||
UsePassV = passVerb ;
|
||||
ComplV2 = complTransVerb ;
|
||||
ComplV3 = complDitransVerb ;
|
||||
ComplReflV2 = reflTransVerb ;
|
||||
ComplVS = complSentVerb ;
|
||||
ComplVV = complVerbVerb ;
|
||||
ComplVQ = complQuestVerb ;
|
||||
ComplVA = complAdjVerb ;
|
||||
ComplV2A = complDitransAdjVerb ;
|
||||
ComplSubjV2V = complDitransVerbVerb False ;
|
||||
ComplObjV2V = complDitransVerbVerb True ;
|
||||
ComplV2S = complDitransSentVerb ;
|
||||
ComplV2Q = complDitransQuestVerb ;
|
||||
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdv = predAdverb ;
|
||||
|
||||
PredProgVP = progressiveVerbPhrase ;
|
||||
|
||||
-- Use VPs
|
||||
|
||||
PredVP = predVerbGroupClause ;
|
||||
RelVP = relVerbPhrase ;
|
||||
IntVP = intVerbPhrase ;
|
||||
|
||||
-- PosVP tp = predVerbGroup True tp ;
|
||||
-- NegVP tp = predVerbGroup False tp ;
|
||||
UseVP = predVerbGroupI ;
|
||||
|
||||
AdvVP = adVerbPhrase ;
|
||||
SubjVP = subjunctVerbPhrase ;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user