Module Language::English::Inflect
In: lib/merb-core/vendor/facets/inflect.rb

English Nouns Number Inflection.

This module provides english singular <-> plural noun inflections.

Methods

External Aliases

singular -> singularize
  Alias for singular (a Railism).
plural -> pluralize
  Alias for plural (a Railism).

Public Class methods

Convert an English word from singular to plurel.

  "boy".plural     #=> boys
  "tomato".plural  #=> tomatoes

Parameters

word<String>:word to pluralize

Returns

<String>:pluralized form of word

Notes

Aliased as pluralize (a Railism)

Define a plurualization rule.

Parameters

singular<String>:ending of the word in singular form
plural<String>:ending of the word in plural form

Examples

Once the following rule is defined: Language::English::Inflector.singular_rule ‘fe’, ‘ves‘

You can see the following results: irb> "wife".plural

> wives

Define a pluralization exception.

Parameters

singular<String>:singular form of the word
plural<String>:plural form of the word

Read prepared pluralization rules.

Define a general rule.

Parameters

singular<String>:ending of the word in singular form
plural<String>:ending of the word in plural form

Examples

Once the following rule is defined: Language::English::Inflector.rule ‘y’, ‘ies‘

You can see the following results: irb> "fly".plural

> flies

irb> "cry".plural

> cries

Convert an English word from plurel to singular.

  "boys".singular      #=> boy
  "tomatoes".singular  #=> tomato

Parameters

word<String>:word to singularize

Returns

<String>:singularized form of word

Notes

Aliased as singularize (a Railism)

Define a singularization rule.

Parameters

singular<String>:ending of the word in singular form
plural<String>:ending of the word in plural form

Examples

Once the following rule is defined: Language::English::Inflector.singular_rule ‘o’, ‘oes‘

You can see the following results: irb> "heroes".singular

> hero

Define a singularization exception.

Parameters

singular<String>:singular form of the word
plural<String>:plural form of the word

Read prepared singularization rules.

Defines a general inflection exception case.

Parameters

singular<String>:singular form of the word
plural<String>:plural form of the word

Examples

Here we define erratum/errata exception case:

Language::English::Inflector.word "erratum", "errata"

In case singular and plural forms are the same omit second argument on call:

Language::English::Inflector.word ‘information‘

[Validate]