Skip to content

Suggestion ordering ignores REP rule priority (Romanian diacritics) #376

Description

@6victor7

Suggestion ordering ignores REP rule priority (Romanian diacritics)

Environment

  • Notepad++ + DSpellCheck (Hunspell library, ro_RO dictionary)
  • Dictionary source: %APPDATA%\Notepad++\plugins\config\Hunspell\ro_RO.aff / .dic
  • Suggestions limit set to 20 in DSpellCheck settings

Issue

A REP rule added to ro_RO.aff correctly generates the intended suggestion, but DSpellCheck places it near the bottom of the suggestion list instead of near the top, even though the raw Hunspell suggestion engine ranks it first.

.aff excerpt

REP 6
REP DRAGAN DRĂGAN
REP A Ă
REP ce che
REP ci chi
REP ge ghe
REP gi ghi

Steps to reproduce

  1. Add the REP rule above to ro_RO.aff (with a matching REP <n> count line first).
  2. Restart Notepad++ so DSpellCheck reloads the dictionary.
  3. Type DRAGAN in a document (misspelling of DRĂGAN).
  4. Right-click the underlined word to view suggestions.

Expected result

DRĂGAN appears near the top of the suggestion list, consistent with the REP rule and with the raw Hunspell engine's own ranking.

Actual result

DRĂGAN appears at position 12 of 13 suggestions in the DSpellCheck context menu:

DRAGAM, DRAGA, DRAGAI, DRAGAT, DRAGON, DRAGAU, URAGAN, DRAGAJ,
DRAG AN, DRAG-AN, DRAGA N, DRĂGAN, ADRAGANT

Verification against raw Hunspell (via spylls, a Python reimplementation of the Hunspell algorithm), using the same .aff/.dic files:

from spylls.hunspell import Dictionary

dictionary = Dictionary.from_files(
    r"C:\Users\victor\AppData\Roaming\Notepad++\plugins\config\Hunspell\ro_RO"
)
for i, s in enumerate(dictionary.suggest("DRAGAN"), start=1):
    print(i, s)

Output:

1. DRĂGAN
2. DRAGAM
3. DRAGA
4. DRAGAI
5. DRAGAT
6. DRAGON
7. DRAGAU
8. URAGAN
9. DRAGAJ
10. DRAG AN
11. DRAG-AN
12. DRAGA N
13. DRAGA-N

The reference implementation ranks DRĂGAN first, matching the REP rule's intent. DSpellCheck's list also includes ADRAGANT, which does not appear in the spylls output at all, suggesting DSpellCheck's suggestion generation and/or ranking diverges from the standard Hunspell suggestion algorithm — possibly due to a different bundled Hunspell library version, or a distance/ranking calculation that operates on UTF-8 byte length rather than Unicode character count (which would penalize multi-byte diacritics like Ă compared to single-byte A).

Ask

Could the suggestion ranking logic be reviewed for consistency with standard Hunspell behavior, particularly around REP-rule-derived candidates and multi-byte (diacritic) characters?

Happy to provide the full .aff/.dic files or further test cases if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions