Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(dict): remove noun flag from e.g. to prevent OxfordComma false positives (#4479) (#4480)
yi111342383dc2445
diff --git a/harper-core/dictionary.dict b/harper-core/dictionary.dictindex b1ab79868..26c958109 100644--- a/harper-core/dictionary.dict+++ b/harper-core/dictionary.dict@@ -22742,7 +22742,7 @@ e-book/NgSe-commerce/Nmge'en/e'er/-e.g./~4N+e.g./4~eBay/OgVeMusic/geSIM/NgSdiff --git a/harper-core/src/linting/oxford_commas/no_oxford_comma.rs b/harper-core/src/linting/oxford_commas/no_oxford_comma.rsindex abbd5928a..43b7ee051 100644--- a/harper-core/src/linting/oxford_commas/no_oxford_comma.rs+++ b/harper-core/src/linting/oxford_commas/no_oxford_comma.rs@@ -163,4 +163,13 @@ mod tests {"One, two and three. But four, five and six.",);}++ #[test]+ fn allow_eg_conjunction() {+ assert_lint_count(+ "Memory is used for different tasks in embedded systems, e.g., storage or communication with sensors and actuators.",+ NoOxfordComma::default(),+ 0,+ );+ }}diff --git a/harper-core/src/linting/oxford_commas/oxford_comma.rs b/harper-core/src/linting/oxford_commas/oxford_comma.rsindex 2f1786a1f..a0128ace7 100644--- a/harper-core/src/linting/oxford_commas/oxford_comma.rs+++ b/harper-core/src/linting/oxford_commas/oxford_comma.rs@@ -220,4 +220,22 @@ mod tests {"One, two, and three. But four, five, and six.",);}++ #[test]+ fn allow_eg_conjunction() {+ assert_lint_count(+ "Memory is used for different tasks in embedded systems, e.g., storage or communication with sensors and actuators.",+ OxfordComma::default(),+ 0,+ );+ }++ #[test]+ fn eg_with_three_items_requires_oxford_comma() {+ assert_suggestion_result(+ "Tasks in embedded systems, e.g., storage, sensing or communication.",+ OxfordComma::default(),+ "Tasks in embedded systems, e.g., storage, sensing, or communication.",+ );+ }}diff --git a/harper-core/tests/text/tagged/Computer science.md b/harper-core/tests/text/tagged/Computer science.mdindex c5d140cda..ee19351ed 100644--- a/harper-core/tests/text/tagged/Computer science.md+++ b/harper-core/tests/text/tagged/Computer science.md@@ -257,9 +257,9 @@> been suggested . In Europe , terms derived from contracted translations of the# VLPp/B VP/J . NPr/J/R/P NPr+ . NPl/V3+ VP/J P VP/J NPl P D+> expression " automatic information " ( e.g. " informazione automatica " in Italian )-# N🅪Sg+ . NSg/J+ Nᴹ+ . . NSg . ? ? . NPr/J/R/P N🅪Sg/J .+# N🅪Sg+ . NSg/J+ Nᴹ+ . . W? . ? ? . NPr/J/R/P N🅪Sg/J .> or " information and mathematics " are often used , e.g. informatique ( French ) ,-# NPr/C . Nᴹ VB/C Nᴹ+ . VLB R VP/J . NSg ? . NPr🅪Sg/VB/J . .+# NPr/C . Nᴹ VB/C Nᴹ+ . VLB R VP/J . W? ? . NPr🅪Sg/VB/J . .> Informatik ( German ) , informatica ( Italian , Dutch ) , informática ( Spanish ,# ? . NPr🅪Sg/J . . ? . N🅪Sg/J . NPrᴹ/VB/J . . ? . NPrᴹ/J .> Portuguese ) , informatika ( Slavic languages and Hungarian ) or pliroforiki