[liblouis-liblouisxml] Re: order of operations in parser

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Mon, 21 Oct 2013 20:10:17 -0500

No. The longest strings are considered first, whatever their opcodes.

John

On Mon, Oct 21, 2013 at 11:13:47PM +0000, Ken Perry wrote:
> But doesn't that make all the other rules operate on words before the word 
> rrules?  
> 
> Ken
> 
> -----Original Message-----
> From: liblouis-liblouisxml-bounce@xxxxxxxxxxxxx 
> [mailto:liblouis-liblouisxml-bounce@xxxxxxxxxxxxx] On Behalf Of John J. Boyer
> Sent: Monday, October 21, 2013 3:42 PM
> To: liblouis-liblouisxml@xxxxxxxxxxxxx
> Subject: [liblouis-liblouisxml] Re: order of operations in parser
> 
> liblouis operates as follows. The character strings in rules are grouped into 
> hash buckets according to their first two characters. (This is modified in 
> the new table lookup algorithm.) Within each bucket the strings are arranged 
> with the longest string first. If two strings are identical the one 
> encountered first in the table compilation goes ahead of the one encountered 
> next. Thus it is possible to have identical strings with different opcodes. 
> For back-translation the same algorithm is fololowed, except that the dot 
> patterns are used instead of the character strings. 
> 
> During translation the first two characters at the curson position are used 
> to generate the hash code, which points to a hash buccket. The strings in 
> this bucket are then tested in order. If a matching strring is found the 
> opcode associated with it is tested to see if it is valid in the context. If 
> so, the dot pattern is placed in an intermediate buffer, If not, the next 
> string is tested. If no string is valid the dot pattern for the first 
> character is placed inn the buffer and the cursor position is increased by 
> one. For valid strings the cursor position is increased by the length of the 
> string. As above, for back-translation the same procedure is followed, except 
> that the dot patterns are used instead of the character strings. 
> 
> I hope this helps,
> John
> 
> On Mon, Oct 21, 2013 at 06:31:06PM +0000, Ken Perry wrote:
> > 
> > 
> > John,  does the word operation get acted on first or the other rules?  
> > I think the word operation should happen first.  For example I have a 
> > rule
> > 
> > Word aft 1-124-2345
> > 
> > But it still back translates as
> > Aftert
> > 
> > 
> > If the word rules were ran first this would not happen ever would it?
> > 
> > Ken
> 
> --
> John J. Boyer; President, Chief Software Developer Abilitiessoft, Inc.
> http://www.abilitiessoft.com
> Madison, Wisconsin USA
> Developing software for people with disabilities
> 
> For a description of the software, to download it and links to project pages 
> go to http://www.abilitiessoft.com
> For a description of the software, to download it and links to
> project pages go to http://www.abilitiessoft.com

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities

For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: