SHORT-CLIMB Documentation

Overview

SHORT-CLIMB is a tool that can create metagrammar libraries for a larger resource grammar, following the ideas in CLIMB. It provides a practical set-up to flip back and forth between different versions of a grammar. The approach can be used to (temporarily) maintain and explore an alternative analyses, or to collect standard differences between versions of a grammar (e.g. a more restricted version and a more robust version)

General Instructions

Creating a SHORT-CLIMB library

Running short-climb

First steps:

SHORT-CLIMB is run by the command:

python short_climb.py [OPTIONS] input

The input can be one of the following:

To define a version in short_climb.py add key value pair to versions in line:

versions = {}

e.g.:

versions = {'versionA' : ['fileA1', 'fileA2'], 'versionB' : ['fileB1'], 'versionC' : ['fileC1','fileC2','fileC3']}

The following options are supported:

NB: if none of the options above is given, files of the original grammar will be modified! A warning with possibility to break of the process is provided before this operation takes place

Default settings

To change these defaults adapt the following lines in short_climb.py:

path = '../climb/'
gram_path = '../'

where gram_path should lead to the directory of the grammar and path to the directory of CLIMB libraries.

CLIMB Library definitions

SHORT-CLIMB can insert and remove types, add new properties to types and remove properties from types. These operations are evoked from statements in CLIMB libraries. Examples are provided below

input files

input=gram_part.tdl

states that gram_part.tdl should be included in the modification process. Statements regarding types that are defined in tdl files that are not defined as input will be ignored. I will use the term input files to refer to files defined as input below.

removing types

remove=type_name

removes all type definitions with type_name from the input files.

remove=type_name,addendum

removes all addenda to type with type_name from the input files.

inserting new types

location=type_name
my_new_type := supertype &
 [ PATH.FEATURE value ].

inserts the definition of my_new_type above the type definition of type_name in the grammar. If type_name is removed by another statement, my_new_type will replace the old type. If type_name does not occur in any of the input files, the statement will be ignored. location=type_name followed by a tdl definition can also be used to insert addenda.

adding properties to types

type_name := new_supertype &
 [ NEW_PROPERTY new_value ].

adds new_supertype as a supertype and [ NEW_PROPERTY new_value ] as a new value to the definition of type_name. If type_name does not occur in the input files, this definition will be ignored. (A location must be defined to insert completely new definitions)

type_name :+ new_supertype &
 [ NEW_PROPERTY new_value ].

will add these properties to the addenda of type_name. If type_name does not have an addendum yet, it will be created. If type_name does not occur at all in the input files, this statement will be ignored. (A location must be defined to insert completely new definitions)

removing properties from types

type_name :- old_supertype &
 [ OLD_PROPERTY old_value ]. 

removes the supertype old_supertype and constraint [ OLD_PROPERTY old_value ] from type type_name. As for the above: this statement is ignored if type_name does not occur in the input files. Careful with lists and diff-lists:

type_name :- [ MY-DLIST <! [ ], old_type, [ ] !>

removes the constraint old_type from the second element on the diff-list. Other constraints on this element will be maintained. If no other constraints are defined, it will be replaced by [ ] in the new grammar. The first and last element on the diff-list will remain untouched

type_name :- [ MY-DLIST <! [ ], [ OLD_C old_v ], [ ] !>

removes the feature-value pair [ OLD_C old_v ] from the second element on the diff-list. Again, other constraints on this element will be maintained and it will be replaced by [ ], if [ OLD_C old_v ] was the only constraint defined on the second element and no specific type was given for it.

NB. To change the number of elements on a list, use the complete replacement option (see below)

completely redefining a type

complete=on
type_name := supertype &
 [ SOME_CONSTRAINT value ].

replaces the type definition of type_name in the original grammar by the new definition below complete=on.

ClimbShortClimb (last edited 2017-01-17 18:46:59 by FrancisBond)

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