Sámediggi > Divvun
 
Font size:      

Documentation for vislcg3

Vislcg3 is the newest parser generation from Odense. As its predecessor, vislcg, it is open source. Vislcg3 is licensed under GPL.

Starting on March 5th 2008, we have migrated to vislcg3. Rule files for vislcg are still available in older revisions. For vislcg3 documentation we recommend the online documentation at beta.visl.sdu.dk/cg3.html. Here, we only document installation and basic usage.

Preparations before you install vislcg3

  • Check if you have MacPorts. Issue the command /opt/local/bin/port search twig in a Terminal. If that is successfull, go on to the next step. If not install MacPorts, then continue
  • Issue the command sudo port install cmake icu boost. This installs the libraries and programs that vislcg3 depends on. Next step is to fetch, install and build vislcg3.

Commands to check out, install and update the vislcg3 program

vislcg3 may be checked out, and later on updated, from Odense via svn, or it may be downloaded from sourceforge. Here, we assume you download it from Odense. Run the following commands:

Commands to check out and install vislcg3

svn co --username anonymous --password anonymous http://beta.visl.sdu.dk/svn/visl/tools/vislcg3/trunk vislcg3 
cd vislcg3/
./get-boost.sh 
./cmake.sh 
make -j3 
test/runall.pl 
sudo make install

If you want vislcg3 in /opt/local, and not in /usr/local (or somewhere else), do this instead:

svn co --username anonymous --password anonymous http://beta.visl.sdu.dk/svn/visl/tools/vislcg3/trunk vislcg3 
cd vislcg3/ 
./get-boost.sh 
cmake -DCMAKE_INSTALL_PREFIX=/opt/local . 
make -j3 
test/runall.pl 
sudo make install

Now vislcg3 is installed in /usr/local/bin/, and is ready to be used.

Note
If you are logged in as a non-admin user, you need to switch to an admin user before you run the last command (the sudo command): su [admin-username] Replace [admin-username] with a username with administrative privileges. Then type in the corresponding password, and continue with the final step above.

Commands to update vislcg3

If you already have checked out vislcg3, then you can simply do the following:

cd vislcg3/
svn up
./cmake.sh 
make -j3 
test/runall.pl
sudo make install

Tip: The vislcg3 is downloaded automatically to victorio every night. If you have access to the svn you can check whether you have the latest version (compare vislcg3 --version on your machine and on victorio, and repeat the steps above if your version is older).

Compilation and usage of CG files

The CG .rle files can be run as text files, or comiled. They will be compiled with the make TARGET=$LANG command d:

... | vislcg3 -g src/sme-dis.rle | ...

Vislcg3 can be run with this command:

... | vislcg3 -g src/sme-dis.rle | ...

Flags

The list of flags can be obtained by vislcg3 --help. That command prints something like this (use the newest version rather than this list):

-bash-3.00$ vislcg3 -h
VISL CG-3 Disambiguator version 0.9.2.3279
Usage: vislcg3 [OPTIONS]

Options:
 -h or -? or --help       Displays this list.
 -V or --version          Prints version number.
 -g or --grammar          Specifies the grammar file to use for disambiguation.
 -p or --vislcg-compat    Tells the grammar compiler to be compatible with older VISLCG syntax.
 --grammar-out            Writes the compiled grammar back out in textual form to a file.
 --grammar-bin            Writes the compiled grammar back out in binary form to a file.
 --grammar-info           Writes the compiled grammar back out in textual form to a file, with lots of statistics and information.
 --grammar-only           Compiles the grammar only.
 --trace                  Prints debug output alongside with normal output.
 --prefix                 Sets the prefix for mapping. Defaults to @.
 --sections               Number of sections to run. Defaults to running all sections.
 --single-run             Only runs each section once.
 --no-mappings            Disables running any MAP, ADD, or REPLACE rules.
 --no-corrections         Disables running any SUBSTITUTE or APPEND rules.
 --no-before-sections     Disables running rules from BEFORE-SECTIONS.
 --no-sections            Disables running rules from any SECTION.
 --no-after-sections      Disables running rules from AFTER-SECTIONS.

 --num-windows            Number of windows to keep in before/ahead buffers. Defaults to 2.
 --always-span            Forces all scanning tests to always span across window boundaries.
 --soft-limit             Number of cohorts after which the SOFT-DELIMITERS kick in. Defaults to 300.
 --hard-limit             Number of cohorts after which the window is delimited forcefully. Defaults to 500.
 --no-magic-readings      Prevents running rules on magic readings.
 --dep-allow-loops        Allows the creation of circular dependencies.

 -O or --stdout           A file to print output to instead of stdout.
 -I or --stdin            A file to read input from instead of stdin.
 -E or --stderr           A file to print errors to instead of stderr.

 -C or --codepage-all     The codepage to use for grammar, input, and output streams. Auto-detects default from environment.
 --codepage-grammar       Codepage to use for grammar. Overrides --codepage-all.
 --codepage-input         Codepage to use for input. Overrides --codepage-all.
 --codepage-output        Codepage to use for output and errors. Overrides --codepage-all.

 -L or --locale-all       The locale to use for grammar, input, and output streams. Defaults to en_US_POSIX.
 --locale-grammar         Locale to use for grammar. Overrides --locale-all.
 --locale-input           Locale to use for input. Overrides --locale-all.
 --locale-output          Locale to use for output and errors. Overrides --locale-all.