[liblouis-liblouisxml] Translating text files with backslash markup

  • From: "Jake Kyle" <jake@xxxxxxxxxxxxxxxxxx>
  • To: <liblouis-liblouisxml@xxxxxxxxxxxxx>
  • Date: Wed, 16 Dec 2015 16:42:44 -0000

Hello,

The organisation I work for is involved in putting the Bible into Braille in
many different languages. At the moment I use a program written by a retired
colleague. It does it in 2 stages:

1. Braille Translation
2. Formatting

I am very interested in whether Liblouis could be used for stage 1 and have
been trying it out but have run into a couple of obstacles. All the source text
files are written with the same markup. This consists of codes which start with
a backslash and end with a space. With the translation stage my aim is to keep
the backslash codes exactly as they are but to translate the rest of the text
into Braille.

Below is an example of a portion of a typical source text file (Matthew chapter
1 verse 1 from the Good News Bible).

\c 1
\s1 The Ancestors of Jesus Christ
\r (Lk 3.23–38)
\p
\v 1 This is the list of the ancestors of Jesus Christ, a descendant of David,
who was a descendant of Abraham.

and here is the desired output in UEB G2 (just as an example). Ideally (for the
formatting stage) the text will be in BRF standard whilst the codes remain
lower case.

\c #A
\s1 ,! ,ANCE/ORS ( ,JESUS ,*RI/
\r "<,LK #C4BC,-#CH">
\p
\v #A ,? IS ! LI/ ( ! ANCE/ORS ( ,JESUS ,*RI/1 A DESC5DANT ( ,DAVID1 :O 0 A
DESC5DANT ( ,ABRAHAM4

The first problem I am finding is with the backslash codes. Liblouis reads them
as escape codes and so they are either not translated properly or at all. One
solution is to make each backslash 2 backslashes before putting it through
Liblouis. I wonder if there is an opcode that can be put in a table telling
Liblouis to do this before translation or telling Liblouis that backslashes are
not to be treated as escape codes?

The other problem is getting the codes themselves not to be transcribed. For
example I would like \s1 to remain \s1 and not be translated \s#A. I was
wondering if the “compbrl” opcode could achieve this?

I look forward to hearing from anyone who can help me or point me in the right
direction.

Best regards
Jake

Jake Kyle
www.compassbraille.org







Other related posts: