Guest User

Untitled

a guest
Jul 17th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. # installation
  2. gem install openamplify
  3.  
  4. # usage
  5. require 'openamplify'
  6.  
  7. API_KEY = "register to get a key"
  8. client = OpenAmplify::Client.new(:api_key => API_KEY)
  9.  
  10. text = "After getting the MX1000 laser mouse and the Z-5500 speakers i fell in love with logitech"
  11. response = client.analyze_text(text)
  12.  
  13. # List all the keys and values returned by OpenAmplify
  14. response.each do |k, v|
  15. pp k
  16. pp v
  17. end
  18.  
  19. # 'response' works like a Hash
  20. puts response['Topics']
  21. puts response['Demographics']
Add Comment
Please, Sign In to add comment