A Guided Tour of Swedish Grammar
Aarne Ranta

%!style(html) : utf8
%!postproc(html) : "#SWE" ""

This is an introduction to the basic grammar of Swedish. 
It is guided by a computer program that knows the rules of the grammar.
The program has produced the examples shown during the tour.
You can read this document without access to the program, and get an
overview of Swedish grammar rules. 
However, really to make use of the knowledge included in the program,
you should try out every rule by itself and also vary the rules in
interaction with the computer. 

You can make the same tour, with appropriate modifications, with
Bulgarian 
Catalan
Dutch
Finnish
French
German


=Computer prerequisites=

To use the Swedish grammar program and test the grammar yourself, you need
- a computer with Linux, Mac OS, or Windows
- the program GF (Grammatical Framework), downloadable from
  the [GF website http://grammaticalframework.org]
- the grammar package ``Lang.pgf``, downloadable from [here ./Lang.pgf]


In future, we plan to provide a web-based version of this grammar tour,
so that you can ran the program without downloading or installing anything.

After installing GF (see instructions at GF website), just start it by
the shell command
```
  gf Lang.pgf
```
Then initialize the shell with a couple of handy commands:

| ``%forms``     | show the forms of a word or a phrase in Swedish |
| ``%numeral``   | translate a number to a Swedish numeral expression |
| ``%table``     | show the inflection table a word or a phrase in Swedish |
| ``%translate`` | translate an utterance from English to Swedish |


Initialization is made with the following commands, which define command macros in GF:
```
> dc translate ps -lextext ?0 | parse -cat=Utt -lang=LangEng | linearize -lang=LangSwe
> dc table linearize -table -lang=LangSwe ?0
> dc forms linearize -list -lang=LangSwe ?0
> dc numeral ps -chars ?0 | p -cat=Digits -lang=LangSwe | pt -transfer=digits2num | l -lang=LangSwe
```
This is just to save you some work afterwards and to make this document
clearer; you could quite as well use the basic commands that are predifined
in GF, and for some less frequent cases we'll actually use them directly.

The **prompt** sign ``>`` is produced by GF, and you should only
write what is after it. In this document, we will use two kinds of markings
of type-written lines:
- ``>`` followed by a command you type
- ``*`` followed by output from GF


=Words and inflection=

We are ready to start the tour. We begin in the same way as grammar books usually do:
from words and their forms.


==Nouns==

The inflection forms of nouns are shown in the following example:
```
> %table flower_N
* s Sg Indef Nom : blomma
* s Sg Indef Gen : blommas
* s Sg Def Nom : blomman
* s Sg Def Gen : blommans
* s Pl Indef Nom : blommor
* s Pl Indef Gen : blommors
* s Pl Def Nom : blommorna
* s Pl Def Gen : blommornas
```
Here are some inflection patterns.
#SWE They show the declensions 1 to 5.
```
> %forms flower_N
* blomma, blommas, blomman, blommans, blommor, blommors, blommorna, blommornas

> %forms car_N
* bil, bils, bilen, bilens, bilar, bilars, bilarna, bilarnas

> %forms cat_N
* katt, katts, katten, kattens, katter, katters, katterna, katternas

> %forms apple_N
* äpple, äpples, äpplet, äpplets, äpplen, äpplens, äpplena, äpplenas

> %forms house_N
* hus, hus, huset, husets, hus, hus, husen, husens
```
The symbol ``N`` is used in the program to denote nouns. Here it is suffixed to
English words to indicate the meanings of the Swedish nouns. This meaning
can be approximative, or just cover one of the possible senses.

In addition to inflection forms,
Swedish nouns also have a gender. The gender is reflected, among
other things, in the indefinite article used with the nouns.
```
> %translate "a man"
* en man

> %translate "a woman"
* en kvinna

> %translate "a house"
* ett hus
```
The grammar training program has a small lexicon, with just 182 nouns. To see 
all there nouns, together with their inflection forms and senses explained in
English, you can do as follows:
```
> generate_trees -cat=N -number=5 | linearize -treebank -list -lang=LangSwe

* airplane_N
* flygplan, flygplans, flygplanet, flygplanets, flygplan, flygplans, flygplanen, flygplanens

* animal_N
* djur, djurs, djuret, djurets, djur, djurs, djuren, djurens
```

===Quizzes with nouns===

If you already know some Swedish,
you can try out a **morphology quiz**, which lets you train your knowledge
of Swedish noun inflection. You can later train your inflection skills with
other parts of speech, just changing the symbol ``N`` to some other symbol.
```
  morpho_quiz -cat=N -lang=LangSwe

  Welcome to GF Morphology Quiz.
  The quiz is over when you have done at least 10 examples
  with at least 75 % success.
  You can interrupt the quiz by entering a line consisting of a dot ('.').
```
The quiz questions are randomly generated, so you can use the same
quiz for increasing your Swedish skills over and over again.

Another quiz is the **translation quiz**, which lets you to train translations
of nouns from English to Swedish (or, in fact, of any part of speech from any
language to any other one). Here is how it goes:
```
  translation_quiz -from=LangEng -to=LangSwe -cat=N
  Welcome to GF Translation Quiz.
  The quiz is over when you have done at least 10 examples
  with at least 75 % success.
  You can interrupt the quiz by entering a line consisting of a dot ('.').
 
  ceiling
  tak
  > Yes.
  Score 1/1
  night
  nat
  > No, not nat, but
  natt
```


==Numerals and determiners==

Numerals are in Swedish the easiest way to build complex noun phrases from nouns,
since their forms are independent of the noun; the noun is just inflected in
the plural indefinite. This is with the exception of "one", whose form depends
on the gender of the noun. Here is a quick way to generate the numerals from 1 to 9:
```
> gt -cat=Sub10 -number=9 | l -lang=LangEng,LangSwe
* en
* två
* tre
* fyra
* fem
* sex
* sju
* åtta
* nio
```
Translate digits to Swedish numerals; the largest one that can be translated is 999,999:
```
> %numeral "123"
* ett hundra tjugo tre
```
Translate noun phrases with numerals and nouns:
```
> %translate "one boy"
* en pojke

> %translate "one apple"
* ett äpple

> %translate "two boys"
* två pojkar

> %translate "eleven cars"
* elva bilar

> %numeral "999999"
* nio hundra nittio nio tusen nio hundra nittio nio
```
Numerals are a special case of **determiners**: words that are combined with nouns to
form **noun phrases**. Articles are anouther special case; we already saw the indefinite
articles:
```
> %translate "a man, a woman, a car and a house"
* en man , en kvinna , en bil och ett hus
```
Here are examples with definite articles.
#SWE In Swedish, they are expressed by inflecting the noun 
#SWE rather than adding a word like English //the//.
```
> %translate "the man, the woman, the car and the house"
* mannen , kvinnan , bilen och huset
```
This is similar in the plural:
```
> %translate "the men, the women, the cars and the houses"
* männen , kvinnorna , bilarna och husen
```
The indefinite forms in plural look as follows.
#SWE Just like in English, there is no explicit indefinite article 
#SWE in the plural: just use the plural indefinite form.
```
> %translate "men, women, cars and houses"
* män , kvinnor , bilar och hus
```
Other common determiners are shown in the following:
```
> %translate "this car, that car, these cars, those cars, some cars and all cars"
* den här bilen , den där bilen , de här bilarna , de där bilarna , några bilar och alla bilar

```
Generate more examples of nouns with determiners:
```
> gr -number=11 (UttNP (DetCN ? (UseN ?))) | l -lang=LangEng,LangSwe
* much reason
* mycket anledning
* 
* few grammars
* få grammatiker
* 
* some teacher
* någon lärare
```
You will find out that other determiners can combine with numerals, such as in
```
> %translate "these seven sisters"
* de här sju systrarna

> %translate "the seven sisters"
* de sju systrarna
```
#SWE thus with a numeral, the definite article suddenly appears as a word.


