On Saturday 25 November 2006 17:21, Andreas Korth wrote:
> 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]
>
I'm looking at trying to use both. My reason:
i = Ferret::I.new
i << "The quick brown fox"
i.search("qwik~").total_hits
=> 0
Where as double metaphoning "quick" or "qwik" both become "KK".
What I'm thinking might be a good solution is to index the word and it's
double-metaphone equivalent. Then search for exact hits against the metaphone
and fuzzy hits against the word field. Then sort based on score, with
hopefully exact matches being 100.
Still investigating the best solutions. Thanks for the ideas,
Curtis
Curtis
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk