#Twitter Streaming Project
#Prerequisite
- Download and Install Node.js.
- Download and Run Apache Spark.
- Download and Run Apache Kafka along with Apache Zookeeper.
- Download and Install SBT.
#Clone the Project into the local machine git clone https://github.com/ManjunathKmph/twitter-sentiment.git
#Steps to prepare the project
- Download the Stanford NLP models jar from the below link and copy it into twitter-sentiment/jars folder.
- Open the file from the path src/main/resources/application.properties and change the values for the following key
- twitter4j.oauth.consumerKey
- twitter4j.oauth.consumerSecret
- twitter4j.oauth.accessToken
- twitter4j.oauth.accessTokenSecret
- bootstrap.servers.config
- Create the following kafka topics
- kafka-topics.sh --create --topic twitterTopic --zookeeper localhost:2181 --replication-factor 1 --partitions 1
- kafka-topics.sh --create --topic sentimentTopic --zookeeper localhost:2181 --replication-factor 1 --partitions 1
- Change the spark home path in the following file
- start-streaming.sh
- Command to execute the files in the machine
- chmod 777 start-server.sh
- chmod 777 start-streaming.sh
#Steps to run the project
- Open the terminal and type the following line
- ./start-server.sh -- To check the server is up and running successfully, in the console it will print use the url localhost:8888/web
- Hit the http://localhost:8888/web in the browser and should show the following image.

- Open another terminal and type the follwing line
- ./start-streaming.sh
#How to start sentiment analysis for the hash tag
- In the browser url, type the hash tag name(ex:- food) in the textbox and click on show tweets. It should show the following image.

Note:- In the above, code will search the mentioned hash tags in the tweets for the last 60 seconds, if it appear in the tweet then it will do the sentiment analysis using Stanford NLP library and marks the tweet as positive/negaitve/neutral/notunderstood. For the mentioned hash tag if the sentiment graph doesn't show then please wait till someone uses the hashtag in the last 60 seconds.

