forked from GitHub/gf-core
Founding the newly structured GF2.0 cvs archive.
This commit is contained in:
1039
grammars/resource/swedish/Morpho.gf
Normal file
1039
grammars/resource/swedish/Morpho.gf
Normal file
File diff suppressed because it is too large
Load Diff
196
grammars/resource/swedish/ResSwe.gf
Normal file
196
grammars/resource/swedish/ResSwe.gf
Normal file
@@ -0,0 +1,196 @@
|
||||
--1 The Top-Level Swedish Resource Grammar
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2003
|
||||
--
|
||||
-- This is the Swedish concrete syntax of the multilingual resource
|
||||
-- grammar. Most of the work is done in the file $syntax.Swe.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 $Types.gf$.
|
||||
|
||||
concrete ResSwe of ResAbs = open Prelude, Syntax in {
|
||||
|
||||
flags
|
||||
startcat=Phr ;
|
||||
parser=chart ;
|
||||
|
||||
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} ;
|
||||
Fun = CommNoun ** {s2 : Preposition} ;
|
||||
|
||||
Adj1 = Adjective ;
|
||||
-- = {s : AdjFormPos => Case => Str} ;
|
||||
Adj2 = Adjective ** {s2 : Preposition} ;
|
||||
AdjDeg = {s : AdjForm => Str} ;
|
||||
AP = Adjective ** {p : IsPostfixAdj} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VForm => Str} ;
|
||||
VP = Verb ** {s2 : Str ; s3 : Gender => Number => Str} ;
|
||||
TV = Verb ** {s2 : Preposition} ;
|
||||
VS = Verb ;
|
||||
|
||||
AdV = {s : Str ; isPost : Bool} ;
|
||||
|
||||
S = Sentence ;
|
||||
-- = {s : 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} ;
|
||||
|
||||
--.
|
||||
|
||||
lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
ModGenOne = npGenDet singular ;
|
||||
ModGenMany = npGenDet plural ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseFun = funAsCommNounPhrase ;
|
||||
AppFun = appFunComm ;
|
||||
AdjP1 = adj2adjPhrase ;
|
||||
ComplAdj = complAdj ;
|
||||
PositAdjP = positAdjPhrase ;
|
||||
ComparAdjP = comparAdjPhrase ;
|
||||
SuperlNP = superlNounPhrase ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefManyNP = indefNounPhrase plural ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefManyNP = defNounPhrase plural ;
|
||||
|
||||
PredVP = predVerbPhrase ;
|
||||
PosV = predVerb True ;
|
||||
NegV = predVerb False ;
|
||||
PosA = predAdjective True ;
|
||||
NegA = predAdjective False ;
|
||||
PosCN = predCommNoun True ;
|
||||
NegCN = predCommNoun False ;
|
||||
PosTV = complTransVerb True ;
|
||||
NegTV = complTransVerb False ;
|
||||
PosNP = predNounPhrase True ;
|
||||
NegNP = predNounPhrase False ;
|
||||
PosVS = complSentVerb True ;
|
||||
NegVS = complSentVerb False ;
|
||||
|
||||
|
||||
AdvVP = adVerbPhrase ;
|
||||
LocNP = locativeNounPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = slashTransVerb False ;
|
||||
|
||||
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 ;
|
||||
|
||||
ImperVP = imperVerbPhrase ;
|
||||
|
||||
IndicPhrase = indicUtt ;
|
||||
QuestPhrase = interrogUtt ;
|
||||
ImperOne = imperUtterance singular ;
|
||||
ImperMany = imperUtterance plural ;
|
||||
|
||||
lin
|
||||
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 ;
|
||||
|
||||
PhrNP = useNounPhrase ;
|
||||
PhrOneCN = useCommonNounPhrase singular ;
|
||||
PhrManyCN = useCommonNounPhrase plural ;
|
||||
PhrIP ip = ip ;
|
||||
PhrIAdv ia = ia ;
|
||||
|
||||
INP = pronNounPhrase jag_32 ;
|
||||
ThouNP = pronNounPhrase du_33 ;
|
||||
HeNP = pronNounPhrase han_34 ;
|
||||
SheNP = pronNounPhrase hon_35 ;
|
||||
WeNP = pronNounPhrase vi_36 ;
|
||||
YeNP = pronNounPhrase ni_37 ;
|
||||
TheyNP = pronNounPhrase de_38 ;
|
||||
|
||||
YouNP = let {ni = pronNounPhrase ni_37 } in {s = ni.s ; g = ni.g ; n = Sg} ;
|
||||
|
||||
EveryDet = varjeDet ;
|
||||
AllDet = allaDet ;
|
||||
WhichDet = vilkenDet ;
|
||||
MostDet = flestaDet ;
|
||||
|
||||
HowIAdv = ss "hur" ;
|
||||
WhenIAdv = ss "när" ;
|
||||
WhereIAdv = ss "var" ;
|
||||
WhyIAdv = ss "varför" ;
|
||||
|
||||
AndConj = ss "och" ** {n = Pl} ;
|
||||
OrConj = ss "eller" ** {n = Sg} ;
|
||||
BothAnd = sd2 "både" "och" ** {n = Pl} ;
|
||||
EitherOr = sd2 "antingen" "eller" ** {n = Sg} ;
|
||||
NeitherNor = sd2 "varken" "eller" ** {n = Sg} ;
|
||||
IfSubj = ss "om" ;
|
||||
WhenSubj = ss "när" ;
|
||||
|
||||
PhrYes = ss ["Ja ."] ;
|
||||
PhrNo = ss ["Nej ."] ;
|
||||
} ;
|
||||
1
grammars/resource/swedish/Svenska.gf
Normal file
1
grammars/resource/swedish/Svenska.gf
Normal file
@@ -0,0 +1 @@
|
||||
resource Svenska = reuse ResSwe ;
|
||||
1000
grammars/resource/swedish/Syntax.gf
Normal file
1000
grammars/resource/swedish/Syntax.gf
Normal file
File diff suppressed because it is too large
Load Diff
35
grammars/resource/swedish/TestSwe.gf
Normal file
35
grammars/resource/swedish/TestSwe.gf
Normal file
@@ -0,0 +1,35 @@
|
||||
concrete TestSwe of TestAbs = ResSwe ** open Syntax in {
|
||||
|
||||
flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ;
|
||||
|
||||
-- a random sample from the lexicon
|
||||
|
||||
lin
|
||||
Big = stor_25 ;
|
||||
Small = liten_1146 ;
|
||||
Old = gammal_16 ;
|
||||
Young = ung_29 ;
|
||||
Man = extCommNoun Masc man_1144 ;
|
||||
Woman = extCommNoun NoMasc (sApa "kvinn") ;
|
||||
Car = extCommNoun NoMasc (sBil "bil") ;
|
||||
House = extCommNoun NoMasc (sHus "hus") ;
|
||||
Light = extCommNoun NoMasc (sHus "ljus") ;
|
||||
Walk = extVerb Act gå_1174 ;
|
||||
Run = extVerb Act (vFinna "spring" "sprang" "sprung") ;
|
||||
Love = extTransVerb (vTala "älsk") [] ;
|
||||
Send = extTransVerb (vTala "skick") [] ;
|
||||
Wait = extTransVerb (vTala "vänt") "på" ;
|
||||
Say = extVerb Act (vLeka "säg") ; --- works in present tense...
|
||||
Prove = extVerb Act (vTala "bevis") ;
|
||||
SwitchOn = extTransVerb (vVända "tän") [] ;
|
||||
SwitchOff = extTransVerb (vLeka "släck") [] ;
|
||||
|
||||
Mother = mkFun (extCommNoun NoMasc mor_1) "till" ;
|
||||
Uncle = mkFun (extCommNoun Masc farbror_8) "till" ;
|
||||
|
||||
Always = advPre "alltid" ;
|
||||
Well = advPost "bra" ;
|
||||
|
||||
John = mkProperName "Johan" Utr Masc ;
|
||||
Mary = mkProperName "Maria" Utr NoMasc ;
|
||||
} ;
|
||||
150
grammars/resource/swedish/Types.gf
Normal file
150
grammars/resource/swedish/Types.gf
Normal file
@@ -0,0 +1,150 @@
|
||||
--1 Swedish 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.
|
||||
|
||||
resource Types = open Prelude in {
|
||||
|
||||
--
|
||||
|
||||
--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 ;
|
||||
|
||||
AdjFormPos = Strong GenNum | Weak SexNum ;
|
||||
AdjFormSup = SupStrong | SupWeak ;
|
||||
|
||||
AdjFormGrad =
|
||||
Posit AdjFormPos
|
||||
| Compar
|
||||
| Super AdjFormSup ;
|
||||
|
||||
oper
|
||||
Adj : Type = {s : AdjForm => Str} ;
|
||||
|
||||
--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 Mode Voice
|
||||
| Pret Mode Voice
|
||||
| Imper ; --- no passive
|
||||
|
||||
VInf =
|
||||
Inf Voice
|
||||
| Supin Voice
|
||||
| PtPres 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.
|
||||
|
||||
param
|
||||
VForm = Infinit | Indicat | Imperat ;
|
||||
|
||||
oper
|
||||
Verb : Type = SS1 VForm ;
|
||||
|
||||
extVerb : Voice -> Verbum -> Verb = \v,verb -> {s = table {
|
||||
Infinit => verb.s ! VI (Inf v) ;
|
||||
Indicat => verb.s ! VF (Pres Ind v) ;
|
||||
Imperat => verb.s ! VF Imper --- no passive in Verbum
|
||||
}} ;
|
||||
|
||||
--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