Do not pluralize common uncountable mass nouns (#239)#255
Open
uttam12331 wants to merge 1 commit into
Open
Conversation
`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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #239.
Problem
plural_noun()pluralizes uncountable mass nouns that have no ordinary plural form:Change
inflectalready keeps a small set of uncountable nouns unchanged via the "UNCOUNTABLE NOUNS" entries inpl_sb_uninflected_endings(e.g.furniture,information). Several common mass nouns were simply missing. This adds a conservative set: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 onmain, e.g.equipment→equipments).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 --checkis clean on the changed files, and the change introduces no newruff checkfindings.