Allow for counting multiple elements of the same kind in sequence rules
Check for existing issues
- [X] Completed
Describe the feature
I am attempting to write a Vale rule to highlight ambiguous pronouns in a sentence. I want the rule to fire on a pronoun (PRP) or personal pronoun possessive (PRP$) only when it is preceded by 2 or more nouns in the sentence. I don't think this is possible currently. See https://studio.vale.sh/s/fa39e2d796458f6e8903cb5728807282
Note the last line in the fixture. The sequence rule doesn't handle multiple instances of the same POS tag.
Something like a min or max count field in the sequence rule would be useful for rules like this I think.
---
extends: sequence
message: "Avoid ambiguous pronouns"
level: warning
ignorecase: true
tokens:
- tag: NN|NNP|NNPS|NNS|PERSON|GPE
skip: 8
min: 2
- pattern: \w+
tag: PRP|PRP$|WP|WP$|SYM
This would also be useful in cases where I need to support one-or-more tokens of a given tag. As far as I can tell, this use case is distinct from defining skip.