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 Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Pluralizer
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  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. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Pluralizer to any2stringadd[Pluralizer] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Pluralizer, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Pluralizer to ArrowAssoc[Pluralizer] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

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

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

    Permalink
    Attributes
    protected
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def ensuring(cond: (Pluralizer) ⇒ Boolean, msg: ⇒ Any): Pluralizer

    Permalink
    Implicit information
    This member is added by an implicit conversion from Pluralizer to Ensuring[Pluralizer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: (Pluralizer) ⇒ Boolean): Pluralizer

    Permalink
    Implicit information
    This member is added by an implicit conversion from Pluralizer to Ensuring[Pluralizer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean, msg: ⇒ Any): Pluralizer

    Permalink
    Implicit information
    This member is added by an implicit conversion from Pluralizer to Ensuring[Pluralizer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): Pluralizer

    Permalink
    Implicit information
    This member is added by an implicit conversion from Pluralizer to Ensuring[Pluralizer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Pluralizer to StringFormat[Pluralizer] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  17. final def getClass(): Class[_]

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

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

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

    Permalink
    Attributes
    protected
  21. 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
  22. final def isInstanceOf[T0]: Boolean

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

    Permalink
    Definition Classes
    AnyRef
  24. 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
  25. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  27. 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

  28. val rules: ListBuffer[Rule]

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. def [B](y: B): (Pluralizer, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Pluralizer to ArrowAssoc[Pluralizer] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Pluralizer to any2stringadd[Pluralizer]

Inherited by implicit conversion StringFormat from Pluralizer to StringFormat[Pluralizer]

Inherited by implicit conversion Ensuring from Pluralizer to Ensuring[Pluralizer]

Inherited by implicit conversion ArrowAssoc from Pluralizer to ArrowAssoc[Pluralizer]

Ungrouped