Last active
August 23, 2016 17:25
-
-
Save tylernappy/5904d9be49daf00a814715ba2e35ab74 to your computer and use it in GitHub Desktop.
Sentiment analysis mini tutorial using Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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