batch parser's output includes sentiment results retrieved from the original CoreNLP tools's XML output

Issue #20 new
Christos Christofidis created an issue

Can you pin point on where if you have used it? It seems that I can't spot it from the output taken from batch_parse

Comments (5)

  1. Pawel Kalinowski

    How did you view the sentiment analysis results? I used the following code, and tried to write the output to a text file using pickle, but I cant understand any of it nor find an indication of sentiment. Any help getting the sentiment results to a text file, would be greatly appreciated.

    from corenlp import batch_parse import pickle

    corenlp_dir = "stanford-corenlp-full-2014-08-27/"

    raw_text_directory = "sample_raw_text/" parsed = batch_parse(raw_text_directory, corenlp_dir, raw_output=True) # It returns a generator object

    pickle.dump( list(parsed), open("parse_dict.txt", "wb"))

  2. LULU HUANG

    I found code about sentiment analysis in line307-310 of corenlp.py.

            sentiment_value = raw_sent_list[id].get('@sentimentValue')
            sentiment = raw_sent_list[id].get('@sentiment')
            if sentiment_value: sent['sentimentValue'] = int(sentiment_value)
            if sentiment_value: sent['sentiment'] = sentiment
    

    However the result from batch_parse did not contain 'sentiment' element ...

  3. Jacob Taylor

    I am working with Pawel who commented above and we have figured out the sentiment analysis part. The problem we are having now is that the output of the batch_parse does not have sentiment values for each of the entries. Given maybe 200 sentences or so in a file, the output will only contain roughly 50 sentiment values or so. Does anyone have any idea why this might be? Or, ideally, a way to fix it?

  4. Devika Kakkar

    How did you view the sentiment analysis results from batch_parse? I used the following code Pawel mentioned above and wrote the output to a text file using pickle, how can I get the sentiment value from this output file? Please help!!

  5. Log in to comment