vaderSentimentScores — Score tokenized documents with VADER-style sentiment rules.

vaderSentimentScores(documents) returns a compound sentiment score for each English tokenizedDocument. [compoundScores,positiveScores,negativeScores,neutralScores] = vaderSentimentScores(___) also returns positive, negative, and neutral proportions.

Syntax

compoundScores = vaderSentimentScores(documents)
compoundScores = vaderSentimentScores(documents,Name,Value)
[compoundScores,positiveScores,negativeScores,neutralScores] = vaderSentimentScores(___)

Inputs

NameTypeRequiredDefaultDescription
documentsAnyYestokenizedDocument object.
NameValueAnyVariadicName-value options: SentimentLexicon, Boosters, Dampeners, Negations.

Returns

NameTypeDescription
compoundScoresNumericArrayCompound VADER-style sentiment score for each document.
positiveScoresNumericArrayPositive sentiment proportions.
negativeScoresNumericArrayNegative sentiment proportions.
neutralScoresNumericArrayNeutral token proportions.

Returned values from vaderSentimentScores depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:vaderSentimentScores:InvalidInputInputs do not match supported vaderSentimentScores forms.vaderSentimentScores: invalid input

How vaderSentimentScores works

  • documents must be a RunMat tokenizedDocument compatibility object with English language metadata.
  • Compound scores are normalized to the range [-1, 1] from token sentiment values after applying booster, dampener, negation, capitalization, and punctuation modifiers.
  • SentimentLexicon accepts a RunMat table with lowercase string Token values and numeric SentimentScore values in the documented range [-4, 4].
  • Boosters and Dampeners accept string, character, cell, or string-array inputs. Column vectors are treated as word lists; multi-column string arrays are treated as row-wise n-grams with empty padding ignored.
  • Negations accepts string, character, cell, or string-array word lists.
  • RunMat ships a compact built-in English compatibility lexicon and modifier lists for common scripts and examples. For domain-specific or full-coverage scoring, pass an explicit SentimentLexicon table.
  • The default lexicon is not yet the complete MATLAB/VADER lexicon, and exact MATLAB VADER scoring parity remains tracked by the broader Text Analytics compatibility issue.

GPU memory and residency

vaderSentimentScores operates on host tokenizedDocument objects and has no provider-resident kernel.

Examples

Score Tokenized Documents

documents = tokenizedDocument(["The book was VERY good!!!!"; "The book was not very good."]);
compoundScores = vaderSentimentScores(documents)

Expected output:

`compoundScores` is a numeric column vector with one score per document.

Return Sentiment Proportions

[compoundScores,positiveScores,negativeScores,neutralScores] = vaderSentimentScores(documents)

Expected output:

Each output is a numeric column vector with one value per document.

Use a Custom Lexicon

tbl = table(["innovative"; "risk"], [4; -3], "VariableNames", ["Token", "SentimentScore"]);
compoundScores = vaderSentimentScores(documents, "SentimentLexicon", tbl)

Expected output:

The custom table replaces the built-in compact lexicon.

Using vaderSentimentScores with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how vaderSentimentScores changes the result.

Run a small vaderSentimentScores example, explain the result, then change one input and compare the output.

FAQ

Does RunMat include MATLAB's full default VADER lexicon?

Not yet. The builtin includes a compact default compatibility lexicon and fully supports custom lexicon tables.

Are booster, dampener, and negation options supported?

Yes. Boosters, Dampeners, and Negations are parsed and applied to preceding sentiment-bearing tokens.

Does vaderSentimentScores execute on the GPU?

No. It performs host text/object processing and returns host numeric score vectors.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how vaderSentimentScores is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.