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() ~ StringReturn
| Type | Description |
|---|---|
| String | classification (positive, negative, or neutral) |
Example
result := SentimentAnalyzer->AnalyzeDetailed("Awful product!");
result->GetClassification()->PrintLine();GetCompound #
Gets the normalized compound score
method : public : GetCompound() ~ FloatReturn
| Type | Description |
|---|---|
| Float | compound 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() ~ IntReturn
| Type | Description |
|---|---|
| Int | sentiment 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
| Name | Type | Description |
|---|---|---|
| score | Int | sentiment score |
| classification | String | sentiment label |