Skip to content

2.13 The correct Opcode

correct test action

Because 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 correct opcode. If there are no correct opcodes 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 context opcode (see context) and multi-pass opcodes, the correct opcode must be preceded by noback opcode (see noback) or nofor opcode (see nofor).

The format of the correct opcode is very similar to that of the context opcode (see context). The only difference is that in the action part strings may be used and dot patterns may not be used. Some examples of correct opcode 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