Skip to content

fix(kazakh): preserve standard abbreviation handling - #61

Merged
yisding merged 5 commits into
mainfrom
codex/propose-fix-for-kazakh-abbreviation-handling
Jun 12, 2026
Merged

yisding merged 5 commits into
mainfrom
codex/propose-fix-for-kazakh-abbreviation-handling

Conversation

@yisding

@yisding yisding commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Kazakh’s custom AbbreviationReplacer.replace() only applied two single-letter Cyrillic rules and multi-period handling, bypassing the base replacer logic that protects single-period ABBREVIATIONS and restores abbreviation-boundary periods, which caused incorrect sentence splits for entries like обл. and тех..

Description

  • Keep Kazakh’s Cyrillic single-letter protection by applying the two Rule patterns with apply_rules before running the shared pipeline via super().replace().
  • Add replace_single_period_abbreviations() to pre-protect ABBREVIATIONS entries stored with a single trailing period by stripping the trailing dot and invoking the standard replace_period_of_abbr helper for each matching entry.
  • Remove the early return so multi-period handling, a.m./p.m. rules, and sentence-boundary restoration run from the base replacer as intended.
  • Add a regression test test_kk_single_period_abbreviations_do_not_split_before_numeric_continuation to tests/lang/test_kazakh.py that asserts single-period Kazakh abbreviations do not produce sentence splits before numeric/parenthesized continuations.

Testing

  • Ran uv run pytest tests/lang/test_kazakh.py --color yes and the Kazakh language tests passed.
  • Ran uv run pytest tests/regression/ tests/test_segmenter.py tests/test_languages.py --color yes and the targeted regression and integration tests passed.
  • Ran full suite uv run pytest --cov=sentencesplit tests/ --color yes which completed with the test suite passing (1759 passed, 8 xfailed) and coverage above the required threshold.
  • Ran uv run ruff check . and uv run ruff format --check . and formatting/lint checks passed.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 140fda9ab7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sentencesplit/lang/kazakh.py Outdated
@yisding
yisding merged commit b46055f into main Jun 12, 2026
7 checks passed
@yisding
yisding deleted the codex/propose-fix-for-kazakh-abbreviation-handling branch June 12, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant