Liblouis User's and Programmer's Manual
2.13 The correct Opcode ¶
correct test actionBecause some input (such as that from an OCR program) may contain systematic errors, it is sometimes advantageous to use a pre-translation pass to remove them. The errors and their corrections are specified by the
correctopcode. If there are nocorrectopcodes in a table, the pre-translation pass is not used. If any back-translation corrections have been specified then they are applied in a post-translation (i.e. the very last) pass.Note that like the
contextopcode (seecontext) and multi-pass opcodes, thecorrectopcode must be preceded bynobackopcode (seenoback) ornoforopcode (seenofor).The format of the
correctopcode is very similar to that of thecontextopcode (seecontext). The only difference is that in the action part strings may be used and dot patterns may not be used. Some examples ofcorrectopcode entries are:noback correct "\\" ? Eliminate backslashes noback correct "cornf" "comf" fix a common "scano" noback correct "cornm" "comm" noback correct "cornp" "comp" noback correct "*" ? Get rid of stray asterisks noback correct "|" ? ditto for vertical bars noback correct "\s?" "?" drop space before question mark