SentimentAnalyzer

o1.sentiment.SentimentAnalyzer
See theSentimentAnalyzer companion class

This companion object of class SentimentAnalyzer provides methods for initializing analyzer instances from training data.

The methods expect the data to be in the following line-based format:

-1 Aggressive self-glorification and a manipulative whitewash.
2 A comedy-drama of nearly epic proportions rooted in a sincere performance by the title character undergoing midlife crisis.
-1 Narratively, Trouble Every Day is a plodding mess.
1 The Importance of Being Earnest, so thick with wit it plays like a reading from Bartlett's Familiar Quotations
0 It's everything you'd expect -- but nothing more.

That is, each line of input should start with a sentiment rating of -2, -1, 0, 1, 2. A negative numbers means that the rest of the line expresses a negative sentiment, as determined by a human rater; positive numbers correspondingly reflect positive sentiments.

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def fromFile(trainingDataPath: String): SentimentAnalyzer

Given the path to a file that contains training data, returns a SentimentAnalyzer trained on that data.

Given the path to a file that contains training data, returns a SentimentAnalyzer trained on that data.

N.B. This method is unsafe: it will crash with an error if it fails to read the file. If it encounters invalid lines, the method will emit warnings and ignore that data.

Attributes

def fromSource(trainingData: Source): SentimentAnalyzer

Given a Source that contains training data, returns a SentimentAnalyzer trained on that data.

Given a Source that contains training data, returns a SentimentAnalyzer trained on that data.

N.B. This method is unsafe: it will crash with an error if it fails to read the source. If it encounters invalid lines, the method will emit warnings and ignore that data.

Attributes