mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 08:32:50 -06:00
New place for new resource API implementations.
This commit is contained in:
199
lib/resource-0.6/swedish/CombinationsSwe.gf
Normal file
199
lib/resource-0.6/swedish/CombinationsSwe.gf
Normal file
@@ -0,0 +1,199 @@
|
||||
--# -path=.:../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 CombinationsSwe of Combinations = 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} ;
|
||||
Fun = Function ;
|
||||
-- = CommNoun ** {s2 : Preposition} ;
|
||||
Fun2 = Function ** {s3 : Preposition} ;
|
||||
Num = {s : Case => Str} ;
|
||||
Prep = {s : Str} ;
|
||||
|
||||
Adj1 = Adjective ;
|
||||
-- = {s : AdjFormPos => Case => Str} ;
|
||||
Adj2 = Adjective ** {s2 : Preposition} ;
|
||||
AdjDeg = {s : AdjForm => Str} ;
|
||||
AP = Adjective ** {p : IsPostfixAdj} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VForm => Str ; s1 : Str} ;
|
||||
VG = {s : VForm => Str ; s2 : Bool => Str ; s3 : Gender => Number => Str} ;
|
||||
VP = {s : VForm => Str ; s2 : Str ; s3 : Gender => Number => Str} ;
|
||||
TV = TransVerb ;
|
||||
-- = Verb ** {s2 : Preposition} ;
|
||||
V3 = TransVerb ** {s3 : Preposition} ;
|
||||
VS = Verb ;
|
||||
VV = Verb ** {isAux : Bool} ;
|
||||
|
||||
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 noNum ;
|
||||
ModGenMany = npGenDet plural ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseFun = funAsCommNounPhrase ;
|
||||
AppFun = appFunComm ;
|
||||
AppFun2 = appFun2 ;
|
||||
AdjP1 = adj2adjPhrase ;
|
||||
ComplAdj = complAdj ;
|
||||
PositAdjP = positAdjPhrase ;
|
||||
ComparAdjP = comparAdjPhrase ;
|
||||
SuperlNP = superlNounPhrase ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefManyNP = indefNounPhraseNum plural ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefManyNP = defNounPhraseNum plural ;
|
||||
MassNP = detNounPhrase (mkDeterminerSg (detSgInvar []) IndefP) ;
|
||||
UseInt i = {s = table {Nom => i.s ; Gen => i.s ++ "s"}} ; ---
|
||||
NoNum = noNum ;
|
||||
|
||||
CNthatS = nounThatSentence ;
|
||||
|
||||
PredVP = predVerbPhrase ;
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
|
||||
PredV = predVerb ;
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredTV = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredPassV = passVerb ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdV = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
VTrans = transAsVerb ;
|
||||
|
||||
AdjAdv a = advPost (a.s ! adverbForm ! Nom) ;
|
||||
PrepNP p = prepPhrase p.s ; ---
|
||||
AdvVP = adVerbPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
ThereNP A = predVerbPhrase npDet
|
||||
(predVerbGroup True
|
||||
(complTransVerb (mkDirectVerb verbFinnas) A)) ;
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = 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 verbFinnas) A)) ;
|
||||
|
||||
ImperVP = imperVerbPhrase ;
|
||||
|
||||
IndicPhrase = indicUtt ;
|
||||
QuestPhrase = interrogUtt ;
|
||||
ImperOne = imperUtterance singular ;
|
||||
ImperMany = imperUtterance plural ;
|
||||
|
||||
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 ;
|
||||
|
||||
} ;
|
||||
1168
lib/resource-0.6/swedish/MorphoSwe.gf
Normal file
1168
lib/resource-0.6/swedish/MorphoSwe.gf
Normal file
File diff suppressed because it is too large
Load Diff
292
lib/resource-0.6/swedish/ParadigmsSwe.gf
Normal file
292
lib/resource-0.6/swedish/ParadigmsSwe.gf
Normal file
@@ -0,0 +1,292 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 Swedish Lexical Paradigms
|
||||
--
|
||||
-- Aarne Ranta 2003
|
||||
--
|
||||
-- This is an API to the user of the resource grammar
|
||||
-- for adding lexical items. It give shortcuts for forming
|
||||
-- expressions of basic categories: nouns, adjectives, verbs.
|
||||
--
|
||||
-- Closed categories (determiners, pronouns, conjunctions) are
|
||||
-- accessed through the resource syntax API, $Structural.gf$.
|
||||
--
|
||||
-- The main difference with $MorphoSwe.gf$ is that the types
|
||||
-- referred to are compiled resource grammar types. We have moreover
|
||||
-- had the design principle of always having existing forms as string
|
||||
-- arguments of the paradigms, not stems.
|
||||
--
|
||||
-- The following modules are presupposed:
|
||||
|
||||
resource ParadigmsSwe = open (Predef=Predef), Prelude, SyntaxSwe, ResourceSwe in {
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over gender names, we define the following identifiers.
|
||||
|
||||
oper
|
||||
utrum : Gender ;
|
||||
neutrum : Gender ;
|
||||
|
||||
masculine : Sex ;
|
||||
nonmasculine : Sex ;
|
||||
|
||||
-- To abstract over case names, we define the following.
|
||||
|
||||
nominative : Case ;
|
||||
genitive : Case ;
|
||||
|
||||
-- To abstract over number names, we define the following.
|
||||
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
|
||||
--2 Nouns
|
||||
|
||||
-- Worst case: give all nominative forms and the gender.
|
||||
-- The genitive is formed automatically, even when the nominative
|
||||
-- ends with an "s".
|
||||
|
||||
mkN : (_,_,_,_ : Str) -> Gender -> Sex -> N ;
|
||||
-- man, mannen, män, männen
|
||||
|
||||
-- Here are some common patterns, corresponding to school-gramamr declensions.
|
||||
-- Except $nPojke$, $nKarl$, and $nMurare$,
|
||||
-- they are defined to be $nonmasculine$, which means that they don't create
|
||||
-- the definite adjective form with "e" but with "a".
|
||||
|
||||
nApa : Str -> N ; -- apa (apan, apor, aporna) ; utrum
|
||||
nBil : Str -> N ; -- bil (bilen, bilar, bilarna) ; utrum
|
||||
nKarl : Str -> N ; -- karl (karlen, karlar, karlarna) ; utrum ; masculine
|
||||
nPojke : Str -> N ; -- pojke (pojken, pojkar, pojkarna) ; utrum ; masculine
|
||||
nNyckel : Str -> N ; -- nyckel (nyckeln, nycklar, nycklarna) ; utrum
|
||||
nRisk : Str -> N ; -- risk (risken, risker, riskerna) ; utrum
|
||||
nDike : Str -> N ; -- dike (diket, diken, dikena) ; neutrum
|
||||
nRep : Str -> N ; -- rep (repet, rep, repen) ; neutrum
|
||||
nPapper : Str -> N ; -- papper (pappret, papper, pappren) ; neutrum
|
||||
nMurare : Str -> N ; -- murare (muraren, murare, murarna) ; utrum ; masculine
|
||||
nKikare : Str -> N ; -- kikare (kikaren, kikare, kikarna) ; utrum
|
||||
|
||||
-- Nouns used as functions need a preposition. The most common ones are "av",
|
||||
-- "på", and "till".
|
||||
|
||||
mkFun : N -> Preposition -> Fun ;
|
||||
funAv : N -> Fun ;
|
||||
funPaa : N -> Fun ;
|
||||
funTill : N -> Fun ;
|
||||
|
||||
-- Proper names, with their possibly
|
||||
-- irregular genitive. The regular genitive is "s", omitted after "s".
|
||||
|
||||
mkPN : (_,_ : Str) -> Gender -> Sex -> PN ; -- Karolus, Karoli
|
||||
pnReg : Str -> Gender -> Sex -> PN ; -- Johan,Johans ; Johannes, Johannes
|
||||
|
||||
-- On the top level, it is maybe $CN$ that is used rather than $N$, and
|
||||
-- $NP$ rather than $PN$.
|
||||
|
||||
mkCN : N -> CN ;
|
||||
mkNP : (Karolus, Karoli : Str) -> Gender -> NP ;
|
||||
|
||||
npReg : Str -> Gender -> NP ; -- Johann, Johanns
|
||||
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
-- Non-comparison one-place adjectives need four forms in the worst case:
|
||||
-- strong singular, weak singular, plural.
|
||||
|
||||
mkAdj1 : (_,_,_,_ : Str) -> Adj1 ; -- liten, litet, lilla, små
|
||||
|
||||
-- Special cases needing one form each are: regular adjectives,
|
||||
-- adjectives with unstressed "e" in the last syllable, those
|
||||
-- ending with "n" as a further special case, and invariable
|
||||
-- adjectives.
|
||||
|
||||
adjReg : Str -> Adj1 ; -- billig (billigt, billiga, billiga)
|
||||
adjNykter : Str -> Adj1 ; -- nykter (nyktert, nyktra, nyktra)
|
||||
adjGalen : Str -> Adj1 ; -- galen (galet, galna, galna)
|
||||
adjInvar : Str -> Adj1 ; -- bra
|
||||
|
||||
-- Two-place adjectives need a preposition and a case as extra arguments.
|
||||
|
||||
mkAdj2 : Adj1 -> Str -> Adj2 ; -- delbar, med
|
||||
mkAdj2Reg : Str -> Str -> Adj2 ; --
|
||||
|
||||
-- Comparison adjectives may need the three four forms for the positive case, plus
|
||||
-- three more forms for the comparison cases.
|
||||
|
||||
mkAdjDeg : (liten, litet, lilla, sma, mindre, minst, minsta : Str) -> AdjDeg ;
|
||||
|
||||
-- Some comparison adjectives are completely regular.
|
||||
|
||||
aReg : Str -> AdjDeg ;
|
||||
|
||||
-- On top level, there are adjectival phrases. The most common case is
|
||||
-- just to use a one-place adjective. The variation in $adjGen$ is taken
|
||||
-- into account.
|
||||
|
||||
apReg : Str -> AP ;
|
||||
|
||||
--2 Verbs
|
||||
--
|
||||
-- The fragment only has present tense so far.
|
||||
-- The worst case needs three forms: the infinitive, the indicative, and the
|
||||
-- imperative.
|
||||
|
||||
mkV : (_,_,_ : Str) -> V ; -- vara, är, var; trivas, trivs, trivs
|
||||
|
||||
-- The main conjugations need one string each.
|
||||
|
||||
vKoka : Str -> V ; -- tala (talar, tala)
|
||||
vSteka : Str -> V ; -- leka (leker, lek)
|
||||
vBo : Str -> V ; -- bo (bor, bo)
|
||||
|
||||
vAndas : Str -> V ; -- andas [all forms the same: also "slåss"]
|
||||
vTrivas : Str -> V ; -- trivas (trivs, trivs)
|
||||
|
||||
-- The verbs 'be' and 'have' are special.
|
||||
|
||||
vVara : V ;
|
||||
vHa : V ;
|
||||
|
||||
-- Particle verbs are formed by putting together a verb and a particle.
|
||||
-- If the verb already has a particle, it is replaced by the new one.
|
||||
|
||||
mkPartV : V -> Str -> V ; -- stänga av ;
|
||||
|
||||
-- Two-place verbs, and the special case with direct object.
|
||||
|
||||
mkTV : V -> Preposition -> TV ; -- tycka, om
|
||||
tvDir : V -> TV ; -- gilla
|
||||
|
||||
-- The definitions should not bother the user of the API. So they are
|
||||
-- hidden from the document.
|
||||
--.
|
||||
|
||||
utrum = Utr ;
|
||||
neutrum = Neutr ;
|
||||
masculine = Masc ;
|
||||
nonmasculine = NoMasc ;
|
||||
nominative = Nom ;
|
||||
genitive = Gen ;
|
||||
-- singular defined in Types
|
||||
-- plural defined in Types
|
||||
|
||||
mkN = \apa, apan, apor, aporna, g, x -> let
|
||||
{nom = table {
|
||||
SF Sg Indef _ => apa ;
|
||||
SF Sg Def _ => apan ;
|
||||
SF Pl Indef _ => apor ;
|
||||
SF Pl Def _ => aporna
|
||||
}
|
||||
} in
|
||||
{s = \\n,d,c => mkCase c (nom ! SF n d Nom) ;
|
||||
g = g ; x = x ; lock_N = <>
|
||||
} ;
|
||||
|
||||
-- auxiliaries
|
||||
mkGenit : Tok -> Tok = \s -> ifTok Tok (Predef.dp 1 s) "s" s (s + "s") ;
|
||||
mkCase : Case -> Tok -> Tok = \c,t -> case c of {
|
||||
Nom => t ;
|
||||
Gen => mkGenit t
|
||||
} ;
|
||||
|
||||
nApa = \apa ->
|
||||
let {apor = Predef.tk 1 apa + "or"} in
|
||||
mkN apa (apa + "n") apor (apor + "na") utrum nonmasculine ;
|
||||
|
||||
nBil = \bil ->
|
||||
mkN bil (bil + "en") (bil + "ar") (bil + "arna") utrum nonmasculine ;
|
||||
nKarl = \bil ->
|
||||
mkN bil (bil + "en") (bil + "ar") (bil + "arna") utrum masculine ;
|
||||
nPojke = \pojke ->
|
||||
let {bil = Predef.tk 1 pojke} in
|
||||
mkN pojke (bil + "en") (bil + "ar") (bil + "arna") utrum masculine ;
|
||||
nNyckel = \cykel ->
|
||||
let {cykl = Predef.tk 2 cykel + Predef.dp 1 cykel} in
|
||||
mkN cykel (cykel + "n") (cykl + "ar") (cykl + "arna") utrum nonmasculine ;
|
||||
nRisk = \bil ->
|
||||
mkN bil (bil + "en") (bil + "er") (bil + "erna") utrum nonmasculine ;
|
||||
nDike = \dike ->
|
||||
mkN dike (dike + "t") (dike + "n") (dike + "na") neutrum nonmasculine ;
|
||||
nRep = \rep ->
|
||||
mkN rep (rep + "et") rep (rep + "en") neutrum nonmasculine ;
|
||||
nPapper = \cykel ->
|
||||
let {cykl = Predef.tk 2 cykel + Predef.dp 1 cykel} in
|
||||
mkN cykel (cykl + "et") cykel (cykl + "en") neutrum nonmasculine ;
|
||||
nMurare = \murare ->
|
||||
let {murar = Predef.tk 1 murare} in
|
||||
mkN murare (murar + "en") murare (murar + "na") utrum masculine ;
|
||||
nKikare = \murare ->
|
||||
let {murar = Predef.tk 1 murare} in
|
||||
mkN murare (murar + "en") murare (murar + "na") utrum nonmasculine ;
|
||||
|
||||
|
||||
mkFun x y = SyntaxSwe.mkFun x y ** {lock_Fun = <>} ;
|
||||
funAv = \f -> mkFun f "av" ;
|
||||
funPaa = \f -> mkFun f "på" ;
|
||||
funTill = \f -> mkFun f "till" ;
|
||||
|
||||
mkPN = \karolus, karoli, g, x ->
|
||||
{s = table {Gen => karoli ; _ => karolus} ; g = g ; x = x ; lock_PN = <>} ;
|
||||
pnReg = \horst ->
|
||||
mkPN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) ;
|
||||
|
||||
mkCN = UseN ;
|
||||
mkNP = \a,b,g -> UsePN (mkPN a b g nonmasculine) ; -- gender irrelevant in NP
|
||||
npReg = \s,g -> UsePN (pnReg s g nonmasculine) ;
|
||||
|
||||
mkAdj1 = \liten, litet, lilla, små ->
|
||||
{s = table {
|
||||
Strong (ASg Utr) => \\c => mkCase c liten ;
|
||||
Strong (ASg Neutr) => \\c => mkCase c litet ;
|
||||
Strong APl => \\c => mkCase c små ;
|
||||
Weak (AxSg Masc) => \\c => mkCase c (Predef.tk 1 lilla + "e") ;
|
||||
Weak _ => \\c => mkCase c lilla
|
||||
} ;
|
||||
lock_Adj1 = <>
|
||||
} ;
|
||||
|
||||
adjReg = \billig -> mkAdj1 billig (billig + "t") (billig + "a") (billig + "a") ;
|
||||
adjNykter = \nykter ->
|
||||
let {nyktr = Predef.tk 2 nykter + Predef.dp 1 nykter} in
|
||||
mkAdj1 nykter (nykter + "t") (nyktr + "a") (nyktr + "a") ;
|
||||
adjGalen = \galen ->
|
||||
let {gal = Predef.tk 2 galen} in
|
||||
mkAdj1 galen (gal + "et") (gal + "na") (gal + "na") ;
|
||||
adjInvar = \bra -> {s = \\_,_ => bra ; lock_Adj1 = <>} ;
|
||||
|
||||
mkAdj2 = \a,p -> a ** {s2 = p ; lock_Adj2 = <>} ;
|
||||
mkAdj2Reg = \a -> mkAdj2 (adjReg a) ;
|
||||
|
||||
mkAdjDeg = \liten, litet, lilla, sma, mindre, minst, minsta ->
|
||||
let {lit = (mkAdj1 liten litet lilla sma).s} in
|
||||
{s = table {
|
||||
AF (Posit f) c => lit ! f ! c ;
|
||||
AF Compar c => mkCase c mindre ;
|
||||
AF (Super SupStrong) c => mkCase c minst ;
|
||||
AF (Super SupWeak) c => mkCase c minsta --- masculine!
|
||||
} ;
|
||||
lock_AdjDeg = <>
|
||||
} ;
|
||||
|
||||
aReg = \fin -> mkAdjDeg fin
|
||||
(fin + "t") (fin + "a") (fin + "a") (fin + "are") (fin + "ast") (fin + "aste") ;
|
||||
|
||||
apReg = \s -> AdjP1 (adjReg s) ;
|
||||
|
||||
mkV x y z = mkVerb x y z ** {lock_V = <>} ;
|
||||
vKoka = \tala -> mkV tala (tala+"r") tala ;
|
||||
vSteka = \leka -> let {lek = Predef.tk 1 leka} in mkV leka (lek + "er") lek ;
|
||||
vBo = \bo -> mkV bo (bo+"r") bo ;
|
||||
vAndas = \andas -> mkV andas andas andas ;
|
||||
vTrivas = \trivas ->
|
||||
let {trivs = Predef.tk 1 trivas + "s"} in mkV trivas trivs trivs ;
|
||||
vVara = verbVara ** {lock_V = <>} ;
|
||||
vHa = verbHava ** {lock_V = <>} ;
|
||||
mkPartV v p = {s = v.s ; s1 = p ; lock_V = <>} ;
|
||||
mkTV x y = mkTransVerb x y ** {lock_TV = <>} ;
|
||||
tvDir = \v -> mkTV v [] ;
|
||||
|
||||
} ;
|
||||
3
lib/resource-0.6/swedish/ResourceSwe.gf
Normal file
3
lib/resource-0.6/swedish/ResourceSwe.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource ResourceSwe = reuse StructuralSwe ;
|
||||
137
lib/resource-0.6/swedish/StructuralSwe.gf
Normal file
137
lib/resource-0.6/swedish/StructuralSwe.gf
Normal file
@@ -0,0 +1,137 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level English Resource Grammar: Structural Words
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2003
|
||||
--
|
||||
concrete StructuralSwe of Structural =
|
||||
CombinationsSwe ** open Prelude, SyntaxSwe in {
|
||||
lin
|
||||
|
||||
INP = pronNounPhrase jag_32 ;
|
||||
ThouNP = pronNounPhrase du_33 ;
|
||||
HeNP = pronNounPhrase han_34 ;
|
||||
SheNP = pronNounPhrase hon_35 ;
|
||||
WeNP n = pronNounPhrase (pronWithNum vi_36 n) ;
|
||||
YeNP n = pronNounPhrase (pronWithNum ni_37 n) ;
|
||||
TheyNP = 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 här"] Neutr NoMasc ;
|
||||
ThatNP = regNameNounPhrase ["det där"] Neutr NoMasc ;
|
||||
TheseNP n = {s = \\c => ["det här"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||
ThoseNP n = {s = \\c => ["det där"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||
|
||||
EveryDet = varjeDet ;
|
||||
AllDet = mkDeterminerSgGender2 "all" "allt" IndefP ;
|
||||
AllsDet = mkDeterminerPlNum "alla" IndefP ;
|
||||
AnyDet = mkDeterminerSgGender2 "någon" "något" IndefP ;
|
||||
AnysDet = mkDeterminerPlNum "några" IndefP ;
|
||||
SomeDet = mkDeterminerSgGender2 "någon" "något" IndefP ;
|
||||
SomesDet = mkDeterminerPlNum "några" IndefP ;
|
||||
ManyDet = mkDeterminerPl "många" IndefP ;
|
||||
NoDet = mkDeterminerSgGender2 "ingen" "inget" IndefP ;
|
||||
NosDet = mkDeterminerPlNum "inga" IndefP ;
|
||||
WhichsDet = mkDeterminerPlNum "vilka" IndefP ;
|
||||
|
||||
WhichDet = vilkenDet ;
|
||||
MostDet = mkDeterminerSgGender2 ["den mesta"] ["det mesta"] (DefP Def) ;
|
||||
MostsDet = flestaDet ;
|
||||
MuchDet = mkDeterminerSg (detSgInvar "mycket") IndefP ;
|
||||
|
||||
ThisDet = mkDeterminerSgGender2 ["den här"] ["det här"] (DefP Def) ;
|
||||
ThatDet = mkDeterminerSgGender2 ["den där"] ["det där"] (DefP Def) ;
|
||||
TheseDet = mkDeterminerPlNum ["de här"] (DefP Def) ;
|
||||
ThoseDet = mkDeterminerPlNum ["de där"] (DefP Def) ;
|
||||
|
||||
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 ."] ;
|
||||
|
||||
VeryAdv = ss "mycket" ;
|
||||
TooAdv = ss "för" ;
|
||||
OtherwiseAdv = ss "annars" ;
|
||||
ThereforeAdv = ss "därför" ;
|
||||
|
||||
{-
|
||||
EveryDet = everyDet ;
|
||||
AllDet = mkDeterminer Sg "all" ; --- all the missing
|
||||
AllsDet = mkDeterminerNum Pl "all" ;
|
||||
WhichDet = whichDet ;
|
||||
WhichsDet = mkDeterminerNum Pl "which" ;
|
||||
MostsDet = mostDet ;
|
||||
MostDet = mkDeterminer Sg "most" ;
|
||||
SomeDet = mkDeterminer Sg "some" ;
|
||||
SomesDet = mkDeterminerNum Pl "some" ;
|
||||
AnyDet = mkDeterminer Sg "any" ;
|
||||
AnysDet = mkDeterminerNum Pl "any" ;
|
||||
NoDet = mkDeterminer Sg "no" ;
|
||||
NosDet = mkDeterminerNum Pl "no" ;
|
||||
ManyDet = mkDeterminer Sg "many" ;
|
||||
MuchDet = mkDeterminer Sg ["a lot of"] ; ---
|
||||
ThisDet = mkDeterminer Sg "this" ;
|
||||
TheseDet = mkDeterminerNum Pl "these" ;
|
||||
ThatDet = mkDeterminer Sg "that" ;
|
||||
ThoseDet = mkDeterminerNum Pl "those" ;
|
||||
|
||||
ThisNP = nameNounPhrase (nameReg "this") ;
|
||||
ThatNP = nameNounPhrase (nameReg "that") ;
|
||||
TheseNP n = nameNounPhrase {s = \\c => "these" ++ n.s ! c} ;
|
||||
ThoseNP n = nameNounPhrase {s = \\c => "those" ++ n.s ! c} ;
|
||||
-}
|
||||
|
||||
EverybodyNP = nameNounPhrase (mkProperName "alleman" Utr Masc) ;
|
||||
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) ;
|
||||
|
||||
CanVV = mkVerb "kunna" "kan" "kunn" ** {isAux = True} ; ---
|
||||
CanKnowVV = mkVerb "kunna" "kan" "kunn" ** {isAux = True} ; ---
|
||||
MustVV = mkVerb "få" "måste" "få" ** {isAux = True} ; ---
|
||||
WantVV = mkVerb "vilja" "vill" "vilj" ** {isAux = True} ; ---
|
||||
|
||||
EverywhereNP = advPost "varstans" ;
|
||||
SomewhereNP = advPost "någonstans" ;
|
||||
NowhereNP = advPost "ingenstans" ;
|
||||
|
||||
AlthoughSubj = ss "fast" ;
|
||||
|
||||
AlmostAdv = ss "nästan" ;
|
||||
QuiteAdv = ss "ganska" ;
|
||||
|
||||
InPrep = ss "i" ;
|
||||
OnPrep = ss "på" ;
|
||||
ToPrep = ss "till" ;
|
||||
ThroughPrep = ss "genom" ;
|
||||
AbovePrep = ss "ovanför" ;
|
||||
UnderPrep = ss "under" ;
|
||||
InFrontPrep = ss "framför" ;
|
||||
BehindPrep = ss "bakom" ;
|
||||
BetweenPrep = ss "mellan" ;
|
||||
FromPrep = ss "från" ;
|
||||
BeforePrep = ss "före" ;
|
||||
DuringPrep = ss "under" ;
|
||||
AfterPrep = ss "efter" ;
|
||||
WithPrep = ss "med" ;
|
||||
WithoutPrep = ss "utan" ;
|
||||
ByMeansPrep = ss "med" ;
|
||||
PartPrep = ss "av" ;
|
||||
AgentPrep = ss "av" ;
|
||||
|
||||
}
|
||||
1148
lib/resource-0.6/swedish/SyntaxSwe.gf
Normal file
1148
lib/resource-0.6/swedish/SyntaxSwe.gf
Normal file
File diff suppressed because it is too large
Load Diff
51
lib/resource-0.6/swedish/TestResourceSwe.gf
Normal file
51
lib/resource-0.6/swedish/TestResourceSwe.gf
Normal file
@@ -0,0 +1,51 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete TestResourceSwe of TestResource = StructuralSwe ** open SyntaxSwe in {
|
||||
|
||||
flags startcat=Phr ; lexer=text ; unlexer=text ;
|
||||
|
||||
-- a random sample from the lexicon
|
||||
|
||||
lin
|
||||
Big = stor_25 ;
|
||||
Small = liten_1146 ;
|
||||
Old = gammal_16 ;
|
||||
Young = ung_29 ;
|
||||
American = extAdjective (aFin "amerikansk") ;
|
||||
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") ;
|
||||
Walk = extVerb Act gå_1174 ;
|
||||
Run = extVerb Act (vFinna "spring" "sprang" "sprung") ;
|
||||
Drink = extTransVerb (vFinna "drick" "drack" "druck") [] ;
|
||||
Love = extTransVerb (vTala "älsk") [] ;
|
||||
Send = extTransVerb (vTala "skick") [] ;
|
||||
Wait = extTransVerb (vTala "vänt") "på" ;
|
||||
Give = extTransVerb (vFinna "giv" "gav" "giv") [] ** {s3 = "till"} ; --- ge
|
||||
Prefer = extTransVerb (vFinna "föredrag" "föredrog" "föredrag") [] **
|
||||
{s3 = "framför"} ; --- föredra
|
||||
|
||||
Say = extVerb Act (vLeka "säg") ; --- works in present tense...
|
||||
Prove = extVerb Act (vTala "bevis") ;
|
||||
SwitchOn = mkDirectVerb (extVerbPart Act (vFinna "sätt" "satte" "satt") "på") ;
|
||||
SwitchOff = mkDirectVerb (extVerbPart Act (vLeka "stäng") "av") ;
|
||||
|
||||
Mother = mkFun (extCommNoun NoMasc mor_1) "till" ;
|
||||
Uncle = mkFun (extCommNoun Masc farbror_8) "till" ;
|
||||
Connection = mkFun (extCommNoun NoMasc (sVarelse "förbindelse")) "från" **
|
||||
{s3 = "till"} ;
|
||||
|
||||
Always = advPre "alltid" ;
|
||||
Well = advPost "bra" ;
|
||||
|
||||
John = mkProperName "Johan" Utr Masc ;
|
||||
Mary = mkProperName "Maria" Utr NoMasc ;
|
||||
} ;
|
||||
161
lib/resource-0.6/swedish/TypesSwe.gf
Normal file
161
lib/resource-0.6/swedish/TypesSwe.gf
Normal file
@@ -0,0 +1,161 @@
|
||||
--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 TypesSwe = 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} ;
|
||||
|
||||
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
|
||||
| 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.
|
||||
-- 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 : VForm => Str ; s1 : Str} ;
|
||||
|
||||
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