Skip to content

MatrixDevConventions

TJTrimble edited this page Sep 6, 2014 · 9 revisions

This page is intended to provide a catalogue of global variables and other information of use to Matrix developers. These global variables should be used rather than repeating the information (for maintainability).

Lexical types

In gmcs.linglib.lexbase:

# all types of lexical items (on lexicon page)
ALL_LEX_TYPES = ('noun', 'verb', 'det', 'aux', 'adj', 'cop')

# types used for lexical rules (verb and aux are merged)
LEXICAL_CATEGORIES = ('noun', 'verb', 'det', 'adj', 'cop')

# Types not automatically added to mylanguage.tdl
NON_ESSENTIAL_LEX_CATEGORIES = ('det', 'adj', 'cop')

# lexical_supertypes is a dictionary mapping the choices file
# encodings to the actual lex-type identifiers of the supertypes.
LEXICAL_SUPERTYPES = {'noun':'noun-lex',
                      'verb':'verb-lex',
                      'iverb':'intransitive-verb-lex',
                      'tverb':'transitive-verb-lex',
                      'mverb':'main-verb-lex',
                      'cop':'copula-verb-lex',
                      'det':'determiner-lex',
                      'aux':'aux-lex',
                      'adj':'adj-lex'}

Choices file version

In gmcs.choices, in the definition of the class ChoicesFile:

  ######################################################################
  # Conversion methods: each of these functions assumes the choices
  # file has already been loaded, then converts an older version into
  # a newer one, updating both old key names and old value names.
  # These methods can be called in a chain: to update from version 2
  # to 5, call convert_2_to_3, convert_3_to_4, and convert_4_to_5, in
  # that order.
  #
  # The mehods should consist of a sequence of calls to
  # convert_value(), followed by a sequence of calls to convert_key().
  # That way the calls always contain an old name and a new name.
  def current_version(self):
    return 23

That return value should be updated whenever a new uprev function (and thus a new choices file version) is defined.

Clone this wiki locally