Skip to content

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

feat:Guilded Age→Gilded Age; once and a while→once in a while (#1196)

Andrew Dunbar323fca8daa43
diff --git a/harper-core/proper_noun_rules.json b/harper-core/proper_noun_rules.json
index 692930dea..3eded61ea 100644
--- a/harper-core/proper_noun_rules.json
+++ b/harper-core/proper_noun_rules.json
@@ -531,7 +531,7 @@
"description": "Ensure proper capitalization of notable places that are significant regional centers, travel destinations, or have international importance."
},
"ProperNouns": {
- "canonical": ["Pax Americana"],
+ "canonical": ["Gilded Age", "Pax Americana"],
"description": "Ensure proper capitalization of proper nouns."
},
"CompaniesProductsAndTrademarks": {
diff --git a/harper-core/src/linting/phrase_corrections.rs b/harper-core/src/linting/phrase_corrections.rs
index 7e14252aa..ac9ce22ad 100644
--- a/harper-core/src/linting/phrase_corrections.rs
+++ b/harper-core/src/linting/phrase_corrections.rs
@@ -1202,10 +1202,16 @@ pub fn lint_group() -> LintGroup {
"Corrects `aswell`, which should be written as two words."
),
"OnceInAWhile" => (
- ["once a while"],
+ ["once a while", "once and a while"],
["once in a while"],
"The correct idiom is `once in a while`.",
- "Corrects `once a while`, which requires the word `in`."
+ "Corrects two common malapropisms of `once in a while`."
+ ),
+ "GildedAge" => (
+ ["guilded age"],
+ ["Gilded Age"],
+ "The period of economic prosperity is called the `Gilded Age`.",
+ "If referring to the period of economic prosperity, the correct term is `Gilded Age`."
),
});
@@ -2643,4 +2649,35 @@ mod tests {
"For me it is a SMB mount I have on the client device that I sync only once in a while for a backup into the cloud.",
);
}
+
+ // There's a bug when changing the length of title case phrases
+ // I believe there's a fix coming in a PR. Uncomment when fixed.
+ // #[test]
+ // fn corrects_gilded_age_capitalized() {
+ // assert_suggestion_result(
+ // "It is especially a reflection of the socio-economic patterns in the Guilded Age.",
+ // lint_group(),
+ // "It is especially a reflection of the socio-economic patterns in the Gilded Age.",
+ // );
+ // }
+
+ // Currently the correct spelling is suggested but the case is not changed.
+ // This maybe also be fixed in the coming PR mentioned above.
+ // #[test]
+ // fn corrects_gilded_age_lowercase() {
+ // assert_suggestion_result(
+ // "It is especially a reflection of the socio-economic patterns in the guilded age.",
+ // lint_group(),
+ // "It is especially a reflection of the socio-economic patterns in the Gilded Age.",
+ // );
+ // }
+
+ #[test]
+ fn corrects_once_and_a_while() {
+ assert_suggestion_result(
+ "Every once and a while all the links on my page seem to stop working.",
+ lint_group(),
+ "Every once in a while all the links on my page seem to stop working.",
+ );
+ }
}
diff --git a/harper-core/src/linting/proper_noun_capitalization_linters.rs b/harper-core/src/linting/proper_noun_capitalization_linters.rs
index 55438a8d7..065894c27 100644
--- a/harper-core/src/linting/proper_noun_capitalization_linters.rs
+++ b/harper-core/src/linting/proper_noun_capitalization_linters.rs
@@ -323,4 +323,13 @@ mod tests {
"I love Day One. It is the best journaling app.",
);
}
+
+ #[test]
+ fn gilded_age_in_sentence() {
+ assert_suggestion_result(
+ "Mani-Chess Destiny is a JavaScript based computer game built off of chess, but in the style of the gilded age.",
+ lint_group(FstDictionary::curated()),
+ "Mani-Chess Destiny is a JavaScript based computer game built off of chess, but in the style of the Gilded Age.",
+ );
+ }
}