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.

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.

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.

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.

Last updated