Skip to content

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

feat: multi-word proper nouns for Australia

hippietrailc2b2a8521e77
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rs
index 8c000c979..68cc96ab4 100644
--- a/harper-core/src/linting/lint_group.rs
+++ b/harper-core/src/linting/lint_group.rs
@@ -37,7 +37,7 @@ use super::plural_conjugate::PluralConjugate;
use super::possessive_your::PossessiveYour;
use super::pronoun_contraction::PronounContraction;
use super::proper_noun_capitalization_linters::{
- AmazonNames, Americas, AppleNames, AzureNames, ChineseCommunistParty, GoogleNames, Holidays,
+ AmazonNames, Americas, Australia, AppleNames, AzureNames, ChineseCommunistParty, GoogleNames, Holidays,
Koreas, MetaNames, MicrosoftNames, UnitedOrganizations,
};
use super::repeated_words::RepeatedWords;
@@ -244,6 +244,7 @@ create_lint_group_config!(
ThatWhich => true,
CapitalizePersonalPronouns => true,
Americas => true,
+ Australia => true,
Koreas => true,
ChineseCommunistParty => true,
UnitedOrganizations => true,
diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rs
index 52b799fc6..f14a210cd 100644
--- a/harper-core/src/linting/mod.rs
+++ b/harper-core/src/linting/mod.rs
@@ -93,7 +93,7 @@ pub use plural_conjugate::PluralConjugate;
pub use possessive_your::PossessiveYour;
pub use pronoun_contraction::PronounContraction;
pub use proper_noun_capitalization_linters::{
- AmazonNames, Americas, AppleNames, AzureNames, ChineseCommunistParty, GoogleNames, Holidays,
+ AmazonNames, Americas, Australia, AppleNames, AzureNames, ChineseCommunistParty, GoogleNames, Holidays,
Koreas, MetaNames, MicrosoftNames, UnitedOrganizations,
};
pub use repeated_words::RepeatedWords;
diff --git a/harper-core/src/linting/proper_noun_capitalization_linters.rs b/harper-core/src/linting/proper_noun_capitalization_linters.rs
index feadeb0e3..8f75a41a2 100644
--- a/harper-core/src/linting/proper_noun_capitalization_linters.rs
+++ b/harper-core/src/linting/proper_noun_capitalization_linters.rs
@@ -68,6 +68,67 @@ create_linter_for!(
"When referring to the continents, make sure to treat them as a proper noun."
);
+create_linter_for!(
+ Australia,
+ EitherPattern::new(vec![
+ // the states and territories
+ Box::new(
+ SequencePattern::default()
+ .t_aco("Australian")
+ .then_whitespace()
+ .t_aco("Capital")
+ .then_whitespace()
+ .t_aco("Territory")
+ ),
+ Box::new(
+ SequencePattern::default()
+ .t_aco("New")
+ .then_whitespace()
+ .t_aco("South")
+ .then_whitespace()
+ .t_aco("Wales")
+ ),
+ Box::new(
+ SequencePattern::default()
+ .t_aco("Northern")
+ .then_whitespace()
+ .t_aco("Territory")
+ ),
+ Box::new(
+ SequencePattern::default()
+ .t_aco("South")
+ .then_whitespace()
+ .t_aco("Australia")
+ ),
+ Box::new(
+ SequencePattern::default()
+ .t_aco("Western")
+ .then_whitespace()
+ .t_aco("Australia")
+ ),
+ // major cities
+ Box::new(
+ SequencePattern::default()
+ .t_aco("Alice")
+ .then_whitespace()
+ .t_aco("Springs")
+ ),
+ Box::new(
+ SequencePattern::default()
+ .t_aco("Gold")
+ .then_whitespace()
+ .t_aco("Coast")
+ ),
+ Box::new(
+ SequencePattern::default()
+ .t_aco("Sunshine")
+ .then_whitespace()
+ .t_aco("Coast")
+ ),
+ ]),
+ "When referring to the states of Australia, make sure to treat them as a proper noun."
+);
+
create_linter_for!(
Koreas,
SequencePattern::default()