Liblouis User's and Programmer's Manual
5.5 lou_translate ¶
This program translates whatever is on the standard input unit and
prints it on the standard output unit. It is intended for large-scale
testing of the accuracy of translation and back-translation. The
command line for lou_translate
is:
lou_translate [OPTION] TABLE
where ‘TABLE’ is either:
- QUERY
- FILE[,FILE,...]
a comma-separated list of table files
Aside from the standard options (see common options) this program also accepts the following options:
- --forward
- -f
Do a forward translation.
- --backward
- -b
Do a backward translation.
- --display-table FILE
- -d FILE
Use the given display table for the translation. This is useful when you are specifying the table as a query. This option takes precedence over any display table specified as part of the table files.
If no options are given forward translation is assumed.
Use the following command to do a forward translation of English text to grade 2 contracted braille according to the U.S. braille standard.
lou_translate --display-table unicode.dis language:en grade:2 region:en-US < input.txt
Use the following command to do a forward translation with translation table en-us-g2.ctb.
lou_translate --forward en-us-g2.ctb < input.txt
When you specify the table as a query, the braille encoding is always Unicode dot patterns, unless you specify a display table with the display-table option.
When you specify the table as a file list, the encoding of the resulting braille depends on the character definitions in the given table. It is recommended to use a display table, as in the following example, if you require a specific braille encoding.
The next example illustrates a forward translation with translation table en-us-g2.ctb and display table unicode.dis. The resulting braille is encoded as Unicode dot patterns (as defined in unicode.dis).
lou_translate --forward unicode.dis,en-us-g2.ctb < input.txt
Use a pipe if you would rather just pass some given text to the translator.
echo "The quick brown fox jumps over the lazy dog" | lou_translate -f unicode.dis,en-us-g2.ctb
The result will be written to standard output:
⠠⠮ ⠟⠅ ⠃⠗⠪⠝ ⠋⠕⠭ ⠚⠥⠍⠏⠎ ⠕⠧⠻ ⠮ ⠇⠁⠵⠽ ⠙⠕⠛
Backward translation can be done as follows:
echo ",! qk br{n fox jumps ov} ! lazy dog" | lou_translate --backward en-us-g2.ctb
which results in
The quick brown fox jumps over the lazy dog
You can also do a backward translation using Unicode dot patterns
echo "⠠⠮ ⠟⠅ ⠃⠗⠪⠝ ⠋⠕⠭" | lou_translate --backward unicode.dis,en-us-g2.ctb
resulting in
The quick brown fox