Text.Inflect.En (Text v0.2.0) View Source

Pluralisation for the English language based on the paper An Algorithmic Approach to English Pluralization.

Link to this section Summary

Functions

Pluralize an english noun, pronoun, verb or adjective.

Pluralize an english adjective.

Pluralize an english noun.

Pluralize an english verb.

Link to this section Functions

Link to this function

do_genetive(word, suffix)

View Source
Link to this function

is_indefinite_article(word)

View Source
Link to this function

is_possessive_pronoun(word)

View Source
Link to this function

pluralize(word, mode \\ :modern)

View Source

Pluralize an english noun, pronoun, verb or adjective.

Arguments

  • word is any English word.

  • mode is :modern or :classical. The default is :modern. This applies to nouns only.

Returns

  • a String representing the pluralized word.

Notes

mode when :classical applies pluralization on latin nouns in english but with latin suffixes.

Examples

iex> Text.Inflect.En.pluralize "fish"
"fish"

iex> Text.Inflect.En.pluralize "soliloquy"
"soliloquies"

iex> Text.Inflect.En.pluralize "genius", :classical
"genii"

iex> Text.Inflect.En.pluralize "has"
"have"

iex> Text.Inflect.En.pluralize "catches"
"catch"

iex> Text.Inflect.En.pluralize "child's"
"children's"

iex> Text.Inflect.En.pluralize "Mary's"
"Marys'"
Link to this function

pluralize_adjective(word)

View Source

Pluralize an english adjective.

Arguments

  • word is any English adjective.

Returns

  • a String representing the pluralized adjective

Examples

iex> Text.Inflect.En.pluralize_adjective "a"
"some"

iex> Text.Inflect.En.pluralize_adjective "my"
"our"

iex> Text.Inflect.En.pluralize_adjective "child's"
"children's"

iex> Text.Inflect.En.pluralize_adjective "Mary's"
"Marys'"
Link to this function

pluralize_noun(word, mode \\ :modern)

View Source

Pluralize an english noun.

Arguments

  • word is any English noun.

  • mode is :modern or :classical. The default is :modern.

Returns

  • a String representing the pluralized noun

Notes

mode when :classical applies pluralization on latin nouns used in english but with latin suffixes.

Examples

iex> Text.Inflect.En.pluralize_noun "Major general"
"Major generals"

iex> Text.Inflect.En.pluralize_noun "fish"
"fish"

iex> Text.Inflect.En.pluralize_noun "soliloquy"
"soliloquies"

iex> Text.Inflect.En.pluralize_noun "genius", :classical
"genii"

iex> Text.Inflect.En.pluralize_noun "genius"
"geniuses"

iex> Text.Inflect.En.pluralize_noun "platypus", :classical
"platypodes"

iex> Text.Inflect.En.pluralize_noun "platypus"
"platypuses"

Pluralize an english verb.

Arguments

  • word is any English verb.

Returns

  • a String representing the pluralized verb

Examples

iex> Text.Inflect.En.pluralize_verb "has"
"have"

iex> Text.Inflect.En.pluralize_verb "catches"
"catch"