Skip to content

Ukrainian: add text preprocessors and deinflection rules #2477

Description

@JayXT

Current state

Ukrainian is registered in language-descriptors.js with capitalizationPreprocessors only, and wty-uk-en is already in recommended-dictionaries.json. So lookup works, but none of the advanced features from docs/development/language-features.md are implemented.

What I'd like to add

Text preprocessors

  • Removal of the combining acute accent (U+0301) used to mark stress, mirroring removeRussianDiacritics.
  • Apostrophe variant matching. This is the one with the clearest payoff: wty-uk-en stores 6383 headwords using ' (U+0027), while running text overwhelmingly uses (U+2019) or ʼ (U+02BC), so scanning п’ять currently never finds the п'ять entry.
    Language transforms

Noun declension across all four declensions, seven cases and two numbers, including the о/е → і closed-syllable alternation (столастіл) and the zero-ending genitive plural (книгкнига); hard- and soft-stem adjective declension with comparison; and both verb conjugations, with the reflexive -ся/-сь postfix handled so that the dictionary form is preserved (вчусявчитися).

Two things I'd like input on before review

  1. Condition granularity. I've used plain n / adj / adv / v rather than Latin-style sub-conditions (n1s, n2p, …). Rationale: wiktionary-to-yomitan derives valid.rs from the const conditions blocks here, and only Spanish has the extra sg/pl tag mapping in ident.rs — so finer conditions would never actually be emitted for Ukrainian and would only cause misses. Happy to go finer if a matching generator change is wanted.
  2. Dictionary regeneration. wty-uk-en currently writes an empty rules field for every entry, so deinflected results are filtered out under the default partsOfSpeechFilter until it is rebuilt. Lang::Uk already exists in the generator's enum, and running its extraction against my branch yields Lang::Uk => matches!(rule, "adj" | "adv" | "n" | "v") with no changes needed there — but someone will need to trigger the regeneration for this to be visible to users.

Status

Implementation is written and passing (test:js, test:ts, test:unit, test:build all clean; the cycles test picks up uk automatically). Roughly 1060 lines across two new source files, two new test files, and the descriptor/type wiring. Since CONTRIBUTING asks for an issue on large features first, I've created it.

Possibly related: #2276, which discusses stress indicators in readings for Ukrainian and Russian.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/linguisticsThe issue or PR is related to linguistics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions