You are here

Sample Source Code: ParallelDots Sentiment Analysis Followers

Sentiment Analysis is contextual mining of text which identifies and extracts subjective information in source material.

ParallelDots Sentiment analysis provides an accurate analysis of the overall social sentiment of your brand, product or service while monitoring online conversations. incorporated from sources like blogs, articles, forums, consumer reviews, surveys, Twitter, etc. It tells whether the text is positive, negative, or neutral with a range (0-1)

This code sample is for use with the ParallelDots Sentiment Analysis API.

from paralleldots.config import get_api_key
import requests
import json

def get_sentiment( sentence1 ): apikey = get_api_key() if not apikey == None: if type( sentence1 ) != str: return "Input must be a string." elif sentence1 == "": return "Input string cannot be empty." url = "" r = requests.get( url, params={ "apikey": apikey, "sentence1": sentence1 } ) if r.status_code != 200: return "Oops something went wrong ! You can raise an issue at" r = json.loads( r.text ) r["usage"] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use:" return r else: return "API key does not exist"