Skip to content

Instantly share code, notes, and snippets.

@tylernappy
Last active August 23, 2016 17:25
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 tylernappy/5904d9be49daf00a814715ba2e35ab74 to your computer and use it in GitHub Desktop.
Save tylernappy/5904d9be49daf00a814715ba2e35ab74 to your computer and use it in GitHub Desktop.
Sentiment analysis mini tutorial using Ruby
# install the official Haven OnDemand Ruby gem: https://github.com/HPE-Haven-OnDemand/havenondemand-ruby
# gem install havenondemand
require 'havenondemand'
client = HODClient.new('APIKEY', 'v1')
# data = {:url => 'https://techcrunch.com', :language => 'eng'} # uncomment if using URL
# data = {:file => File.new('/path/to/file', 'rb'), :language => 'eng'} # uncomment if using file
data = {:text => 'I like cats', :language => 'eng'} # uncomment if using block of raw text
response = client.post('analyzesentiment', data)
puts response.json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment