Skip to content

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

feat: hallucinization→hallucination (#4516)

Andrew Dunbarc0ec781d1bdd
diff --git a/harper-core/default_config.json b/harper-core/default_config.json
index 4ea74c3a8..e4fe3f27a 100644
--- a/harper-core/default_config.json
+++ b/harper-core/default_config.json
@@ -2623,6 +2623,13 @@
"label": "Going To"
}
},
+ {
+ "Bool": {
+ "name": "Hallucination",
+ "state": true,
+ "label": "Hallucination"
+ }
+ },
{
"Bool": {
"name": "Hazzle",
diff --git a/harper-core/src/linting/phrase_set_corrections/many_to_many_tests.rs b/harper-core/src/linting/phrase_set_corrections/many_to_many_tests.rs
index 365a1ff71..62b789200 100644
--- a/harper-core/src/linting/phrase_set_corrections/many_to_many_tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/many_to_many_tests.rs
@@ -588,6 +588,44 @@ fn got_ride_of() {
);
}
+// Hallucination
+
+#[test]
+fn fix_hallucinisation() {
+ assert_suggestion_result(
+ "candybar left over from halloween [mmm moldy hallucinisation goodness! >_>]",
+ test_linter(),
+ "candybar left over from halloween [mmm moldy hallucination goodness! >_>]",
+ )
+}
+
+#[test]
+fn fix_hallucinisations() {
+ assert_suggestion_result(
+ "I havent really experienced hallucinisations or delusions, but this interpertation of movie is extremely intriguing",
+ test_linter(),
+ "I havent really experienced hallucinations or delusions, but this interpertation of movie is extremely intriguing",
+ )
+}
+
+#[test]
+fn fix_hallucinization() {
+ assert_suggestion_result(
+ "The hallucinization machine makers will be long gone to their retirement homes on private islands",
+ test_linter(),
+ "The hallucination machine makers will be long gone to their retirement homes on private islands",
+ )
+}
+
+#[test]
+fn fix_hallucinizations() {
+ assert_suggestion_result(
+ "He was treated for schizophrenia so I think the meds helped him with the voices and hallucinizations.",
+ test_linter(),
+ "He was treated for schizophrenia so I think the meds helped him with the voices and hallucinations.",
+ )
+}
+
// Hijack
#[test]
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index b71eccfb1..809f4bd79 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -935,6 +935,15 @@ pub fn lint_group() -> LintGroup {
"Corrects common misspellings of the idiom `get rid of`.",
LintKind::Typo
),
+ "Hallucination" => (
+ &[
+ (&["hallucinisation", "hallucinization"], &["hallucination"]),
+ (&["hallucinisations", "hallucinizations"], &["hallucinations"]),
+ ],
+ "The correct spelling is `hallucination`.",
+ "Corrects the misspelling `hallucinization`/`hallucinisation`.",
+ LintKind::Spelling
+ ),
"Hijack" => (
&[
// "hi jack" would result in false positives