diff options
author | Maurice Laveaux <m.laveaux@student.tue.nl> | 2014-05-22 16:33:24 +0200 |
---|---|---|
committer | Maurice Laveaux <m.laveaux@student.tue.nl> | 2014-05-22 16:33:24 +0200 |
commit | 4f32eedd2bd49837cc297acce399c108e8b558a7 (patch) | |
tree | e80ceb3fdf38db9552b52bd7f0c6b209c6c4bc28 /src/Chapter4/classification/bayes/TestNBC.java | |
parent | 1da00321db0aa8c412c3ff1dff5734962ee49240 (diff) | |
download | TwitterDataAnalytics-4f32eedd2bd49837cc297acce399c108e8b558a7.tar.gz |
Removed unused source files
* Removed the shitty examples.
Diffstat (limited to 'src/Chapter4/classification/bayes/TestNBC.java')
-rw-r--r-- | src/Chapter4/classification/bayes/TestNBC.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/Chapter4/classification/bayes/TestNBC.java b/src/Chapter4/classification/bayes/TestNBC.java deleted file mode 100644 index 7e0e743..0000000 --- a/src/Chapter4/classification/bayes/TestNBC.java +++ /dev/null @@ -1,49 +0,0 @@ -package Chapter4.classification.bayes; - -import java.io.FileReader; -import java.io.IOException; - -import com.google.gson.JsonObject; -import com.google.gson.JsonStreamParser; - -public class TestNBC { - public static void main(String[] args){ - - String filename = args.length >= 1 ? args[0] : "owsemoticons.json"; - - //initialize the sentiment classifier - NaiveBayesSentimentClassifier nbsc = new NaiveBayesSentimentClassifier(); - - try { - //read the file, and train each document - JsonStreamParser parser = new JsonStreamParser(new FileReader(filename)); - JsonObject elem; - String text; - while (parser.hasNext()) { - elem = parser.next().getAsJsonObject(); - text = elem.get("text").getAsString(); - nbsc.trainInstance(text); - } - - //print out the positive and negative dictionary - System.out.println("=== Positive Dictionary ==="); - System.out.println(nbsc.printWordOccurs(0, 25)); - System.out.println("=== Negative Dictionary ==="); - System.out.println(nbsc.printWordOccurs(1, 25)); - - //now go through and classify each line as positive or negative -// parser = new JsonStreamParser(new FileReader(filename)); -// while (parser.hasNext()) { -// elem = parser.next().getAsJsonObject(); -// text = elem.get("text").getAsString(); -// Classification c = nbsc.classify(text); -// System.out.println(c + " -> " + text); -// } - System.out.println(nbsc.classify("I love new york")); - - } catch (IOException e) { - e.printStackTrace(); - } - - } -} |