codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Follow publication

Member-only story

Analyzing The Sentiment of Tweets With Java

A primer for NLP with Java

Siddhant Dubey
codeburst
Published in
4 min readMay 19, 2021
Photo by Hitesh Choudhary on Unsplash

For my final project for an Advanced Java course I was taking at school, I decided to combine my interest in Machine Learning with Java and make a Natural Language Processing project. One of the most basic Natural Language Processing projects is analyzing the sentiment analysis of tweets on Twitter. So naturally, I went about attempting to analyze the sentiments of tweets with the words “USA Coronavirus Response.”

Obtaining the Data.

At the beginning of any Machine Learning project, the first thing you need to do is obtain data. To obtain the tweets you’ll need to do your analysis, you’re going to need to access the Twitter API. Python has a ton of libraries to do this, such as Tweepy. However, we’re using Java which doesn’t have as many packages as Python does, but it does have a great Twitter API package that we can use to get data: twitter4j. First, you should install the package, I recommend using Maven as your build manager for the project. So to add the twitter4j library to your java project, add this to your pom.xml life.

<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Responses (1)

Write a response