node-bitap icon indicating copy to clipboard operation
node-bitap copied to clipboard

Issues with Deletions

Open mingzian opened this issue 4 years ago • 0 comments

Hi, great little JS program you have here. One question I have, however, is whether your algorithm is really handling deletions correctly - that is, like in the source paper.

Check those examples:

> bitap('testing', 'testx', 1)
[]
> bitap('testing', 'xtest', 1)
[]
> bitap('testing', 'texst', 1)
[]

In all the three above, only one deletion would be needed to make the pattern be found in the text, at position 0 (or, in your program, position 3, since for some reason you decide to return the position of the end of the matched substrings).

mingzian avatar Feb 25 '21 02:02 mingzian