Dotan,
Greg Donald wrote:
On Mon, 17 Jan 2005 23:43:48 +0200, Dotan Cohen <dotan_0105@xxxxxxxxxxxxxx> wrote:
I looked at the 'sound like' modules in php (leveshtien, soundex) but they are for comparing 2 strings, not creating a string based on what we already have.
You're looking at it from the wrong end.
With soundex you create soundex values for _all_ your known words, and you stick them in a db.. then you find the soundex value for the word in question and you do a lookup in your db to find other words with the closest values. You're right that you don't create any new strings based on the word. Instead you would provide a listing of similar words from the db lookup. It's all up to you what words go into the db to pick from.
good example of text search/matching but he has the problem that he still needs to create the words which brings him back to the original problem... how do you create:
cayac kayac cayak
from: kayak
...he seemed to want to generate permutations - regardless of whether they are actually in the dictionary.
well you would start off with a set of zero or more replacement chars for each letter in the alphabet (bare in mind that character (set?) encoding plays a part here). e.g. :
$repl = array( 'a' => null, 'b' => null, 'c' => array('k'), 'd' => null; 'e' => array('i'), /* * and so on.. */ );
then onto the string:
$str = str_split("kayak"); var_dump($str);
str_split() will give you an array, each element containing one letter of the original string.
now you need a loop! I leave the magic to build the permutations up to you
I read somewhere most English speaking folks only use about 80K words or so.
programmers use more :-)
rgds, Jochem
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php