yaspeller icon indicating copy to clipboard operation
yaspeller copied to clipboard

Unexpected inconsistency with some custom dictionary words prefixed with "a "

Open wesbiggs opened this issue 3 years ago • 0 comments

yaspeller exhibits some strange behaviour in some circumstances when checking certain words prefixed with the word "a".

It can be reproduced using the command line invocation.

Setup:

mkdir yaspeller-issue; cd yaspeller-issue
npm init -y
npm i yaspeller
echo '{"dictionary":["blockchain"]}' > .yaspellerrc.json

Test cases:

The word by itself is correctly allowed.

echo "blockchain" | ./node_modules/.bin/yaspeller --stdin -l en
Spelling check:
✓ stdin 379 ms
No errors.
Checking finished: 0.477 sec.

The word prefixed by "a " causes an error.

echo "a blockchain" | ./node_modules/.bin/yaspeller --stdin -l en
Spelling check:
✗ stdin 378 ms
-----
Typos: 1
1. a blockchain (1:1, suggest: black chain)
-----

Fix typo or add word to dictionary at .yaspellerrc.json ("dictionary" property) if you are sure about spelling. Docs: https://github.com/hcodes/yaspeller#configuration
Checking finished: 0.48 sec.

"on a blockchain" is fine.

echo "on a blockchain" | ./node_modules/.bin/yaspeller --stdin -l en
Spelling check:
✓ stdin 375 ms
No errors.
Checking finished: 0.474 sec.

But "by a blockchain" is not.

echo "by a blockchain" | ./node_modules/.bin/yaspeller --stdin -l en
Spelling check:
✗ stdin 374 ms
-----
Typos: 1
1. a blockchain (1:4, suggest: black chain)
-----

Fix typo or add word to dictionary at .yaspellerrc.json ("dictionary" property) if you are sure about spelling. Docs: https://github.com/hcodes/yaspeller#configuration
Checking finished: 0.472 sec.

Tested against version 8.0.1.

Other words that are known to trigger the error in similar circumstances are "blockchains" and "mainnet". However, "mainnets" is OK.

wesbiggs avatar Jan 05 '23 16:01 wesbiggs