This is a Java project for Sentiment Analysis using Stanford CoreNLP.
The Stanford CoreNLP provides statistical NLP, deep learning NLP, and rule-based NLP tools for major computational linguistics problems, which can be incorporated into applications with human language technology needs..
The underlying technology of this is based on a new type of Recursive Neural Network that builds on top of grammatical structures.
The Java documentation for stanford nlp can be found here.
The live Demo of Stanfod sentiment analysis.
-
Download the project and import into Intellij
-
Set the build path which must have the following libraries
- stanford-corenlp-3.9.2
- ejml-0.23
- stanford-corenlp-3.9.2-models
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.9.2</version>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.9.2</version>
<classifier>models</classifier>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.efficient-java-matrix-library/ejml -->
<dependency>
<groupId>com.googlecode.efficient-java-matrix-library</groupId>
<artifactId>ejml</artifactId>
<version>0.23</version>
</dependency>
Note: The stanford-corenlp-3.9.2-models has all the trained models. It is not set in the build path of this project due to size constraint.
Download the jar file from Stanford NLP site
- Run the main file
All the dependencies can be downloaded from Stanford NLP site .
This project has the following output
Sentiment Score: 4.0
Sentiment Type: Very positive
Very positive: 80.0%
Positive: 17.0%
Neutral: 2.0%
Negative: 0.0%
Very negative: 0.0%