hbutils.string.plural

Overview:

Useful utilities for pluralize your words.

plural_form

hbutils.string.plural.plural_form(word: str) → str[source]
Overview:

Get the pluralized form of the given word.

The same as hbutils.string.inflection.pluralize().

Arguments:
  • word (str): The given word to be pluralized.

Returns:
  • pluralized (str): Pluralized word.

Examples::
>>> from hbutils.string import plural_form
>>> plural_form('it')
'they'
>>> plural_form('word')
'words'
>>> plural_form('woman')
'women'

singular_form

hbutils.string.plural.singular_form(word: str) → str[source]
Overview:

Get the singular form of the given word.

The same as hbutils.string.inflection.singularize().

Arguments:
  • word (str): The given word to be singularized.

Returns:
  • single (str): Singular form of word.

Examples::
>>> from hbutils.string import singular_form
>>> singular_form('they')
'it'
>>> singular_form('it')
'it'
>>> singular_form('women')
'woman'
>>> singular_form('words')
'word'
>>> singular_form('themselves')
'itself'

plural_word

hbutils.string.plural.plural_word(count: int, word: str) → str[source]
Overview:

Get plural form of the whole word, with the number before the word.

Arguments:
  • count (int): Count of the word, should be a non-negative integer.

  • word (str): Word to be pluralized.

Returns:
  • plural_word (str): Pluralized word, with the number.

Examples::
>>> from hbutils.string import plural_word
>>> plural_word(0, 'word')
'0 words'
>>> plural_word(1, 'word')
'1 word'
>>> plural_word(2, 'word')
'2 words'
>>> plural_word(20, 'word')
'20 words'
>>> plural_word(233, 'word')
'233 words'