On 25.11.2006, at 22:38, Curtis Hatter wrote:

> As you can see it has been metaphoned. Now if someone were to  
> search but
> inadvertently type 'qwick' instead of 'quick' it would still match  
> because
> 'qwick' metaphoned also becomes 'KK'.

You can achieve almost the same result using Ferret's built-in  
FuzzyQuery. It works even better for misspellings than phonetic  
algorithms, and it's language-neutral.

Consider:

i = Ferret::I.new
i << "the quick brown fox"

i.search("quikc~").total_hits
=> 1
i.search("qwick~").total_hits
=> 1

Whereas metaphone yields:

Text::Metaphone.double_metaphone("quick")
=> ["KK", nil]
Text::Metaphone.double_metaphone("quikc")
=> ["KKK", nil]

Cheers,
Andy
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to