HUGO
Menu
GitHub 90265 stars Mastodon

inflect.Singularize

Returns the singular form of the given word according to a set of common English singularization rules.
Syntax
inflect.Singularize INPUT
Returns
string
Alias
singularize

Usage

The inflect.Singularize function returns the singular form of the given word according to a set of common English singularization rules. If the word is already singular, the function returns it unchanged.

Examples

{{ inflect.Singularize "cats" }} → cat
{{ inflect.Singularize "boxes" }} → box
{{ inflect.Singularize "categories" }} → category

Converting irregular nouns:

{{ inflect.Singularize "children" }} → child
{{ inflect.Singularize "people" }} → person
{{ inflect.Singularize "sheep" }} → sheep