| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE chapter SYSTEM "docbook-dtd-45/docbookx.dtd"> |
| 3 |
|
| 4 |
<chapter id="cmdreference"> |
| 5 |
<title>Command Line Reference</title> |
| 6 |
|
| 7 |
<para> |
| 8 |
A list of binaries available and their usage information. |
| 9 |
</para> |
| 10 |
|
| 11 |
<section id="cmdargs-override"> |
| 12 |
<title>Order of argument sources</title> |
| 13 |
<para> |
| 14 |
If command line arguments come from multiple sources, they are applied in this order, with later values overriding prior: <link linkend="grammar-cmdargs"><code>CMDARGS</code></link>, environment variable <code>CG3_DEFAULT</code>, arguments passed on the command line, <link linkend="grammar-cmdargs"><code>CMDARGS-OVERRIDE</code></link>, environment variable <code>CG3_OVERRIDE</code>. |
| 15 |
</para> |
| 16 |
</section> |
| 17 |
|
| 18 |
<section id="vislcg3"> |
| 19 |
<title>vislcg3</title> |
| 20 |
<para> |
| 21 |
vislcg3 is the primary binary. It can run rules, compile grammars, and so on. |
| 22 |
</para> |
| 23 |
<screen> |
| 24 |
Usage: vislcg3 [OPTIONS] |
| 25 |
|
| 26 |
Environment variable: |
| 27 |
CG3_DEFAULT: Sets default cmdline options, which the actual passed options will override. |
| 28 |
CG3_OVERRIDE: Sets forced cmdline options, which will override any passed option. |
| 29 |
|
| 30 |
Options: |
| 31 |
-h, --help shows this help |
| 32 |
-?, --? shows this help |
| 33 |
-V, --version prints copyright and version information |
| 34 |
--min-binary-revision prints the minimum usable binary grammar revision |
| 35 |
-g, --grammar specifies the grammar file to use for disambiguation |
| 36 |
--grammar-out writes the compiled grammar in textual form to a file |
| 37 |
--grammar-bin writes the compiled grammar in binary form to a file |
| 38 |
--grammar-only only compiles the grammar; implies --verbose |
| 39 |
--ordered (will in future allow full ordered matching) |
| 40 |
-u, --unsafe allows the removal of all readings in a cohort, even the last one |
| 41 |
-s, --sections number or ranges of sections to run; defaults to all sections |
| 42 |
--rules number or ranges of rules to run; defaults to all rules |
| 43 |
--rule a name or number of a single rule to run |
| 44 |
--nrules a regex for which rule names to parse/run; defaults to all rules |
| 45 |
--nrules-v a regex for which rule names not to parse/run |
| 46 |
-d, --debug enables debug output (very noisy) |
| 47 |
--debug-rules number or ranges of rules to debug |
| 48 |
-v, --verbose increases verbosity |
| 49 |
--quiet squelches warnings (same as -v 0) |
| 50 |
-2, --vislcg-compat enables compatibility mode for older CG-2 and vislcg grammars |
| 51 |
-I, --stdin file to read input from instead of stdin |
| 52 |
-O, --stdout file to print output to instead of stdout |
| 53 |
-E, --stderr file to print errors to instead of stderr |
| 54 |
--no-mappings disables all MAP, ADD, and REPLACE rules |
| 55 |
--no-corrections disables all SUBSTITUTE and APPEND rules |
| 56 |
--no-before-sections disables all rules in BEFORE-SECTIONS parts |
| 57 |
--no-sections disables all rules in SECTION parts |
| 58 |
--no-after-sections disables all rules in AFTER-SECTIONS parts |
| 59 |
-t, --trace prints debug output alongside normal output; optionally stops execution |
| 60 |
--trace-name-only if a rule is named, omit the line number; implies --trace |
| 61 |
--trace-no-removed does not print removed readings; implies --trace |
| 62 |
--trace-encl traces which enclosure pass is currently happening; implies --trace |
| 63 |
--deleted read deleted readings as such, instead of as text |
| 64 |
--dry-run make no actual changes to the input |
| 65 |
--single-run runs each section only once; same as --max-runs 1 |
| 66 |
--max-runs runs each section max N times; defaults to unlimited (0) |
| 67 |
--profile gathers profiling statistics and code coverage into a SQLite database |
| 68 |
-p, --prefix sets the mapping prefix; defaults to @ |
| 69 |
--unicode-tags outputs Unicode code points for things like -> |
| 70 |
--unique-tags outputs unique tags only once per reading |
| 71 |
--num-windows number of windows to keep in before/ahead buffers; defaults to 2 |
| 72 |
--always-span forces scanning tests to always span across window boundaries |
| 73 |
--soft-limit number of cohorts after which the SOFT-DELIMITERS kick in; defaults to 300 |
| 74 |
--hard-limit number of cohorts after which the window is forcefully cut; defaults to 500 |
| 75 |
-T, --text-delimit additional delimit based on non-CG text, ensuring it isn't attached to a cohort; defaults to /(^|\n)</s/r |
| 76 |
-D, --dep-delimit delimit windows based on dependency instead of DELIMITERS; defaults to 10 |
| 77 |
--dep-absolute outputs absolute cohort numbers rather than relative ones |
| 78 |
--dep-original outputs the original input dependency tag even if it is no longer valid |
| 79 |
--dep-allow-loops allows the creation of circular dependencies |
| 80 |
--dep-no-crossing prevents the creation of dependencies that would result in crossing branches |
| 81 |
--no-magic-readings prevents running rules on magic readings |
| 82 |
-o, --no-pass-origin prevents scanning tests from passing the point of origin |
| 83 |
--split-mappings keep mapped readings separate in output |
| 84 |
-e, --show-end-tags allows the <<< tags to appear in output |
| 85 |
--show-unused-sets prints a list of unused sets and their line numbers; implies --grammar-only |
| 86 |
--show-tags prints a list of unique used tags; implies --grammar-only |
| 87 |
--show-tag-hashes prints a list of tags and their hashes as they are parsed during the run |
| 88 |
--show-set-hashes prints a list of sets and their hashes; implies --grammar-only |
| 89 |
--dump-ast prints the grammar parse tree; implies --grammar-only |
| 90 |
-B, --no-break inhibits any extra whitespace in output |
| 91 |
</screen> |
| 92 |
</section> |
| 93 |
|
| 94 |
<section id="cg-conv"> |
| 95 |
<title>cg-conv</title> |
| 96 |
<para> |
| 97 |
cg-conv converts between <link linkend="streamformats">stream formats</link>. |
| 98 |
It can currently convert from any of CG, Niceline CG, Apertium, HFST/XFST, and plain text formats, |
| 99 |
turning them into CG, Niceline CG, Apertium, or plain text formats. |
| 100 |
By default it tries to auto-detect the input format and convert that to CG. |
| 101 |
Currently only meant for use in a pipe. |
| 102 |
</para> |
| 103 |
<screen> |
| 104 |
Usage: cg-conv [OPTIONS] |
| 105 |
|
| 106 |
Environment variable: |
| 107 |
CG3_CONV_DEFAULT: Sets default cmdline options, which the actual passed options will override. |
| 108 |
CG3_CONV_OVERRIDE: Sets forced cmdline options, which will override any passed option. |
| 109 |
|
| 110 |
Options: |
| 111 |
-h, --help shows this help |
| 112 |
-?, --? shows this help |
| 113 |
-p, --prefix sets the mapping prefix; defaults to @ |
| 114 |
-u, --in-auto auto-detect input format (default) |
| 115 |
-c, --in-cg sets input format to CG |
| 116 |
-n, --in-niceline sets input format to Niceline CG |
| 117 |
-a, --in-apertium sets input format to Apertium |
| 118 |
-f, --in-fst sets input format to HFST/XFST |
| 119 |
-x, --in-plain sets input format to plain text |
| 120 |
--add-tags adds minimal analysis to readings (implies -x) |
| 121 |
-C, --out-cg sets output format to CG (default) |
| 122 |
-A, --out-apertium sets output format to Apertium |
| 123 |
-F, --out-fst sets output format to HFST/XFST |
| 124 |
-M, --out-matxin sets output format to Matxin |
| 125 |
-N, --out-niceline sets output format to Niceline CG |
| 126 |
-X, --out-plain sets output format to plain text |
| 127 |
-W, --wfactor FST weight factor (defaults to 1.0) |
| 128 |
--wtag FST weight tag prefix (defaults to W) |
| 129 |
-S, --sub-delim FST sub-reading delimiters (defaults to #) |
| 130 |
-r, --rtl sets sub-reading direction to RTL (default) |
| 131 |
-l, --ltr sets sub-reading direction to LTR |
| 132 |
-o, --ordered tag order matters mode |
| 133 |
-D, --parse-dep parse dependency (defaults to treating as normal tags) |
| 134 |
--unicode-tags outputs Unicode code points for things like -> |
| 135 |
--deleted read deleted readings as such, instead of as text |
| 136 |
-B, --no-break inhibits any extra whitespace in output |
| 137 |
</screen> |
| 138 |
</section> |
| 139 |
|
| 140 |
<section id="cg-comp"> |
| 141 |
<title>cg-comp</title> |
| 142 |
<para> |
| 143 |
cg-comp is a lighter tool that only compiles grammars to their binary form. |
| 144 |
It requires grammars to be in Unicode (UTF-8) encoding. |
| 145 |
Made for the Apertium toolchain. |
| 146 |
</para> |
| 147 |
<screen> |
| 148 |
USAGE: cg-comp grammar_file output_file |
| 149 |
</screen> |
| 150 |
</section> |
| 151 |
|
| 152 |
<section id="cg-proc"> |
| 153 |
<title>cg-proc</title> |
| 154 |
<para> |
| 155 |
cg-proc is a grammar applicator which can handle the Apertium stream format. |
| 156 |
It works with binary grammars only, hence the need for cg-comp. |
| 157 |
It requires the input stream to be in Unicode (UTF-8) encoding. |
| 158 |
Made for the Apertium toolchain. |
| 159 |
</para> |
| 160 |
<screen> |
| 161 |
USAGE: cg-proc [-t] [-s] [-d] [-g] [-r rule] grammar_file [input_file [output_file]] |
| 162 |
|
| 163 |
Options: |
| 164 |
-d: morphological disambiguation (default behaviour) |
| 165 |
-s: specify number of sections to process |
| 166 |
-f: set the format of the I/O stream to NUM, |
| 167 |
where `0' is VISL format, `1' is |
| 168 |
Apertium format and `2' is Matxin (default: 1) |
| 169 |
-r: run only the named rule |
| 170 |
-t: print debug output on stderr |
| 171 |
-w: enforce surface case on lemma/baseform |
| 172 |
(to work with -w option of lt-proc) |
| 173 |
-n: do not print out the word form of each cohort |
| 174 |
-g: do not surround lexical units in ^$ |
| 175 |
-1: only output the first analysis if ambiguity remains |
| 176 |
-z: flush output on the null character |
| 177 |
-v: version |
| 178 |
-h: show this help |
| 179 |
</screen> |
| 180 |
</section> |
| 181 |
|
| 182 |
<section id="cg-strictify"> |
| 183 |
<title>cg-strictify</title> |
| 184 |
<para> |
| 185 |
cg-strictify will parse a grammar and output a candidate STRICT-TAGS line that you can edit and then put |
| 186 |
into your grammar. Optionally, it can also output the whole grammar and strip superfluous LISTs along the way. |
| 187 |
</para> |
| 188 |
<screen> |
| 189 |
Usage: cg-strictify [OPTIONS] <grammar> |
| 190 |
|
| 191 |
Options: |
| 192 |
-?, --help outputs this help |
| 193 |
-g, --grammar the grammar to parse; defaults to first non-option argument |
| 194 |
-o, --output outputs the whole grammar with STRICT-TAGS |
| 195 |
--strip removes superfluous LISTs from the output grammar; implies -o |
| 196 |
--secondary adds secondary tags (<...>) to strict list |
| 197 |
--regex adds regular expression tags (/../r, <..>r, etc) to strict list |
| 198 |
--icase adds case-insensitive tags to strict list |
| 199 |
--baseforms adds baseform tags ("...") to strict list |
| 200 |
--wordforms adds wordform tags ("<...>") to strict list |
| 201 |
--all same as --strip --secondary --regex --icase --baseforms --wordforms |
| 202 |
</screen> |
| 203 |
</section> |
| 204 |
|
| 205 |
<section id="cg3-autobin.pl"> |
| 206 |
<title>cg3-autobin.pl</title> |
| 207 |
<para> |
| 208 |
A thin Perl wrapper for vislcg3. It will compile the grammar to binary form the first time and re-use that on |
| 209 |
subsequent runs for the speed boost. Accepts all command line options that vislcg3 does. |
| 210 |
</para> |
| 211 |
</section> |
| 212 |
</chapter> |