Matrix Development

This wiki is a reference for Grammar Matrix developers. Users of the Grammar Matrix should start from MatrixTop.

Below we have information about the SVN repository, configuration, the directory structure, and other links.

Moving to GitHub

As of July 2020, we are in the process of moving to GitHub. The Matrix projects page is:

This page needs to be updated.

Matrix Developers links

A collection of documentation regarding the Matrix project, aimed at Matrix developers.

Matrix Repository

svn co svn:// matrix

Note that you need to be granted permission to read or write to/from this repository. Send email to linghelp@ or Emily Bender (ebender@) about getting permissions. (Both email addresses above have as the domain)



Several commands (such as "install", "vivify", and "regression-test") require the environment variable CUSTOMIZATIONROOT to be set, with the value being the "gmcs" directory of the Matrix branch being used. In most cases this can, and should, be set as an option to (--customizationroot (short form: -C)). For example:

python --customizationroot=gmcs/ regression-test


python -C gmcs/ regression-test

If necessary, the variable may be set with an export command, which would be valid for the current session. This export command may be placed in ~/.bashrc so the variable is set each time a session is started. Assuming the directory matrix/ exists is the home directory, the export commands would look like this for trunk:

export CUSTOMIZATIONROOT=~/matrix/trunk/gmcs

or like this for a branch:

export CUSTOMIZATIONROOT=~/matrix/branches/mybranch/gmcs


Additionally, if you are using ACE (AceTop) for regression testing or whatever, the variable may also be set with an export command. This export command may be placed in ~/.bashrc, too. Make sure to point the ACEROOT to the directory where ACE is located, as opposed to the actual ACE binary.


You can download the latest version of ACE here. is a top-level script used mainly by developers to do a wide range of tasks, such as customization, validation, unit-testing, regression-testing, and installing. The command python --help prints the following (as of 2011.04.26):


    --customizationroot (-C) PATH
                Set CUSTOMIZATIONROOT to PATH.
                Add a blank morphological rule to irules.tdl (if it is
                empty) to workaround a bug in Cheap.
                Install the LKB binaries to a live site.
    --warning (-w)
                Print warnings when running validate.
    --help (-h) [COMMAND]
                Print a usage message about COMMAND (if specified) or
                else all commands and examples.
    customize (c) PATH [DEST]
                Customize the grammar at PATH, with the output written to
                DEST/iso or the directory named as the isocode at PATH. 
                PATH points to a choices
                file or a directory that contains a choices file.
    customize-to-destination (cd) PATH DEST
                Customize the grammar at PATH, with the output written directly to
                DEST. PATH points to a choices
                file or a directory that contains a choices file.
    customize-and-flop (cf) PATH [DEST]
                Customize and flop the grammar at PATH, with the output
                written to DEST or the directory at PATH. PATH points to a
                choices file or a directory that contains a choices file.
    validate (v) PATH
                Validate the choices file at PATH.
    regression-test [-TASK] [TESTS]
                Run regression test TASK (or all tasks if unsprecified)
                over TEST (or all tests if unspecified). TASKS can be any
                of the following and can be combined (e.g. -vc):
                  [none]       : run all tests
                  -v : validate and report errors
                  -c : customize and report errors
                  -p : customize and parse, report differences with gold
                TESTS can be a single test name or a list of names.
    regression-test-add (ra) PATH/TO/CHOICES PATH/TO/TXTSUITE
                Add CHOICES (a choices file) and TXTSUITE (a text file
                containing test sentences) as a new regression test.
    regression-test-update (ru) TEST
                Update the gold standard of TEST to use the results of the
                current system.
    regression-test-remove (rr) TEST
                Remove TEST from the regression test suite. This command
                removes all files checked into subversion.
    regression-test-rename (rn) OLDTEST NEWTEST
                Rename OLDTEST to NEWTEST. This is performed with a call
                to 'svn mv' on the files in the repository. Remember to
                commit your changes.
    unit-test (u)
                Run all unit tests.
    web-test (w)
                Run all web tests.
    web-test-add (wa) PATH [comment]
                Add a new Selenium test with an optional comment.
    web-test-remove (wr) TEST
                Remove a Selenium test.
    install (i) PATH
                Install a custom instance of the Grammar Matrix
                Customization System and Questionnaire at PATH (PATH is
                generally a URL on the uakari server accessible via the patas server).
    vivify (v)
                Install a new version of the Grammar Matrix Customization
                System and Questionnaire to the live site after verifying
                the code has been tested and committed to SVN.

EXAMPLES: customize ../choices/Finnish c ../choices/Finnish customize-and-flop ../choices/Finnish cf ../choices/Finnish validate ../choices/Finnish v ../choices/Finnish --customizationroot=gmcs/ regression-test -C gmcs/ r -v -C gmcs/ r -cp vso-aux-before-vp Fore -C gmcs/ ra Cree_choices Cree_test_suite -C gmcs/ ru Cree -C gmcs/ rr tiniest -C gmcs/ rn sujb-drop subj-drop -C gmcs install -C gmcs/ --lkb ih my_matrix -C gmcs/ vivify

Directory Structure

If you get the repository using the command above, you will see three subdirectories: branches, tags, and trunk. Each of these contain a copy of the Matrix code (a "branch"), but "trunk" is the official version, "tags" contains frozen snapshots (e.g. the version used for a dissertation, etc.), and "branches" contains development versions. The directory structure detailed below explains the directories and files for a single branch (e.g. in trunk):

gmcs/        [most of the code resides here]
    lib/              [Python libraries for internal code]            [module for type hierarchies]         [module for tdl hierarchies]                [module for itsdb profile creation]
    linglib/          [Libraries for linguistic phenomena]
        tests/                  [unit tests for linglib]              [classes shared by and]        [should probably be merged with]
    regression-tests/ [code and resources for regression testing]
    sql_profiles/     [code and resources for MatrixTDB]
    tests/            [unit tests for the general system]       [gmcs packaging module]        [classes for working with choices files]      [primary code for customizing grammars]      [module to check matrixdef]        [module to interpret matrixdef for web presentation]       [module to aid in test-by-generation]       [MatrixTDB ... might be from old version]       [out-of-date script to create a semi-random grammar]            [module for dealing with TDL files]        [code to test Should probably be folded into unit tests]          [module with various helper functions]       [module to validate a choices file]
gmmt/        [resources for the "massively multilingual translation" task]
lisp/        [various lisp scripts for Developers]
matrix-core/ [the Matrix grammar files]
modules/     [snippets of TDL and notes about analyses]
web/         [place for web questionnaire related files]
    sample-choices/   [sample choices files displayed on the live site]
    templates/        [inputs for test-by-generation]
    matrix.css        [style file for the questionnaire]
    matrixdef         [website content definition]
    matrix.js         [website-related functions]
install      [bash script for installing the code (e.g. to the live site)]    [Python script for running customize, tests, install, etc.]
matrix.cgi   [CGI script to handle web requests]

MatrixDevTop (last edited 2020-07-14 02:40:27 by EmilyBender)

(The DELPH-IN infrastructure is hosted at the University of Oslo)