I have a search on my website that search names, so I know all of the values they could enter. How do I do something like google where if I type jonson it would say "did you mean johnson"? Any ideas? Thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
gene.tani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-18 04:57 UTC
Re: How does google do the "did you mean...."?
On Jun 17, 9:33 pm, Ben Johnson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I have a search on my website that search names, so I know all of the > values they could enter. How do I do something like google where if I > type jonson it would say "did you mean johnson"? > > Any ideas? > > Thanks. > > -- > Posted viahttp://www.ruby-forum.com/.there''s several ways: Levenshtein distance, soundex, Metaphone and Phonex algo''s. There''ve been threads on "spelling correction" here and in rubytalk. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
A bunch of useful stuff: http://text.rubyforge.org/ On Jun 18, 6:57 am, "gene.t...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <gene.t...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jun 17, 9:33 pm, Ben Johnson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > I have a search on my website that search names, so I know all of the > > values they could enter. How do I do something like google where if I > > type jonson it would say "did you mean johnson"? > > > Any ideas? > > > Thanks. > > > -- > > Posted viahttp://www.ruby-forum.com/. > > there''s several ways: Levenshtein distance, soundex, Metaphone and > Phonex algo''s. There''ve been threads on "spelling correction" here > and in rubytalk.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
gene.tani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:>> Posted viahttp://www.ruby-forum.com/. > > there''s several ways: Levenshtein distance, soundex, Metaphone and > Phonex algo''s. There''ve been threads on "spelling correction" here > and in rubytalk.I actually tried soundex, the problem is that I''m dealing with parts of the string in the database, not the entire string. There is not split() function for mysql. Example: A person types "red sox" and my field has "boston red sox", soundex would not detect that. I''m trying to do this all in a query, for performance reasons, but this seems to be nearly impossible sicnce mysql does not have a split() function for strings. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Have you looked at SOLR or other full text search plug-ins. Michael On Jun 17, 2007, at 10:09 PM, Ben Johnson wrote:> > gene.tani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: >>> Posted viahttp://www.ruby-forum.com/. >> >> there''s several ways: Levenshtein distance, soundex, Metaphone and >> Phonex algo''s. There''ve been threads on "spelling correction" here >> and in rubytalk. > > I actually tried soundex, the problem is that I''m dealing with > parts of > the string in the database, not the entire string. There is not > split() > function for mysql. Example: > > A person types "red sox" and my field has "boston red sox", soundex > would not detect that. > > I''m trying to do this all in a query, for performance reasons, but > this > seems to be nearly impossible sicnce mysql does not have a split() > function for strings. > > -- > Posted via http://www.ruby-forum.com/. > > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk- > unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > For more options, visit this group at http://groups.google.com/ > group/rubyonrails-talk?hl=en > -~----------~----~----~----~------~----~------~--~--- >
Quoting Ben Johnson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > I have a search on my website that search names, so I know all of the > values they could enter. How do I do something like google where if I > type jonson it would say "did you mean johnson"? > > Any ideas? > > Thanks.Pete Norvig explains how he did it: http://norvig.com/spell-correct.html -- Pau Garcia i Quiles http://www.elpauer.org (Due to the amount of work, I usually need 10 days to answer) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There''s also a plugin for the feature: http://agilewebdevelopment.com/plugins/acts_as_suggest -- Benjamin Curtis http://www.bencurtis.com/ -- blog http://agilewebdevelopment.com/rails-ecommerce -- build e-commerce sites with Rails On Jun 17, 2007, at 11:27 PM, Pau Garcia i Quiles wrote:> > Quoting Ben Johnson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: > >> >> I have a search on my website that search names, so I know all of the >> values they could enter. How do I do something like google where if I >> type jonson it would say "did you mean johnson"? >> >> Any ideas? >> >> Thanks. > > Pete Norvig explains how he did it: > http://norvig.com/spell-correct.html > > -- > Pau Garcia i Quiles > http://www.elpauer.org > (Due to the amount of work, I usually need 10 days to answer) >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---