Repository navigation
Description
Summary
With useIntlWordSegmentation: true, checking the Thai word กระดูกสฟีนอยด์ fails with an assertion in isWordTooShort:
AssertionError [ERR_ASSERTION]: 'ดู' == 'ดูก'
at isWordTooShort (cspell-lib/dist/lib/textValidation/lineValidatorFactory.js:141:20)
at splitterIsValid (cspell-lib/dist/lib/textValidation/lineValidatorFactory.js:159:17)
at checkTextRange (cspell-lib/dist/lib/util/wordSplitter/wordSplitter.js:148:37)
at splitIntoWords (cspell-lib/dist/lib/util/wordSplitter/wordSplitter.js:349:36)
at split (cspell-lib/dist/lib/util/wordSplitter/wordSplitter.js:165:20)
at _checkPossibleWords (cspell-lib/dist/lib/textValidation/lineValidatorFactory.js:320:37)
(The first string ends in a literal U+00AD soft hyphen, shown here as .)
In 10.3.3 and earlier the error was dropped and the file was reported as skipped (Files checked: 0, skipped: 1). Since #9267 (10.3.4) it is thrown, so the run fails.
Reproduce
cspell 10.3.4, using @cspell/dict-th-th from cspell-dicts:
cd cspell-dicts/dictionaries/th_th
printf 'กระดูกสฟีนอยด์\n' | cspell -c ./cspell-ext.json --locale=th "--languageId=*" stdinFailed to process "stdin://" AssertionError [ERR_ASSERTION]: 'ดู' == 'ดูก'
CSpell: Files checked: 0, skipped: 1, Issues found: 0 in 1 file with 1 error.
cspell-ext.json turns on useIntlWordSegmentation for locale: th. Any config that does the same with a Thai dictionary should reproduce it.
Cause
IntlSegmentTextTransformerinserts U+00AD at eachIntl.Segmenterword boundary, so the line text becomes…ดูก….- The word splitter tries the candidate
ดูกand removes the soft hyphen (wordSplitter.ts:word.text = word.text.replaceAll(softHyphen, '')). The text is nowดูก(3 code units), butoffsetstill points at a 4-code-unit span in the line. isWordTooShortassertsline.text.slice(offset, offset + word.text.length) === word.text. The slice isดู, so the assert fails.
isWordTooShort is still the same on main. The soft hyphen changes in #9144, #9196, and #9215 likely introduced it.
Possible fixes
- In
isWordTooShort, allow for removed soft hyphens: compare against the line text with soft hyphens stripped, or skip the check when the span contains U+00AD. - Or have the splitter keep the original span length, so later checks can slice the line correctly after the soft hyphens are removed.
Impact
Found in cspell-dicts, where the th_th test (the first 1000 words of the Hunspell dictionary) had been skipped without error and fails after updating to 10.3.4 (streetsidesoftware/cspell-dicts#5751). Of those 1000 words, only กระดูกสฟีนอยด์ hits this. cspell-dicts excludes it from the test until this is fixed.
Activity
github-actions commentedon Oct 28, 2026
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.