From 154d281cfc0f017c80778a4aecb42c3b28d5b673 Mon Sep 17 00:00:00 2001 From: Aidan Reilly <74046732+aireilly@users.noreply.github.com> Date: Wed, 14 May 2025 14:33:17 +0100 Subject: [PATCH] Add ambiguous pronoun rule --- .../fixtures/RedHat/AmbiguousPronouns/.vale.ini | 5 +++++ .../RedHat/AmbiguousPronouns/testinvalid.adoc | 16 ++++++++++++++++ .../RedHat/AmbiguousPronouns/testvalid.adoc | 3 +++ .vale/styles/RedHat/AmbiguousPronouns.yml | 15 +++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 .vale/fixtures/RedHat/AmbiguousPronouns/.vale.ini create mode 100644 .vale/fixtures/RedHat/AmbiguousPronouns/testinvalid.adoc create mode 100644 .vale/fixtures/RedHat/AmbiguousPronouns/testvalid.adoc create mode 100644 .vale/styles/RedHat/AmbiguousPronouns.yml diff --git a/.vale/fixtures/RedHat/AmbiguousPronouns/.vale.ini b/.vale/fixtures/RedHat/AmbiguousPronouns/.vale.ini new file mode 100644 index 00000000..9e17af0c --- /dev/null +++ b/.vale/fixtures/RedHat/AmbiguousPronouns/.vale.ini @@ -0,0 +1,5 @@ +; Vale configuration file to test the `AmbiguousPronouns` rule +StylesPath = ../../../styles +MinAlertLevel = suggestion +[*.adoc] +RedHat.AmbiguousPronouns = YES diff --git a/.vale/fixtures/RedHat/AmbiguousPronouns/testinvalid.adoc b/.vale/fixtures/RedHat/AmbiguousPronouns/testinvalid.adoc new file mode 100644 index 00000000..1cd808bd --- /dev/null +++ b/.vale/fixtures/RedHat/AmbiguousPronouns/testinvalid.adoc @@ -0,0 +1,16 @@ +The manager and the assistant reviewed the document, but she didn't approve it. +Alex told Jordan that he should study more. +The teacher gave Sarah her homework. +The robot and the cat went shopping, but he forgot his wallet. +John called Tom while he was driving. +Alex texted Jordan because he was late. +Tom gave Jerry his book. +John told Mark that he would win the prize. +Susan praised Lisa for her presentation. +The wind blew through the trees as it howled. +The teacher asked the student to submit her work by Friday. +The manager called the assistant when she needed the report. +When Sarah met Emma, she waved. +When the dog chased the cat, it ran away. +After the dog chased the cat, it hid under the couch. +If the robot and the cat go outside, they might get wet. diff --git a/.vale/fixtures/RedHat/AmbiguousPronouns/testvalid.adoc b/.vale/fixtures/RedHat/AmbiguousPronouns/testvalid.adoc new file mode 100644 index 00000000..7f5e2c4b --- /dev/null +++ b/.vale/fixtures/RedHat/AmbiguousPronouns/testvalid.adoc @@ -0,0 +1,3 @@ +John called Tom while Tom was driving. +The dog chased the cat. +John gave Lucy a book. diff --git a/.vale/styles/RedHat/AmbiguousPronouns.yml b/.vale/styles/RedHat/AmbiguousPronouns.yml new file mode 100644 index 00000000..3ef676a4 --- /dev/null +++ b/.vale/styles/RedHat/AmbiguousPronouns.yml @@ -0,0 +1,15 @@ +--- +extends: sequence +message: "Avoid ambiguous pronouns. Replace with a specific noun that has a clear antecedent." +level: warning +ignorecase: true +tokens: + # First noun antecedent (common or proper, or named entity) + - tag: 'NN|NNP|NNPS|NNS|PERSON|GPE' + skip: 8 + # Second noun antecedent + - tag: 'NN|NNP|NNPS|NNS|PERSON|GPE' + skip: 8 + # Ambiguous pronoun + - pattern: '\b(it|its|they|he|she|his|her|their)\b' + tag: 'PRP|PRP\$'