Class 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 Detail

      • 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
      • filterUnknownRoots

        public static List<Tree> filterUnknownRoots​(List<Tree> trees)