Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(core): proper-noun coverage for Apple i-products and product phrases (#3436)
John Decker423c817368fa
diff --git a/harper-core/dictionary.dict b/harper-core/dictionary.dictindex 86075f857..f9c99af31 100644--- a/harper-core/dictionary.dict+++ b/harper-core/dictionary.dict@@ -29470,12 +29470,12 @@ hysterical/~JYhysterics/Ngi/~i.e./~-iMac/NgS+iMac/ONgSiOS/Og-iPad/NgS-iPhone/NgS-iPod/NgS-iTunes/Ng+iPad/ONgS+iPhone/ONgS+iPod/ONgS+iTunes/Oiamb/NgSiambi/Niambic/JNSgdiff --git a/harper-core/proper_noun_rules.json b/harper-core/proper_noun_rules.jsonindex deea64f88..6b3f9b40b 100644--- a/harper-core/proper_noun_rules.json+++ b/harper-core/proper_noun_rules.json@@ -331,26 +331,33 @@},"AppleNames": {"canonical": [- "Apple iPhone",- "Apple iPad",+ "AirPods Max",+ "AirPods Pro",+ "Apple AirPods",+ "Apple AirPods Max",+ "Apple AirPods Pro",+ "Apple Arcade",+ "Apple CarPlay",+ "Apple HomeKit",+ "Apple iCloud","Apple iMac",+ "Apple iPad",+ "Apple iPhone",+ "Apple iPod",+ "Apple Mac Mini",+ "Apple Mac Pro","Apple MacBook",- "Apple Watch",- "Apple TV",+ "Apple MacBook Air",+ "Apple MacBook Pro","Apple Music",- "Apple Arcade",- "Apple iCloud","Apple Safari",- "Apple HomeKit",- "Apple CarPlay",- "Apple MacBook Pro",- "Apple MacBook Air",- "Apple Mac Pro",- "Apple Mac Mini",- "Apple AirPods",- "Apple AirPods Pro",- "Apple AirPods Max",- "Apple Vision Pro"+ "Apple TV",+ "Apple Vision Pro",+ "Apple Watch",+ "Mac Mini",+ "Mac Pro",+ "MacBook Air",+ "MacBook Pro"],"description": "When referring to Apple products and services, make sure to treat them as proper nouns."},diff --git a/harper-core/src/linting/orthographic_consistency.rs b/harper-core/src/linting/orthographic_consistency.rsindex fc2567a3d..539324dfb 100644--- a/harper-core/src/linting/orthographic_consistency.rs+++ b/harper-core/src/linting/orthographic_consistency.rs@@ -291,6 +291,51 @@ mod tests {);}+ #[test]+ fn iphone_should_use_canonical_case() {+ assert_suggestion_result(+ "She bought a new iphone last week.",+ OrthographicConsistency::default(),+ "She bought a new iPhone last week.",+ );+ }++ #[test]+ fn ipad_should_use_canonical_case() {+ assert_suggestion_result(+ "He reads on his ipad every morning.",+ OrthographicConsistency::default(),+ "He reads on his iPad every morning.",+ );+ }++ #[test]+ fn ipod_should_use_canonical_case() {+ assert_suggestion_result(+ "She still listens to her ipod on long flights.",+ OrthographicConsistency::default(),+ "She still listens to her iPod on long flights.",+ );+ }++ #[test]+ fn imac_should_use_canonical_case() {+ assert_suggestion_result(+ "She edits photos on her imac at home.",+ OrthographicConsistency::default(),+ "She edits photos on her iMac at home.",+ );+ }++ #[test]+ fn itunes_should_use_canonical_case() {+ assert_suggestion_result(+ "She bought the album on itunes years ago.",+ OrthographicConsistency::default(),+ "She bought the album on iTunes years ago.",+ );+ }+#[test]fn pdf_should_be_all_caps() {assert_suggestion_result(diff --git a/harper-core/src/linting/proper_noun_capitalization_linters.rs b/harper-core/src/linting/proper_noun_capitalization_linters.rsindex 0014107b7..69e6c64d2 100644--- a/harper-core/src/linting/proper_noun_capitalization_linters.rs+++ b/harper-core/src/linting/proper_noun_capitalization_linters.rs@@ -191,6 +191,52 @@ mod tests {);}+ #[test]+ fn apple_ipod_lowercase() {+ assert_suggestion_result("apple ipod", lint_group(), "Apple iPod");+ }++ #[test]+ fn apple_ipod_allow_correct() {+ assert_lint_count("Apple iPod", lint_group(), 0);+ }++ #[test]+ fn apple_macbook_family_lowercase() {+ assert_suggestion_result("macbook pro", lint_group(), "MacBook Pro");+ assert_suggestion_result("macbook air", lint_group(), "MacBook Air");+ }++ #[test]+ fn apple_macbook_family_allow_correct() {+ assert_lint_count("MacBook Pro", lint_group(), 0);+ assert_lint_count("MacBook Air", lint_group(), 0);+ }++ #[test]+ fn apple_mac_family_lowercase() {+ assert_suggestion_result("mac pro", lint_group(), "Mac Pro");+ assert_suggestion_result("mac mini", lint_group(), "Mac Mini");+ }++ #[test]+ fn apple_mac_family_allow_correct() {+ assert_lint_count("Mac Pro", lint_group(), 0);+ assert_lint_count("Mac Mini", lint_group(), 0);+ }++ #[test]+ fn apple_airpods_family_lowercase() {+ assert_suggestion_result("airpods pro", lint_group(), "AirPods Pro");+ assert_suggestion_result("airpods max", lint_group(), "AirPods Max");+ }++ #[test]+ fn apple_airpods_family_allow_correct() {+ assert_lint_count("AirPods Pro", lint_group(), 0);+ assert_lint_count("AirPods Max", lint_group(), 0);+ }+#[test]fn test_atlantic_ocean_lowercase() {assert_suggestion_result("atlantic ocean", test_linter(), "Atlantic Ocean");