java.lang.ObjectClassifier
public class Classifier
Class that classifies messages based on their mood.
| Constructor Summary | |
|---|---|
Classifier(java.lang.String posFile,
java.lang.String negFile)
Constructs a Classifier for determining the mood of messages. |
|
| Method Summary | |
|---|---|
java.lang.String |
classify(java.lang.String message)
Classifies a message with respect to its mood. |
int |
negativity(java.lang.String message)
Determines the negativity (number of unique negative terms) of a message |
int |
positivity(java.lang.String message)
Determines the positivity (number of unique positive terms) of a message |
void |
processFile(java.lang.String filename)
Process a file and displays the file name and the number of lines from that file of each type: positive, negative, and neutral. |
| Methods inherited from class |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Classifier(java.lang.String posFile,
java.lang.String negFile)
throws java.io.FileNotFoundException
posFile - the name of the file containing positive termsnegFile - the name of the file containing negative terms
java.io.FileNotFoundException| Method Detail |
|---|
public java.lang.String classify(java.lang.String message)
message - the message to be rated
public int negativity(java.lang.String message)
message - the message to be rated
public int positivity(java.lang.String message)
message - the message to be rated
public void processFile(java.lang.String filename)
throws java.io.FileNotFoundException
File name: test.txt
# of positive lines = 42
# of negative lines = 28
# of neutral lines = 22
filename - the name of a file containing lines of text to be processed
java.io.FileNotFoundException