1
0
forked from GitHub/gf-core

globalized the resource tour

This commit is contained in:
aarne
2010-04-30 13:44:33 +00:00
parent a47df1d54e
commit 65ede6ff35
4 changed files with 1319 additions and 153 deletions

View File

@@ -37,5 +37,8 @@ Spa:
runghc MkTour Spa Spanish runghc MkTour Spa Spanish
Swe: Swe:
txt2tags -thtml -o tourSwe.html tour.txt runghc MkTour Swe Swedish
Urd:
runghc MkTour Urd Urdu

View File

@@ -1,5 +1,6 @@
module Main where module Main where
import Char
import System import System
original = "tour.txt" original = "tour.txt"
@@ -14,27 +15,30 @@ main = do
writeFile txt [] writeFile txt []
script <- mkTour lan language src txt gfs script <- mkTour lan language src txt gfs
system $ "gf -s Demo.pgf <" ++ gfs system $ "gf -s Demo.pgf <" ++ gfs
system $ "txt2tags -thtml " ++ txt system $ "txt2tags --toc -thtml " ++ txt
mkTour :: String -> String -> [String] -> FilePath -> FilePath -> IO () mkTour :: String -> String -> [String] -> FilePath -> FilePath -> IO ()
mkTour lan language src txt gfs = mapM_ mk src where mkTour lan language src txt gfs = mapM_ mk src where
mk line = case line of mk ll = do
'>':command -> do -- gf command let (lans,line) = lansline ll
let comm = loc command if (not (null lans) && not (elem lan lans)) -- language-specific, not for lan
apptxt ('>':comm) then return ()
appgfs (comm ++ " | " ++ appcomm) else case line of
appgfs "\n" '>':command -> do -- gf command
'*':_ -> return () -- gf-generated text let comm = loc command
'#':_ -> return () -- Swedish-specific line apptxt ('>':comm)
_ -> apptxt (loc line) appgfs (comm ++ " | " ++ appcomm)
appgfs "\n"
'*':_ -> return () -- gf-generated text
_ -> apptxt (loc line)
appgfs line = appendFile gfs line >> appendFile gfs "\n" appgfs line = appendFile gfs line >> appendFile gfs "\n"
loc line = case line of loc line = case line of
'S':'w':'e':'d':'i':'s':'h':cs -> language ++ loc cs 'L':'A':'N':'G':'U':'A':'G':'E':cs -> language ++ loc cs
'S':'w':'e' :cs -> lan ++ loc cs 'L':'N':'G' :cs -> lan ++ loc cs
c :cs -> c : loc cs c :cs -> c : loc cs
_ -> line _ -> line
@@ -42,6 +46,9 @@ mkTour lan language src txt gfs = mapM_ mk src where
appcomm = "wf -append -file=" ++ txt appcomm = "wf -append -file=" ++ txt
lansline ll = case ll of
'#':cs -> let (la,li) = break isSpace cs in (langs la, drop 1 li)
_ -> ([],ll)
langs = words . (map (\c -> if c==',' then ' ' else c))

View File

