Drops.Inflector.Inflections (drops_inflector v0.1.0)

View Source

Inflection rules container.

This module manages all the inflection rules including plurals, singulars, uncountables, humans, and acronyms.

Summary

Functions

Adds acronym rules.

Adds an irregular inflection (both plural and singular).

Creates a new Inflections struct with default rules.

Adds a pluralization rule.

Adds a singularization rule.

Adds uncountable words.

Types

t()

@type t() :: %Drops.Inflector.Inflections{
  acronyms: Drops.Inflector.Acronyms.t(),
  humans: Drops.Inflector.Rules.t(),
  plurals: Drops.Inflector.Rules.t(),
  singulars: Drops.Inflector.Rules.t(),
  uncountables: MapSet.t()
}

Functions

acronym(struct, words)

@spec acronym(t(), [String.t()] | String.t()) :: t()

Adds acronym rules.

human(struct, rule, replacement)

@spec human(t(), String.t() | Regex.t(), String.t()) :: t()

Adds a human rule.

irregular(struct, singular_word, plural_word)

@spec irregular(t(), String.t(), String.t()) :: t()

Adds an irregular inflection (both plural and singular).

new()

@spec new() :: t()

Creates a new Inflections struct with default rules.

new(opts)

@spec new(keyword()) :: t()

plural(struct, rule, replacement)

@spec plural(t(), String.t() | Regex.t(), String.t()) :: t()

Adds a pluralization rule.

singular(struct, rule, replacement)

@spec singular(t(), String.t() | Regex.t(), String.t()) :: t()

Adds a singularization rule.

uncountable(struct, words)

@spec uncountable(t(), [String.t()] | String.t()) :: t()

Adds uncountable words.