Pluralizr

Pluralizr is a gem that takes a single word and returns the pluralized version of that word. It attempts to take into account various rules—like, handling words that end in 'y' where the 'y' is preceded by a vowel or consonant (i.e., day -> days versus baby -> babies)—as well as words of French, Greek and Latin origins.

Installation

Add this line to your application's Gemfile:

gem 'pluralizr'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pluralizr

Usage

Require Pluralizr in your application (or in irb).

require 'pluralizr'

Then, simply use the Pluralizr.pluralize() method to get pluralizing!

$ Pluralizr.pluralize('day')
=> "days"

$ Pluralizr.pluralize('baby')
=> "babies"

$ Pluralizr.pluralize('foot')
=> "feet"

$ Pluralizr.pluralize('child')
=> "children"

$ Pluralizr.pluralize('pundit')
=> "pundits"

$ Pluralizr.pluralize('alumnus')
=> "alumni"

$ Pluralizr.pluralize('criterion')
=> "criteria"

Contributing

Making a contribution is easy and happily welcomed. Simply submit a pull request on GitHub at https://github.com/srndptylabs/pluralizr/pulls. Here are a few examples of things worth submitting a pull request for:

  • a word that's not pluralizing as expected
  • a word that should be added to the exception list
  • any bugs you encounter
  • improvements to the README file
  • and whatever else you can think of!

License

The gem is available as open source under the terms of the MIT License.