note 73606 added to function.levenshtein
| From: | Paul at osu1 dot php dot net | Date: | Sat, 03 Mar 2007 06:47:11 +0000 |
| Subject: | note 73606 added to function.levenshtein | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124037@lists.php.net to get a copy of this message | ||
@ ivo_gelov at gmx dot net
Your implementation of Myers' algorithm is not entirely correct. The algorithm finds the end of
a match, but you still need to find the start of a match. The easiest way to find the start of a
match is to execute the algorithm again on the reversed string, starting at the j'th character.
You can't just assume the start of the match is at j - m because you don't know whether
the match is longer, shorter, or of equal length.
Just my 2 cents.
----
Server IP: 216.194.113.175
Probable Submitter: 24.174.239.115
----
Manual Page -- http://www.php.net/manual/en/function.levenshtein.php
Edit -- https://master.php.net/note/edit/73606
Del: integrated -- https://master.php.net/note/delete/73606/integrated
Del: useless -- https://master.php.net/note/delete/73606/useless
Del: bad code -- https://master.php.net/note/delete/73606/bad+code
Del: spam -- https://master.php.net/note/delete/73606/spam
Del: non-english -- https://master.php.net/note/delete/73606/non-english
Del: in docs -- https://master.php.net/note/delete/73606/in+docs
Del: other reasons-- https://master.php.net/note/delete/73606
Reject -- https://master.php.net/note/reject/73606
Search -- https://master.php.net/manage/user-notes.php