v2026.4.1
All Bundles

SentimentAnalyzer

Basic lexicon-based sentiment analysis

text := "This is absolutely wonderful and amazing!";
score := System.NLP.SentimentAnalyzer->Analyze(text);
classification := System.NLP.SentimentAnalyzer->Classify(text);
result := System.NLP.SentimentAnalyzer->AnalyzeDetailed(text);
result->ToString()->PrintLine();

Operations

Analyze

Analyzes sentiment of text and returns a sentiment score

function : Analyze(text:String) ~ Int

Parameters

NameTypeDescription
textStringinput text to analyze

Return

TypeDescription
Intsentiment score (positive = positive sentiment, negative = negative sentiment, 0 = neutral)

AnalyzeDetailed

Gets detailed sentiment analysis with scores

function : AnalyzeDetailed(text:String) ~ SentimentResult

Parameters

NameTypeDescription
textStringinput text to analyze

Return

TypeDescription
SentimentResultsentiment result with score and classification

Classify

Classifies text sentiment as positive, negative, or neutral

function : Classify(text:String) ~ String

Parameters

NameTypeDescription
textStringinput text to classify

Return

TypeDescription
Stringsentiment label: "positive", "negative", or "neutral"

Init

Initializes sentiment lexicons with common positive and negative words

function : Init() ~ Nil