Skip to content

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

a table 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.

5.5.1 Examples

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

Do the same forward translation but with a specific ASCII braille encoding instead of Unicode braille.

lou_translate -d en-us-brf.dis language:en grade:2 region:en-US < input.txt

Do a backward translation with the English grade 2 table. Note that the ASCII braille input (as shown here) must match the specified display table (North American Braille Computer Code in this case).

echo ",! qk br{n fox" | lou_translate -b -d text_nabcc.dis language:en grade:2 region:en-US

Note that with query-based tables the braille encoding is always Unicode dot patterns unless you override it with -d. With file-based tables the braille encoding depends on the character definitions in the table, so the examples below use -d to specify an explicit display table.

The following example does 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 -f -d 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 -d 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 -b -d unicode.dis en-us-g2.ctb

resulting in

The quick brown fox