Skip to content

Instantly share code, notes, and snippets.

@balkian
Created January 11, 2017 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balkian/a6e97dcbb3b4bc295b64bc2d6325de94 to your computer and use it in GitHub Desktop.
Save balkian/a6e97dcbb3b4bc295b64bc2d6325de94 to your computer and use it in GitHub Desktop.
import json
from senpy import Client
client = Client('http://senpy.cluster.gsi.dit.upm.es')
with open('madrid.json', 'r') as f:
for line in f:
tweet = json.loads(line.strip())
results = client.analyse(input=tweet['text'], algorithm='sentiText')
tweet['sentiment'] = results.entries[0].sentiments[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment