Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/rulvar / wordCountValidator

Function: wordCountValidator()

ts
function wordCountValidator(options): FinishValidator;

Defined in: packages/core/dist/index.d.ts

Requires the result text's word count (whitespace separated tokens; an empty text counts zero) to sit inside the configured bounds (the v1.71 experiment review, P0.7: a formal length requirement must be code, never a natural-language plea the model may round away). At least one bound is required; both are positive integers with min <= max. Default name 'word-count'. fencedCode: 'excluded' counts only words outside fenced code blocks (cycle 74), so code samples cannot pad a length requirement; the default counts everything, byte identical to the historical behavior.

Parameters

ParameterType
options{ fencedCode?: FencedCodeMode; max?: number; min?: number; name?: string; }
options.fencedCode?FencedCodeMode
options.max?number
options.min?number
options.name?string

Returns

FinishValidator