Class/Object

com.reactific.helpers

Pluralizer

Related Docs: object Pluralizer | package helpers

Permalink

abstract class Pluralizer extends AnyRef

Competently find the plural of most common English words.

In dealing with logged messages, error messages, and other output that people see, it is always nice to have the correct plural form of nouns be used. This class attempts to get pretty good coverage for the english language based on a variety of pluralization rules. This is also used in URL path matching to distinguish between operations that act on an instance (singular) or a collection of instances (plural)

Inspired by: https://github.com/atteo/evo-inflector/blob/master/src/main/java/org/atteo/evo/inflector/TwoFormInflector.java Rules from: http://www.barstow.edu/lrc/tutorserv/handouts/015%20Irregular%20Plural%20Nouns.pd Oxford Rules: http://oxforddictionaries.com/words/plurals-of-nouns

Linear Supertypes
AnyRef, Any
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Pluralizer
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Pluralizer()

    Permalink

Type Members

  1. case class Rule(singular: Pattern, plural: String) extends Product with Serializable

    Permalink

    A rule is very simple, it maps a pattern to match with the substitution to make for that pattern.

    A rule is very simple, it maps a pattern to match with the substitution to make for that pattern.

    singular

    A regular expression with a substitution group to be replaced by plural

    plural

    The substitution for the group in singular

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def category(word_list: List[String], pattern: String, plural: String): Unit

    Permalink
    Attributes
    protected
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  12. def irregular(pairs: List[(String, String)]): Unit

    Permalink
    Attributes
    protected
  13. def irregular(pair: (String, String)): Unit

    Permalink
    Attributes
    protected
  14. def irregular(singular: String, plural: String): Unit

    Permalink

    Declaration of an irregular wwhose plural just doesn't match a rule Subclasses can register a pair of words that have an irregular plural form.

    Declaration of an irregular wwhose plural just doesn't match a rule Subclasses can register a pair of words that have an irregular plural form. That is, it is not easy to convert the singular to the plural so both must be specified.

    singular

    The singular form of the word

    plural

    The plural form of the word

    Attributes
    protected
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def noplural(word_list: List[String]): Unit

    Permalink

    Declaration of a list of non-plural words.

    Declaration of a list of non-plural words. Subclasses can register a list of words that do not have plural forms. The plural words will each be the same as their singular word counterpart.

    word_list

    A list of worlds whose plural form is the same as its singular form.

    Attributes
    protected
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. def pluralize(word: String): String

    Permalink

    The main interface to this class.

    The main interface to this class. Call pluralize to pluralize any word and return its plural form.

    word

    The word to be pluralized

    returns

    The plural form of word

  21. val rules: ListBuffer[Rule]

    Permalink
  22. def standard(pairs: List[(String, String)]): Unit

    Permalink
    Attributes
    protected
  23. def standard(pair: (String, String)): Unit

    Permalink
    Attributes
    protected
  24. def standard(singular: String, plural: String): Unit

    Permalink
    Attributes
    protected
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped