Leksa

Leksa needs more documentation.

Background

To be included here: A list of relevant files. While waiting, see this document

Installation

for sjd and sma

Make a backup of the database (there is a script for it in the db_bakup directory). Then make the new database. There is a script ./feed_db.sh to do that in the lower $LANGoahpa directory.

for the other languages

Note that your .bashrc path must be ok. In .bashrc on the machine where the installation is, you need a path PYTHONPATH containing also the string /PATH/TO/OAHPA/APPLICATION.

Installation is performed via ./install.py with one option. The installation must be run for each .xml file (for each language direction), here marked with XML, so replace XML with each of the file names (There is a script for sjd and sma, todo: make a script for other lgs):

    python2.6 install.py --file/-f XML

Also, superset must be indicated (the sjd here should be replaced with the language code of the language you work on):

    python2.6 install.py --sem sjd/meta-data/semantical_sets.xml

For sme and sma installation of Leksa is performed in combination with installation of Morfa-S (Morfa-B), thus a tagfile and paradigm file must be specified. For more information on this, see the Morfa-S documentation, however, the command that will typically be performed for these operations is:

	./install.py --file XML --tagfile tags.txt --paradigmfile paradigms.txt

Files and classes

I'm organizing these to reflect somewhat what the structure is for dependencies and methods that call what. In Leksa (as in other games), methods and classes in views.py call objects in game.py, which call objects in forms.py

  • settings.py
    • INFINITIVE_SUBTRACT, INFINITIVE_ADD - settings for adding and subtracting infinitive markers; dictionaries of regular expressions.
    • OLD_NEW_ISO_CODES - used in producing the corresponding language pair for the user's browser language settings. If more languages are added, this must be altered.
  • conf/tools.py
    • switch_language_code
  • views.py
    • leksa_game
    • Quizzview
      • leksa_game is called, which uses Quizzview to set up a lot of common variables, and then a response is returned. This is where the browser language is checked and a game is produced based on those settings.
      • Quizzview handles the processing of the settings form, and GET and POST data. GET is available so that outside courses can link directly to certain exercises, and in addition, Quizzview handles instantiating game.QuizzGame, and setting various template variables.
      • Docstrings and comments on these methods should explain a little more in depth
  • game.py
    • relax - spell relaxing, used in all games where user input is accepted in South Sámi
    • QuizzGame - The whole goal of QuizzGame is to produce a LeksaForm object. To do this, it initializes variables (QuizzGame.get_db_info), and then queries the database and creates the form (QuizzGame.create_form). As QuizzGame is a subclass of Game, there are many relevant methods there, such as init, and new_game (called by *** Game in views.py), as well as check_game
    • Docstrings and comments on these methods should explain a little more in depth
  • forms.py
    • LeksaSettings
    • LeksaQuestion
    • SEMTYPE_CHOICES - These correspond to semtypes both in semantical_sets.xml (the supersets) and one or two in the actual lexicon files.
    • TRANS_CHOICES - keys representing language pairs, with 3-character ISO codes corresponding to the iso codes used in lexicon files. ZZZWWW
    • GEOGRAPHY_CHOICES - Choices corresponding to lexicon files.
  • semantical_sets.xml
    • This file is in sme/xml in Ur-Oahpa, in LANG/meta-data in sma-type Oahpa versions.
    • It contains the supersets (not found in the xml files) and their subsets (found in the xml files). Sets in the xml files not being part of supersets are not listed in this file. Both supersets and singleton sets are listed in forms.py, though.
    
    templates/smaoahpa_main.html
    	templates/smaoahpa.html
    		smadrill/templates/game.html
    			smadrill/templates/leksa.html
    				smadrill/templates/leksa_place.html