How to use the CG-2 parser vislcg

How to use the vislcg parser

Basic usage

The command line looks like this (for sme, supposing you stand in the sme directory):

sme$ cat sometext.txt | preprocess --abbr=bin/abbr.txt | lookup -flags mbTT bin/sme.fst |  ../script/lookup2cg | vislcg --grammar=src/sme-dis.rle | less

Flags and their use

The vislcg program contains 18 flags, or usage options. A list of the flags may be obtained by writing the following command:

vislcg --help

i.e., by using the flag --help. The most relevant flags for our use are the following:

--grammar=src/sme-dis.rle
This flag selects the grammar file. The "=" symbol is optional.
--sections=n
This flag sets the number of CONSTRAINT sections that are applied. In this way it is possible to study the effects of one rule set at a time.
--trace
This flag tells the parser to include information of what constraint rules are invoked in each concrete case. The flag is crucial for studying the effects of the different rules.
--minimal
The flag --minimal is used together with the flag --trace. With this flag only the line number of the rule is given. Without the --minimal flag, the parser also lists the rule in question.

For reference: Tapanainen's original CG-2 parser

Tapanainen's original CG-2 parser mdis is available from Connexor. A copy of the parser is available for staff and students on the computer of the ling.dept at the U of Helsinki, at ~tapanain/conexor/mdis/bin/. The parser cannot be used outside this computer.

The CG-2 parser is actually two different CG-2 parsers (Tap96 mentions 4 more parsers, this information is obsolete):

mdis
mapping and disambiguation
mdis.trace
mapping and disambiguation, but with id numbers of the rules.

The flags

This list given here is not complete, but includes only relevant flags. For a full list, see Tap96.

--grammar=grammarfile.rle
obligatorily for parsing (note the symbol "=*, in Tap96 this is still not included)
--sections=n
sets the number (n) of CONSTRAINT sections. By default, all sections are applied.
--check-only
the parser does not apply rules

Thus, CG-2 differs from vislcg, that consists of only one parser (vislcg), but has more flags (also more flags than CG-2).

References

Tapanainen, Pasi 1996: The Constraint Grammar Parser CG-2. University of Helsinki Publications No. 27.