Pluralize Bug?

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?

On 9/23/06, Clare [email protected] wrote:

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

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.

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

On 9/23/06, Brian G. [email protected] 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

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.

Robert H. <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

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.