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
- Add the
REP rule above to ro_RO.aff (with a matching REP <n> count line first).
- Restart Notepad++ so DSpellCheck reloads the dictionary.
- Type
DRAGAN in a document (misspelling of DRĂGAN).
- 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.
Suggestion ordering ignores REP rule priority (Romanian diacritics)
Environment
ro_ROdictionary)%APPDATA%\Notepad++\plugins\config\Hunspell\ro_RO.aff/.dicIssue
A
REPrule added toro_RO.affcorrectly 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..affexcerptSteps to reproduce
REPrule above toro_RO.aff(with a matchingREP <n>count line first).DRAGANin a document (misspelling ofDRĂGAN).Expected result
DRĂGANappears near the top of the suggestion list, consistent with theREPrule and with the raw Hunspell engine's own ranking.Actual result
DRĂGANappears at position 12 of 13 suggestions in the DSpellCheck context menu:Verification against raw Hunspell (via
spylls, a Python reimplementation of the Hunspell algorithm), using the same.aff/.dicfiles:Output:
The reference implementation ranks
DRĂGANfirst, matching theREPrule's intent. DSpellCheck's list also includesADRAGANT, which does not appear in thespyllsoutput 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-byteA).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/.dicfiles or further test cases if useful.