Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat(core): add special case for `teh` (#1613)

Elijah Potter65b0292760a1
diff --git a/harper-core/src/linting/phrase_corrections/mod.rs b/harper-core/src/linting/phrase_corrections/mod.rs
index ae919af8f..bbb7db30d 100644
--- a/harper-core/src/linting/phrase_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_corrections/mod.rs
@@ -1141,6 +1141,13 @@ pub fn lint_group() -> LintGroup {
"`Wrought iron` is low-carbon, malleable iron used for decorative work; variants like `rod iron` or `rot iron` are phonetic misspellings that may confuse readers.",
LintKind::Eggcorn
),
+ "The" => (
+ ["teh"],
+ ["the"],
+ "Did you mean the definite article?",
+ "Fixes especially common misspellings of the word `the`",
+ LintKind::Typo
+ )
});
group.set_all_rules_to(Some(true));
diff --git a/harper-core/src/linting/phrase_corrections/tests.rs b/harper-core/src/linting/phrase_corrections/tests.rs
index 38c93b537..a30cc57f2 100644
--- a/harper-core/src/linting/phrase_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_corrections/tests.rs
@@ -1412,3 +1412,12 @@ fn corrects_rot_iron() {
fn allows_wrought_iron() {
assert_lint_count("She specialized in wrought iron artwork.", lint_group(), 0);
}
+
+#[test]
+fn fixes_teh() {
+ assert_suggestion_result(
+ "I adore teh light of the moon.",
+ lint_group(),
+ "I adore the light of the moon.",
+ );
+}