mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-01 23:32:51 -06:00
parametrizad Scandinavian and added Danish
This commit is contained in:
4
lib/resource/danish/CategoriesDan.gf
Normal file
4
lib/resource/danish/CategoriesDan.gf
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
--# -path=.:../scandinavian:../abstract:../../prelude
|
||||||
|
|
||||||
|
concrete CategoriesDan of Categories =
|
||||||
|
CategoriesScand with (SyntaxScand=SyntaxDan) ;
|
||||||
228
lib/resource/danish/MorphoDan.gf
Normal file
228
lib/resource/danish/MorphoDan.gf
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
--1 A Simple Danish Resource Morphology
|
||||||
|
--
|
||||||
|
-- Aarne Ranta 2002
|
||||||
|
--
|
||||||
|
-- This resource morphology contains definitions needed in the resource
|
||||||
|
-- syntax. It moreover contains copies of the most usual inflectional patterns
|
||||||
|
-- as defined in functional morphology (in the Haskell file $RulesSw.hs$).
|
||||||
|
--
|
||||||
|
-- We use the parameter types and word classes defined for morphology.
|
||||||
|
|
||||||
|
resource MorphoDan = open Prelude, TypesDan in {
|
||||||
|
|
||||||
|
-- Danish grammar source: http://users.cybercity.dk/~nmb3879/danish.html
|
||||||
|
|
||||||
|
-- nouns
|
||||||
|
|
||||||
|
oper
|
||||||
|
mkSubstantive : (_,_,_,_ : Str) -> {s : SubstForm => Str} =
|
||||||
|
\dreng, drengen, drenge, drengene -> {s = table {
|
||||||
|
SF Sg Indef c => mkCase dreng ! c ;
|
||||||
|
SF Sg Def c => mkCase drengen ! c ;
|
||||||
|
SF Pl Indef c => mkCase drenge ! c ;
|
||||||
|
SF Pl Def c => mkCase drengene ! c
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
mkCase : Str -> Case => Str = \bil -> table {
|
||||||
|
Nom => bil ;
|
||||||
|
Gen => bil + "s" --- but: hus --> hus
|
||||||
|
} ;
|
||||||
|
|
||||||
|
nDreng : Str -> Subst = \dreng ->
|
||||||
|
mkSubstantive dreng (dreng + "en") (dreng + "e") (dreng + "ene") **
|
||||||
|
{h1 = Utr} ;
|
||||||
|
|
||||||
|
nBil : Str -> Subst = \bil ->
|
||||||
|
mkSubstantive bil (bil + "en") (bil + "er") (bil + "erne") **
|
||||||
|
{h1 = Utr} ;
|
||||||
|
|
||||||
|
nUge : Str -> Subst = \uge ->
|
||||||
|
mkSubstantive uge (uge + "n") (uge + "r") (uge + "rne") **
|
||||||
|
{h1 = Utr} ;
|
||||||
|
|
||||||
|
nHus : Str -> Subst = \hus ->
|
||||||
|
mkSubstantive hus (hus + "et") hus (hus + "ene") **
|
||||||
|
{h1 = Neutr} ;
|
||||||
|
|
||||||
|
-- adjectives
|
||||||
|
|
||||||
|
mkAdjective : (_,_,_,_,_ : Str) -> Adj =
|
||||||
|
\stor,stort,store,storre,storst -> {s = table {
|
||||||
|
AF (Posit (Strong (ASg Utr))) c => mkCase stor ! c ;
|
||||||
|
AF (Posit (Strong (ASg Neutr))) c => mkCase stort ! c ;
|
||||||
|
AF (Posit _) c => mkCase store ! c ;
|
||||||
|
AF Compar c => mkCase storre ! c ;
|
||||||
|
AF (Super SupStrong) c => mkCase storst ! c ;
|
||||||
|
AF (Super SupWeak) c => mkCase (storst + "e") ! c
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
aRod : Str -> Adj = \rod ->
|
||||||
|
mkAdjective rod (rod + "t") (rod + "e") (rod + "ere") (rod + "est") ;
|
||||||
|
|
||||||
|
aAbstrakt : Str -> Adj = \abstrakt ->
|
||||||
|
mkAdjective abstrakt abstrakt (abstrakt + "e") (abstrakt + "ere") (abstrakt + "est") ;
|
||||||
|
|
||||||
|
aRask : Str -> Adj = \rask ->
|
||||||
|
mkAdjective rask rask (rask + "e") (rask + "ere") (rask + "est") ;
|
||||||
|
|
||||||
|
-- verbs
|
||||||
|
|
||||||
|
mkVerb : (_,_,_,_,_,_ : Str) -> Verbum =
|
||||||
|
\spise,spiser,spises,spiste,spist,spis -> {s = table {
|
||||||
|
VI (Inf v) => mkVoice v spise ;
|
||||||
|
VF (Pres m Act) => spiser ;
|
||||||
|
VF (Pres m Pass) => spises ;
|
||||||
|
VF (Pret m v) => mkVoice v spiste ;
|
||||||
|
VI (Supin v) => mkVoice v spist ;
|
||||||
|
VI (PtPret c) => mkCase spist ! c ;
|
||||||
|
VF Imper => spis
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
mkVoice : Voice -> Str -> Str = \v,s -> case v of {
|
||||||
|
Act => s ;
|
||||||
|
Pass => s + "s"
|
||||||
|
} ;
|
||||||
|
|
||||||
|
vHusk : Str -> Verbum = \husk ->
|
||||||
|
mkVerb (husk + "e") (husk + "er") (husk + "es") (husk + "ede") (husk + "et") husk ;
|
||||||
|
|
||||||
|
vSpis : Str -> Verbum = \spis ->
|
||||||
|
mkVerb (spis + "e") (spis + "er") (spis + "es") (spis + "te") (spis + "t") spis ;
|
||||||
|
|
||||||
|
vBo : Str -> Verbum = \bo ->
|
||||||
|
mkVerb bo (bo + "r") (bo + "es") (bo + "ede") (bo + "et") bo ;
|
||||||
|
|
||||||
|
-- pronouns
|
||||||
|
|
||||||
|
oper jag_32 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "jeg" ;
|
||||||
|
PAcc => "mig" ;
|
||||||
|
PGen (ASg Utr) => "min" ;
|
||||||
|
PGen (ASg Neutr) => "mit" ;
|
||||||
|
PGen APl => "mine"
|
||||||
|
} ;
|
||||||
|
h1 = Utr ;
|
||||||
|
h2 = Sg ;
|
||||||
|
h3 = P1
|
||||||
|
} ;
|
||||||
|
|
||||||
|
oper du_33 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "du" ;
|
||||||
|
PAcc => "dig" ;
|
||||||
|
PGen (ASg Utr) => "din" ;
|
||||||
|
PGen (ASg Neutr) => "dit" ;
|
||||||
|
PGen APl => "dine"
|
||||||
|
} ;
|
||||||
|
h1 = Utr ;
|
||||||
|
h2 = Sg ;
|
||||||
|
h3 = P2
|
||||||
|
} ;
|
||||||
|
|
||||||
|
oper han_34 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "han" ;
|
||||||
|
PAcc => "ham" ;
|
||||||
|
PGen (ASg Utr) => "hans" ;
|
||||||
|
PGen (ASg Neutr) => "hans" ;
|
||||||
|
PGen APl => "hans"
|
||||||
|
} ;
|
||||||
|
h1 = Utr ;
|
||||||
|
h2 = Sg ;
|
||||||
|
h3 = P3
|
||||||
|
} ;
|
||||||
|
oper hon_35 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "hun" ;
|
||||||
|
PAcc => "hende" ;
|
||||||
|
PGen (ASg Utr) => "hendes" ;
|
||||||
|
PGen (ASg Neutr) => "hendes" ;
|
||||||
|
PGen APl => "hendes"
|
||||||
|
} ;
|
||||||
|
h1 = Utr ;
|
||||||
|
h2 = Sg ;
|
||||||
|
h3 = P3
|
||||||
|
} ;
|
||||||
|
|
||||||
|
oper vi_36 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "vi" ;
|
||||||
|
PAcc => "os" ;
|
||||||
|
PGen _ => "vores"
|
||||||
|
} ;
|
||||||
|
h1 = Utr ;
|
||||||
|
h2 = Pl ;
|
||||||
|
h3 = P1
|
||||||
|
} ;
|
||||||
|
|
||||||
|
oper ni_37 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "i" ;
|
||||||
|
PAcc => "jer" ;
|
||||||
|
PGen _ => "jeres"
|
||||||
|
} ;
|
||||||
|
h1 = Utr ;
|
||||||
|
h2 = Pl ;
|
||||||
|
h3 = P2
|
||||||
|
} ;
|
||||||
|
|
||||||
|
oper de_38 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "de" ;
|
||||||
|
PAcc => "dem" ;
|
||||||
|
PGen _ => "deres"
|
||||||
|
} ;
|
||||||
|
h1 = Utr ;
|
||||||
|
h2 = Pl ;
|
||||||
|
h3 = P3
|
||||||
|
} ;
|
||||||
|
|
||||||
|
oper De_38 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "De" ;
|
||||||
|
PAcc => "Dem" ;
|
||||||
|
PGen _ => "Deres"
|
||||||
|
} ;
|
||||||
|
h1 = Utr ;
|
||||||
|
h2 = Sg ;
|
||||||
|
h3 = P2
|
||||||
|
} ;
|
||||||
|
|
||||||
|
oper den_39 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "den" ;
|
||||||
|
PAcc => "den" ;
|
||||||
|
PGen _ => "dens"
|
||||||
|
} ;
|
||||||
|
h1 = Utr ;
|
||||||
|
h2 = Sg ;
|
||||||
|
h3 = P3
|
||||||
|
} ;
|
||||||
|
|
||||||
|
oper det_40 : ProPN =
|
||||||
|
{s = table {
|
||||||
|
PNom => "det" ;
|
||||||
|
PAcc => "det" ;
|
||||||
|
PGen _ => "dets"
|
||||||
|
} ;
|
||||||
|
h1 = Neutr ;
|
||||||
|
h2 = Sg ;
|
||||||
|
h3 = P3
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
-- from Numerals
|
||||||
|
|
||||||
|
param DForm = ental | ton | tiotal ;
|
||||||
|
|
||||||
|
oper mkTal : Str -> Str -> Str -> {s : DForm => Str} =
|
||||||
|
\to, tolv, tyve ->
|
||||||
|
{s = table {ental => to ; ton => tolv ; tiotal => tyve}} ;
|
||||||
|
oper regTal : Str -> {s : DForm => Str} = \fem -> mkTal fem (fem + "ton") (fem + "tio") ;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
37
lib/resource/danish/NumeralsDan.gf
Normal file
37
lib/resource/danish/NumeralsDan.gf
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
-- AR 12/10/2002 following www.geocities.com/tsca.geo/dansk/dknummer.html
|
||||||
|
|
||||||
|
concrete NumeralsDan of Numerals = open Prelude, MorphoDan in {
|
||||||
|
|
||||||
|
lincat Numeral = {s : Str} ;
|
||||||
|
lincat Digit = {s : DForm => Str} ;
|
||||||
|
lincat Sub10 = {s : DForm => Str} ;
|
||||||
|
lincat Sub100 = {s : Str} ;
|
||||||
|
lincat Sub1000 = {s : Str} ;
|
||||||
|
lincat Sub1000000 = {s : Str} ;
|
||||||
|
|
||||||
|
lin num x = x ;
|
||||||
|
|
||||||
|
lin n2 = mkTal "to" "tolv" "tyve" ;
|
||||||
|
lin n3 = mkTal "tre" "tretten" "tredive" ;
|
||||||
|
lin n4 = mkTal "fire" "fjorten" "fyrre" ;
|
||||||
|
lin n5 = mkTal "fem" "femten" "halvtreds" ;
|
||||||
|
lin n6 = mkTal "seks" "seksten" "tres" ;
|
||||||
|
lin n7 = mkTal "syv" "sytten" "halvfjerds" ;
|
||||||
|
lin n8 = mkTal "otte" "atten" "firs" ;
|
||||||
|
lin n9 = mkTal "ni" "nitten" "halvfems" ;
|
||||||
|
|
||||||
|
lin pot01 = {s = table {f => "en"}} ; ---
|
||||||
|
lin pot0 d = {s = table {f => d.s ! f}} ;
|
||||||
|
lin pot110 = ss "ti" ;
|
||||||
|
lin pot111 = ss "elleve" ;
|
||||||
|
lin pot1to19 d = ss (d.s ! ton) ;
|
||||||
|
lin pot0as1 n = ss (n.s ! ental) ;
|
||||||
|
lin pot1 d = ss (d.s ! tiotal) ;
|
||||||
|
lin pot1plus d e = ss (e.s ! ental ++ "og" ++ d.s ! tiotal) ;
|
||||||
|
lin pot1as2 n = n ;
|
||||||
|
lin pot2 d = ss (d.s ! ental ++ "hundrede") ;
|
||||||
|
lin pot2plus d e = ss (d.s ! ental ++ "hundrede" ++ "og" ++ e.s) ;
|
||||||
|
lin pot2as3 n = n ;
|
||||||
|
lin pot3 n = ss (n.s ++ "tusind") ;
|
||||||
|
lin pot3plus n m = ss (n.s ++ "tusind" ++ "og" ++ m.s) ; ---
|
||||||
|
}
|
||||||
4
lib/resource/danish/RulesDan.gf
Normal file
4
lib/resource/danish/RulesDan.gf
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
--# -path=.:../scandinavian:../abstract:../../prelude
|
||||||
|
|
||||||
|
concrete RulesDan of Rules =
|
||||||
|
RulesScand with (SyntaxScand=SyntaxDan) ;
|
||||||
118
lib/resource/danish/StructuralDan.gf
Normal file
118
lib/resource/danish/StructuralDan.gf
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
--# -path=.:../scandinavian:../abstract:../../prelude
|
||||||
|
|
||||||
|
--1 The Top-Level Swedish Resource Grammar: Structural Words
|
||||||
|
--
|
||||||
|
-- Aarne Ranta 2002 -- 2004
|
||||||
|
--
|
||||||
|
concrete StructuralDan of Structural =
|
||||||
|
CategoriesDan, NumeralsDan ** open Prelude, MorphoDan, SyntaxDan in {
|
||||||
|
lin
|
||||||
|
|
||||||
|
INP = pronNounPhrase jag_32 ;
|
||||||
|
ThouNP = pronNounPhrase du_33 ;
|
||||||
|
HeNP = pronNounPhrase han_34 ;
|
||||||
|
SheNP = pronNounPhrase hon_35 ;
|
||||||
|
WeNumNP n = pronNounPhrase (pronWithNum vi_36 n) ;
|
||||||
|
YeNumNP n = pronNounPhrase (pronWithNum ni_37 n) ;
|
||||||
|
TheyNP = pronNounPhrase de_38 ;
|
||||||
|
TheyFemNP = pronNounPhrase de_38 ;
|
||||||
|
|
||||||
|
YouNP = let {ni = pronNounPhrase ni_37 } in {s = ni.s ; g = ni.g ; n = Sg} ;
|
||||||
|
|
||||||
|
ItNP = pronNounPhrase det_40 ; ----
|
||||||
|
ThisNP = regNameNounPhrase ["det her"] NNeutr ;
|
||||||
|
ThatNP = regNameNounPhrase ["det der"] NNeutr ;
|
||||||
|
TheseNumNP n =
|
||||||
|
{s = \\c => ["de her"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||||
|
ThoseNumNP n =
|
||||||
|
{s = \\c => ["de der"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||||
|
|
||||||
|
EveryDet = varjeDet ;
|
||||||
|
AllMassDet = mkDeterminerSgGender2 "all" "alt" IndefP ;
|
||||||
|
AllNumDet = mkDeterminerPlNum "alle" IndefP ;
|
||||||
|
AnyDet = mkDeterminerSgGender2 "nogen" "noget" IndefP ;
|
||||||
|
AnyNumDet = mkDeterminerPlNum "nogle" IndefP ;
|
||||||
|
SomeDet = mkDeterminerSgGender2 "nogen" "noget" IndefP ;
|
||||||
|
SomeNumDet = mkDeterminerPlNum "nogle" IndefP ;
|
||||||
|
ManyDet = mkDeterminerPl "mange" IndefP ;
|
||||||
|
HowManyDet = mkDeterminerPl ["hvor mange"] IndefP ;
|
||||||
|
NoDet = mkDeterminerSgGender2 "ingen" "ingen" IndefP ;
|
||||||
|
NoNumDet = mkDeterminerPlNum "ingen" IndefP ;
|
||||||
|
WhichNumDet = mkDeterminerPlNum "hvilke" IndefP ;
|
||||||
|
|
||||||
|
UseNumeral i = {s = table {Nom => i.s ; Gen => i.s ++ "s"}} ; ---
|
||||||
|
|
||||||
|
WhichDet = vilkenDet ;
|
||||||
|
MostDet = mkDeterminerSgGender2 ["den meste"] ["det meste"] (DefP Def) ;
|
||||||
|
MostsDet = flestaDet ;
|
||||||
|
MuchDet = mkDeterminerSg (detSgInvar "meget") IndefP ;
|
||||||
|
|
||||||
|
ThisDet = mkDeterminerSgGender2 ["den her"] ["det her"] (DefP Def) ;
|
||||||
|
ThatDet = mkDeterminerSgGender2 ["den der"] ["det der"] (DefP Def) ;
|
||||||
|
TheseNumDet = mkDeterminerPlNum ["de her"] (DefP Def) ;
|
||||||
|
ThoseNumDet = mkDeterminerPlNum ["de der"] (DefP Def) ;
|
||||||
|
|
||||||
|
HowIAdv = ss "hvor" ;
|
||||||
|
WhenIAdv = ss "hvornår" ;
|
||||||
|
WhereIAdv = ss "hver" ;
|
||||||
|
WhyIAdv = ss "hvorfor" ;
|
||||||
|
|
||||||
|
AndConj = ss "og" ** {n = Pl} ;
|
||||||
|
OrConj = ss "eller" ** {n = Sg} ;
|
||||||
|
BothAnd = sd2 "både" "og" ** {n = Pl} ;
|
||||||
|
EitherOr = sd2 "enten" "eller" ** {n = Sg} ;
|
||||||
|
NeitherNor = sd2 "hverken" "eller" ** {n = Sg} ;
|
||||||
|
IfSubj = ss "hvis" ;
|
||||||
|
WhenSubj = ss "når" ;
|
||||||
|
|
||||||
|
PhrYes = ss ["Ja ."] ;
|
||||||
|
PhrNo = ss ["Nej ."] ;
|
||||||
|
|
||||||
|
VeryAdv = ss "meget" ;
|
||||||
|
TooAdv = ss "for" ; ---- ?
|
||||||
|
OtherwiseAdv = ss "anderledes" ; ---- ?
|
||||||
|
ThereforeAdv = ss "derfor" ;
|
||||||
|
|
||||||
|
EverybodyNP = let alla = table {Nom => "alle" ; Gen => "alles"} in
|
||||||
|
{s = \\c => alla ! npCase c ; g = Utr ; n = Pl} ;
|
||||||
|
SomebodyNP = nameNounPhrase (mkProperName "nogen" NUtr) ;
|
||||||
|
NobodyNP = nameNounPhrase (mkProperName "ingen" NUtr) ;
|
||||||
|
EverythingNP = nameNounPhrase (mkProperName "alt" NNeutr) ;
|
||||||
|
SomethingNP = nameNounPhrase (mkProperName "noget" NNeutr) ;
|
||||||
|
NothingNP = nameNounPhrase (mkProperName "intet" NNeutr) ;
|
||||||
|
|
||||||
|
CanVV = mkVerb "kunne" "kan" nonExist "kunne" "kunnet" nonExist ** {s1 = [] ; isAux = True} ;
|
||||||
|
CanKnowVV = mkVerb "kunne" "kan" nonExist "kunne" "kunnet" nonExist ** {s1 = [] ; isAux = True} ;
|
||||||
|
MustVV = mkVerb "måtte" "må" "mås" "måtte" "måttet" "må" ** {s1 = [] ; isAux = True} ; ---- ?
|
||||||
|
WantVV = mkVerb "ville" "vil" nonExist "ville" "villet" nonExist ** {s1 = [] ; isAux = True} ; ---
|
||||||
|
|
||||||
|
EverywhereNP = advPost "overalt" ;
|
||||||
|
SomewhereNP = advPost ["et eller andet sted"] ; ---- ?
|
||||||
|
NowhereNP = advPost "intetsteds" ;
|
||||||
|
|
||||||
|
AlthoughSubj = ss ["selv om"] ;
|
||||||
|
|
||||||
|
AlmostAdv = ss "næsten" ;
|
||||||
|
QuiteAdv = ss "temmelig" ;
|
||||||
|
|
||||||
|
InPrep = ss "i" ;
|
||||||
|
OnPrep = ss "på" ;
|
||||||
|
ToPrep = ss "til" ;
|
||||||
|
ThroughPrep = ss "igennem" ;
|
||||||
|
AbovePrep = ss "ovenfor" ;
|
||||||
|
UnderPrep = ss "under" ;
|
||||||
|
InFrontPrep = ss "fremfor" ; ---- ?
|
||||||
|
BehindPrep = ss "bag" ;
|
||||||
|
BetweenPrep = ss "mellem" ;
|
||||||
|
FromPrep = ss "fra" ;
|
||||||
|
BeforePrep = ss "før" ;
|
||||||
|
DuringPrep = ss "under" ;
|
||||||
|
AfterPrep = ss "efter" ;
|
||||||
|
WithPrep = ss "med" ;
|
||||||
|
WithoutPrep = ss "uden" ;
|
||||||
|
ByMeansPrep = ss "med" ;
|
||||||
|
PossessPrep = ss "af" ;
|
||||||
|
PartPrep = ss "af" ;
|
||||||
|
AgentPrep = ss "af" ;
|
||||||
|
|
||||||
|
}
|
||||||
104
lib/resource/danish/SyntaxDan.gf
Normal file
104
lib/resource/danish/SyntaxDan.gf
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
--# -path=.:../scandinavian:../../prelude
|
||||||
|
|
||||||
|
instance SyntaxDan of SyntaxScand = TypesDan **
|
||||||
|
open Prelude, (CO = Coordination), MorphoDan in {
|
||||||
|
|
||||||
|
oper
|
||||||
|
|
||||||
|
------ mkAdjForm
|
||||||
|
|
||||||
|
-- When common nouns are extracted from lexicon, the composite noun form is ignored.
|
||||||
|
|
||||||
|
extCommonNounMasc = extCommNoun ;
|
||||||
|
|
||||||
|
npMan : NounPhrase = nameNounPhrase (mkProperName "man" NUtr) ;
|
||||||
|
npDet : NounPhrase = nameNounPhrase (mkProperName "det" NNeutr) ;
|
||||||
|
|
||||||
|
|
||||||
|
mkAdjForm : Species -> Number -> NounGender -> AdjFormPos = \b,n,g ->
|
||||||
|
case <b,n> of {
|
||||||
|
<Indef,Sg> => Strong (ASg (genNoun g)) ;
|
||||||
|
<Indef,Pl> => Strong APl ;
|
||||||
|
<Def, _> => Weak
|
||||||
|
} ;
|
||||||
|
|
||||||
|
deponentVerb : Verb -> Verb = \finna -> {
|
||||||
|
s = table {
|
||||||
|
VF (Pres m _) => finna.s ! VF (Pres m Pass) ;
|
||||||
|
VF (Pret m _) => finna.s ! VF (Pret m Pass) ;
|
||||||
|
VI (Inf _) => finna.s ! VI (Inf Pass) ;
|
||||||
|
VI (Supin _) => finna.s ! VI (Supin Pass) ;
|
||||||
|
v => finna.s ! v --- Imper !
|
||||||
|
} ;
|
||||||
|
s1 = finna.s1
|
||||||
|
} ;
|
||||||
|
|
||||||
|
verbFinnas : Verb =
|
||||||
|
deponentVerb (mkVerb "finde" "finder" "findes" "fandt" "fundet" "find" ** {s1 = []}) ;
|
||||||
|
verbVara = mkVerb "være" "er" nonExist "var" "været" "vær" ** {s1 = []} ;
|
||||||
|
verbHava = mkVerb "have" "har" "haves" "havde" "haft" "hav" ** {s1 = []} ;
|
||||||
|
|
||||||
|
relPronForms : RelCase => GenNum => Str = table {
|
||||||
|
RNom => \\_ => "som" ;
|
||||||
|
RAcc => \\_ => variants {"som" ; []} ;
|
||||||
|
RGen => \\_ => "hvis" ;
|
||||||
|
RPrep => pronVilken
|
||||||
|
} ;
|
||||||
|
|
||||||
|
pronVilken = table {
|
||||||
|
ASg Utr => "hvilken" ;
|
||||||
|
ASg Neutr => "hvilket" ;
|
||||||
|
APl => "hvilke"
|
||||||
|
} ;
|
||||||
|
|
||||||
|
pronSådan = table {
|
||||||
|
ASg Utr => "sådan" ;
|
||||||
|
ASg Neutr => "sådant" ;
|
||||||
|
APl => "sådanne"
|
||||||
|
} ;
|
||||||
|
|
||||||
|
pronNågon = table {
|
||||||
|
ASg Utr => "nogen" ;
|
||||||
|
ASg Neutr => "noget" ;
|
||||||
|
APl => "nogle"
|
||||||
|
} ;
|
||||||
|
|
||||||
|
specDefPhrase : Bool -> Species = \b ->
|
||||||
|
if_then_else Species b Indef Def ;
|
||||||
|
|
||||||
|
superlSpecies = Indef ;
|
||||||
|
|
||||||
|
artIndef = table {Utr => "en" ; Neutr => "et"} ;
|
||||||
|
|
||||||
|
artDef : Bool => GenNum => Str = table {
|
||||||
|
True => table {
|
||||||
|
ASg Utr => "den" ;
|
||||||
|
ASg Neutr => "det" ; -- det gamla huset
|
||||||
|
APl => variants {"de"}
|
||||||
|
} ;
|
||||||
|
False => table {_ => []} -- huset
|
||||||
|
} ;
|
||||||
|
|
||||||
|
auxHar = "har" ;
|
||||||
|
auxHade = "havde" ;
|
||||||
|
auxHa = "have" ;
|
||||||
|
auxSka = "skal" ;
|
||||||
|
auxSkulle = "skulle" ;
|
||||||
|
|
||||||
|
infinAtt = "at" ;
|
||||||
|
|
||||||
|
varjeDet : Determiner = mkDeterminerSg (detSgInvar "hver") IndefP ;
|
||||||
|
allaDet : Determiner = mkDeterminerPl "alle" IndefP ;
|
||||||
|
flestaDet : Determiner = mkDeterminerPl ["de fleste"] IndefP ;
|
||||||
|
|
||||||
|
prepÄn = "end" ;
|
||||||
|
negInte = "ikke" ;
|
||||||
|
|
||||||
|
conjOm = "hvis" ;
|
||||||
|
|
||||||
|
pronVars = "hvis" ;
|
||||||
|
pronVem = "hvem" ;
|
||||||
|
pronVems = "hvis" ; ---- ??
|
||||||
|
pronVad = "hvad" ;
|
||||||
|
|
||||||
|
}
|
||||||
50
lib/resource/danish/TestResourceDan.gf
Normal file
50
lib/resource/danish/TestResourceDan.gf
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
--# -path=.:../scandinavian:../abstract:../../prelude
|
||||||
|
|
||||||
|
concrete TestResourceDan of TestResource = RulesDan, StructuralDan ** open MorphoDan, SyntaxDan in {
|
||||||
|
|
||||||
|
flags startcat=Phr ; lexer=text ; unlexer=text ;
|
||||||
|
|
||||||
|
-- a random sample from the lexicon
|
||||||
|
|
||||||
|
lin
|
||||||
|
Big = mkAdjective "stor" "stort" "store" "større" "størst" ;
|
||||||
|
Small = mkAdjective "lille" "lille" "små" "mindre" "mindst" ;
|
||||||
|
Old = mkAdjective "gammel" "gammelt" "gamle" "ældre" "ældst" ;
|
||||||
|
Young = mkAdjective "ung" "ungt" "unge" "yngre" "yngst" ;
|
||||||
|
American = extAdjective (aRod "amerikansk") ;
|
||||||
|
Finnish = extAdjective (aRod "finsk") ;
|
||||||
|
Happy = aRod "lykkelig" ;
|
||||||
|
Married = extAdjective (aAbstrakt "gift") ** {s2 = "med"} ;
|
||||||
|
Man = extCommNoun (mkSubstantive "mand" "manden" "mænd" "mænden" ** {h1 = Utr}) ;
|
||||||
|
Bar = extCommNoun (nBil "bar") ; ---- ?
|
||||||
|
Bottle = extCommNoun (nUge "flaske") ;
|
||||||
|
Woman = extCommNoun (nUge "kvinde") ;
|
||||||
|
Car = extCommNoun (nBil "bil") ;
|
||||||
|
House = extCommNoun (nHus "hus") ;
|
||||||
|
Light = extCommNoun (nHus "lys") ;
|
||||||
|
Wine = extCommNoun (nHus "vin") ; ---- ?
|
||||||
|
Walk = mkVerb "gå" "går" "gås" "gik" "gået" "gå" ** {s1 = []} ;
|
||||||
|
Run = mkVerb "springe" "springer" "springes" "sprang" "sprunget" "spring" ** {s1 = []} ;
|
||||||
|
Drink = extTransVerb (mkVerb "drikke" "drikker" "drikkes" "drak" "drukket" "drikk" ** {s1 = []}) [] ;
|
||||||
|
Love = extTransVerb (vNopart (vHusk "ælsk")) [] ;
|
||||||
|
Send = extTransVerb (vNopart (vSpis "send")) [] ; ---- ?
|
||||||
|
Wait = extTransVerb (vNopart (vSpis "vent")) "på" ;
|
||||||
|
Give = extTransVerb (vNopart (mkVerb "give" "giver" "gives" "gav" "givet" "giv")) [] ** {s3 = "til"} ;
|
||||||
|
Prefer = extTransVerb (vNopart (vSpis "foretrækk")) [] ** {s3 = "for"} ;
|
||||||
|
|
||||||
|
Say = vNopart (mkVerb "sige" "siger" "siges" "sagde" "sagt" "sig") ;
|
||||||
|
Prove = vNopart (vSpis "bevise") ;
|
||||||
|
SwitchOn = mkDirectVerb (vHusk "lukk" ** {s1 = "op"}) ;
|
||||||
|
SwitchOff = mkDirectVerb (vHusk "slukk" ** {s1 = []}) ;
|
||||||
|
|
||||||
|
Mother = mkFun (extCommNoun (mkSubstantive "moder" "moderen" "mødre"
|
||||||
|
"mødrene" ** {h1 = Utr})) "til" ; ---- ?
|
||||||
|
Uncle = mkFun (extCommNoun (mkSubstantive "onkel" "onkelen" "onkler" "onklene" ** {h1 = Utr})) "til" ; ---- ?
|
||||||
|
Connection = mkFun (extCommNoun (nUge "forbindelse")) "fra" ** {s3 = "til"} ;
|
||||||
|
|
||||||
|
Always = advPre "altid" ;
|
||||||
|
Well = advPost "godt" ;
|
||||||
|
|
||||||
|
John = mkProperName "Johan" NUtr ;
|
||||||
|
Mary = mkProperName "Maria" NUtr ;
|
||||||
|
} ;
|
||||||
33
lib/resource/danish/TypesDan.gf
Normal file
33
lib/resource/danish/TypesDan.gf
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
--1 Danish Word Classes and Morphological Parameters
|
||||||
|
--
|
||||||
|
-- This is a resource module for Italian morphology, defining the
|
||||||
|
-- morphological parameters and word classes of Italian.
|
||||||
|
-- The morphology is so far only
|
||||||
|
-- complete w.r.t. the syntax part of the resource grammar.
|
||||||
|
-- It does not include those parameters that are not needed for
|
||||||
|
-- analysing individual words: such parameters are defined in syntax modules.
|
||||||
|
|
||||||
|
instance TypesDan of TypesScand = {
|
||||||
|
|
||||||
|
param
|
||||||
|
NounGender = NUtr | NNeutr ;
|
||||||
|
|
||||||
|
oper
|
||||||
|
genNoun = \s -> case s of {NUtr => Utr ; NNeutr => Neutr} ;
|
||||||
|
sexNoun _ = NoMasc ;
|
||||||
|
gen2nounGen = \s -> case s of {Utr => NUtr ; Neutr => NNeutr} ;
|
||||||
|
|
||||||
|
param
|
||||||
|
AdjFormPos = Strong GenNum | Weak ;
|
||||||
|
|
||||||
|
VFin =
|
||||||
|
Pres Mode Voice
|
||||||
|
| Pret Mode Voice
|
||||||
|
| Imper ; --- no passive
|
||||||
|
|
||||||
|
VInf =
|
||||||
|
Inf Voice
|
||||||
|
| Supin Voice
|
||||||
|
| PtPret Case ; ---- number and gender
|
||||||
|
|
||||||
|
}
|
||||||
63
lib/resource/scandinavian/CategoriesScand.gf
Normal file
63
lib/resource/scandinavian/CategoriesScand.gf
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
incomplete concrete CategoriesScand of Categories =
|
||||||
|
open Prelude, SyntaxScand in {
|
||||||
|
|
||||||
|
flags
|
||||||
|
startcat=Phr ;
|
||||||
|
lexer=text ;
|
||||||
|
unlexer=text ;
|
||||||
|
|
||||||
|
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} ;
|
||||||
|
PN = {s : Case => Str ; g : NounGender} ;
|
||||||
|
Det = {s : NounGender => Str ; n : Number ; b : SpeciesP} ;
|
||||||
|
N2 = Function ;
|
||||||
|
-- = CommNoun ** {s2 : Preposition} ;
|
||||||
|
N3 = Function ** {s3 : Preposition} ;
|
||||||
|
Num = {s : Case => Str} ;
|
||||||
|
Prep = {s : Str} ;
|
||||||
|
|
||||||
|
A = Adjective ;
|
||||||
|
-- = {s : AdjFormPos => Case => Str} ;
|
||||||
|
A2 = Adjective ** {s2 : Preposition} ;
|
||||||
|
ADeg = {s : AdjForm => Str} ;
|
||||||
|
AP = Adjective ** {p : IsPostfixAdj} ;
|
||||||
|
|
||||||
|
V = Verb ;
|
||||||
|
-- = {s : VerbForm => Str ; s1 : Str} ;
|
||||||
|
VG = {s : SForm => Str ; s2 : Bool => Str ; s3 : SForm => Gender => Number => Str} ;
|
||||||
|
VP = {s : SForm => Str ; s2 : Str ; s3 : SForm => Gender => Number => Str} ;
|
||||||
|
V2 = TransVerb ;
|
||||||
|
-- = Verb ** {s2 : Preposition} ;
|
||||||
|
V3 = TransVerb ** {s3 : Preposition} ;
|
||||||
|
VS = Verb ;
|
||||||
|
VV = Verb ** {isAux : Bool} ;
|
||||||
|
|
||||||
|
Adv = Adverb ;
|
||||||
|
-- = {s : Str ; isPost : Bool} ;
|
||||||
|
PP = Adverb ;
|
||||||
|
|
||||||
|
S = Sentence ;
|
||||||
|
-- = {s : Order => Str} ;
|
||||||
|
Cl = Clause ;
|
||||||
|
-- = {s : Bool => SForm => Order => Str} ;
|
||||||
|
Slash = Sentence ** {s2 : Preposition} ;
|
||||||
|
RP = {s : RelCase => GenNum => Str ; g : RelGender} ;
|
||||||
|
RC = {s : GenNum => Str} ;
|
||||||
|
IP = NounPhrase ;
|
||||||
|
Qu = {s : 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} ;
|
||||||
|
}
|
||||||
141
lib/resource/scandinavian/RulesScand.gf
Normal file
141
lib/resource/scandinavian/RulesScand.gf
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
--# -path=.:../abstract:../../prelude
|
||||||
|
|
||||||
|
incomplete concrete RulesScand of Rules = CategoriesScand **
|
||||||
|
open Prelude, SyntaxScand in {
|
||||||
|
|
||||||
|
lin
|
||||||
|
UseN = noun2CommNounPhrase ;
|
||||||
|
ModAP = modCommNounPhrase ;
|
||||||
|
ModGenOne = npGenDet singular noNum ;
|
||||||
|
ModGenNum = npGenDet plural ;
|
||||||
|
UsePN = nameNounPhrase ;
|
||||||
|
UseN2 = funAsCommNounPhrase ;
|
||||||
|
AppN2 = appFunComm ;
|
||||||
|
AppN3 = appFun2 ;
|
||||||
|
UseA = adj2adjPhrase ;
|
||||||
|
ComplA2 = complAdj ;
|
||||||
|
PositADeg = positAdjPhrase ;
|
||||||
|
ComparADeg = comparAdjPhrase ;
|
||||||
|
SuperlNP = superlNounPhrase ;
|
||||||
|
|
||||||
|
DetNP = detNounPhrase ;
|
||||||
|
IndefOneNP = indefNounPhrase singular ;
|
||||||
|
IndefNumNP = indefNounPhraseNum plural ;
|
||||||
|
DefOneNP = defNounPhrase singular ;
|
||||||
|
DefNumNP = defNounPhraseNum plural ;
|
||||||
|
MassNP = detNounPhrase (mkDeterminerSg (detSgInvar []) IndefP) ;
|
||||||
|
UseInt i = {s = table {Nom => i.s ; Gen => i.s ++ "s"}} ; ---
|
||||||
|
NoNum = noNum ;
|
||||||
|
|
||||||
|
SymbPN i = {s = \\_ => i.s ; g = NNeutr} ;
|
||||||
|
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
|
||||||
|
} ;
|
||||||
|
|
||||||
|
CNthatS = nounThatSentence ;
|
||||||
|
|
||||||
|
PredVP = predVerbPhrase ;
|
||||||
|
|
||||||
|
PosVG = predVerbGroup True ;
|
||||||
|
NegVG = predVerbGroup False ;
|
||||||
|
|
||||||
|
PredVG = predVerbGroupClause ;
|
||||||
|
|
||||||
|
PredV = predVerb ;
|
||||||
|
PredAP = predAdjective ;
|
||||||
|
PredSuperl a = predAdjective (superlAdjPhrase a) ;
|
||||||
|
PredCN = predCommNoun ;
|
||||||
|
PredV2 = complTransVerb ;
|
||||||
|
PredV3 = complDitransVerb ;
|
||||||
|
PredPassV = passVerb ;
|
||||||
|
PredNP = predNounPhrase ;
|
||||||
|
PredPP = predAdverb ;
|
||||||
|
PredVS = complSentVerb ;
|
||||||
|
PredVV = complVerbVerb ;
|
||||||
|
VTrans = transAsVerb ;
|
||||||
|
|
||||||
|
AdjAdv a = advPost (a.s ! adverbForm ! Nom) ;
|
||||||
|
AdvPP p = p ;
|
||||||
|
PrepNP p = prepPhrase p.s ; ---
|
||||||
|
AdvVP = adVerbPhrase ;
|
||||||
|
AdvCN = advCommNounPhrase ;
|
||||||
|
AdvAP = advAdjPhrase ;
|
||||||
|
|
||||||
|
ThereNP A = predVerbPhrase npDet
|
||||||
|
(predVerbGroup True
|
||||||
|
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) A)) ;
|
||||||
|
|
||||||
|
PosSlashV2 = slashTransVerb True ;
|
||||||
|
NegSlashV2 = slashTransVerb False ;
|
||||||
|
OneVP = predVerbPhrase npMan ;
|
||||||
|
|
||||||
|
IdRP = identRelPron ;
|
||||||
|
FunRP = funRelPron ;
|
||||||
|
RelVP = relVerbPhrase ;
|
||||||
|
RelSlash = relSlash ;
|
||||||
|
ModRC = modRelClause ;
|
||||||
|
RelSuch = relSuch ;
|
||||||
|
|
||||||
|
WhoOne = intPronWho singular ;
|
||||||
|
WhoMany = intPronWho plural ;
|
||||||
|
WhatOne = intPronWhat singular ;
|
||||||
|
WhatMany = intPronWhat plural ;
|
||||||
|
FunIP = funIntPron ;
|
||||||
|
NounIPOne = nounIntPron singular ;
|
||||||
|
NounIPMany = nounIntPron plural ;
|
||||||
|
|
||||||
|
QuestVP = questVerbPhrase ;
|
||||||
|
IntVP = intVerbPhrase ;
|
||||||
|
IntSlash = intSlash ;
|
||||||
|
QuestAdv = questAdverbial ;
|
||||||
|
IsThereNP A = questVerbPhrase npDet
|
||||||
|
(predVerbGroup True
|
||||||
|
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) A)) ;
|
||||||
|
|
||||||
|
ImperVP = imperVerbPhrase ;
|
||||||
|
|
||||||
|
IndicPhrase = indicUtt ;
|
||||||
|
QuestPhrase = interrogUtt ;
|
||||||
|
ImperOne = imperUtterance singular ;
|
||||||
|
ImperMany = imperUtterance plural ;
|
||||||
|
|
||||||
|
PrepS p = ss (p.s ++ ",") ;
|
||||||
|
AdvS = advSentence ;
|
||||||
|
|
||||||
|
TwoS = twoSentence ;
|
||||||
|
ConsS = consSentence ;
|
||||||
|
ConjS = conjunctSentence ;
|
||||||
|
ConjDS = conjunctDistrSentence ;
|
||||||
|
|
||||||
|
TwoAP = twoAdjPhrase ;
|
||||||
|
ConsAP = consAdjPhrase ;
|
||||||
|
ConjAP = conjunctAdjPhrase ;
|
||||||
|
ConjDAP = conjunctDistrAdjPhrase ;
|
||||||
|
|
||||||
|
TwoNP = twoNounPhrase ;
|
||||||
|
ConsNP = consNounPhrase ;
|
||||||
|
ConjNP = conjunctNounPhrase ;
|
||||||
|
ConjDNP = conjunctDistrNounPhrase ;
|
||||||
|
|
||||||
|
SubjS = subjunctSentence ;
|
||||||
|
SubjImper = subjunctImperative ;
|
||||||
|
SubjQu = subjunctQuestion ;
|
||||||
|
SubjVP = subjunctVerbPhrase ;
|
||||||
|
|
||||||
|
PhrNP = useNounPhrase ;
|
||||||
|
PhrOneCN = useCommonNounPhrase singular ;
|
||||||
|
PhrManyCN = useCommonNounPhrase plural ;
|
||||||
|
PhrIP ip = ip ;
|
||||||
|
PhrIAdv ia = ia ;
|
||||||
|
|
||||||
|
OnePhr p = p ;
|
||||||
|
ConsPhr = cc2 ;
|
||||||
|
|
||||||
|
} ;
|
||||||
1278
lib/resource/scandinavian/SyntaxScand.gf
Normal file
1278
lib/resource/scandinavian/SyntaxScand.gf
Normal file
File diff suppressed because it is too large
Load Diff
151
lib/resource/scandinavian/TypesScand.gf
Normal file
151
lib/resource/scandinavian/TypesScand.gf
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
--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 = Utr | Neutr ;
|
||||||
|
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} ;
|
||||||
|
|
||||||
|
--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 Neutr) ;
|
||||||
|
|
||||||
|
--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 ;
|
||||||
|
|
||||||
|
VInf ;
|
||||||
|
|
||||||
|
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} ;
|
||||||
|
}
|
||||||
@@ -1,83 +1,4 @@
|
|||||||
--# -path=.:../abstract:../../prelude
|
--# -path=.:../scandinavian:../abstract:../../prelude
|
||||||
|
|
||||||
--1 The Top-Level Swedish Resource Grammar: Combination Rules
|
concrete CategoriesSwe of Categories =
|
||||||
--
|
CategoriesScand with (SyntaxScand=SyntaxSwe) ;
|
||||||
-- Aarne Ranta 2002 -- 2003
|
|
||||||
--
|
|
||||||
-- This is the Swedish concrete syntax of the multilingual resource
|
|
||||||
-- grammar. Most of the work is done in the file $SyntaxSwe.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 $TypesSwe.gf$.
|
|
||||||
|
|
||||||
concrete CategoriesSwe of Categories = open Prelude, SyntaxSwe in {
|
|
||||||
|
|
||||||
flags
|
|
||||||
startcat=Phr ;
|
|
||||||
lexer=text ;
|
|
||||||
unlexer=text ;
|
|
||||||
|
|
||||||
lincat
|
|
||||||
CN = {s : Number => SpeciesP => Case => Str ; g : Gender ; x : Sex ;
|
|
||||||
p : IsComplexCN} ;
|
|
||||||
N = CommNoun ;
|
|
||||||
-- = {s : Number => Species => Case => Str ; g : Gender ; x : Sex} ;
|
|
||||||
NP = NounPhrase ;
|
|
||||||
-- = {s : NPForm => Str ; g : Gender ; n : Number} ;
|
|
||||||
PN = {s : Case => Str ; g : Gender ; x : Sex} ;
|
|
||||||
Det = {s : Gender => Sex => Str ; n : Number ; b : SpeciesP} ;
|
|
||||||
N2 = Function ;
|
|
||||||
-- = CommNoun ** {s2 : Preposition} ;
|
|
||||||
N3 = Function ** {s3 : Preposition} ;
|
|
||||||
Num = {s : Case => Str} ;
|
|
||||||
Prep = {s : Str} ;
|
|
||||||
|
|
||||||
A = Adjective ;
|
|
||||||
-- = {s : AdjFormPos => Case => Str} ;
|
|
||||||
A2 = Adjective ** {s2 : Preposition} ;
|
|
||||||
ADeg = {s : AdjForm => Str} ;
|
|
||||||
AP = Adjective ** {p : IsPostfixAdj} ;
|
|
||||||
|
|
||||||
V = Verb ;
|
|
||||||
-- = {s : VerbForm => Str ; s1 : Str} ;
|
|
||||||
VG = {s : SForm => Str ; s2 : Bool => Str ; s3 : SForm => Gender => Number => Str} ;
|
|
||||||
VP = {s : SForm => Str ; s2 : Str ; s3 : SForm => Gender => Number => Str} ;
|
|
||||||
V2 = TransVerb ;
|
|
||||||
-- = Verb ** {s2 : Preposition} ;
|
|
||||||
V3 = TransVerb ** {s3 : Preposition} ;
|
|
||||||
VS = Verb ;
|
|
||||||
VV = Verb ** {isAux : Bool} ;
|
|
||||||
|
|
||||||
Adv = Adverb ;
|
|
||||||
-- = {s : Str ; isPost : Bool} ;
|
|
||||||
PP = Adverb ;
|
|
||||||
|
|
||||||
S = Sentence ;
|
|
||||||
-- = {s : Order => Str} ;
|
|
||||||
Cl = Clause ;
|
|
||||||
-- = {s : Bool => SForm => Order => Str} ;
|
|
||||||
Slash = Sentence ** {s2 : Preposition} ;
|
|
||||||
RP = {s : RelCase => GenNum => Str ; g : RelGender} ;
|
|
||||||
RC = {s : GenNum => Str} ;
|
|
||||||
IP = NounPhrase ;
|
|
||||||
Qu = {s : 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} ;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -10,45 +10,7 @@
|
|||||||
|
|
||||||
resource MorphoSwe = TypesSwe ** open Prelude in {
|
resource MorphoSwe = TypesSwe ** open Prelude in {
|
||||||
|
|
||||||
-- The indefinite and definite article
|
|
||||||
oper
|
oper
|
||||||
artIndef = table {Utr => "en" ; Neutr => "ett"} ;
|
|
||||||
|
|
||||||
artDef : Bool => GenNum => Str = table {
|
|
||||||
True => table {
|
|
||||||
ASg Utr => "den" ;
|
|
||||||
ASg Neutr => "det" ; -- det gamla huset
|
|
||||||
APl => variants {"de" ; "dom"}
|
|
||||||
} ;
|
|
||||||
False => table {_ => []} -- huset
|
|
||||||
} ;
|
|
||||||
|
|
||||||
-- A simplified verb category: present tense only (no more!).
|
|
||||||
|
|
||||||
oper
|
|
||||||
verbVara = vara_1200 ;
|
|
||||||
verbHava = hava_1198 ;
|
|
||||||
|
|
||||||
verbFinnas : Verb = vFinna "finn" "fann" "funn" ** {s1 = []} ;
|
|
||||||
|
|
||||||
deponentVerb : Verb -> Verb = \finna -> {
|
|
||||||
s = table {
|
|
||||||
VF (Pres m _) => finna.s ! VF (Pres m Pass) ;
|
|
||||||
VF (Pret m _) => finna.s ! VF (Pret m Pass) ;
|
|
||||||
VI (Inf _) => finna.s ! VI (Inf Pass) ;
|
|
||||||
VI (Supin _) => finna.s ! VI (Supin Pass) ;
|
|
||||||
v => finna.s ! v --- Imper !
|
|
||||||
} ;
|
|
||||||
s1 = finna.s1
|
|
||||||
} ;
|
|
||||||
|
|
||||||
{- deprecated
|
|
||||||
|
|
||||||
verbFinnas = mkVerb "finnas" "finns" "finns" ;
|
|
||||||
|
|
||||||
-- A simplified conjugation takes three forms in the worst case, plus a particle.
|
|
||||||
-}
|
|
||||||
|
|
||||||
mkVerbPart : (supa,super,sup,söp,supit,supen,upp : Str) -> Verb =
|
mkVerbPart : (supa,super,sup,söp,supit,supen,upp : Str) -> Verb =
|
||||||
\finna,finner,finn,fann,funnit,funnen,upp ->
|
\finna,finner,finn,fann,funnit,funnen,upp ->
|
||||||
let funn = ptPretForms funnen in
|
let funn = ptPretForms funnen in
|
||||||
|
|||||||
@@ -1,140 +1,4 @@
|
|||||||
concrete RulesSwe of Rules = CategoriesSwe ** open Prelude, SyntaxSwe in {
|
--# -path=.:../scandinavian:../abstract:../../prelude
|
||||||
|
|
||||||
lin
|
concrete RulesSwe of Rules =
|
||||||
UseN = noun2CommNounPhrase ;
|
RulesScand with (SyntaxScand=SyntaxSwe) ;
|
||||||
ModAP = modCommNounPhrase ;
|
|
||||||
ModGenOne = npGenDet singular noNum ;
|
|
||||||
ModGenNum = npGenDet plural ;
|
|
||||||
UsePN = nameNounPhrase ;
|
|
||||||
UseN2 = funAsCommNounPhrase ;
|
|
||||||
AppN2 = appFunComm ;
|
|
||||||
AppN3 = appFun2 ;
|
|
||||||
UseA = adj2adjPhrase ;
|
|
||||||
ComplA2 = complAdj ;
|
|
||||||
PositADeg = positAdjPhrase ;
|
|
||||||
ComparADeg = comparAdjPhrase ;
|
|
||||||
SuperlNP = superlNounPhrase ;
|
|
||||||
|
|
||||||
DetNP = detNounPhrase ;
|
|
||||||
IndefOneNP = indefNounPhrase singular ;
|
|
||||||
IndefNumNP = indefNounPhraseNum plural ;
|
|
||||||
DefOneNP = defNounPhrase singular ;
|
|
||||||
DefNumNP = defNounPhraseNum plural ;
|
|
||||||
MassNP = detNounPhrase (mkDeterminerSg (detSgInvar []) IndefP) ;
|
|
||||||
UseInt i = {s = table {Nom => i.s ; Gen => i.s ++ "s"}} ; ---
|
|
||||||
NoNum = noNum ;
|
|
||||||
|
|
||||||
SymbPN i = {s = \\_ => i.s ; g = Neutr ; x = NoMasc} ;
|
|
||||||
SymbCN cn s =
|
|
||||||
{s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
|
|
||||||
g = cn.g ;
|
|
||||||
x = cn.x ;
|
|
||||||
p = cn.p
|
|
||||||
} ;
|
|
||||||
IntCN cn s =
|
|
||||||
{s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
|
|
||||||
g = cn.g ;
|
|
||||||
x = cn.x ;
|
|
||||||
p = cn.p
|
|
||||||
} ;
|
|
||||||
|
|
||||||
CNthatS = nounThatSentence ;
|
|
||||||
|
|
||||||
PredVP = predVerbPhrase ;
|
|
||||||
|
|
||||||
PosVG = predVerbGroup True ;
|
|
||||||
NegVG = predVerbGroup False ;
|
|
||||||
|
|
||||||
PredVG = predVerbGroupClause ;
|
|
||||||
|
|
||||||
PredV = predVerb ;
|
|
||||||
PredAP = predAdjective ;
|
|
||||||
PredSuperl a = predAdjective (superlAdjPhrase a) ;
|
|
||||||
PredCN = predCommNoun ;
|
|
||||||
PredV2 = complTransVerb ;
|
|
||||||
PredV3 = complDitransVerb ;
|
|
||||||
PredPassV = passVerb ;
|
|
||||||
PredNP = predNounPhrase ;
|
|
||||||
PredPP = predAdverb ;
|
|
||||||
PredVS = complSentVerb ;
|
|
||||||
PredVV = complVerbVerb ;
|
|
||||||
VTrans = transAsVerb ;
|
|
||||||
|
|
||||||
AdjAdv a = advPost (a.s ! adverbForm ! Nom) ;
|
|
||||||
AdvPP p = p ;
|
|
||||||
PrepNP p = prepPhrase p.s ; ---
|
|
||||||
AdvVP = adVerbPhrase ;
|
|
||||||
AdvCN = advCommNounPhrase ;
|
|
||||||
AdvAP = advAdjPhrase ;
|
|
||||||
|
|
||||||
ThereNP A = predVerbPhrase npDet
|
|
||||||
(predVerbGroup True
|
|
||||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) A)) ;
|
|
||||||
|
|
||||||
PosSlashV2 = slashTransVerb True ;
|
|
||||||
NegSlashV2 = slashTransVerb False ;
|
|
||||||
OneVP = predVerbPhrase npMan ;
|
|
||||||
|
|
||||||
IdRP = identRelPron ;
|
|
||||||
FunRP = funRelPron ;
|
|
||||||
RelVP = relVerbPhrase ;
|
|
||||||
RelSlash = relSlash ;
|
|
||||||
ModRC = modRelClause ;
|
|
||||||
RelSuch = relSuch ;
|
|
||||||
|
|
||||||
WhoOne = intPronWho singular ;
|
|
||||||
WhoMany = intPronWho plural ;
|
|
||||||
WhatOne = intPronWhat singular ;
|
|
||||||
WhatMany = intPronWhat plural ;
|
|
||||||
FunIP = funIntPron ;
|
|
||||||
NounIPOne = nounIntPron singular ;
|
|
||||||
NounIPMany = nounIntPron plural ;
|
|
||||||
|
|
||||||
QuestVP = questVerbPhrase ;
|
|
||||||
IntVP = intVerbPhrase ;
|
|
||||||
IntSlash = intSlash ;
|
|
||||||
QuestAdv = questAdverbial ;
|
|
||||||
IsThereNP A = questVerbPhrase npDet
|
|
||||||
(predVerbGroup True
|
|
||||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) A)) ;
|
|
||||||
|
|
||||||
ImperVP = imperVerbPhrase ;
|
|
||||||
|
|
||||||
IndicPhrase = indicUtt ;
|
|
||||||
QuestPhrase = interrogUtt ;
|
|
||||||
ImperOne = imperUtterance singular ;
|
|
||||||
ImperMany = imperUtterance plural ;
|
|
||||||
|
|
||||||
PrepS p = ss (p.s ++ ",") ;
|
|
||||||
AdvS = advSentence ;
|
|
||||||
|
|
||||||
TwoS = twoSentence ;
|
|
||||||
ConsS = consSentence ;
|
|
||||||
ConjS = conjunctSentence ;
|
|
||||||
ConjDS = conjunctDistrSentence ;
|
|
||||||
|
|
||||||
TwoAP = twoAdjPhrase ;
|
|
||||||
ConsAP = consAdjPhrase ;
|
|
||||||
ConjAP = conjunctAdjPhrase ;
|
|
||||||
ConjDAP = conjunctDistrAdjPhrase ;
|
|
||||||
|
|
||||||
TwoNP = twoNounPhrase ;
|
|
||||||
ConsNP = consNounPhrase ;
|
|
||||||
ConjNP = conjunctNounPhrase ;
|
|
||||||
ConjDNP = conjunctDistrNounPhrase ;
|
|
||||||
|
|
||||||
SubjS = subjunctSentence ;
|
|
||||||
SubjImper = subjunctImperative ;
|
|
||||||
SubjQu = subjunctQuestion ;
|
|
||||||
SubjVP = subjunctVerbPhrase ;
|
|
||||||
|
|
||||||
PhrNP = useNounPhrase ;
|
|
||||||
PhrOneCN = useCommonNounPhrase singular ;
|
|
||||||
PhrManyCN = useCommonNounPhrase plural ;
|
|
||||||
PhrIP ip = ip ;
|
|
||||||
PhrIAdv ia = ia ;
|
|
||||||
|
|
||||||
OnePhr p = p ;
|
|
||||||
ConsPhr = cc2 ;
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
--# -path=.:../abstract:../../prelude
|
--# -path=.:../abstract:../scandinavian:../../prelude
|
||||||
|
|
||||||
--1 The Top-Level Swedish Resource Grammar: Structural Words
|
--1 The Top-Level Swedish Resource Grammar: Structural Words
|
||||||
--
|
--
|
||||||
-- Aarne Ranta 2002 -- 2004
|
-- Aarne Ranta 2002 -- 2004
|
||||||
--
|
--
|
||||||
concrete StructuralSwe of Structural =
|
concrete StructuralSwe of Structural =
|
||||||
CategoriesSwe, NumeralsSwe ** open Prelude, SyntaxSwe in {
|
CategoriesSwe, NumeralsSwe ** open Prelude, MorphoSwe, SyntaxSwe in {
|
||||||
lin
|
lin
|
||||||
|
|
||||||
INP = pronNounPhrase jag_32 ;
|
INP = pronNounPhrase jag_32 ;
|
||||||
@@ -20,8 +20,8 @@ concrete StructuralSwe of Structural =
|
|||||||
YouNP = let {ni = pronNounPhrase ni_37 } in {s = ni.s ; g = ni.g ; n = Sg} ;
|
YouNP = let {ni = pronNounPhrase ni_37 } in {s = ni.s ; g = ni.g ; n = Sg} ;
|
||||||
|
|
||||||
ItNP = pronNounPhrase det_40 ; ----
|
ItNP = pronNounPhrase det_40 ; ----
|
||||||
ThisNP = regNameNounPhrase ["det här"] Neutr NoMasc ;
|
ThisNP = regNameNounPhrase ["det här"] NNeutr ;
|
||||||
ThatNP = regNameNounPhrase ["det där"] Neutr NoMasc ;
|
ThatNP = regNameNounPhrase ["det där"] NNeutr ;
|
||||||
TheseNumNP n =
|
TheseNumNP n =
|
||||||
{s = \\c => ["de här"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
{s = \\c => ["de här"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||||
ThoseNumNP n =
|
ThoseNumNP n =
|
||||||
@@ -75,11 +75,11 @@ concrete StructuralSwe of Structural =
|
|||||||
|
|
||||||
EverybodyNP = let alla = table {Nom => "alla" ; Gen => "allas"} in
|
EverybodyNP = let alla = table {Nom => "alla" ; Gen => "allas"} in
|
||||||
{s = \\c => alla ! npCase c ; g = Utr ; n = Pl} ;
|
{s = \\c => alla ! npCase c ; g = Utr ; n = Pl} ;
|
||||||
SomebodyNP = nameNounPhrase (mkProperName "någon" Utr Masc) ;
|
SomebodyNP = nameNounPhrase (mkProperName "någon" (NUtr Masc)) ;
|
||||||
NobodyNP = nameNounPhrase (mkProperName "ingen" Utr Masc) ;
|
NobodyNP = nameNounPhrase (mkProperName "ingen" (NUtr Masc)) ;
|
||||||
EverythingNP = nameNounPhrase (mkProperName "allting" Neutr NoMasc) ;
|
EverythingNP = nameNounPhrase (mkProperName "allting" NNeutr) ;
|
||||||
SomethingNP = nameNounPhrase (mkProperName "någonting" Neutr NoMasc) ;
|
SomethingNP = nameNounPhrase (mkProperName "någonting" NNeutr) ;
|
||||||
NothingNP = nameNounPhrase (mkProperName "ingenting" Neutr NoMasc) ;
|
NothingNP = nameNounPhrase (mkProperName "ingenting" NNeutr) ;
|
||||||
|
|
||||||
CanVV = mkVerb "kunna" "kan" "kunn" "kunde" "kunnat" "kunnen" ** {isAux = True} ;
|
CanVV = mkVerb "kunna" "kan" "kunn" "kunde" "kunnat" "kunnen" ** {isAux = True} ;
|
||||||
CanKnowVV = mkVerb "kunna" "kan" "kunn" "kunde" "kunnat" "kunnen" ** {isAux = True} ;
|
CanKnowVV = mkVerb "kunna" "kan" "kunn" "kunde" "kunnat" "kunnen" ** {isAux = True} ;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
--# -path=.:../abstract:../../prelude
|
--# -path=.:../scandinavian:../abstract:../../prelude
|
||||||
|
|
||||||
concrete TestResourceSwe of TestResource = RulesSwe, StructuralSwe ** open MorphoSwe, SyntaxSwe in {
|
concrete TestResourceSwe of TestResource = RulesSwe, StructuralSwe ** open MorphoSwe, SyntaxSwe in {
|
||||||
|
|
||||||
@@ -15,14 +15,14 @@ lin
|
|||||||
Finnish = extAdjective (aFin "finsk") ;
|
Finnish = extAdjective (aFin "finsk") ;
|
||||||
Happy = aFin "lycklig" ;
|
Happy = aFin "lycklig" ;
|
||||||
Married = extAdjective (aAbstrakt "gift") ** {s2 = "med"} ;
|
Married = extAdjective (aAbstrakt "gift") ** {s2 = "med"} ;
|
||||||
Man = extCommNoun Masc man_1144 ;
|
Man = extCommNounMasc man_1144 ;
|
||||||
Bar = extCommNoun NoMasc (sSak "bar") ;
|
Bar = extCommNoun (sSak "bar") ;
|
||||||
Bottle = extCommNoun NoMasc (sApa "flask") ;
|
Bottle = extCommNoun (sApa "flask") ;
|
||||||
Woman = extCommNoun NoMasc (sApa "kvinn") ;
|
Woman = extCommNoun (sApa "kvinn") ;
|
||||||
Car = extCommNoun NoMasc (sBil "bil") ;
|
Car = extCommNoun (sBil "bil") ;
|
||||||
House = extCommNoun NoMasc (sHus "hus") ;
|
House = extCommNoun (sHus "hus") ;
|
||||||
Light = extCommNoun NoMasc (sHus "ljus") ;
|
Light = extCommNoun (sHus "ljus") ;
|
||||||
Wine = extCommNoun NoMasc (sParti "vin") ;
|
Wine = extCommNoun (sParti "vin") ;
|
||||||
Walk = vNopart gå_1174 ;
|
Walk = vNopart gå_1174 ;
|
||||||
Run = vNopart (vFinna "spring" "sprang" "sprung") ;
|
Run = vNopart (vFinna "spring" "sprang" "sprung") ;
|
||||||
Drink = extTransVerb (vFinna "drick" "drack" "druck") [] ;
|
Drink = extTransVerb (vFinna "drick" "drack" "druck") [] ;
|
||||||
@@ -38,14 +38,14 @@ lin
|
|||||||
SwitchOn = mkDirectVerb (vFinna "sätt" "satte" "satt" ** {s1 = "på"}) ;
|
SwitchOn = mkDirectVerb (vFinna "sätt" "satte" "satt" ** {s1 = "på"}) ;
|
||||||
SwitchOff = mkDirectVerb (vLeka "stäng" ** {s1 = "av"}) ;
|
SwitchOff = mkDirectVerb (vLeka "stäng" ** {s1 = "av"}) ;
|
||||||
|
|
||||||
Mother = mkFun (extCommNoun NoMasc mor_1) "till" ;
|
Mother = mkFun (extCommNoun mor_1) "till" ;
|
||||||
Uncle = mkFun (extCommNoun Masc farbror_8) "till" ;
|
Uncle = mkFun (extCommNounMasc farbror_8) "till" ;
|
||||||
Connection = mkFun (extCommNoun NoMasc (sVarelse "förbindelse")) "från" **
|
Connection = mkFun (extCommNoun (sVarelse "förbindelse")) "från" **
|
||||||
{s3 = "till"} ;
|
{s3 = "till"} ;
|
||||||
|
|
||||||
Always = advPre "alltid" ;
|
Always = advPre "alltid" ;
|
||||||
Well = advPost "bra" ;
|
Well = advPost "bra" ;
|
||||||
|
|
||||||
John = mkProperName "Johan" Utr Masc ;
|
John = mkProperName "Johan" (NUtr Masc) ;
|
||||||
Mary = mkProperName "Maria" Utr NoMasc ;
|
Mary = mkProperName "Maria" (NUtr NoMasc) ;
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -1,88 +1,25 @@
|
|||||||
--1 Swedish Word Classes and Morphological Parameters
|
--1 Swedish Word Classes and Morphological Parameters
|
||||||
--
|
--
|
||||||
-- This is a resource module for Swedish morphology, defining the
|
-- This is a resource module for Swedish morphology, defining the
|
||||||
-- morphological parameters and word classes of Swedish. It is aimed
|
-- morphological parameters and word classes of Italian.
|
||||||
-- to be complete w.r.t. the description of word forms.
|
-- The morphology is so far only
|
||||||
-- However, it does not include those parameters that are not needed for
|
-- complete w.r.t. the syntax part of the resource grammar.
|
||||||
|
-- It does not include those parameters that are not needed for
|
||||||
-- analysing individual words: such parameters are defined in syntax modules.
|
-- 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.
|
|
||||||
|
|
||||||
resource TypesSwe = open Prelude in {
|
instance TypesSwe of TypesScand = {
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
--2 Enumerated parameter types
|
|
||||||
--
|
|
||||||
-- These types are the ones found in school grammars.
|
|
||||||
-- Their parameter values are atomic.
|
|
||||||
|
|
||||||
param
|
param
|
||||||
Gender = Utr | Neutr ;
|
NounGender = NUtr Sex | NNeutr ;
|
||||||
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} ;
|
|
||||||
|
|
||||||
--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 ;
|
|
||||||
|
|
||||||
AdjFormPos = Strong GenNum | Weak SexNum ;
|
|
||||||
AdjFormSup = SupStrong | SupWeak ;
|
|
||||||
|
|
||||||
AdjFormGrad =
|
|
||||||
Posit AdjFormPos
|
|
||||||
| Compar
|
|
||||||
| Super AdjFormSup ;
|
|
||||||
|
|
||||||
oper
|
oper
|
||||||
Adj : Type = {s : AdjForm => Str} ;
|
genNoun = \s -> case s of {NUtr _ => Utr ; NNeutr => Neutr} ;
|
||||||
|
sexNoun = \s -> case s of {NUtr x => x ; NNeutr => NoMasc} ;
|
||||||
adverbForm : AdjFormPos = Strong (ASg Neutr) ;
|
gen2nounGen = \s -> case s of {Utr => NUtr NoMasc ; Neutr => NNeutr} ;
|
||||||
|
|
||||||
--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
|
param
|
||||||
|
AdjFormPos = Strong GenNum | Weak SexNum ;
|
||||||
|
|
||||||
VFin =
|
VFin =
|
||||||
Pres Mode Voice
|
Pres Mode Voice
|
||||||
| Pret Mode Voice
|
| Pret Mode Voice
|
||||||
@@ -93,73 +30,4 @@ param
|
|||||||
| Supin Voice
|
| Supin Voice
|
||||||
| PtPres Case
|
| PtPres Case
|
||||||
| PtPret AdjFormPos Case ;
|
| 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".
|
|
||||||
|
|
||||||
param
|
|
||||||
VMode = Infinit | Indicat | Imperat ;
|
|
||||||
VForm = VPres VMode Voice ;
|
|
||||||
|
|
||||||
oper
|
|
||||||
Verb : Type = {s : VerbForm => Str ; s1 : Str} ;
|
|
||||||
|
|
||||||
vNopart : Verbum -> Verb = \v -> v ** {s1 = []} ;
|
|
||||||
|
|
||||||
{- deprecated
|
|
||||||
extVerbPart : Voice -> Verbum -> Str -> Verb = \v,verb,upp -> {s = table {
|
|
||||||
VPres Infinit v => verb.s ! VI (Inf v) ;
|
|
||||||
VPres Indicat v => verb.s ! VF (Pres Ind v) ;
|
|
||||||
VPres Imperat Act => verb.s ! VF Imper ;
|
|
||||||
VPres Imperat Pass => verb.s ! VF (Pres Ind Pass) --- no passive in Verbum
|
|
||||||
} ;
|
|
||||||
s1 = upp
|
|
||||||
} ;
|
|
||||||
|
|
||||||
extVerb : Voice -> Verbum -> Verb = \v,verb ->
|
|
||||||
extVerbPart v verb [] ;
|
|
||||||
-}
|
|
||||||
|
|
||||||
--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} ;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user