v2026.10.3
All Bundles
Bundle

Natural language processing toolkit. Provides tokenization, text preprocessing, TF-IDF vectorization, cosine similarity, and sentiment analysis. Works with plain strings — no external model required. Compile with -lib nlp.

SentimentResult

Sentiment analysis result

Example

result := System.NLP.SentimentAnalyzer->AnalyzeDetailed("Great product!");
score := result->GetScore();
compound := result->GetCompound();
label := result->GetClassification();

Operations

GetClassification #

Gets the classification label

method : public : GetClassification() ~ String

Return

TypeDescription
Stringclassification (positive, negative, or neutral)

Example

result := SentimentAnalyzer->AnalyzeDetailed("Awful product!");
result->GetClassification()->PrintLine();

GetCompound #

Gets the normalized compound score

method : public : GetCompound() ~ Float

Return

TypeDescription
Floatcompound score from -1.0 to 1.0

Example

result := SentimentAnalyzer->AnalyzeDetailed("Not bad at all.");
"Compound: {$result->GetCompound()}"->PrintLine();

GetScore #

Gets the sentiment score

method : public : GetScore() ~ Int

Return

TypeDescription
Intsentiment score, the rounded sum of valences

Example

result := SentimentAnalyzer->AnalyzeDetailed("Great job!");
"Score: {$result->GetScore()}"->PrintLine();

New # constructor

Constructor; the compound score is derived from the integer score

New(score:Int, classification:String)

Parameters

NameTypeDescription
scoreIntsentiment score
classificationStringsentiment label

New # constructor

Constructor

New(score:Int, compound:Float, classification:String)

Parameters

NameTypeDescription
scoreIntsentiment score, the rounded sum of valences
compoundFloatnormalized score from -1.0 to 1.0
classificationStringsentiment label

ToString #

String representation

method : public : ToString() ~ String

Return

TypeDescription
Stringformatted result