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:
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} ;
|
||||
}
|
||||
Reference in New Issue
Block a user