Aarne Ranta
December 2010 for GF 3.2
Grammatical Framework Quick Start
This Quick Start shows two examples of how GF can be used.
We assume that you have downloaded and installed GF, so that
the command gf works for you. See download and install
instructions here.
Translation and generation
When you have downloaded and installed GF:
- Copy the files
Food.gf,
FoodEng.gf, and
FoodIta.gf.
Or go to GF/examples/tutorial/food/, if you have downloaded the
GF sources.
- Start GF with the command
gf FoodIta.gf FoodEng.gf
- Translation. Try your first translation by giving the GF command
parse "this cheese is very very Italian" | linearize -treebank
- Generation. Random-generate sentences in two languages:
generate_random | linearize
- Grammar development. Add words to the Food
grammars and try the above commands again. For instance, add the following lines:
Bread : Kind ; -- in Food.gf
Black = {s = "bread"} ; -- in FoodEng.gf
Black = {s = "pane"} ; -- in FoodIta.gf
and start GF again with the same command. Now you can even translate
this bread is very Italian.
To lear more on GF commands and
grammar development, go to the one of the tutorials:
To learn about how GF is used for easily writing grammars for 16 languages, consult the
Run-time grammars and web applications
GF has its own "machine language", PGF (Portable Grammar Format),
which is recommended for use in applications at run time. To produce a PGF file from
the two grammars above, do
gf -make FoodIta.gf FoodEng.gf
wrote Food.pgf
You can use this in Haskell and Java programs, and also on web services, as shown in
here.
To build your own web application, consult the
developer wiki.
User Group
You are welcome to join the User Group
to get help and discuss GF-related issues!