Reply to Re: [PHP] Phonetic speller function

Your name:

Reply:


Posted by Jochem Maas on 01/18/05 02:02

Dotan,


Greg Donald wrote:
> On Mon, 17 Jan 2005 23:43:48 +0200, Dotan Cohen
> <dotan_0105@dotancohen.com> 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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация