Skip to content

Various ops for handling several entities in a document, perform anaphora resolution, clustering, etc.

Notifications You must be signed in to change notification settings

charlesashby/entity-sentiment-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

Sentiment Analysis on Extracted Entities

Various ops for handling several entities in a document, performs anaphora resolution, clustering, etc..

Requirements

Directory Structure

This code assume you have the following directory structure, where CharLSTM is taken from this page.

- Main
-- CharLSTM
-- entity-sentiment-analysis
--- stanford-corenlp-full-2016-10-31

Exemple Usage

First, download the Stanford-CoreNLP server files at this page. And type the following commands in a terminal to start it.

# Start the Stanford-CoreNLP server
cd entity-sentiment-analysis/stanford-corenlp-*
java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000

Then, you can use this script to perform anaphora resolution, entity extraction & sentiment analysis on any sentence by modifying parse_doc.py. As an example, here's the result by running this script on the sentence: "Jean is really sad, but Adam is the happiest guy ever".

python entity-sentiment-analysis/parse_doc.py

>>> Processing sentence: Jean is really sad, but Adam is the happiest guy ever
>>> Sentence: 0,Jean is really sad , yielded results (pos/neg): 0.35512/0.64488, prediction: neg
>>> Sentence: 0,Adam is the happiest guy ever , yielded results (pos/neg): 0.97269/0.02731, prediction: pos
>>> Entity:  Jean -- sentiment: -0.2897535
>>> Entity:  Adam -- sentiment: 0.94538456

You can read the full blog post here.

About

Various ops for handling several entities in a document, perform anaphora resolution, clustering, etc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages