ADT.Heap performance poorer than just sorting and slicing
"Martin Nilsson (Coppermist) @ Pike (-) importm?te f?r mailinglistan" <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
>String.fuzzymatch will examine two strings and give a score out of 100
>for their similarity. I'd like to employ this to create a simple
>spelling suggestion engine, by feeding it a test word and an array of
>known words, and getting back an array of the 5 nearest matches. So
>far, so good.
As a side note I think using levenstein_distance() is better. At least
it is twice as fast. We should possibly change fuzzymatch to something
like the following, if people or OK with the actual numbers not being
exactly the same.
int fuzzymatch(stirng a, string b)
{
return (int)round(1-levenstein_distance()/max(sizeof(a),sizeof(b)));
}