For the complete documentation index, see llms.txt. This page is also available as Markdown.

sequence

Learn about the sequence extension point.

Name
Type
Description

tokens

[]NLPToken

A list of tokens with associated NLP metadata.

ignorecase

bool

Makes all matches case-insensitive.

exceptions

[]string

Sentence regions, as regexes; a match beginning inside one is dropped.

While most extension points focus on writing style, sequence aims to support grammar-focused rules.

extends: sequence

# `%[4]s` is like `%s`, but specifically refers to the
# 4th token in our sequence.
message: |
  The infinitive '%[4]s' after 'be' requires 'to'.
  Did you mean '%[2]s %[3]s *to* %[4]s'?"
tokens:
  - tag: MD
  - pattern: be
  - tag: JJ
  # The `|` notation means that we'll accept `VB`
  # or `VBN` in position 4.
  - tag: VB|VBN

Every sequence-based rule is required to have at least one pattern (such as pattern: be, shown above). This becomes the “anchor” of the sequence: we find all instances of the first pattern and then check that the left- and right-hand sides of the sequence match.

Tokens judge the sentence one word at a time. When a rule needs a judgment about a region — for example, “the comma closing a fronted phrase isn’t a list comma” — hand that part to exceptions: each entry is a regular expression matched against the sentence, and a sequence match that begins inside one of its matches is dropped. Unlike other checks’ exceptions, these are regions rather than vocabulary terms, so the project’s accepted vocabulary is never merged in.

exceptions, and the boundary behavior of negate described below, require Vale v3.20.0 or later.

Each entry in a sequence is known as an NLPToken and has the following structure:

sequence-based are sentence-scoped. See prose/tagging for a full list of supported part-of-speech tags.

min requires Vale v3.19.0 or later.

min and skip combine to express "at least n occurrences within a window." For example, a pronoun is ambiguous when two or more nouns precede it:

This matches "The dog chased the cat until it tired" — two nouns, then a pronoun — but not "The dog barked because it hungered." Without skip, min means consecutive occurrences: tag: JJ, min: 2 is two adjectives in a row.

Reaching every block, and honoring a declared scope, requires Vale v3.17.0 or later. Earlier versions read sentences from paragraphs only.

By default, a sequence rule reads sentences from every block—headings, list items, and table cells as well as paragraphs. Much of a document's prose lives outside its paragraphs, and sequence is the only extension point that reads part-of-speech data, so it needs to reach all of it.

To narrow that, declare a scope:

The scope selects which blocks the sentences are drawn from; the rule still matches sentence by sentence within them. A doc(...) selection works the same way: the rule reads the sentences inside the selected element.

Last updated