Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's fun to think of the regular expression which matches all strings off by Levenshtein=1. For "hello" it's something like: hello|ello|hllo|helo|hell|.hello|h.ello|he.llo|hel.lo|hell.o|hello.|.ello|h.llo|he.lo|hel.o|hell.

This seems pretty easy to generate the NFA for this, then compile it to a DFA as usual.



The problem with this approach is that it can be (absurdly) complex to generate, even when the actual DFA output required is small.

Look at the intermediates generated by something like "hhhhh". There is a massive amount of redundancy there.


Or: hello|.?ello|h.?llo|he.?lo|hel.?o|hell.?


That doesn't match "helloo".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: