Skip to content

Recognize alternative plural possessives in comparisons - #290

Draft
guocn wants to merge 1 commit into
jaraco:mainfrom
guocn:fix-plural-possessive-comparison-58
Draft

guocn wants to merge 1 commit into
jaraco:mainfrom
guocn:fix-plural-possessive-comparison-58

Conversation

@guocn

@guocn guocn commented Oct 22, 2026 •

Copy link
Copy Markdown

Summary

Addresses the plural-possessive part of #58: the already checked-in expected failures for compare("dresses's", "dresses'") and compare_adjs(...) now pass as "p:p".

After removing the possessive suffix, both inputs have the same stem. _pl_check_plurals_N only handles different irregular plural forms, so it does not recognize this case. Accept identical stems when the existing singular_noun classifies the stem as plural. In compare(), check this possessive equivalence before the generic noun/verb paths can treat the extra s as an ordinary inflection.

The change deliberately does not add the undocumented "s:s" result, alter possessive generation, or fix the singular-name TODOs (dress's/dress', Jess's/Jess'). Consequently this PR does not close all of #58. It follows the existing plural-vs-singular classification rather than introducing a new linguistic rule: ambiguous names such as James remain subject to the existing singularizer's classification.

Verification

Linux x86_64, native isolated CPython 3.10.21 and 3.13.5:

  • New public-API regression matrix: baseline 8 failed, 7 passed; patch 15 passed. Both argument orders are checked for the four alternative plural pairs.
  • Existing dresses xfails promoted to ordinary assertions in both generic and adjective comparison tests; unrelated s:s xfails retained.
  • Full pytest with Ruff/checkdocs/mypy/coverage enabled: 344 passed, 14 xfailed on each interpreter. Untouched baseline: 325 passed, 16 xfailed.
  • Statement coverage 99% (2,372 statements, 14 missed including tests); not claiming branch coverage.
  • Wheel and sdist build pass; Ruff check/format and git diff --check pass.
  • Native Windows/macOS/PyPy/other interpreters and upstream CI not verified. Documentation build not rerun: no API signature/doc page changes; Towncrier fragment included.

Timing / draft

Eight fresh subprocess samples per version, interleaved baseline/head then head/baseline, 1,000 public calls per case. Microseconds/call (min / median / max):

case baseline patch
compare('cat','cats') 48.10 / 55.16 / 60.78 43.50 / 49.27 / 57.54
compare_adjs('my','our') 22.90 / 24.80 / 28.23 21.29 / 25.73 / 29.25
alternative plural possessives 172.08 / 184.82 / 235.44 164.56 / 172.49 / 198.93
unrelated plural possessives 156.04 / 164.95 / 198.33 149.53 / 162.90 / 232.52

Ranges overlap; this does not establish performance neutrality. Draft for maintainer review of recognizing existing plural stems before generic noun/verb comparison. Ordinary nonpossessive generic comparisons bypass the new helper call. No broader possessive-generation redesign is included.

AI disclosure

Prepared with AI assistance. Investigation, implementation, tests, local checks and this description are AI-assisted; no human review is claimed. A separate assistant will independently inspect the production diff and rerun focused regressions. The small fix restores an existing checked-in expected result rather than inventing a new comparison category.

Identical possessive stems are not handled by the irregular plural-pair check. Recognize stems classified as plural by the existing singularizer, and check possessive equivalence before the generic noun and verb paths can misclassify the apostrophe suffix. Promote the existing dresses regression and preserve singular-only TODOs.
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.

1 participant