Skip to content

Do not pluralize common uncountable mass nouns (#239)#255

Open
uttam12331 wants to merge 1 commit into
jaraco:mainfrom
uttam12331:fix/uncountable-mass-nouns-239
Open

Do not pluralize common uncountable mass nouns (#239)#255
uttam12331 wants to merge 1 commit into
jaraco:mainfrom
uttam12331:fix/uncountable-mass-nouns-239

Conversation

@uttam12331

Copy link
Copy Markdown

Closes #239.

Problem

plural_noun() pluralizes uncountable mass nouns that have no ordinary plural form:

>>> import inflect
>>> p = inflect.engine()
>>> p.plural_noun("equipment")
'equipments'   # should be 'equipment'

Change

inflect already keeps a small set of uncountable nouns unchanged via the "UNCOUNTABLE NOUNS" entries in pl_sb_uninflected_endings (e.g. furniture, information). Several common mass nouns were simply missing. This adds a conservative set:

equipment, luggage, baggage, jewelry, machinery, cutlery, livestock

I deliberately kept the list to words that are unambiguously uncountable (no countable sense) and are not a suffix of a common countable word, so the existing suffix matching doesn't accidentally swallow ordinary plurals. As @ecederstrand noted in the issue, words like "paper" and "sugar" have both count and mass senses, so those are intentionally left out.

Tests

Added tests/test_uncountable_nouns.py:

  • test_mass_nouns_are_uninflected — each added mass noun is returned unchanged (fails on main, e.g. equipmentequipments).
  • test_countable_nouns_still_pluralize — an over-match guard verifying representative countable nouns (document, element, package, stock, block, cutter, …) still pluralize normally.

Full suite passes (214 passed, 16 pre-existing xfailed). ruff format --check is clean on the changed files, and the change introduces no new ruff check findings.

`plural_noun("equipment")` returned `"equipments"`. English mass nouns such
as equipment, luggage, baggage, jewelry, machinery, cutlery and livestock
have no ordinary plural form.

`inflect` already keeps a small set of uncountable nouns
(`pl_sb_uninflected_endings`, e.g. "furniture", "information") unchanged;
these words were simply missing. Add a conservative set of unambiguous mass
nouns to that list. Only words with no countable sense and that are not a
suffix of a common countable word are included, so ordinary plurals are
unaffected.

Closes jaraco#239
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Noncount (mass) nouns improperly pluralized

1 participant