I am using Pluralize and it is working well.... but.... pluralizing on "glass" comes back with "glas" and "glasses" and does not return "glass". I am using Ferret to then search using the pluralized terms but I then get no results because I do not find the items with "glass" in the title. This works on every other term that I can think of... just not the term "Glass"... Any ideas? -- 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 -~----------~----~----~----~------~----~------~--~---
On 9/23/06, Clare <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I am using Pluralize and it is working well.... but.... > > pluralizing on "glass" comes back with "glas" and "glasses" and does not > return "glass". > > I am using Ferret to then search using the pluralized terms but I then > get no results because I do not find the items with "glass" in the > title. > > This works on every other term that I can think of... just not the term > "Glass"... > > Any ideas? >Hi Clare, If you are doing this so that you can search for both pluralized and non-pluralized versions of a term then you''d be better off using Ferret''s StemFilter. Otherwise, I''ll leave the answer to this up to the rails people. Cheers, Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Why not set your query to return results on the singular OR the plural form? Also you can add new inflection rules in the environment.rb file. Don''t forget to restart the server if you make edits to that file. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 9/23/06, Brian Gibson <brian.gibson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Why not set your query to return results on the singular OR the plural > form? Also you can add new inflection rules in the environment.rb > file. Don''t forget to restart the server if you make edits to that > file. >Hi Brian, That''s what using the StemFilter in Ferret will do. Plus it will search for other forms of the word. For example, "burn" will also match "burns", "burned" and "burning". Cheers, Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you all for the answers, I added the following line to enviroment.rb and uncoomented the rest (I played with variations of commenting/uncommenting) and restarted the server a few times but it produces glasses OR glas. Id there anything else that i have to do apart from uncommenting the inflector bit + is there a better way to catch more than just glass? Would anyone like to share their upgraded inflector rules for english language? Inflector.inflections do |inflect| inflect.irregular ''glass'', ''glasses'' inflect.plural /^(ox)$/i, ''\1en'' inflect.singular /^(ox)en/i, ''\1'' inflect.irregular ''person'', ''people'' inflect.uncountable %w( fish sheep ) end Dave: Will look into StemFilter, thanks for that. Thanks regards c -- 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 -~----------~----~----~----~------~----~------~--~---
glass is considered uncountable unless you mean eye glasses or drinking glasses you don''t need to uncomment the rest because they are already loaded by default. they are there as examples. StemFilter may be overkill unless Clare wants to search for all forms of a word. On 9/22/06, Clare <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Thank you all for the answers, I added the following line to > enviroment.rb and uncoomented the rest (I played with variations of > commenting/uncommenting) and restarted the server a few times but it > produces glasses OR glas. Id there anything else that i have to do apart > from uncommenting the inflector bit + is there a better way to catch > more than just glass? Would anyone like to share their upgraded > inflector rules for english language? > > Inflector.inflections do |inflect| > inflect.irregular ''glass'', ''glasses'' > inflect.plural /^(ox)$/i, ''\1en'' > inflect.singular /^(ox)en/i, ''\1'' > inflect.irregular ''person'', ''people'' > inflect.uncountable %w( fish sheep ) > end > > Dave: Will look into StemFilter, thanks for that. > > Thanks > regards > c > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Clare wrote:> inflect.plural /^(ox)$/i, ''\1en'' > inflect.singular /^(ox)en/i, ''\1'' >I don''t recommend these. You''ll get box / boxen, which is mildly amusing to dorks like us, but probably not what you intended. -- 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 -~----------~----~----~----~------~----~------~--~---
Robert Head <rails-mailing-list@...> writes:> > > Clare wrote: > > inflect.plural /^(ox)$/i, ''\1en'' > > inflect.singular /^(ox)en/i, ''\1'' > > > > I don''t recommend these. You''ll get box / boxen, which is mildly > amusing to dorks like us, but probably not what you intended. >Well, it would if there wasn''t a ^ at the start of that regular expression. In any case you don''t get a choice because it''s one of the default rules which is already loaded, as mentioned above --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---