Produced by gfdoc - a rudimentary GF document generator. (c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
Aarne Ranta 2003
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. It covers the bokmål variant of Norwegian.
Closed categories (determiners, pronouns, conjunctions) are
accessed through the resource syntax API, Structural
.
The main difference with MorphoNor.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 IrregNor
,
which covers irregularly inflected verbs.
resource ParadigmsNor = open (Predef=Predef), Prelude, CommonScand, ResNor, MorphoNor, CatNor in {
To abstract over gender names, we define the following identifiers.
oper Gender : Type ; masculine : Gender ; feminine : 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 are just strings.
mkPrep : Str -> Prep ; noPrep : Prep ; -- empty string
The regular function takes the singular indefinite form
and computes the other forms and the gender by a heuristic.
The heuristic is that nouns ending e are feminine like kvinne,
all others are masculine like bil.
Giving gender manually makes the heuristic more reliable.
One can also compute the gender from the definite form.
gender is computed from the definite form.
If in doubt, use the cc
command to test!
In the worst case, give all four forms. The gender is computed from the
last letter of the second form (if n, then utrum
, otherwise neutrum
).
mkN : overload { mkN : Str -> N ; mkN : Str -> Gender -> N ; mkN : (bil,bilen : Str) -> N ; mkN : (dreng,drengen,drenger,drengene : Str) -> N } ;
All the functions above work quite as well to form compound nouns, such as fotboll.
Relational nouns (datter til x) need a preposition.
mkN2 : N -> Prep -> N2 ;
The most common preposition is av, and the following is a
shortcut for regular, nonhuman
relational nouns with av.
regN2 : Str -> Gender -> N2 ;
Use the function mkPrep
or see the section on prepositions below to
form other prepositions.
Three-place relational nouns (forbindelse fra x til 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 gamle kongen av). 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 as follows Sometimes you can reuse a common noun as a proper name, e.g. Bank.
mkPN : overload { mkPN : Str -> PN ; -- masculine mkPN : Str -> Gender -> PN ; mkPN : N -> PN ; } ;
The regular pattern works for many adjectives, e.g. those ending with ig. Two, five, or at worst five forms are sometimes needed.
mkA : overload { mkA : (fin : Str) -> A ; mkA : (fin,fint : Str) -> A ; mkA : (galen,galet,galne : Str) -> A ; mkA : (stor,stort,store,storre,storst : Str) -> A ;
If comparison is formed by mer, mest, as in general for long adjective, the following pattern is used:
mkA : A -> A ; -- -/mer/mest norsk } ;
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 follow the verb (e.g. altid).
mkAdv : Str -> Adv ; -- e.g. her mkAdV : Str -> AdV ; -- e.g. altid
Adverbs modifying adjectives and sentences can also be formed.
mkAdA : Str -> AdA ;
mkV : overload {
The 'regular verb' function is the first conjugation.
mkV : (snakke : Str) -> V ;
The almost regular verb function needs the infinitive and the preteritum.
mkV : (leve,levde : Str) -> V ;
There is an extensive list of irregular verbs in the module IrregNor
.
In practice, it is enough to give three forms, as in school books.
mkV : (drikke, drakk, drukket : Str) -> V ;
The worst case needs six forms.
mkV : (spise,spiser,spises,spiste,spist,spis : Str) -> V ;
The particle, such as in lukke opp, is given as a string.
mkV : V -> Str -> V ; } ;
By default, the auxiliary is have. This function changes it to være.
vaereV : V -> V ;
Some words are used in passive forms only, e.g. trives, some as reflexive e.g. forestille seg.
depV : V -> V ; reflV : V -> V ;
Two-place verbs need a preposition, except the special case with direct object.
(transitive verbs). 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.
mkV3 : V -> Prep -> Prep -> V3 ; -- snakke, med, om dirV3 : V -> Prep -> V3 ; -- gi,_,til dirdirV3 : V -> V3 ; -- gi,_,_
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 ;