Skip to content

MatrixDevTop

MichaelGoodman edited this page Dec 7, 2010 · 45 revisions

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 [#repository SVN repository], [#configuration configuration], the [#directory directory structure], and [#links other links].

Matrix Developers links

Anchor(links)

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

Matrix Repository

Anchor(repository)

svn co svn://lemur.ling.washington.edu/shared/matrix matrix

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

Configuration

Anchor(configuration)

CUSTOMIZATIONROOT

Anchor(customizationroot)

Several matrix.py commands (such as "install", "vivify", and "regression-test") require CUSTOMIZATIONROOT be set as an environment variable, with the value being the "gmcs" directory of the Matrix branch being used. The purpose is so the scripts can reliably find the files necessary for processing. For example:

export CUSTOMIZATIONROOT=~/matrix/trunk/gmcs

or

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

This command may be run in a terminal (note: it will be set only for the current session) or put into ~/.bashrc (be sure to run .bashrc or start a new session so it will be set).

Alternatively, you can use the --customizationroot (short form: -C) option of matrix.py (use "matrix.py --help" for more information). For example:

python matrix.py --customizationroot=gmcs/ regression-test

or

python matrix.py -C gmcs/ regression-test

Matrix.py

Anchor(matrixpy)

matrix.py 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 matrix.py --help prints the following (as of 2010.12.06):

Usage: matrix.py [OPTION] COMMAND [ARGS...]

OPTIONS:
    --cr (-C) PATH                 : Set CUSTOMIZATIONROOT to PATH.
    --help (-h)                    : Print this help message.

COMMANDS:
    customize (c) PATH [DEST]      : Customize the choices file at PATH,
                                     with the output going to DEST (if
                                     specified) or PATH. PATH is either a
                                     directory or a choices file.
    customize-and-flop (cf) PATH [DEST]
                                   : Customize the choices file at PATH,
                                     then flop the resulting grammar.
    validate (v) PATH              : Validate the choices file at PATH.
    regression-test (r) [TEST]     : Run regression TEST (runs all tests if
                                     TEST is not specified).
    regression-test-add (ra) CHOICES TXTSUITE
                                   : Add CHOICES and TXTSUITE as a new
                                     regression test.
    regression-test-update (ru) TEST
                                   : Update the gold standard of TEST to use
                                     the results of the current system.
    unit-test (u)                  : Run all unit tests.
    install (i) PATH               : Install a custom instance of the Grammar
                                     Matrix Customization System at the PATH
                                     specified on the default server.
    vivify                         : Install a new version of the Grammar
                                     Matrix Customization System to the live
                                     site after verifying the code has been
                                     tested and committed to SVN.

EXAMPLES:
    matrix.py customize ../choices/Finnish
    matrix.py cf ../choices/Finnish
    matrix.py v ../choices/Finnish
    matrix.py -C gmcs/ r
    matrix.py ra Cree_choices Cree_test_suite
    matrix.py install my_matrix
    matrix.py vivify

Directory Structure

Anchor(directory)

If you get the repository using the command [#repository 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):

doc/         [publications and documents related to the system]
gmcs/        [most of the code resides here]
    80proof/          [grammars used in the 80proof paper]
    harvest/          []
    lib/              [Python libraries for internal code]
        hierarchy.py            [module for type hierarchies]
        tdlhierarchy.py         [module for tdl hierarchies]
    linglib/          [Libraries for linguistic phenomena]
        tests/                  [unit tests for linglib]
        argument_optionality.py
        case.py
        direct_inverse.py
        lexbase.py              [classes shared by lexicon.py and morphotactics.py]
        lexicon.py
        morphotactics.py
        negation.py
    profile/          []
    profiles/         []
    regression-tests/ [code and resources for regression testing]
    sample-choices/   [sample choices files displayed on the live site]
    sql_profiles/     []
    string_lists/     []
    templates/        []
    tests/            [unit tests for the general system]
    web/              [intended place for web questionnaire related files]
    choices.py        [classes for working with choices files]
    customize.py      [primary code for customizing grammars]
    def_check.py      [module to check matrixdef]
    deffile.py        [module to interpret matrixdef for web presentation]
    generate.py       [module to aid in test-by-generation]
    __init__.py       [gmcs packaging module]
    kickoff.sh        []
    matrix.cgi        [CGI script to handle web requests]
    matrix.css        [style file for the questionnaire]
    matrixdef         [website content definition]
    matrix.js         [website-related functions]
    profiles.py       []
    randgram.py       [out-of-date script to create a semi-random grammar]
    tdl.py            [module for dealing with TDL files]
    tdltest.py        [code to test tdl.py. Should probably be folded into unit tests]
    utils.py          [module with various helper functions]
    validate.py       [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]
install      [bash script for installing the code (e.g. to the live site)]
matrix.py    [Python script for running customize, tests, install, etc.]
Clone this wiki locally