Skip to content

Falcon based API interface for sentiment analysis over twitter data

License

Notifications You must be signed in to change notification settings

mshenron/TwitterSentimentAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TwitterSentiment

Falcon based API interface for sentiment analysis over twitter data

dependencies:

pip install -r requirements.txt

To start the App

Open utils.py file and go to line number 38 - 42 and input your api tokens there

        # keys and tokens from the Twitter Dev Console
        consumer_key='#YOUR CUSTOMER KEY HERE'
        consumer_secret='#YOUR CUSTOMER SECRET HERE'
        access_token='#YOUR ACCESS TOKEN HERE'
        access_token_secret='YOUR ACCESS TOKEN SECRET HERE'

open terminal and start the server using

bash start.sh

API calls :

import requests
url = "http://127.0.0.1:8089/api/AnalyzeTweets/"
payload = "{\"query\":\"bjp\"}"
headers = {'cache-control': "no-cache"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)

Returns a json object with
{'PTP': positive tweets percentage
'NTP' : negative tweets percentage
'NTWP': neutral tweets percentage
}

import requests
url = "http://35.196.64.132:8089/api/GetSent/"
payload = "{\"tweet\":\"I was happy to see her again\"}"
headers = {'cache-control': "no-cache"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)

Returns a json object with
{'sentiment':sentiment of the sentence i.e Positive/Negative or Neutral
'polarity': sentiment score
'cleaned_text': processed text
}

import requests
url = "http://35.196.64.132:8089/api/SearchTwitter/"
payload = ""
headers = {'cache-control': "no-cache"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)

Returns a json object with
{'PTP': positive tweets percentage
'NTP' : negative tweets percentage
'NTWP': neutral tweets percentage
'ptweets': All positive tweets
'ntweets' : all negative tweets
}

About

Falcon based API interface for sentiment analysis over twitter data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published