Package edu.stanford.nlp.sentiment
Class SentimentUtils
- java.lang.Object
-
- edu.stanford.nlp.sentiment.SentimentUtils
-
public class SentimentUtils extends Object
In the Sentiment dataset converted to tree form, the labels on the intermediate nodes are the sentiment scores and the leaves are the text of the sentence. This class provides routines to read a file of those trees and attach the sentiment score as the GoldLabel annotation.- Author:
- John Bauer
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidattachLabels(Tree tree, Class<? extends CoreAnnotation<Integer>> annotationClass)static List<Tree>filterUnknownRoots(List<Tree> trees)static List<Tree>readTreesWithGoldLabels(String path)Given a file name, reads in those trees and returns them as a Liststatic List<Tree>readTreesWithLabels(String path, Class<? extends CoreAnnotation<Integer>> annotationClass)Given a file name, reads in those trees and returns them as a Liststatic List<Tree>readTreesWithPredictedLabels(String path)Given a file name, reads in those trees and returns them as list with labels attached as predictionsstatic StringsentimentString(SentimentModel model, int sentiment)
-
-
-
Method Detail
-
attachLabels
public static void attachLabels(Tree tree, Class<? extends CoreAnnotation<Integer>> annotationClass)
-
readTreesWithGoldLabels
public static List<Tree> readTreesWithGoldLabels(String path)
Given a file name, reads in those trees and returns them as a List
-
readTreesWithPredictedLabels
public static List<Tree> readTreesWithPredictedLabels(String path)
Given a file name, reads in those trees and returns them as list with labels attached as predictions
-
readTreesWithLabels
public static List<Tree> readTreesWithLabels(String path, Class<? extends CoreAnnotation<Integer>> annotationClass)
Given a file name, reads in those trees and returns them as a List
-
sentimentString
public static String sentimentString(SentimentModel model, int sentiment)
-
-