liblouis / liblouis-js

Port/cross-compiled version of liblouis to Javascript
GNU General Public License v3.0
11 stars 4 forks source link

Pattern of errors when translating with en-ueb-g2 #52

Open morrisonsign opened 1 year ago

morrisonsign commented 1 year ago

I'm receiving an error when translating from en-ueb-g2 to en-us-brf in certain letter/number combinations using the latest build-no-tables-utf32.js with on demand table loading. This is similar to the errors in this other issue, but it still occurs with the utf32 build.

Here's one of the errors: abort() at Error at jsStackTrace (http://localhost:3000/lib/build-no-tables-utf32.js:1104:13) at stackTrace (http://localhost:3000/lib/build-no-tables-utf32.js:1121:12) at Object.abort (http://localhost:3000/lib/build-no-tables-utf32.js:68839:44) at _abort (http://localhost:3000/lib/build-no-tables-utf32.js:1726:22) at _free (http://localhost:3000/lib/build-no-tables-utf32.js:65850:7) at asm._free (http://localhost:3000/lib/build-no-tables-utf32.js:68505:19) at LiblouisEasyApi.translateString (http://localhost:3000/lib/easy-api.js:233:13) at LiblouisEasyApi.translateString (http://localhost:3000/lib/easy-api.js:484:24) at port.onmessage (http://localhost:3000/lib/braille.js:10:21)

I've noticed some patterns of letter/number combinations will throw this error, notably when a pair of letters or numbers contains one or more capital letters, or when switching from letters to numbers. But I can't quite figure out what is causing this to happen.

Translating the following throws an error: Ab aBBb AbCd AbcD ABCD AbcDef aBcdEf AbcdeF ABCDEF A1 A1b1 A1B1 A111 AB.123

Translating the following works just fine: ab aB ABC aBbB Abcd abcD Abcdef ABCDE ABCDEFGH a1 A1b A1B A11 ab.123

I had the same issue previously with the utf16 build but with different combinations (as noted in issue 50). Any idea of what could cause this?

bertfrees commented 1 year ago

Hi @morrisonsign. I have no idea how to interpret the stack trace. Perhaps a small test program to reproduce the issue would be helpful, but even then I don't know if I would be able to find the problem. I don't know how to debug this. It's complicated because the C code is transpiled to JavaScript.