Produced by gfdoc - a rudimentary GF document generator. (c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
Aarne Ranta 2001 - 2006
This is an API for the user of the resource grammar for adding lexical items. It gives functions for forming expressions of open 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, rather
than stems, as string arguments of the paradigms.
The structure of functions for each word class C
is the following:
first we give a handful of patterns that aim to cover all
regular cases. Then we give a worst-case function mkC
, which serves as an
escape to construct the most irregular words of type C
.
However, this function should only seldom be needed: we have a
separate module IrregSwe
,
which covers many irregular verbs.
resource ParadigmsSwe = open (Predef=Predef), Prelude, CommonScand, ResSwe, MorphoSwe, CatSwe in {
To abstract over gender names, we define the following identifiers.
oper Gender : Type ; utrum : Gender ; neutrum : Gender ;
To abstract over number names, we define the following.
Number : Type ; singular : Number ; plural : Number ;
To abstract over case names, we define the following.
Case : Type ; nominative : Case ; genitive : Case ;
Prepositions used in many-argument functions can be constructed from strings.
mkPrep : Str -> Prep ; noPrep : Prep ; -- empty string
The following overloaded paradigm takes care of all noun formation.
mkN : overload {
The one-argument case takes the singular indefinite form and computes the other forms and the gender by a simple heuristic. The heuristic is currently to treat all words ending with a like apa-apor, with e like rike-riken, and otherwise like bil-bilar.
mkN : (apa : Str) -> N ;
The case with a string and gender makes it possible to treat lik (neutrum) and pojke (utrum).
mkN : (lik : Str) -> Gender -> N ;
Giving two forms - the singular and plural indefinite - is sufficient for most nouns. The paradigm deals correctly with the vowel contractions in nyckel - nycklar such as pojke - pojkar.
mkN : (nyckel,nycklar : Str) -> N ;
In the worst case, four forms are needed.
mkN : (museum,museet,museer,museerna : Str) -> N } ;
All the functions above work quite as well to form compound nouns, such as fotboll.
Relational nouns (kung av x) are nouns with a preposition.
As a special case, we provide regular nouns (formed with one-argument mkN
)
with the preposition av.
mkN2 : overload { mkN2 : Str -> N2 ; mkN2 : N -> Prep -> N2 } ;
Three-place relational nouns (förbindelse från x till y) need two prepositions.
mkN3 : N -> Prep -> Prep -> N3 ;
In some cases, you may want to make a complex CN
into a
relational noun (e.g. den före detta maken till). However, N2
and
N3
are purely lexical categories. But you can use the AdvCN
and PrepNP
constructions to build phrases like this.
Proper names, with a regular genitive, are formed from strings and have the default gender utrum.
mkPN : overload { mkPN : Str -> PN ; mkPN : Str -> Gender -> PN ;
In the worst case, the genitive form is irregular.
mkPN : (jesus,jesu : Str) -> Gender -> PN } ;
Adjectives need one to seven forms.
mkA : overload {
Most adjectives are formed simply by adding endings to a stem.
mkA : (billig : Str) -> A ;
Some adjectives have a deviant neuter form. The following pattern also recognizes the neuter formation galen-galet and forms the proper plural and comparison forms galna-galnare-galnast.
mkA : (bred,brett : Str) -> A ;
Umlaut in comparison forms is
mkA : (tung,tyngre,tyngst : Str) -> A ;
A few adjectives need 5 forms.
mkA : (god,gott,goda,battre,bast : Str) -> A ;
Hardly any other adjective than liten needs the full 7 forms.
mkA : (liten,litet,lilla,sma,mindre,minst,minsta : Str) -> A } ;
Comparison forms may be compound (mera svensk - mest svensk); this behaviour can be forced on any adjective.
compoundA : A -> A ;
Two-place adjectives need a preposition for their second argument.
mkA2 : A -> Prep -> A2 ;
Adverbs are not inflected. Most lexical ones have position after the verb. Some can be preverbal in subordinate position (e.g. alltid).
mkAdv : Str -> Adv ; -- här mkAdV : Str -> AdV ; -- alltid
Adverbs modifying adjectives and sentences can also be formed.
mkAdA : Str -> AdA ;
All verbs can be defined by the overloaded paradigm mkV
.
mkV : overload {
The 'regular verb' (= one-place) case is inspired by Lexin. It uses the present tense indicative form. The value is the first conjugation if the argument ends with ar (tala - talar - talade - talat), the second with er (leka - leker - lekte - lekt, with the variations like in gräva, vända, tyda, hyra), and the third in other cases (bo - bor - bodde - bott). It is also possible to give the infinite form to it; they are treated as if they were implicitly suffixed by r. Moreover, deponent verbs are recognized from the final s (hoppas).
mkV : (stämmer : Str) -> V ;
Most irregular verbs need just the conventional three forms.
mkV : (dricka,drack,druckit : Str) -> V ;
In the worst case, six forms are given.
mkV : (gå,går,gå,gick,gått,gången : Str) -> V ;
Particle verbs, such as passa på, are formed by adding a string to a verb.
mkV : V -> Str -> V } ;
Some words are used in passive forms only, e.g. hoppas, some as
reflexive e.g. ångra sig. Regular deponent verbs are also
handled by mkV
and recognized from the ending s.
depV : V -> V ; reflV : V -> V ;
Two-place verbs need a preposition, which default to the 'empty preposition'
i.e. direct object. (transitive verbs). The simplest case is a regular
verb (as in mkV
) with a direct object.
Notice that, if a particle is needed, it comes from the V
.
mkV2 : overload { mkV2 : Str -> V2 ; mkV2 : V -> V2 ; mkV2 : V -> Prep -> V2 } ;
Three-place (ditransitive) verbs need two prepositions, of which
the first one or both can be absent. The simplest case is a regular
verb (as in mkV
) with no prepositions.
mkV3 : overload { mkV3 : Str -> V3 ; mkV3 : V -> V3 ; mkV3 : V -> Prep -> V3 ; mkV3 : V -> Prep -> Prep -> V3 } ;
Verbs and adjectives can take complements such as sentences, questions, verb phrases, and adjectives.
mkV0 : V -> V0 ; mkVS : V -> VS ; mkV2S : V -> Prep -> V2S ; mkVV : V -> VV ; mkV2V : V -> Prep -> Prep -> V2V ; mkVA : V -> VA ; mkV2A : V -> Prep -> V2A ; mkVQ : V -> VQ ; mkV2Q : V -> Prep -> V2Q ; mkAS : A -> AS ; mkA2S : A -> Prep -> A2S ; mkAV : A -> AV ; mkA2V : A -> Prep -> A2V ;
Notice: categories V2S, V2V, V2A, V2Q
are in v 1.0 treated
just as synonyms of V2
, and the second argument is given
as an adverb. Likewise AS, A2S, AV, A2V
are just A
.
V0
is just V
.
V0, V2S, V2V, V2A, V2Q : Type ; AS, A2S, AV, A2V : Type ;