parametrizad Scandinavian and added Danish

This commit is contained in:
aarne
2005-01-19 16:40:49 +00:00
parent 027539d4e2
commit 4e004d4097
19 changed files with 2323 additions and 1618 deletions

View File

@@ -1,83 +1,4 @@
--# -path=.:../abstract:../../prelude
--# -path=.:../scandinavian:../abstract:../../prelude
--1 The Top-Level Swedish Resource Grammar: Combination Rules
--
-- 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} ;
}
concrete CategoriesSwe of Categories =
CategoriesScand with (SyntaxScand=SyntaxSwe) ;

View File

@@ -10,45 +10,7 @@
resource MorphoSwe = TypesSwe ** open Prelude in {
-- The indefinite and definite article
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 =
\finna,finner,finn,fann,funnit,funnen,upp ->
let funn = ptPretForms funnen in

View File

@@ -1,140 +1,4 @@
concrete RulesSwe of Rules = CategoriesSwe ** open Prelude, SyntaxSwe in {
--# -path=.:../scandinavian:../abstract:../../prelude
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 = 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 ;
} ;
concrete RulesSwe of Rules =
RulesScand with (SyntaxScand=SyntaxSwe) ;

View File

@@ -1,11 +1,11 @@
--# -path=.:../abstract:../../prelude
--# -path=.:../abstract:../scandinavian:../../prelude
--1 The Top-Level Swedish Resource Grammar: Structural Words
--
-- Aarne Ranta 2002 -- 2004
--
concrete StructuralSwe of Structural =
CategoriesSwe, NumeralsSwe ** open Prelude, SyntaxSwe in {
CategoriesSwe, NumeralsSwe ** open Prelude, MorphoSwe, SyntaxSwe in {
lin
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} ;
ItNP = pronNounPhrase det_40 ; ----
ThisNP = regNameNounPhrase ["det här"] Neutr NoMasc ;
ThatNP = regNameNounPhrase ["det där"] Neutr NoMasc ;
ThisNP = regNameNounPhrase ["det här"] NNeutr ;
ThatNP = regNameNounPhrase ["det där"] NNeutr ;
TheseNumNP n =
{s = \\c => ["de här"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
ThoseNumNP n =
@@ -75,11 +75,11 @@ concrete StructuralSwe of Structural =
EverybodyNP = let alla = table {Nom => "alla" ; Gen => "allas"} in
{s = \\c => alla ! npCase c ; g = Utr ; n = Pl} ;
SomebodyNP = nameNounPhrase (mkProperName "någon" Utr Masc) ;
NobodyNP = nameNounPhrase (mkProperName "ingen" Utr Masc) ;
EverythingNP = nameNounPhrase (mkProperName "allting" Neutr NoMasc) ;
SomethingNP = nameNounPhrase (mkProperName "någonting" Neutr NoMasc) ;
NothingNP = nameNounPhrase (mkProperName "ingenting" Neutr NoMasc) ;
SomebodyNP = nameNounPhrase (mkProperName "någon" (NUtr Masc)) ;
NobodyNP = nameNounPhrase (mkProperName "ingen" (NUtr Masc)) ;
EverythingNP = nameNounPhrase (mkProperName "allting" NNeutr) ;
SomethingNP = nameNounPhrase (mkProperName "någonting" NNeutr) ;
NothingNP = nameNounPhrase (mkProperName "ingenting" NNeutr) ;
CanVV = 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

View File

@@ -1,4 +1,4 @@
--# -path=.:../abstract:../../prelude
--# -path=.:../scandinavian:../abstract:../../prelude
concrete TestResourceSwe of TestResource = RulesSwe, StructuralSwe ** open MorphoSwe, SyntaxSwe in {
@@ -15,14 +15,14 @@ lin
Finnish = extAdjective (aFin "finsk") ;
Happy = aFin "lycklig" ;
Married = extAdjective (aAbstrakt "gift") ** {s2 = "med"} ;
Man = extCommNoun Masc man_1144 ;
Bar = extCommNoun NoMasc (sSak "bar") ;
Bottle = extCommNoun NoMasc (sApa "flask") ;
Woman = extCommNoun NoMasc (sApa "kvinn") ;
Car = extCommNoun NoMasc (sBil "bil") ;
House = extCommNoun NoMasc (sHus "hus") ;
Light = extCommNoun NoMasc (sHus "ljus") ;
Wine = extCommNoun NoMasc (sParti "vin") ;
Man = extCommNounMasc man_1144 ;
Bar = extCommNoun (sSak "bar") ;
Bottle = extCommNoun (sApa "flask") ;
Woman = extCommNoun (sApa "kvinn") ;
Car = extCommNoun (sBil "bil") ;
House = extCommNoun (sHus "hus") ;
Light = extCommNoun (sHus "ljus") ;
Wine = extCommNoun (sParti "vin") ;
Walk = vNopart gå_1174 ;
Run = vNopart (vFinna "spring" "sprang" "sprung") ;
Drink = extTransVerb (vFinna "drick" "drack" "druck") [] ;
@@ -38,14 +38,14 @@ lin
SwitchOn = mkDirectVerb (vFinna "sätt" "satte" "satt" ** {s1 = "på"}) ;
SwitchOff = mkDirectVerb (vLeka "stäng" ** {s1 = "av"}) ;
Mother = mkFun (extCommNoun NoMasc mor_1) "till" ;
Uncle = mkFun (extCommNoun Masc farbror_8) "till" ;
Connection = mkFun (extCommNoun NoMasc (sVarelse "förbindelse")) "från" **
Mother = mkFun (extCommNoun mor_1) "till" ;
Uncle = mkFun (extCommNounMasc farbror_8) "till" ;
Connection = mkFun (extCommNoun (sVarelse "förbindelse")) "från" **
{s3 = "till"} ;
Always = advPre "alltid" ;
Well = advPost "bra" ;
John = mkProperName "Johan" Utr Masc ;
Mary = mkProperName "Maria" Utr NoMasc ;
John = mkProperName "Johan" (NUtr Masc) ;
Mary = mkProperName "Maria" (NUtr NoMasc) ;
} ;

View File

@@ -1,88 +1,25 @@
--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
-- 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.
--
-- 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 {
--
--2 Enumerated parameter types
--
-- These types are the ones found in school grammars.
-- Their parameter values are atomic.
instance TypesSwe of TypesScand = {
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 ;
NounGender = NUtr Sex | NNeutr ;
--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.
oper
genNoun = \s -> case s of {NUtr _ => Utr ; NNeutr => Neutr} ;
sexNoun = \s -> case s of {NUtr x => x ; NNeutr => NoMasc} ;
gen2nounGen = \s -> case s of {Utr => NUtr NoMasc ; Neutr => NNeutr} ;
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} ;
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 =
Pres Mode Voice
| Pret Mode Voice
@@ -93,73 +30,4 @@ param
| 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.
-- 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} ;
}