Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: multi-word proper nouns for Canada
hippietrail415f6fc6b33b
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rsindex 7ac6a6302..bccc3675f 100644--- a/harper-core/src/linting/lint_group.rs+++ b/harper-core/src/linting/lint_group.rs@@ -37,8 +37,8 @@ use super::plural_conjugate::PluralConjugate;use super::possessive_your::PossessiveYour;use super::pronoun_contraction::PronounContraction;use super::proper_noun_capitalization_linters::{- AmazonNames, Americas, AppleNames, Australia, AzureNames, ChineseCommunistParty, GoogleNames,- Holidays, Koreas, Malaysia, MetaNames, MicrosoftNames, UnitedOrganizations,+ AmazonNames, Americas, AppleNames, Australia, AzureNames, Canada, ChineseCommunistParty,+ GoogleNames, Holidays, Koreas, Malaysia, MetaNames, MicrosoftNames, UnitedOrganizations,};use super::repeated_words::RepeatedWords;use super::sentence_capitalization::SentenceCapitalization;@@ -245,6 +245,7 @@ create_lint_group_config!(CapitalizePersonalPronouns => true,Americas => true,Australia => true,+ Canada => true,Koreas => true,Malaysia => true,ChineseCommunistParty => true,diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rsindex c86189b97..6cbf49497 100644--- a/harper-core/src/linting/mod.rs+++ b/harper-core/src/linting/mod.rs@@ -93,8 +93,8 @@ pub use plural_conjugate::PluralConjugate;pub use possessive_your::PossessiveYour;pub use pronoun_contraction::PronounContraction;pub use proper_noun_capitalization_linters::{- AmazonNames, Americas, AppleNames, Australia, AzureNames, ChineseCommunistParty, GoogleNames,- Holidays, Koreas, Malaysia, MetaNames, MicrosoftNames, UnitedOrganizations,+ AmazonNames, Americas, AppleNames, Australia, AzureNames, Canada, ChineseCommunistParty,+ GoogleNames, Holidays, Koreas, Malaysia, MetaNames, MicrosoftNames, UnitedOrganizations,};pub use repeated_words::RepeatedWords;pub use sentence_capitalization::SentenceCapitalization;diff --git a/harper-core/src/linting/proper_noun_capitalization_linters.rs b/harper-core/src/linting/proper_noun_capitalization_linters.rsindex 57c0fe186..2424d57f1 100644--- a/harper-core/src/linting/proper_noun_capitalization_linters.rs+++ b/harper-core/src/linting/proper_noun_capitalization_linters.rs@@ -62,10 +62,10 @@ macro_rules! create_linter_for {create_linter_for!(Americas,SequencePattern::default()- .then(Box::new(WordSet::all(&["South", "North",])))+ .then(Box::new(WordSet::all(&["South", "North", "Central"]))).then_whitespace().t_aco("America"),- "When referring to the continents, make sure to treat them as a proper noun."+ "When referring to North, Central, and South America, make sure to treat them as a proper noun.");create_linter_for!(@@ -129,6 +129,53 @@ create_linter_for!("When referring to the states of Australia, make sure to treat them as a proper noun.");+create_linter_for!(+ Canada,+ EitherPattern::new(vec![+ // the provinces and territories+ Box::new(+ SequencePattern::default()+ .t_aco("British")+ .then_whitespace()+ .t_aco("Columbia")+ ),+ Box::new(+ SequencePattern::default()+ .t_aco("New")+ .then_whitespace()+ .t_aco("Brunswick")+ ),+ Box::new(+ SequencePattern::default()+ .t_aco("Northwest")+ .then_whitespace()+ .t_aco("Territories")+ ),+ Box::new(+ SequencePattern::default()+ .t_aco("Nova")+ .then_whitespace()+ .t_aco("Scotia")+ ),+ Box::new(+ SequencePattern::default()+ .t_aco("Prince")+ .then_whitespace()+ .t_aco("Edward")+ .then_whitespace()+ .t_aco("Island")+ ),+ // major cities+ Box::new(+ SequencePattern::default()+ .t_aco("Quebec")+ .then_whitespace()+ .t_aco("City")+ )+ ]),+ "When referring to the provinces of Canada, make sure to treat them as a proper noun."+);+create_linter_for!(Koreas,SequencePattern::default()