Skip to content

Sync UkrainianWordTokenizer port with LanguageTool master (2026-08-22) - #16

Open
ZavarOvek wants to merge 2 commits into
lang-uk:masterfrom
ZavarOvek:sync-lt-329295d
Open

ZavarOvek wants to merge 2 commits into
lang-uk:masterfrom
ZavarOvek:sync-lt-329295d

Conversation

@ZavarOvek

Copy link
Copy Markdown

Closes #15.

Ports the drift between 0761ec3e (the pinned sync commit) and
329295d5d4. Only three commits touch UkrainianWordTokenizer.java
between those points, and two of them cancel out: a revert and a
revert of the revert - so the net change is the content of 1b267acce7:

  • ³ (U+00B3) added to the superscript class after Cyrillic words,
    and ↵ (U+21B5) added to the always-split characters.
  • \b added to the four abbreviation-with-dot patterns. Without it,
    ABBR_DOT_VO_PATTERN2 matched к. с. inside щиколоток. с. жел,
    reading the final letter of an unrelated word as the start of an
    abbreviation.

One note on the port: upstream pairs \b with
Pattern.UNICODE_CHARACTER_CLASS, since Java's \b is defined over
ASCII \w and would not see a boundary on Cyrillic. This port uses
regex, where \b is Unicode-aware by default for str patterns, so
no flag is needed. Checked directly rather than assumed.

Test drift went into the existing test_superscript and
test_abbreviations - upstream added assertions to existing methods
rather than new ones, so the test count is unchanged at 41.

Corpus differential against the Java driver on
tests/data/ci_corpus/uk_wikipedia.txt: 92,870 tokens, identical to Java.

Apply the net change since the 2026-04-07 sync (LT 0761ec3..329295d,
which reached this state after a same-day revert and re-revert of one
commit, 1b267acce7): the superscript lookbehind class gains U+00B3, and
U+21B5 (wikipedia line break) joins the always-split control set. More
significantly, \b now anchors four abbreviation-dot patterns (v./u./k.s./
ch.-l./st.-l./s.-g.) so they no longer match starting mid-word, using the
last letter of an unrelated preceding word as their own first character
(e.g. "щиколоток. с." previously matched "к. с." as one abbreviation unit
spanning the two words). Python's `regex` module resolves \b against
Cyrillic word characters with no extra flags needed, unlike Java's \b
which requires Pattern.UNICODE_CHARACTER_CLASS to see past ASCII \w.

Test file synced: uncommented the км² case and added примітка³² to
test_superscript, added the щиколоток./с./жел boundary case to
test_abbreviations. All existing tests still pass.
Corpus differential against the pinned revision stays byte-identical:
92,870 tokens across tests/data/ci_corpus/uk_wikipedia.txt (1,292 lines),
zero differences from the Java driver.

This branch has not been deployed

No deployments
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.

Upstream UkrainianWordTokenizer.java has moved past the pinned sync commit

1 participant