README.md in WatsonNLPWrapper-1.0.0 vs README.md in WatsonNLPWrapper-1.1.0

- old
+ new

@@ -1,13 +1,13 @@ # WatsonNLPWrapper [![Build Status](https://travis-ci.org/thededlier/WatsonNLPWrapper.svg?branch=master)](https://travis-ci.org/thededlier/WatsonNLPWrapper) +[![Gem Version](https://badge.fury.io/rb/WatsonNLPWrapper.svg)](https://badge.fury.io/rb/WatsonNLPWrapper) +[rubygems.org/gems/WatsonNLPWrapper](https://rubygems.org/gems/WatsonNLPWrapper) -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/WatsonNLPWrapper`. To experiment with that code, run `bin/console` for an interactive prompt. +This is a simple ruby wrapper implementation of IBM's Watson Natural Language Understanding API which is used to analyze text to extract meta-data from content -TODO: Delete this and the text above, and describe your gem - ## Installation Add this line to your application's Gemfile: ```ruby @@ -22,16 +22,48 @@ $ gem install WatsonNLPWrapper ## Usage -TODO: Write usage instructions here +```ruby +# Require the library +require "WatsonNLPWrapper" +# Initialize +# Version parameter is not needed to be sent and by default is 2018-03-16 +nlp = WatsonNLPWrapper::WatsonNLPApi.new('{url}', '{username}', '{password}', '{version}') + +# Set sample text +text = '{sample text}' + +# Call the analyze API with default features +# This will give a json response +nlp.analyze(text) + +# If you want to enable specific features only and not the default features + +features = + { + entities: { + emotion: true, + sentiment: true, + limit: 2 + }, + keywords: { + emotion: true, + sentiment: true, + limit: 2 + } + } + +nlp.analyze(text, features) +``` + ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). +To install this gem onto your local machine, run `bundle exec rake install`. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/thededlier/WatsonNLPWrapper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.