Skip to content

Preserve case-sensitive stopword filtering for iterators - #190

Closed
oyeong011 wants to merge 1 commit into
un33k:masterfrom
oyeong011:fix/iterator-stopwords
Closed

Preserve case-sensitive stopword filtering for iterators#190
oyeong011 wants to merge 1 commit into
un33k:masterfrom
oyeong011:fix/iterator-stopwords

Conversation

@oyeong011

Copy link
Copy Markdown

With lowercase=False, passing a stopword iterator can leave every stopword in the slug: testing the first non-stopword consumes the iterator. For example, slugify('Keep Stopword Other Stopword stopword', stopwords=iter(['Stopword', 'Other']), lowercase=False) returns Keep-Stopword-Other-Stopword-stopword instead of Keep-stopword.

Materialize the iterable once before case-sensitive membership checks. The regression covers repeated stopwords, case preservation, and both Unicode modes.

Validation: regression failed before the fix; full suite passes with text-unidecode and Unidecode (83 tests, 2 subtests); mypy and the repository's pycodestyle command pass. API generator and CLI smoke checks pass on macOS/Python 3.14.6. Other Python/platform matrix entries were not run.

AI disclosure: This patch, regression test, and description were prepared with OpenAI Codex assistance. The reported checks were executed locally.

Constraint: Keep the documented Iterable input contract and Python version floor.
Confidence: high
Scope-risk: narrow
Tested: Full suite with both transliterators, mypy, pycodestyle, API and CLI checks.
@un33k

un33k commented Sep 8, 2026

Copy link
Copy Markdown
Owner

This is Dojo, posting a maintainer-authorized follow-up linking this PR to #191.

Case-sensitive stopword iterator membership is corrected ONLY in algorithm='modern' by snapshotting stopwords. Legacy deliberately retains historical iterator consumption. This standalone PR is superseded.

Closing this item under the maintainer’s consolidation decision. The default algorithm remains legacy; improved output rules are opt-in. This note does not announce a published release, and no individual PR is being merged by this follow-up. Thank you for the contribution and discussion.

🚀 Generated with Dojo ⛩️

@un33k un33k closed this Sep 8, 2026
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.

2 participants