Aarne Ranta

3 September, 2007

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:
  1. Copy the files Food.gf, FoodEng.gf, and FoodIta.gf. Or go to GF/examples/tutorial/food/, if you have downloaded the GF sources.
  2. Start GF with the command
      gf FoodIta.gf FoodEng.gf
    
  3. Translation. Try your first translation by giving the GF command
      parse "this cheese is very very Italian" | tree_bank
    
  4. Generation. Random-generate sentences in two languages:
      generate_random | l -multi
    
  5. 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 New Grammarian's Tutorial.

Multilingual authoring

This demo also requires the GUI package, which makes the command jgf work for you.
  1. Download the file Letter.gfcm.
  2. Start the GF editor by the command
      gfeditor Letter.gfcm
    
  3. When the editor window is open, select "Letter" from the "New" menu.
  4. Push the button "Random" in the lower end of the window.
  5. Move the pointer to some place in the text, e.g. to the first word (in any of the languages), and click. The first word should now be highlighted and a number of alternatives appear in the lower window part (a similar situation is shown in the picture below).
  6. Double-click at some of the alternatives marked "ch ..." and observe how the text changes in each of the languages.
See the Editor User Manual for more information on how to use the editor. To change the grammars, you should not edit Letter.gfcm, which is low-level code generated by the GF grammar compiler. Instead, you can edit the files in examples/letter in the GF grammar package, and compile by using the script mkLetter.gfs in the same package.