Text (Text v0.2.0) View Source

Functions for basic text processing and analysis.

Link to this section Summary

Types

A corpus module

A tuple of the form {language, number}

A language as a BCP-47 string

A vocabulary module

Link to this section Types

Specs

corpus() :: module()

A corpus module

Specs

frequency_tuple() :: {language(), number()}

A tuple of the form {language, number}

Specs

language() :: String.t()

A language as a BCP-47 string

Specs

vocabulary() :: module()

A vocabulary module

Link to this section Functions

See Text.Language.detect/1.

See Text.Language.detect/2.

See Text.Ngram.ngram/2.

Link to this function

pluralize_noun(word, options \\ [])

View Source

Pluralize a noun.

Arguments

  • word is any English noun.

  • options is a keyword list of options.

Options

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

  • :language is the inflection module to be used. The default and ony option is Text.Inflect.En

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.pluralize_noun "Major general"
"Major generals"

iex> Text.pluralize_noun "fish"
"fish"

iex> Text.pluralize_noun "soliloquy"
"soliloquies"

iex> Text.pluralize_noun "genius", mode: :classical
"genii"

iex> Text.pluralize_noun "genius"
"geniuses"

iex> Text.pluralize_noun "platypus", mode: :classical
"platypodes"

iex> Text.pluralize_noun "platypus"
"platypuses"