[liblouis-liblouisxml] Re: Difficulty with the context opcode.

  • From: Michael Gray <mgray@xxxxxxx>
  • To: "liblouis-liblouisxml@xxxxxxxxxxxxx" <liblouis-liblouisxml@xxxxxxxxxxxxx>
  • Date: Thu, 19 Jan 2017 23:30:13 +0000

Sorry for the delay.  I haven't read all the emails in this thread so I may be 
repeating something or missing some point.

My goal is to prefix the first English letter of a sequence with dots 56.

The issue as I see it comes down to the fact that every opcode has to have a 
sequence of characters in order to know when to be matched.  Whatever those 
characters are in the input, they will correspond to something in the output.  
How else would a rule know when it is to be used?  Your prefix's output does 
not correspond to any input.  This is why there is special processing for 
emphases; which I believe should be capable of doing what you want.  However 
UEB uses up all 10 available emphasis classes so the MAX_EMPH_CLASSES would 
have to be raised and LibLouis recompiled.  But I wrote it in such a way with 
the hopes that if something like this came up it could do it.

A possible quick and dirty solution could be that because there are only 52 
rules max needed (26 uppercase and 26 lowercase), the context opcode could be 
used for each letter, and then the letter's dots be included in the action 
portion.  I did something like this to remove the numeric indicator from 
between the numeric space indicators (see en-ueb-g1.ctb), it took 100 rules.

     context _!%englishLetter[A]%englishLetter @56*
     context _!%englishLetter[B]%englishLetter @56*
     ...
     context _!%englishLetter[z]%englishLetter @56*

MRG
mgray@xxxxxxx


________________________________________
From: liblouis-liblouisxml-bounce@xxxxxxxxxxxxx 
[liblouis-liblouisxml-bounce@xxxxxxxxxxxxx] on behalf of Michael Whapples 
[dmarc-noreply@xxxxxxxxxxxxx]
Sent: Wednesday, January 04, 2017 5:19 AM
To: liblouis-liblouisxml@xxxxxxxxxxxxx
Subject: [liblouis-liblouisxml] Re: Difficulty with the context opcode.

I am aware that no answer yet has been given to your original question.
Having done a bit more work using context and multipass opcodes for some
tables I am working on, they really seem to be questionable in how these
rules work and I feel just unreliable opcodes. The documentation is so
slim and there are so many cases beyond the documentation specification
one is reliant on undocumented and probably undefined behaviour, who
knows if it will change in the future without notice.


I think I now understand why Mike Gray decided to create the match
opcode to replace these. I am not sure if that match opcode has been
included into the standard liblouis or if it is still an APH specific
feature. I am not sure if he added details of the match opcode to the
documentation but here is a link to an old mailing list post where the
match opcode was described
//www.freelists.org/post/liblouis-liblouisxml/new-opcodes

Also here is a link to the issue for merging the documentation for the
match opcode https://github.com/liblouis/liblouis/pull/189/files


May be this will offer a possible solution.


Michael Whapples


On 02/01/2017 16:30, Dave Mielke wrote:
[quoted lines by Michael Whapples on 2017/01/02 at 10:38 +0000]

OK, I wasn't certain and now you mention getting repeated dots 56 for
that first rule I think I had a similar issue when creating a
different rule.
For that case (empty brackets), lou_trace gives me:

    1.      lowercase       a       1
    2.      context `[]$w   @56
    3.      lowercase       a       1
    4.      context `[]$w   @56

And so on. The log made it easier to count. It looped 256 times.

I have done a bit more looking at it and my original suggestion of
@56* was wrong, it appears that can be used in the third column. So
yes your original suggestion looks correct.
This is what lou_trace gives for my original method (class name within
brackets, and @56*):

    1.      lowercase       a       1
    2.      context `[$w]   @56*
    3.      lowercase       b       12
    4.      lowercase       c       14
    5.      space           0
    6.      lowercase       d       145
    7.      context _!$l[$w]        @56*
    8.      lowercase       e       15
    9.      lowercase       f       124


For a description of the software, to download it and links to
project pages go to http://liblouis.org
For a description of the software, to download it and links to
project pages go to http://liblouis.org

Other related posts: