Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(core): do not flag Dickens as a swear (#4031)
Mauro Pereira3bec2dbe7328
diff --git a/harper-core/dictionary.dict b/harper-core/dictionary.dictindex 38b32f02f..efd2fa9fc 100644--- a/harper-core/dictionary.dict+++ b/harper-core/dictionary.dict@@ -2835,7 +2835,7 @@ Dianna/OgDianne/OgDiasDiaspora/OgS-Dick/OgX+Dick/OgDickens/OgDickensian/JNDickerson/Og@@ -21460,8 +21460,9 @@ dichotomous/Jdichotomy/~NSgdicier/Jcdiciest/Ju-dick/~NgSV>XZx-dicker/VdGN+dick/~NgSVx+dickens/N+dicker/VdGNSdickey/~NSgJdickhead/NSxdickybird/Sdiff --git a/harper-core/src/linting/avoid_curses.rs b/harper-core/src/linting/avoid_curses.rsindex fdd70b8b9..23e99f209 100644--- a/harper-core/src/linting/avoid_curses.rs+++ b/harper-core/src/linting/avoid_curses.rs@@ -262,6 +262,15 @@ mod tests {);}+ #[test]+ fn allows_dickens_1656() {+ assert_lint_count(+ "Charles Dickens wrote many novels.",+ AvoidCurses::default(),+ 0,+ );+ }+#[test]fn fix_shit() {assert_suggestion_result("shit", AvoidCurses::default(), "crap")diff --git a/harper-core/src/spell/fst_dictionary.rs b/harper-core/src/spell/fst_dictionary.rsindex 9b39e1e84..e4d9cffa6 100644--- a/harper-core/src/spell/fst_dictionary.rs+++ b/harper-core/src/spell/fst_dictionary.rs@@ -340,6 +340,18 @@ mod tests {assert!(!dict.get_word_metadata_str("on").unwrap().is_nominal());}+ #[test]+ fn dickens_is_not_a_swear_1656() {+ let dict = FstDictionary::curated();+ let metadata = dict.get_word_metadata_str("Dickens").unwrap();++ assert!(metadata.is_proper_noun());+ assert!(!metadata.is_swear());+ assert!(metadata.derived_from.is_none());+ assert!(dict.contains_exact_word_str("dickens"));+ assert!(dict.get_word_metadata_str("dick").unwrap().is_swear());+ }+#[test]fn fuzzy_result_sorted_by_edit_distance() {let dict = FstDictionary::curated();