Req #29552 [Opn->Fbk]: Callback function for levenshtein
| From: | levim@php.net | Date: | Mon, 21 Apr 2014 20:27:50 +0000 |
| Subject: | Req #29552 [Opn->Fbk]: Callback function for levenshtein | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185355@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=29552&edit=1
ID: 29552
Updated by: levim@php.net
Reported by: philip at cornado dot com
-Summary: callback function for levenshtein
+Summary: Callback function for levenshtein
-Status: Open
+Status: Feedback
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: Strings related
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Is this something you are still interested in seeing? A quick look at the docs indicates that it
hasn't been added.
Previous Comments:
------------------------------------------------------------------------
[2004-08-06 18:09:50] philip at cornado dot com
Description:
------------
The levenshtein() documentation goes into great detail on a third yet to be implemented parameter
for a levenshtein callback function. Below are those docs which will soon be removed from the php
manual until this feature is actually implemented:
The third variant (which is not implemented yet) will be the most general and adaptive, but also the
slowest alternative. It will call a user-supplied function that will determine the cost for every
possible operation.
The user-supplied function will be called with the following arguments:
* operation to apply: 'I', 'R' or 'D'
* actual character in string 1
* actual character in string 2
* position in string 1
* position in string 2
* remaining characters in string 1
* remaining characters in string 2
The user-supplied function has to return a positive integer describing the cost for this particular
operation, but it may decide to use only some of the supplied arguments.
The user-supplied function approach offers the possibility to take into account the relevance of
and/or difference between certain symbols (characters) or even the context those symbols appear in
to determine the cost of insert, replace and delete operations, but at the cost of losing all
optimizations done regarding cpu register utilization and cache misses that have been worked into
the other two variants.
Attempting to use it gives us:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The general Levenshtein support is not there
yet");
And a return value of -1.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=29552&edit=1