Skip to content

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

feat: part of speeches → parts of speech (#2346)

Andrew Dunbar6a97ff125cc0
diff --git a/harper-core/src/linting/phrase_corrections/mod.rs b/harper-core/src/linting/phrase_corrections/mod.rs
index a2ad1add1..7815879ed 100644
--- a/harper-core/src/linting/phrase_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_corrections/mod.rs
@@ -859,6 +859,13 @@ pub fn lint_group() -> LintGroup {
"Corrects `ontop of` to `on top of`.",
LintKind::BoundaryError
),
+ "PartsOfSpeech" => (
+ ["part of speeches", "parts of speeches"],
+ ["parts of speech"],
+ "The correct plural is `parts of speech`.",
+ "Corrects pluralizing the wrong noun in `part of speech`.",
+ LintKind::Grammar
+ ),
"PeaceOfMind" => (
["piece of mind"],
["peace of mind"],
@@ -874,7 +881,7 @@ pub fn lint_group() -> LintGroup {
LintKind::Spelling
),
"PointsOfView" => (
- ["point of views"],
+ ["point of views", "points of views"],
["points of view"],
"The correct plural is `points of view`.",
"Corrects pluralizing the wrong noun in `point of view`.",
@@ -953,7 +960,7 @@ pub fn lint_group() -> LintGroup {
LintKind::WordChoice
),
"RulesOfThumb" => (
- ["rule of thumbs", "rule-of-thumbs"],
+ ["rule of thumbs", "rule-of-thumbs", "rules of thumbs"],
["rules of thumb"],
"The correct plural is `rules of thumb`.",
"Corrects pluralizing the wrong noun in `rule of thumb`.",
diff --git a/harper-core/src/linting/phrase_corrections/tests.rs b/harper-core/src/linting/phrase_corrections/tests.rs
index ce715d8e9..2970c98c8 100644
--- a/harper-core/src/linting/phrase_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_corrections/tests.rs
@@ -1473,6 +1473,26 @@ fn correct_on_top_of() {
);
}
+// PartOfSpeech
+#[test]
+fn corrects_part_of_speeches() {
+ assert_suggestion_result(
+ "The part of speeches (POS) or as follows:",
+ lint_group(),
+ "The parts of speech (POS) or as follows:",
+ )
+}
+
+// It can connect different parts of speeches e.g noun to adjective, adjective to adverb, noun to verb etc.
+#[test]
+fn corrects_parts_of_speeches() {
+ assert_suggestion_result(
+ "It can connect different parts of speeches e.g noun to adjective, adjective to adverb, noun to verb etc.",
+ lint_group(),
+ "It can connect different parts of speech e.g noun to adjective, adjective to adverb, noun to verb etc.",
+ )
+}
+
// PeaceOfMind
#[test]
fn corrects_piece_of_mind() {
@@ -1513,7 +1533,7 @@ fn corrects_per_say_hyphenated() {
// PointsOfView
#[test]
-fn corrects_points_of_view() {
+fn corrects_point_of_views() {
assert_suggestion_result(
"This will produce a huge amount of raw data, representing the region in multiple point of views.",
lint_group(),
@@ -1521,6 +1541,16 @@ fn corrects_points_of_view() {
)
}
+// log events, places, moods and self-reflect from various points of views
+#[test]
+fn corrects_points_of_views() {
+ assert_suggestion_result(
+ "log events, places, moods and self-reflect from various points of views",
+ lint_group(),
+ "log events, places, moods and self-reflect from various points of view",
+ )
+}
+
// PrayingMantis
// -none-
@@ -1578,7 +1608,7 @@ fn correct_iirc_correctly() {
// RulesOfThumb
#[test]
-fn correct_rules_of_thumbs() {
+fn correct_rule_of_thumbs() {
assert_suggestion_result(
"Thanks. 0.2 is just from my rule of thumbs.",
lint_group(),
@@ -1586,6 +1616,15 @@ fn correct_rules_of_thumbs() {
);
}
+#[test]
+fn correct_rules_of_thumbs() {
+ assert_suggestion_result(
+ "But as rules of thumbs, what is said in config file should be respected whatever parameter (field or directory) is passed to php-cs-fixer.phar.",
+ lint_group(),
+ "But as rules of thumb, what is said in config file should be respected whatever parameter (field or directory) is passed to php-cs-fixer.phar.",
+ );
+}
+
#[test]
fn correct_rules_of_thumbs_hyphenated() {
assert_suggestion_result(