@@ -1,20 +1,20 @@
A Guided Tour of Swedish Grammar A Guided Tour of LANGUAGE Grammar
Aarne Ranta Aarne Ranta
%!style(html) : utf8
%!postproc(html) : "#SWE" ""
%!postproc(html) : "sswedish" "Swedish"
This is an introduction to the basic grammar of Swedish. %!style(html) : utf8
This is an introduction to the basic grammar of LANGUAGE.
It is guided by a computer program that knows the rules of the grammar. It is guided by a computer program that knows the rules of the grammar.
All examples shown during the tour have been produced by that program. All examples shown during the tour have been produced by that program.
You can read this document as it is, to get an You can read this document as it is, to get an
overview of Swedish grammar. overview of LANGUAGE grammar.
However, really to exploit the linguistic knowledge included in the program, However, really to exploit the linguistic knowledge included in the program,
you should try out every rule by itself and also vary the rules in you should try out every rule by itself and also vary the rules in
interaction with the computer. interaction with the computer.
The same tour is available for 16 languages. The same tour is (or will be) available for 17 languages.
- [Arabic tourAra.html] - [Arabic tourAra.html]
- [Bulgarian tourBul.html] - [Bulgarian tourBul.html]
- [Catalan tourCat.html] - [Catalan tourCat.html]
@@ -30,16 +30,17 @@ The same tour is available for 16 languages.
- [Romanian tourRon.html] - [Romanian tourRon.html]
- [Russian tourRus.html] - [Russian tourRus.html]
- [Spanish tourSpa.html] - [Spanish tourSpa.html]
- [swedish tour.html] - [Swedish tourSwe.html]
- [Urdu tourUrd.html]
To contribute a new language, see the See the last section of this document for how to contribute support for
[GF Resource Grammar Project http://grammaticalframework.org/doc/gfss]. new languages as a developer.
=Computer prerequisites= =Computer prerequisites=
To use the Swedish grammar program and test the grammar yourself, you need To use the LANGUAGE grammar program and test the grammar yourself, you need
- a computer with Linux, Mac OS, or Windows - a computer with Linux, Mac OS, or Windows
- the program GF (Grammatical Framework), downloadable from - the program GF (Grammatical Framework), downloadable from
the [GF website http://grammaticalframework.org] the [GF website http://grammaticalframework.org]
@@ -57,18 +58,18 @@ the shell command
``` ```
Then initialize the shell with a couple of handy commands: Then initialize the shell with a couple of handy commands:
| ``%forms`` | show the forms of a word or a phrase in Swedish | | ``%forms`` | show the forms of a word or a phrase in LANGUAGE |
| ``%numeral`` | translate a number to a Swedish numeral expression | | ``%numeral`` | translate a number to a LANGUAGE numeral expression |
| ``%table`` | show the inflection table a word or a phrase in Swedish | | ``%table`` | show the inflection table a word or a phrase in LANGUAGE |
| ``%translate`` | translate an utterance from English to Swedish | | ``%translate`` | translate an utterance from English to LANGUAGE |
Initialization is made with the command macro definitions in GF: Initialization is made with the command macro definitions in GF:
``` ```
> dc translate ps -lextext ?0 | parse -cat=Utt -lang=DemoEng | linearize -lang=DemoSwe > dc translate ps -lextext ?0 | parse -cat=Utt -lang=Eng | linearize -lang=LNG
> dc table linearize -table -lang=DemoSwe ?0 > dc table linearize -table -lang=LNG ?0
> dc forms linearize -list -lang=DemoSwe ?0 > dc forms linearize -list -lang=LNG ?0
> dc numeral ps -chars ?0 | p -cat=Digits -lang=DemoSwe | pt -transfer=digits2num | l -lang=DemoSwe > dc numeral ps -chars ?0 | p -cat=Digits -lang=LNG | pt -transfer=digits2num | l -bind -lang=LNG
``` ```
This is just to save you some work afterwards and to make this document 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 clearer; you could quite as well use the basic commands that are predifined
@@ -106,7 +107,7 @@ The inflection forms of nouns are shown in the following example:
``` ```
The forms together are an example of an **inflection pattern**. The forms together are an example of an **inflection pattern**.
Here are some inflection patterns. Here are some inflection patterns.
#SWE They show the declensions 1 to 5. #Swe They show the declensions 1 to 5.
``` ```
> %forms flower_N > %forms flower_N
* blomma, blommas, blomman, blommans, blommor, blommors, blommorna, blommornas * blomma, blommas, blomman, blommans, blommor, blommors, blommorna, blommornas
@@ -118,17 +119,17 @@ Here are some inflection patterns.
* katt, katts, katten, kattens, katter, katters, katterna, katternas * katt, katts, katten, kattens, katter, katters, katterna, katternas
> %forms apple_N > %forms apple_N
* äpple, äpples, äpplet, äpplets, äpplen, äpplens, äpplena, äpplenas * äpple, äpples, äpplet, äpplets, äpplen, äpplens, äpplena, äpplenas
> %forms house_N > %forms house_N
* hus, hus, huset, husets, hus, hus, husen, husens * hus, hus, huset, husets, hus, hus, husen, husens
``` ```
The symbol ``N`` is used in the program to denote nouns. Here it is suffixed to 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 English words to indicate the meanings of the LANGUAGE nouns. This meaning
can be approximative, or just cover one of the possible senses. can be approximative, or just cover one of the possible senses.
In addition to inflection forms, In addition to inflection forms,
Swedish nouns also have a gender. The gender is reflected, among LANGUAGE nouns also have a gender. The gender is reflected, among
other things, in the indefinite article used with the nouns. other things, in the indefinite article used with the nouns.
``` ```
> %translate "a man" > %translate "a man"
@@ -144,7 +145,7 @@ 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 all there nouns, together with their inflection forms and senses explained in
English, you can do as follows: English, you can do as follows:
``` ```
> generate_trees -cat=N -number=5 | linearize -treebank -list -lang=DemoSwe > generate_trees -cat=N -number=5 | linearize -treebank -list -lang=LNG
* airplane_N * airplane_N
* flygplan, flygplans, flygplanet, flygplanets, flygplan, flygplans, flygplanen, flygplanens * flygplan, flygplans, flygplanet, flygplanets, flygplan, flygplans, flygplanen, flygplanens
@@ -155,12 +156,12 @@ English, you can do as follows:
===Quizzes with nouns=== ===Quizzes with nouns===
If you already know some Swedish, If you already know some LANGUAGE,
you can try out a **morphology quiz**, which lets you train your knowledge 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 of LANGUAGE noun inflection. You can later train your inflection skills with
other parts of speech, just changing the symbol ``N`` to some other symbol. other parts of speech, just changing the symbol ``N`` to some other symbol.
``` ```
morpho_quiz -cat=N -lang=DemoSwe morpho_quiz -cat=N -lang=LNG
Welcome to GF Morphology Quiz. Welcome to GF Morphology Quiz.
The quiz is over when you have done at least 10 examples The quiz is over when you have done at least 10 examples
@@ -181,12 +182,12 @@ other parts of speech, just changing the symbol ``N`` to some other symbol.
(The above quiz example is swedish for all languages, for technical reasons.) (The above quiz example is swedish for all languages, for technical reasons.)
The quiz questions are randomly generated, so you can use the same The quiz questions are randomly generated, so you can use the same
quiz for increasing your Swedish skills over and over again. quiz for increasing your LANGUAGE skills over and over again.
Another quiz is the **translation quiz**, which lets you to train translations 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 of nouns from English to LANGUAGE (or, in fact, of any part of speech from any
language to any other one). Here is how it goes language to any other one). Here is how it goes
(to swedish, for technical reasons): (to Swedish, for the sake of example):
``` ```
translation_quiz -from=DemoEng -to=DemoSwe -cat=N translation_quiz -from=DemoEng -to=DemoSwe -cat=N
Welcome to GF Translation Quiz. Welcome to GF Translation Quiz.
@@ -207,25 +208,25 @@ language to any other one). Here is how it goes
==Numerals and determiners== ==Numerals and determiners==
Numerals are in Swedish the easiest way to build complex noun phrases from nouns, Numerals are in LANGUAGE the easiest way to build complex noun phrases from nouns,
since their forms are independent of the noun; the noun is just inflected in 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 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 on the gender of the noun. Here is a quick way to generate the numerals from 1
to 9: to 9:
``` ```
> generate_trees -cat=Sub10 -number=9 | l -lang=DemoEng,DemoSwe > generate_trees -cat=Sub10 -number=9 | l -lang=Eng,LNG
* en * en
* två * två
* tre * tre
* fyra * fyra
* fem * fem
* sex * sex
* sju * sju
* åtta * åtta
* nio * nio
``` ```
Any sequence of digits from 1 to 999999 can be translated Any sequence of digits from 1 to 999999 can be translated
to a Swedish numeral with the ``%numeral`` command: to a LANGUAGE numeral with the ``%numeral`` command:
``` ```
> %numeral "10" > %numeral "10"
* tio * tio
@@ -243,9 +244,9 @@ Numerals can be combined with nouns to form **noun phrases**:
> %translate "one boy" > %translate "one boy"
* en pojke * en pojke
> %translate "one apple" > %translate "one apple"
* ett äpple * ett äpple
> %translate "two boys" > %translate "two boys"
* två pojkar * två pojkar
> %translate "eleven cars" > %translate "eleven cars"
* elva bilar * elva bilar
``` ```
@@ -267,8 +268,8 @@ we already saw the indefinite articles:
* ett hus * ett hus
``` ```
Here are examples with definite articles. Here are examples with definite articles.
#SWE In Swedish, they are expressed by inflecting the noun #Swe In LANGUAGE, they are expressed by inflecting the noun
#SWE rather than adding a word like English //the//. #Swe rather than adding a word like English //the//.
``` ```
> %translate "the man" > %translate "the man"
* mannen * mannen
@@ -285,7 +286,7 @@ Here are examples with definite articles.
Definite articles in the plural: Definite articles in the plural:
``` ```
> %translate "the men" > %translate "the men"
* männen * männen
> %translate "the women" > %translate "the women"
* kvinnorna * kvinnorna
@@ -301,7 +302,7 @@ English, like many other languages, have no explicit indefinite article:
just use the plural form of the noun. just use the plural form of the noun.
``` ```
> %translate "men" > %translate "men"
* män * män
> %translate "women" > %translate "women"
* kvinnor * kvinnor
@@ -315,58 +316,58 @@ just use the plural form of the noun.
Other common determiners are shown in the following: Other common determiners are shown in the following:
``` ```
> %translate "this car" > %translate "this car"
* den här bilen * den här bilen
> %translate "that car" > %translate "that car"
* den där bilen * den där bilen
> %translate "these cars" > %translate "these cars"
* de här bilarna * de här bilarna
> %translate "those cars" > %translate "those cars"
* de där bilarna * de där bilarna
> %translate "some cars" > %translate "some cars"
* några bilar * några bilar
> %translate "all cars" > %translate "all cars"
* alla bilar * alla bilar
``` ```
Generate more examples of nouns with determiners: Generate more examples of nouns with determiners:
``` ```
> gr -number=11 (UttNP (DetCN ? (UseN ?))) | l -lang=DemoEng,DemoSwe > gr -number=11 (UttNP (DetCN ? (UseN ?))) | l -lang=Eng,LNG
* much reason * much reason
* mycket anledning * mycket anledning
* *
* few grammars * few grammars
* få grammatiker * få grammatiker
* *
* some teacher * some teacher
* någon lärare * någon lärare
``` ```
You will find out that other determiners can combine with numerals, such as in You will find out that other determiners can combine with numerals, such as in
``` ```
> %translate "these seven sisters" > %translate "these seven sisters"
* de här sju systrarna * de här sju systrarna
> %translate "the seven sisters" > %translate "the seven sisters"
* de sju systrarna * de sju systrarna
``` ```
#SWE thus with a numeral, the definite article suddenly appears as a word. #Swe thus with a numeral, the definite article suddenly appears as a word.
The random generation above used a **pattern** for generating The random generation above used a **pattern** for generating
expressions of the form ``(UttNP (DetCN ? (UseN ?)))``, where just the expressions of the form ``(UttNP (DetCN ? (UseN ?)))``, where just the
question marks may vary. Such patterns can also be used to fine-tune quizzes. question marks may vary. Such patterns can also be used to fine-tune quizzes.
For instance, here is a translation quiz for nouns with determiners: For instance, here is a translation quiz for nouns with determiners:
``` ```
trans_quiz -from=DemoEng -to=DemoSwe (UttNP (DetCN ? (UseN ?))) trans_quiz -from=DemoEng -to=DemoLNG (UttNP (DetCN ? (UseN ?)))
``` ```
==Adjectives== ==Adjectives==
Adjectives generally have more forms than nouns. Here is an example showing the Adjectives generally have more forms than nouns. Here is an example showing the
available forms for Swedish adjectives: available forms for LANGUAGE adjectives:
``` ```
> %table warm_A > %table warm_A
* s (AF (APosit (Strong (GSg Utr))) Nom) : varm * s (AF (APosit (Strong (GSg Utr))) Nom) : varm
@@ -392,10 +393,10 @@ words similar to //more// and //most//.
Here are some examples of adjective inflections: Here are some examples of adjective inflections:
``` ```
> %forms good_A > %forms good_A
* god, gods, gott, gotts, goda, godas, goda, godas, goda, godas, bättre, bättres, bäst, bästs, bästa, bästas * god, gods, gott, gotts, goda, godas, goda, godas, goda, godas, bättre, bättres, bäst, bästs, bästa, bästas
> %forms bad_A > %forms bad_A
* dålig, dåligs, dåligt, dåligts, dåliga, dåligas, dåliga, dåligas, dåliga, dåligas, sämre, sämres, sämst, sämsts, sämsta, sämstas * dålig, dåligs, dåligt, dåligts, dåliga, dåligas, dåliga, dåligas, dåliga, dåligas, sämre, sämres, sämst, sämsts, sämsta, sämstas
> %forms rotten_A > %forms rotten_A
* rutten, ruttens, ruttet, ruttets, ruttna, ruttnas, ruttna, ruttnas, ruttna, ruttnas, ruttnare, ruttnares, ruttnast, ruttnasts, ruttnaste, ruttnastes * rutten, ruttens, ruttet, ruttets, ruttna, ruttnas, ruttna, ruttnas, ruttna, ruttnas, ruttnare, ruttnares, ruttnast, ruttnasts, ruttnaste, ruttnastes
@@ -408,7 +409,7 @@ Here are some examples of adjective inflections:
``` ```
The morpho quiz for adjectives is as one would expect: The morpho quiz for adjectives is as one would expect:
``` ```
morpho_quiz -cat=A -lang=DemoSwe morpho_quiz -cat=A -lang=DemoLNG
``` ```
==The use of adjectives== ==The use of adjectives==
@@ -433,39 +434,39 @@ bare noun:
``` ```
Here are the quizzes for training the adjectival modification of nouns: Here are the quizzes for training the adjectival modification of nouns:
``` ```
translate_quiz -from=DemoEng -to=DemoSwe (AdjCN (PositA ?) (UseN ?)) translate_quiz -from=DemoEng -to=DemoLNG (AdjCN (PositA ?) (UseN ?))
morpho_quiz -lang=DemoSwe (AdjCN (PositA ?) (UseN ?)) morpho_quiz -lang=DemoLNG (AdjCN (PositA ?) (UseN ?))
``` ```
Adjectives can be combined to **adjectival phrases** (AP). One way to do this Adjectives can be combined to **adjectival phrases** (AP). One way to do this
is by means of **adadjectives**, such as //very// and //too//: is by means of **adadjectives**, such as //very// and //too//:
``` ```
> p -lang=DemoEng -cat=AP "very old" | l -lang=DemoSwe > p -lang=Eng -cat=AP "very old" | l -lang=LNG
* mycket gammal * mycket gammal
> p -lang=DemoEng -cat=AP "too heavy" | l -lang=DemoSwe > p -lang=Eng -cat=AP "too heavy" | l -lang=LNG
* för tung * för tung
``` ```
The **comparative** forms can be used for building adjectival phrases together The **comparative** forms can be used for building adjectival phrases together
with noun phrase complements: with noun phrase complements:
``` ```
> p -lang=DemoEng -cat=AP "warmer than the sun" | l -lang=DemoSwe > p -lang=Eng -cat=AP "warmer than the sun" | l -lang=LNG
* varmare än solen * varmare än solen
``` ```
Also these complex AP's can modify common nouns. The word order can be different Also these complex AP's can modify common nouns. The word order can be different
from modification with simple adjectives. from modification with simple adjectives.
``` ```
> p -lang=DemoEng -cat=CN "country warmer than the sun" | l -lang=DemoSwe > p -lang=Eng -cat=CN "country warmer than the sun" | l -lang=LNG
* land varmare än solen * land varmare än solen
> p -lang=DemoEng -cat=CN "very warm country" | l -lang=DemoSwe > p -lang=Eng -cat=CN "very warm country" | l -lang=LNG
* mycket varmt land * mycket varmt land
``` ```
Quizzes for such constructions are as follows: Quizzes for such constructions are as follows:
``` ```
translate_quiz -from=DemoEng -to=DemoSwe (AdjCN ? (UseN ?)) translate_quiz -from=DemoEng -to=DemoLNG (AdjCN ? (UseN ?))
morpho_quiz -lang=DemoSwe (AdjCN ? (UseN ?)) morpho_quiz -lang=DemoLNG (AdjCN ? (UseN ?))
``` ```
@@ -476,11 +477,11 @@ Personal pronouns have many forms:
> %table we_Pron > %table we_Pron
* s NPNom : vi * s NPNom : vi
* s NPAcc : oss * s NPAcc : oss
* s (NPPoss (GSg Utr)) : vår * s (NPPoss (GSg Utr)) : vår
* s (NPPoss (GSg Neutr)) : vårt * s (NPPoss (GSg Neutr)) : vårt
* s (NPPoss GPl) : våra * s (NPPoss GPl) : våra
``` ```
Here are the forms of all personal pronouns of Swedish: Here are the forms of all personal pronouns of LANGUAGE:
``` ```
> %forms i_Pron > %forms i_Pron
* jag, mig, min, mitt, mina * jag, mig, min, mitt, mina
@@ -498,7 +499,7 @@ Here are the forms of all personal pronouns of Swedish:
* hon, henne, hennes, hennes, hennes * hon, henne, hennes, hennes, hennes
> %forms we_Pron > %forms we_Pron
* vi, oss, vår, vårt, våra * vi, oss, vår, vårt, våra
> %forms youPl_Pron > %forms youPl_Pron
* ni, er, er, ert, era * ni, er, er, ert, era
@@ -511,7 +512,7 @@ Notice the polite and plural forms of //you//, which English doesn't have.
The **possessive** forms of pronouns are used as determiners: The **possessive** forms of pronouns are used as determiners:
``` ```
> %translate "her house , my car and our children" > %translate "her house , my car and our children"
* hennes hus , min bil och våra barn * hennes hus , min bil och våra barn
``` ```
Here's the pattern for training the combination of possessive pronouns and Here's the pattern for training the combination of possessive pronouns and
nouns, with the ``morpho_quiz`` and ``translate_quiz`` commands: nouns, with the ``morpho_quiz`` and ``translate_quiz`` commands:
@@ -535,7 +536,7 @@ word may be shown, but just a different form of the noun phrase.
* till mitt gula hus * till mitt gula hus
> %translate "from my yellow house" > %translate "from my yellow house"
* från mitt gula hus * från mitt gula hus
> %translate "with my yellow house" > %translate "with my yellow house"
* med mitt gula hus * med mitt gula hus
@@ -586,13 +587,13 @@ Here are some inflection examples:
* spelar, spelas, spelade, spelades, spela, spelas, spela, spelas, spelat, spelats, spelad, spelads, spelat, spelats, spelade, spelades, spelade, spelades, spelade, spelades, * spelar, spelas, spelade, spelades, spela, spelas, spela, spelas, spelat, spelats, spelad, spelads, spelat, spelats, spelade, spelades, spelade, spelades, spelade, spelades,
> %forms buy_V2 > %forms buy_V2
* köper, köps, köpte, köptes, köp, köps, köpa, köpas, köpt, köpts, köpt, köpts, köpt, köpts, köpta, köptas, köpta, köptas, köpta, köptas, , * köper, köps, köpte, köptes, köp, köps, köpa, köpas, köpt, köpts, köpt, köpts, köpt, köpts, köpta, köptas, köpta, köptas, köpta, köptas, ,
> %forms run_V > %forms run_V
* springer, springs, sprang, sprangs, spring, springs, springa, springas, sprungit, sprungits, sprungen, sprungens, sprunget, sprungets, sprungna, sprungnas, sprungna, sprungnas, sprungna, sprungnas, * springer, springs, sprang, sprangs, spring, springs, springa, springas, sprungit, sprungits, sprungen, sprungens, sprunget, sprungets, sprungna, sprungnas, sprungna, sprungnas, sprungna, sprungnas,
> %forms walk_V > %forms walk_V
* går, gås, gick, gicks, gå, gås, gå, gås, gått, gåtts, gången, gångens, gånget, gångets, gångna, gångnas, gångna, gångnas, gångna, gångnas, * går, gås, gick, gicks, gå, gås, gå, gås, gått, gåtts, gången, gångens, gånget, gångets, gångna, gångnas, gångna, gångnas, gångna, gångnas,
``` ```
In some languages, verbs can be very irregular. In some languages, verbs can be very irregular.
@@ -618,7 +619,7 @@ and the **complements** (what is done, to whom it is done, etc). The simplest
predication is with **intransitive verbs**, which only have the subject: predication is with **intransitive verbs**, which only have the subject:
``` ```
> %translate "he walks" > %translate "he walks"
* han går * han går
> %translate "we sleep" > %translate "we sleep"
* vi sover * vi sover
@@ -630,66 +631,66 @@ A predication forms a **clause**, which corresponds to many different
**sentences**. Each sentence is built by fixing a **tense**, a **polarity** **sentences**. Each sentence is built by fixing a **tense**, a **polarity**
(yes or no), and possibly a word order (inverted question, subordinate clause), (yes or no), and possibly a word order (inverted question, subordinate clause),
a mood (indicative, subjunctive). Here is a table showing what forms a clause a mood (indicative, subjunctive). Here is a table showing what forms a clause
can have in Swedish: can have in LANGUAGE:
``` ```
> p -cat=Cl -lang=DemoEng "the man walks" | %table > p -cat=Cl -lang=Eng "the man walks" | %table
* s Pres Simul Pos Main : mannen går * s Pres Simul Pos Main : mannen går
* s Pres Simul Pos Inv : går mannen * s Pres Simul Pos Inv : går mannen
* s Pres Simul Pos Sub : mannen går * s Pres Simul Pos Sub : mannen går
* s Pres Simul Neg Main : mannen går inte * s Pres Simul Neg Main : mannen går inte
* s Pres Simul Neg Inv : går mannen inte * s Pres Simul Neg Inv : går mannen inte
* s Pres Simul Neg Sub : mannen inte går * s Pres Simul Neg Sub : mannen inte går
* s Pres Anter Pos Main : mannen har gått * s Pres Anter Pos Main : mannen har gått
* s Pres Anter Pos Inv : har mannen gått * s Pres Anter Pos Inv : har mannen gått
* s Pres Anter Pos Sub : mannen har gått * s Pres Anter Pos Sub : mannen har gått
* s Pres Anter Neg Main : mannen har inte gått * s Pres Anter Neg Main : mannen har inte gått
* s Pres Anter Neg Inv : har mannen inte gått * s Pres Anter Neg Inv : har mannen inte gått
* s Pres Anter Neg Sub : mannen inte har gått * s Pres Anter Neg Sub : mannen inte har gått
* s Past Simul Pos Main : mannen gick * s Past Simul Pos Main : mannen gick
* s Past Simul Pos Inv : gick mannen * s Past Simul Pos Inv : gick mannen
* s Past Simul Pos Sub : mannen gick * s Past Simul Pos Sub : mannen gick
* s Past Simul Neg Main : mannen gick inte * s Past Simul Neg Main : mannen gick inte
* s Past Simul Neg Inv : gick mannen inte * s Past Simul Neg Inv : gick mannen inte
* s Past Simul Neg Sub : mannen inte gick * s Past Simul Neg Sub : mannen inte gick
* s Past Anter Pos Main : mannen hade gått * s Past Anter Pos Main : mannen hade gått
* s Past Anter Pos Inv : hade mannen gått * s Past Anter Pos Inv : hade mannen gått
* s Past Anter Pos Sub : mannen hade gått * s Past Anter Pos Sub : mannen hade gått
* s Past Anter Neg Main : mannen hade inte gått * s Past Anter Neg Main : mannen hade inte gått
* s Past Anter Neg Inv : hade mannen inte gått * s Past Anter Neg Inv : hade mannen inte gått
* s Past Anter Neg Sub : mannen inte hade gått * s Past Anter Neg Sub : mannen inte hade gått
* s Fut Simul Pos Main : mannen ska gå * s Fut Simul Pos Main : mannen ska gå
* s Fut Simul Pos Inv : ska mannen gå * s Fut Simul Pos Inv : ska mannen gå
* s Fut Simul Pos Sub : mannen ska gå * s Fut Simul Pos Sub : mannen ska gå
* s Fut Simul Neg Main : mannen ska inte gå * s Fut Simul Neg Main : mannen ska inte gå
* s Fut Simul Neg Inv : ska mannen inte gå * s Fut Simul Neg Inv : ska mannen inte gå
* s Fut Simul Neg Sub : mannen inte ska gå * s Fut Simul Neg Sub : mannen inte ska gå
* s Fut Anter Pos Main : mannen ska ha gått * s Fut Anter Pos Main : mannen ska ha gått
* s Fut Anter Pos Inv : ska mannen ha gått * s Fut Anter Pos Inv : ska mannen ha gått
* s Fut Anter Pos Sub : mannen ska ha gått * s Fut Anter Pos Sub : mannen ska ha gått
* s Fut Anter Neg Main : mannen ska inte ha gått * s Fut Anter Neg Main : mannen ska inte ha gått
* s Fut Anter Neg Inv : ska mannen inte ha gått * s Fut Anter Neg Inv : ska mannen inte ha gått
* s Fut Anter Neg Sub : mannen inte ska ha gått * s Fut Anter Neg Sub : mannen inte ska ha gått
* s Cond Simul Pos Main : mannen skulle gå * s Cond Simul Pos Main : mannen skulle gå
* s Cond Simul Pos Inv : skulle mannen gå * s Cond Simul Pos Inv : skulle mannen gå
* s Cond Simul Pos Sub : mannen skulle gå * s Cond Simul Pos Sub : mannen skulle gå
* s Cond Simul Neg Main : mannen skulle inte gå * s Cond Simul Neg Main : mannen skulle inte gå
* s Cond Simul Neg Inv : skulle mannen inte gå * s Cond Simul Neg Inv : skulle mannen inte gå
* s Cond Simul Neg Sub : mannen inte skulle gå * s Cond Simul Neg Sub : mannen inte skulle gå
* s Cond Anter Pos Main : mannen skulle ha gått * s Cond Anter Pos Main : mannen skulle ha gått
* s Cond Anter Pos Inv : skulle mannen ha gått * s Cond Anter Pos Inv : skulle mannen ha gått
* s Cond Anter Pos Sub : mannen skulle ha gått * s Cond Anter Pos Sub : mannen skulle ha gått
* s Cond Anter Neg Main : mannen skulle inte ha gått * s Cond Anter Neg Main : mannen skulle inte ha gått
* s Cond Anter Neg Inv : skulle mannen inte ha gått * s Cond Anter Neg Inv : skulle mannen inte ha gått
* s Cond Anter Neg Sub : mannen inte skulle ha gått * s Cond Anter Neg Sub : mannen inte skulle ha gått
``` ```
The following quiz can be used for training the inflection of intransitive The following quiz can be used for training the inflection of intransitive
clauses: clauses:
``` ```
morpho_quiz -lang=DemoSwe (PredVP (UsePron ?) (UseV ?)) morpho_quiz -lang=DemoLNG (PredVP (UsePron ?) (UseV ?))
``` ```
The following quiz translates English sentences in random tenses and polarities: The following quiz translates English sentences in random tenses and polarities:
``` ```
translate_quiz -from=DemoEng -to=DemoSwe (UseCl ? ? (PredVP (UsePron ?) (UseV ?))) translate_quiz -from=DemoEng -to=DemoLNG (UseCl ? ? (PredVP (UsePron ?) (UseV ?)))
``` ```
==Verbs with different predication patterns== ==Verbs with different predication patterns==
@@ -697,14 +698,14 @@ The following quiz translates English sentences in random tenses and polarities:
Transitive verbs take an object in the accusative case (if there is a case): Transitive verbs take an object in the accusative case (if there is a case):
``` ```
> %translate "he loves her" > %translate "he loves her"
* han älskar henne * han älskar henne
``` ```
A generalization is two-place verbs, where the object is in some other case, or A generalization is two-place verbs, where the object is in some other case, or
has a preposition. What is transitive in one language can often require a has a preposition. What is transitive in one language can often require a
preposition in another language: preposition in another language:
``` ```
> %translate "he waits for her" > %translate "he waits for her"
* han väntar på henne * han väntar på henne
> %translate "he likes her" > %translate "he likes her"
* han tycker om henne * han tycker om henne
@@ -718,13 +719,13 @@ There are also verbs that have a sentence or a question as an argument,
possibly with an object: possibly with an object:
``` ```
> %translate "he said that the man walks" > %translate "he said that the man walks"
* han sade att mannen går * han sade att mannen går
> %translate "he wonders who sleeps" > %translate "he wonders who sleeps"
* han undrar vem som sover * han undrar vem som sover
> %translate "he asked me who sleeps" > %translate "he asked me who sleeps"
* han frågade mig vem som sover * han frågade mig vem som sover
> %translate "we answer to him that everybody sleeps" > %translate "we answer to him that everybody sleeps"
* vi svarar till honom att alla sover * vi svarar till honom att alla sover
@@ -732,32 +733,32 @@ possibly with an object:
There are also verbs that take other verbs (with their complements) as arguments: There are also verbs that take other verbs (with their complements) as arguments:
``` ```
> %translate "we must sleep" > %translate "we must sleep"
* vi måste sova * vi måste sova
> %translate "we want to wait for her" > %translate "we want to wait for her"
* vi vill vänta på henne * vi vill vänta på henne
``` ```
The verb //to be// takes adjectives and noun phrases as arguments: The verb //to be// takes adjectives and noun phrases as arguments:
``` ```
> %translate "he is very old" > %translate "he is very old"
* han är mycket gammal * han är mycket gammal
> %translate "he is an old man" > %translate "he is an old man"
* han är en gammal man * han är en gammal man
``` ```
The following quiz can be used for training the inflection of clauses with The following quiz can be used for training the inflection of clauses with
any verb: any verb:
``` ```
morpho_quiz -lang=DemoSwe (PredVP (UsePron ?) ?) morpho_quiz -lang=DemoLNG (PredVP (UsePron ?) ?)
``` ```
The following quiz can be used for training the inflection of clauses with The following quiz can be used for training the inflection of clauses with
//to be//: //to be//:
``` ```
morpho_quiz -lang=DemoSwe (PredVP (UsePron ?) (UseComp ?)) morpho_quiz -lang=DemoLNG (PredVP (UsePron ?) (UseComp ?))
``` ```
The following quiz translates English sentences in random tenses and polarities: The following quiz translates English sentences in random tenses and polarities:
``` ```
translate_quiz -from=DemoEng -to=DemoSwe (UseCl ? ? (PredVP (UsePron ?) ?)) translate_quiz -from=DemoEng -to=DemoLNG (UseCl ? ? (PredVP (UsePron ?) ?))
``` ```
@@ -766,7 +767,7 @@ The following quiz translates English sentences in random tenses and polarities:
Questions are similar to sentences, but can have a different word order: Questions are similar to sentences, but can have a different word order:
``` ```
> %translate "is he very old" > %translate "is he very old"
* är han mycket gammal * är han mycket gammal
> %translate "would I sleep" > %translate "would I sleep"
* skulle jag sova * skulle jag sova
@@ -778,7 +779,7 @@ instead of norman nouns:
* vem sover inte * vem sover inte
> %translate "whom did she see" > %translate "whom did she see"
* vem såg hon * vem såg hon
``` ```
Sentences without interrogatives can be made to questions with Sentences without interrogatives can be made to questions with
**interrogative adverbs**: **interrogative adverbs**:
@@ -787,5 +788,75 @@ Sentences without interrogatives can be made to questions with
* var ska vi sova * var ska vi sova
> %translate "why didn't she wait for us" > %translate "why didn't she wait for us"
* varför väntade hon inte på oss * varför väntade hon inte på oss
``` ```
=For developers=
There are three levels of involvement, from the easiest to the hardest,
+ create the default tour for a language that is in the GF resource grammar library
(takes less than a minute, if you have the tools listed below)
+ customize the tour for a language that is in the library
(worth spending a couple of hours on)
+ add a language to the library and build the tour for it
(an undertaking of a few months)
1. To create the tour for a language that is in the library, e.g. Spanish,
just run
```
make Spa
```
in the directory ``GF/lib/doc/tour``. You need the following things for this
to work out
- the program GF (Grammatical Framework), downloadable from
the [GF website http://grammaticalframework.org]
- the precompiled grammar package ``Demo.pgf``, downloadable from
[here http://grammaticalframework.org/lib/doc/Demo.pgf.gz] or makeable in
``GF/lib/src`` with ``make demo``
- the command ``runghc`` available in any [GHC http://www.haskell.org/ghc] installation
- the command [``txt2tags`` http://txt2tags.sourceforge.net/]
2. To customize the tour, edit the master file ``GF/lib/doc/tour/tour.txt``.
The customization mainly proceeds by adding lines marked ``#Spa`` (if Spanish is
your target language). This can be done both for text lines, e.g.
```
#Spa LANGUAGE has separate second-person plural pronouns for both genders.
```
and for GF command lines, e.g.
```
#Spa %translate "you are very old"
```
In both cases, one can also add ``#Spa`` to the existing markings if they are
adequate, e.g.
```
#Fre,Spa LANGUAGE has two genders: the masculine and the feminine.
```
It's in particular for this purpose that we recommend using the variable ``LANGUAGE``
rather than the constant ``Spanish``. The ``make`` procedure replaces the variable with
the constant automatically. Similarly, the language code ``Spa`` used in GF commands
should be avoided and the variable ``LNG`` used instead.
In general, the master file ``tour.txt`` is processed line by line. It has five kinds
of lines, distinguished by the prefix of the line:
- ``#`` //LANGS// ``>`` //COMMAND// : language-specific GF command
- ``#`` //LANGS// //TEXT// : language-specific text
- ``>`` //COMMAND// : language-independent GF command
- ``*`` : ignored; included for the sake of documentation
- any other text : language-independet text
Here //LANGS// is a comma-separated list of 3-letter language codes,
such as ``Fre,Spa,Ita``.
3. To contribute a new language to the library, see the
[GF Resource Grammar Project http://grammaticalframework.org/doc/gfss].
In cases (2) and (3), please contribute your work to the GF community!

1085
lib/doc/tour/tourSwe.html Normal file

File diff suppressed because it is too large Load Diff