[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Mini quiz (Was: Detecting similar strings

Hal E. Fulton

8/1/2006 11:41:00 PM

Nuralanur@aol.com wrote:
>>It's missing from wikipedia though.
>
>
> Does wikipedia provide the code for the implementations it lists?
> Maybe Hal would be so kind to add it then, if we ask him politely
> to do so :)

Ping me in a week and I will...

Hal


1 Answer

Andrew Skegg

8/2/2006 12:38:00 AM

0

A quick search on Google reveals a levenshtein ruby function has already been created.
http://po-ru.com/projects/le...

To my untrained eye (I am new to Ruby) using the levenshtein distance to calculate what someone might have meant to type mught be expensive. You will need to calculate the distance for all values in the field to compare it with the user input, then pick the small distances and display them as options. As the list of values grows larger, your app will bog down.

Perhaps a better way is to use an auto-complete ajax call on the input field?

Andrew



On Wednesday, August 02, 2006, at 09:42AM, Hal Fulton <hal9000@hypermetrics.com> wrote:

>Nuralanur@aol.com wrote:
>>>It's missing from wikipedia though.
>>
>>
>> Does wikipedia provide the code for the implementations it lists?
>> Maybe Hal would be so kind to add it then, if we ask him politely
>> to do so :)
>
>Ping me in a week and I will...
>
>Hal
>
>
>
>