Re: ADT.Heap performance poorer than just sorting and slicing
Chris Angelico <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CAPTjJmp-J8_GMtSuiW+Z-zM_iP9ahmS7w9ENMejaHB4+3pFr5g@mail.gmail.com> |
On Wed, Feb 24, 2016 at 11:15 PM, Martin Nilsson (Coppermist) @ Pike (-) importmöte för mailinglistan <[email protected]> wrote: >>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))); > } > I'm not sure what the algorithm for fuzzymatch currently is, but it's giving much more useful typo correction than levenshtein_distance is. I'd rather a slight pause followed by useful results than immediate but useless ones :) ChrisA