diff --git a/lib/resource/doc/example/Animals.gf b/lib/resource/doc/example/Animals.gf
index 17e64c7b1..33b56e740 100644
--- a/lib/resource/doc/example/Animals.gf
+++ b/lib/resource/doc/example/Animals.gf
@@ -2,6 +2,8 @@
abstract Animals = Questions ** {
+ flags startcat=Phrase ;
+
fun
-- a lexicon of animals and actions among them
Dog, Cat, Mouse, Lion, Zebra : Entity ;
diff --git a/lib/resource/doc/example/mkAnimals.gfs b/lib/resource/doc/example/mkAnimals.gfs
index 295057768..304263eb9 100644
--- a/lib/resource/doc/example/mkAnimals.gfs
+++ b/lib/resource/doc/example/mkAnimals.gfs
@@ -1,4 +1,4 @@
- i -src AnimalsEng.gf ;; s
- i -src AnimalsFre.gf ;; s
- i -src AnimalsSwe.gf ;; s
+ i -ex AnimalsEng.gf ;; s
+ i AnimalsFre.gf ;; s
+ i AnimalsSwe.gf ;; s
pm | wf animals.gfcm
diff --git a/lib/resource/doc/gf-resource.html b/lib/resource/doc/gf-resource.html
index a6abe7b04..1b1bdc7fd 100644
--- a/lib/resource/doc/gf-resource.html
+++ b/lib/resource/doc/gf-resource.html
@@ -5,15 +5,17 @@
-
+
+Fourth Version, 2 November 2005.
+
Third Version, 22 May 2005. Completed 1 July.
-
Second Version, 1 March 2005
-
First Draft, 7 February 2005
+
@@ -29,16 +31,16 @@ Aarne Ranta
-Designed to be nice for ordinary programmers to use: by this -we mean programmers without training in linguistics. +GF was designed to be nice for ordinary programmers to use: by this +we mean programmers without training in linguistics.
-Mission: to make natural-language applications available for +The mission of GF is to make natural-language applications available for ordinary programmers, in tasks like
+ Abstract syntax: language-independent representation
cat Prop ; Nat ; fun Even : Nat -> Prop ; + fun NInt : Int -> Nat ;Concrete syntax: mapping from abstract syntax trees to strings in a language (English, French, German, Swedish,...) @@ -70,11 +78,18 @@ linguists. lin Even x = {s = x.s ++ "är" ++ "jämnt"} ; -We can translate between language via the abstract syntax. +We can translate between languages via the abstract syntax: +
+ 4 is even 4 ist gerade + \ / + Even (NInt 4) + / \ + 4 est pair 4 är jämnt +
-Is it really so simple?
+But is it really so simple?
@@ -93,6 +108,8 @@ la somme de 3 et de 5 est pair
wenn 2 ist gerade, dann 2+2 ist gerade
om 2 är jämnt, 2+2 är jämnt
+All these sentences are grammatically incorrect.
+
@@ -120,7 +137,10 @@ and record types. For instance, French:
}
} ;
-
+To learn more about these constructs, consult GF documentation, e.g. the
+New Grammarian's Tutorial.
+However, in what follows we will show how to avoid learning them and
+still write linguistically correct grammars.
@@ -131,7 +151,7 @@ theoretical knowledge about the language.
-Which kind of a programmer is easier to find? +Which kind of a programmer is it easier to find?
Even = predA (regA "jämn") ;+For the French version, we write +
+ Even = predA (regA "pair") ; +@@ -207,6 +231,44 @@ Extra constraint: we want open-source free software and hence cannot use existing proprietary resources. + +
+The library has, for each language
+
+
+
+Organization and presentation:
+
+
+
+Where do we get the data from?
+
+
+
V ; NP ; CN ; Det ; -- verb, noun phrase, common noun, determiner @@ -360,29 +427,44 @@ The first three letters (Dan etc) are used in grammar module names DetNP : Det -> CN -> NP ; -- combine Det and CN into NP
and_Conj : Conj ; +Numerals, number words from 1 to 999,999 with their +inflections, e.g. +
+ n8 : Digit ; +Basic lexicon of (now 218) frequent everyday words +
+ man_N : N ;+
+ +In addition, and not included in Lang, there is +
+ squeeze_V : V ; ++Of course, there is some overlap between SwadeshLex and the other modules. +
mkN : Str -> Str -> Str -> Str -> Gender -> N ; -- worst-case nouns mkN : Str -> N ; -- regular nouns-
angripa_V = irregV "angripa" "angrep" "angripit" ;-
- man_N = mkN "man" "mannen" "män" "männen" masculine ; --
PassBli : V2 -> NP -> VP ; -- bli överkörd av ngn@@ -399,28 +481,20 @@ to implement the current API. Reservations:
-
-Alternative views on sentence formation: +Two alternative views on sentence formation by predication: Clause, Verbphrase @@ -519,11 +593,27 @@ Import a set of LangX grammars: i english/LangEng.gf i swedish/LangSwe.gf -Test with random generation, translation, morphological analysis... +Alternatively, you can make a precompiled package of +all the languages by using lib/resource/Makefile:
- - + make + gf langs.gfcm+Then you can test with translation, random generation, morphological analysis... +
+ > p -lang=LangEng "I have loved her." | l -lang=LangFre + Je l' ai aimée. + + > gr -cat=NP | l -multi + The sock + Strumpan + Strømpen + La media + La calza + La chaussette + Sukka ++
- > p -cat=S -v "jag ska åka till Chalmers" + > p -cat=S -v -lexer=words "jag ska åka till Chalmers" unknown tokens [TS "åka",TS "Chalmers"]Then try to select words that LangX recognizes:
- > p -cat=S "jag ska gå till Danmark"
+ > p -cat=S "jag ska springa till Danmark"
UseCl (PosTP TFuture ASimul)
- (AdvCl (SPredV i_NP go_V)
+ (AdvCl (SPredV i_NP run_V)
(AdvPP (PrepNP to_Prep (UsePN (PNCountry Denmark)))))
Use these API structures and extend vocabulary to match your need.
@@ -609,7 +699,7 @@ You can run the syntax editor on LangX to
find resource API functions through context-sensitive menus.
For instance, the shell command
- jgf LangEng.gf LangFre.gf + gfeditor LangEng.gf LangFre.gfopens the editor with English and French views. The @@ -682,42 +772,48 @@ for this set of grammars.
-Just issue the following GF commands -
- i -src AnimalsEng.gf ;; s - i -src AnimalsFre.gf ;; s - i -src AnimalsSwe.gf ;; s - pm | wf animals.gfcm --and you get an end-user grammar animals.gfcm. - -
- -You can also write the commands in a gfs (GF script) +To produce an end-user multilingual grammar animals.gfcm, +write the sequence of compilation commands in a gfs (GF script) file, say mkAnimals.gfs, and then call GF with
gf <mkAnimals.gfs+To try out the grammar, +
+ > i animals.gfcm + + > gr | l -multi + vem jagar hundar ? + qui chasse des chiens ? + who chases dogs ? ++
You can use the resource grammar as a parser on a special file format, -.gfe ("GF examples"). Here is the new source, +.gfe ("GF examples"). Here is the real source, QuestionsI.gfe, which -generates -QuestionsI.gf, -when you execute the command +generated +QuestionsI.gf. +when you executed the GF command
- gf -examples QuestionsI.gfe + i -ex AnimalsEng.gf+Since QuestionsI is an incomplete module ("functor"), +it need only be built once. This is why only the first +command in mkAnimals.gfs needs the flag -ex. + +
+ Of course, the grammar of any language can be created by parsing any language, as long as they have a common resource API. The use of English resource is generally recommended, because it @@ -792,6 +888,30 @@ If many substitutions are needed, semicolons are used as separators: + +
+ +Each of the API implementations uses the following auxiliary resource modules: +
+ +(Much more to be written...) + + + +
+ +For this, you need +
+ +A useful command to test opers: +
+ i -retain MorphoRot.gf + cc regNoun "foo" ++ +
English: +missing uncontracted negations.
Finnish: -missing many nominal forms of verbs; compiling the heuristic paradigms is slow; -the basic lexicon has some erroneous inflectional forms; possessive and interrogative suffixes have no proper lexer.
French: @@ -869,7 +1027,7 @@ some verbs in Basic should be reflexive; bad forms of reflexive infinitives
Norwegian: -possessives bilen min not included +possessives of type bilen min not included
Russian
@@ -894,4 +1052,9 @@ GF Download Page
. The current libraries are in lib/resource. Version 0.6 is in lib/resource-0.6. ++ +The very very latest version of GF and its libraries is in +Snapshots. +