errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.46k stars 154 forks source link

Bug with 'occurrence' causing warnings in wrong place #307

Closed brest-amzn closed 3 years ago

brest-amzn commented 3 years ago

Occurrence rules seem to trigger the warning in the wrong place. They used to work fine, but I noticed it changed in one of the recent updates.

For example, this rule is straight out of your docs.

extends: occurrence
message: "More than 3 commas. Can you reduce the complexity of the sentence?"
level: suggestion
# Here, we're counting the number of times a comma appears
# in a sentence.
#
# If it occurs more than 3 times, we'll flag it.
scope: sentence
ignorecase: false
max: 3
token: ','

However, it's flagging the first comma in an unrelated sentence (when it should be flagging the next sentence).

example1

Example text

Flagging (in bold)

The ASP isn't actually a component of the SDK. It's software that lives on a chip (SOC) or firmware on a dedicated digital signal processor (DSP). Its job is to clean up the audio and create a single audio stream, even if your device uses a multimicrophone array. Techniques used to clean the audio include acoustic echo cancellation (AEC), noise suppression, beam forming, voice activity detection (VAD), dynamic range compression (DRC), and equalization.

Expected flagging

The ASP isn't actually a component of the SDK. It's software that lives on a chip (SOC) or firmware on a dedicated digital signal processor (DSP). Its job is to clean up the audio and create a single audio stream, even if your device uses a multimicrophone array. Techniques used to clean the audio include acoustic echo cancellation (AEC), noise suppression, beam forming, voice activity detection (VAD), dynamic range compression (DRC), and equalization.

jdkato commented 3 years ago

Thanks for the report. This will be fixed in the next release.