Automattic / Automattic/harper
Feature: detect near/bear typos
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 106
Description
**The Error**
The words "near" and "bear" are both valid, yet they differ only in one position, and the differing letters are adjacent on the keyboard, thus making it a possible typo undetectable in isolation. I speculate that in some cases the error can be detected without AI, as the sentence only admits a noun, or only a verb, or only an adjective in the problematic place.
**Examples (2-3):**
1. From a comment here: https://www.youtube.com/watch?v=xVycJp_UE2c
> Exactly. I'm nowhere bear retirement, but I’m sick of what this industry is becoming. I would like to venture into something else, where my expertise is respected and people trust my decisions, but I don’t really know what else I could do that would pay similar money.
This sentence is grammatically invalid. "Bear" can be a noun or a verb, but the sentence does not accept a noun or a verb, so it must be a typo for "near".
2. http://apollo-core.com/knwledge.php?b=4¬e=13059&x=1&z=Db9bCn
> So results of testing so far are positive. It still crashes/freezes/resets but nowhere bear as frequently nor as soon as it did.
This sentence does accept a verb in a place where the word "bear" stands, but not in its original form. A verb must have an "s" suffix there to be grammatically compatible with the subject "it", but in this case, it's a typo for "near".
**References**
The paid version of LanguageTool detects it in both example cases.
**Potential Edge Cases**
"Nowhere Bear" is actually an episode of The Yogi Bear Show.
Another false positive from https://law.justia.com/cases/federal/district-courts/FSupp/180/845/1485094/:
> Also without question, however, is the fact that these lighters nowhere bear any indication, other than form and design, of being manufactured by Zippo.
In this case, the sentence only admits a verb in its original form in the "bear" position.
Contributor guide
Research direction
No source file, test, or entry point is named. Start by reproducing the two near/bear examples and comparing the desired behavior with LanguageTool; done means detecting the grammatical typos while preserving valid uses such as “Nowhere Bear” and the Zippo sentence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100