Choosing a split column for edit-script reconstruction #
Split the source into left ++ right. A forward row gives the distance from the left half
to every target prefix, and a backward row gives the distance from the right half to every
target suffix. Adding corresponding entries and selecting the first minimum finds a target
column where two independently optimal alignments concatenate to a whole optimal alignment.
The suffix-indexed grid computes the prefix scores on reversed words. Reversing the order of a script leaves the cost of each operation unchanged, so asymmetric letter costs are allowed.
Reversing both words preserves their weighted edit distance. Each reversed script has the same operations in reverse order, with the same individual costs.
Column k records the cost of cutting the target just before index k.
An optimal alignment through the selected column has the whole edit distance as its cost.