Like levenchtein(), You can do :
(strlen($string2) - similar_text($string,$string2))
to see how much characters have been changed.
![]() |
|
||||||||||
|
similar_textОписаниеint similar_text ( string first, string second [, float percent] )Вычисляет степень похожести двух строк по алгоритму, описанному Oliver [1993]. Эта реализация алгоритма не использует стэка, использованного в оригинале, вместо этого применяются рекурсивные вызовы, что в некоторых случаях может ускорить процесс. Сложность алгоритма составляет O(N**3), где N - длина более длинной из двух строк. При передаче по ссылке третьего аргумента, ему присваивается степень похожести двух строк в процентах. Возвращается количество совпадающих символов в двух строках. similar_text
romain dot boyer at gmail dot com
08-Aug-2007 05:59
Like levenchtein(), You can do :
Paul
18-Jan-2007 08:50
The speed issues for similar_text seem to be only an issue for long sections of text (>20000 chars).
dmitry dot polushkin at gmail dot com
07-Mar-2006 08:08
Well... hard to explain, why I have written this function, but maybe it will be usefull.
brad dot fish at gmail dot com
24-Feb-2006 02:30
The link below to the Oliver document appears to be broken. Here is one that works: http://citeseer.ist.psu.edu/oliver93decision.html
louis #at# mulliemedia.com
06-Jun-2004 05:01
Note that this function will calculate the percentage blindly, without regard to the LENGHT of the string.
hate at spam dot com dot BR
09-May-2004 09:21
In PHP4+, you don't need to pass the percent variable as reference..
julius at infoguiden dot no
06-Feb-2003 06:46
If you have reserved names in a database that you don't want others to use, i find this to work pretty good.
georgesk at hotmail dot com 08-Mar-2002 08:14
Well, as mentioned above the speed is O(N^3), i've done a longest common subsequence way that is O(m.n) where m and n are the length of str1 and str2, the result is a percentage and it seems to be exactly the same as similar_text percentage but with better performance... here's the 3 functions i'm using.. |
| © 2007 info@grandviewstudio.com |
|
Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324 Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330 Z058440144362 Z348613067571 |