Skip to content

Commit

Permalink
add targeted sentiment to example
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Herschleb committed Dec 2, 2013
1 parent 3f9a4a0 commit cde4659
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,35 @@



print('')
print('')
print('')
print('############################################')
print('# Targeted Sentiment Analysis Example #')
print('############################################')
print('')
print('')

print('Processing text: ', demo_text)
print('')

response = alchemyapi.sentiment_targeted('text',demo_text, 'Denver')

if response['status'] == 'OK':
print('## Response Object ##')
print(json.dumps(response, indent=4))

print('')
print('## Targeted Sentiment ##')
print('type: ', response['docSentiment']['type'])

if 'score' in response['docSentiment']:
print('score: ', response['docSentiment']['score'])
else:
print('Error in targeted sentiment analysis call: ', response['statusInfo'])



print('')
print('')
print('')
Expand Down

0 comments on commit cde4659

Please sign in to comment.