Retraining the Sentiment Analysis Annotator: Changing file to a Binarized tree Issues
jessicaaamango opened this issue · 3 comments
I am trying to retrain the Sentiment Analysis Annotator. I am struggling with trying to change my file to a binarized tree with the following call:
$ java -mx5g edu.stanford.nlp.sentiment.BuildBinarizedDataset -input sample.txt
Here are the errors I keep running into:
BuildBinarizedDataset.java:7: error: package edu.stanford.nlp.io does not exist
import edu.stanford.nlp.io.IOUtils;
^
BuildBinarizedDataset.java:8: error: package edu.stanford.nlp.ling does not exist
import edu.stanford.nlp.ling.CoreAnnotations;
^
BuildBinarizedDataset.java:9: error: package edu.stanford.nlp.ling does not exist
import edu.stanford.nlp.ling.CoreLabel;
^
BuildBinarizedDataset.java:10: error: package edu.stanford.nlp.ling does not exist
import edu.stanford.nlp.ling.HasWord;
^
BuildBinarizedDataset.java:11: error: package edu.stanford.nlp.neural.rnn does not exist
import edu.stanford.nlp.neural.rnn.RNNCoreAnnotations;
^
BuildBinarizedDataset.java:12: error: package edu.stanford.nlp.parser.lexparser does not exist
import edu.stanford.nlp.parser.lexparser.LexicalizedParser;
^
BuildBinarizedDataset.java:13: error: package edu.stanford.nlp.parser.lexparser does not exist
import edu.stanford.nlp.parser.lexparser.TreeBinarizer;
^
BuildBinarizedDataset.java:14: error: package edu.stanford.nlp.process does not exist
import edu.stanford.nlp.process.DocumentPreprocessor;
^
BuildBinarizedDataset.java:15: error: package edu.stanford.nlp.trees does not exist
import edu.stanford.nlp.trees.Tree;
^
BuildBinarizedDataset.java:16: error: package edu.stanford.nlp.trees does not exist
import edu.stanford.nlp.trees.Trees;
^
BuildBinarizedDataset.java:17: error: package edu.stanford.nlp.util does not exist
import edu.stanford.nlp.util.Generics;
^
BuildBinarizedDataset.java:18: error: package edu.stanford.nlp.util does not exist
import edu.stanford.nlp.util.Pair;
^
BuildBinarizedDataset.java:19: error: package edu.stanford.nlp.util.logging does not exist
import edu.stanford.nlp.util.logging.Redwood;
^
BuildBinarizedDataset.java:28: error: package Redwood does not exist
private static final Redwood.RedwoodChannels log = Redwood.channels(BuildBinarizedDataset.class);
^
BuildBinarizedDataset.java:35: error: cannot find symbol
public static void setUnknownLabels(Tree tree, Integer defaultLabel) {
^
symbol: class Tree
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:47: error: cannot find symbol
public static void setPredictedLabels(Tree tree) {
^
symbol: class Tree
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:59: error: cannot find symbol
public static void extractLabels(Map<Pair<Integer, Integer>, String> spanToLabels, List tokens, String line) {
^
symbol: class Pair
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:59: error: cannot find symbol
public static void extractLabels(Map<Pair<Integer, Integer>, String> spanToLabels, List tokens, String line) {
^
symbol: class HasWord
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:84: error: cannot find symbol
public static boolean setSpanLabel(Tree tree, Pair<Integer, Integer> span, String value) {
^
symbol: class Tree
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:84: error: cannot find symbol
public static boolean setSpanLabel(Tree tree, Pair<Integer, Integer> span, String value) {
^
symbol: class Pair
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:28: error: cannot find symbol
private static final Redwood.RedwoodChannels log = Redwood.channels(BuildBinarizedDataset.class);
^
symbol: variable Redwood
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:40: error: cannot find symbol
for (Tree child : tree.children()) {
^
symbol: class Tree
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:52: error: cannot find symbol
for (Tree child : tree.children()) {
^
symbol: class Tree
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:56: error: cannot find symbol
tree.label().setValue(Integer.toString(RNNCoreAnnotations.getPredictedClass(tree)));
^
symbol: variable RNNCoreAnnotations
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:79: error: cannot find symbol
spanToLabels.put(new Pair<>(i, i + pieces.length - 1), pieces[0]);
^
symbol: class Pair
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:85: error: cannot find symbol
if (!(tree.label() instanceof CoreLabel)) {
^
symbol: class CoreLabel
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:88: error: cannot find symbol
CoreLabel label = (CoreLabel) tree.label();
^
symbol: class CoreLabel
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:88: error: cannot find symbol
CoreLabel label = (CoreLabel) tree.label();
^
symbol: class CoreLabel
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:89: error: package CoreAnnotations does not exist
if (label.get(CoreAnnotations.BeginIndexAnnotation.class).equals(span.first) &&
^
BuildBinarizedDataset.java:90: error: package CoreAnnotations does not exist
label.get(CoreAnnotations.EndIndexAnnotation.class).equals(span.second)) {
^
BuildBinarizedDataset.java:94: error: package CoreAnnotations does not exist
if (label.get(CoreAnnotations.BeginIndexAnnotation.class) > span.first &&
^
BuildBinarizedDataset.java:95: error: package CoreAnnotations does not exist
label.get(CoreAnnotations.EndIndexAnnotation.class) < span.second) {
^
BuildBinarizedDataset.java:98: error: cannot find symbol
for (Tree child : tree.children()) {
^
symbol: class Tree
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:160: error: cannot find symbol
CollapseUnaryTransformer transformer = new CollapseUnaryTransformer();
^
symbol: class CollapseUnaryTransformer
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:160: error: cannot find symbol
CollapseUnaryTransformer transformer = new CollapseUnaryTransformer();
^
symbol: class CollapseUnaryTransformer
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:167: error: cannot find symbol
SentimentModel sentimentModel = null;
^
symbol: class SentimentModel
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:189: error: cannot find symbol
LexicalizedParser parser = LexicalizedParser.loadModel(parserModel);
^
symbol: class LexicalizedParser
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:189: error: cannot find symbol
LexicalizedParser parser = LexicalizedParser.loadModel(parserModel);
^
symbol: variable LexicalizedParser
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:190: error: cannot find symbol
TreeBinarizer binarizer = TreeBinarizer.simpleTreeBinarizer(parser.getTLPParams().headFinder(), parser.treebankLanguagePack());
^
symbol: class TreeBinarizer
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:190: error: cannot find symbol
TreeBinarizer binarizer = TreeBinarizer.simpleTreeBinarizer(parser.getTLPParams().headFinder(), parser.treebankLanguagePack());
^
symbol: variable TreeBinarizer
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:193: error: cannot find symbol
sentimentModel = SentimentModel.loadSerialized(sentimentModelPath);
^
symbol: variable SentimentModel
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:196: error: cannot find symbol
String text = IOUtils.slurpFileNoExceptions(inputPath);
^
symbol: variable IOUtils
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:211: error: cannot find symbol
DocumentPreprocessor document = new DocumentPreprocessor(sin);
^
symbol: class DocumentPreprocessor
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:211: error: cannot find symbol
DocumentPreprocessor document = new DocumentPreprocessor(sin);
^
symbol: class DocumentPreprocessor
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:213: error: cannot find symbol
List tokens = document.iterator().next();
^
symbol: class HasWord
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:219: error: cannot find symbol
Map<Pair<Integer, Integer>, String> spanToLabels = Generics.newHashMap();
^
symbol: class Pair
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:219: error: cannot find symbol
Map<Pair<Integer, Integer>, String> spanToLabels = Generics.newHashMap();
^
symbol: variable Generics
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:226: error: cannot find symbol
Tree tree = parser.apply(tokens);
^
symbol: class Tree
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:227: error: cannot find symbol
Tree binarized = binarizer.transformTree(tree);
^
symbol: class Tree
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:228: error: cannot find symbol
Tree collapsedUnary = transformer.transformTree(binarized);
^
symbol: class Tree
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:233: error: cannot find symbol
Trees.convertToCoreLabels(collapsedUnary);
^
symbol: variable Trees
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:234: error: cannot find symbol
SentimentCostAndGradient scorer = new SentimentCostAndGradient(sentimentModel, null);
^
symbol: class SentimentCostAndGradient
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:234: error: cannot find symbol
SentimentCostAndGradient scorer = new SentimentCostAndGradient(sentimentModel, null);
^
symbol: class SentimentCostAndGradient
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:241: error: cannot find symbol
Trees.convertToCoreLabels(collapsedUnary);
^
symbol: variable Trees
location: class BuildBinarizedDataset
BuildBinarizedDataset.java:244: error: cannot find symbol
for (Map.Entry<Pair<Integer, Integer>, String> pairStringEntry : spanToLabels.entrySet()) {
^
symbol: class Pair
location: class BuildBinarizedDataset
55 errors
error: compilation failed
Can someone help me figure out how to fix this please? I have already tried adding the CoreNLP repository to eclipse and adding the jar files, however, it's still not working. What do I do?
I already added all of the CoreNLP jar files to the classpath on Eclipse and still the same thing.
I am trying to use the command to change my file to a binarized tree. However, both the IDE and the regular command are giving me the same errors for some reason.
How do I go about surpassing my errors in order to turn my file into a binarized tree?
Also, no I'm not changing the code at all.