Automattic / Automattic/harper
Spelling suggestions are very poor for words in all caps
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 102
Description
**Describe the bug**
I was working on #1411 adding logic to bump spelling suggestions for words with `ie` and `ei` and added unit tests for titlecase and all-caps variants of affected words. I noticed that although the lowercase tests all worked, about 50% of the titlecase ones fail, perhaps depending on the dialect set. And all of the all-caps tests fail.
**To Reproduce**
Steps to reproduce the behavior:
1. Check out PR #1418
2. Run the tests, either from cargo, from VS Code, etc.
3. Many tests have `#ignore` set so they have to be run manually or perhaps with a switch that runs even ignored tests. I run them from VS Code.
**Expected behavior**
Spelling suggestions should work just as well no matter what case the words are in.
**Screenshots**
Working lowercase:
Fairly broken titlecase:
Totally broken all-caps:
**Additional context**
At first I assumed it was an oversight from when @RunDevelopment added the dialect-variation spelling suggestion logic. But that's definitely not the case and it was just obscured by the fact that that work did not include unit tests for the spelling suggestions.
Now I think it's either due to the "edit distance" logic not taking case into account or the fact that the dictionary does case-folding rather than being able to have multiple entries for "who" and "WHO" for instance. But the edit distance seems more likely.
Contributor guide
Research direction
Inspect PR #1418 and the ignored unit tests for titlecase and all-caps spelling suggestions, then run them with ignored tests enabled via Cargo or VS Code. Trace the case handling involved in edit distance or dictionary lookup. Done means case variants produce suggestions as well as lowercase words across dialects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100