Ruby wrapper for the Big Huge Labs Thesaurus API.
Ruby
Latest commit fce6818 Oct 29, 2015 @dtuite Remove Trello from README
Permalink
Failed to load latest commit information.
lib Remove some tmp vars May 28, 2015
spec Regen VCR cassettes May 28, 2015
.gitignore Update specs May 28, 2015
.rspec.dist Update specs May 28, 2015
Gemfile Initial commit Jul 22, 2012
LICENSE Initial commit Jul 22, 2012
README.md Remove Trello from README Oct 29, 2015
Rakefile Initial commit Jul 22, 2012
dinosaurus.gemspec Add dependencies Jul 30, 2012

README.md

Dinosaurus Build Status

Ruby wrapper for the Big Huge Labs Thesaurus API.

Installation

Add this line to your application's Gemfile:

gem 'dinosaurus'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dinosaurus

Usage

Basic

Add your api key using the configure method. If you're in the Rails environemnt then this can be done in an initializer file.

Dinosaurus.configure do |config|
  config.api_key = 'djksfhjk'
end

Now, lookup words in the Thesaurus:

require "dinosaurus"
results = Dinosaurus.lookup('word')

Results

The 'results' object is a hash with some special accessors added.

# You can use it like a normal hash:
results['noun']
# => { 'syn' => [..., ..., ...], 'ant' => [..., ...] }

# Or you can access it with symbols.
results[:noun]
# => { 'syn' => [..., ..., ...], 'ant' => [..., ...] }

# Or you can take advantage of the special accesor methods. The
# methods provided are
#  - synonyms
#  - antonyms
#  - related_terms
#  - similar_terms
results.synonyms
# => [..., ..., ...]

Convenience Methods

Certain convenience methods are provided on the top level namespace. Each method returns an array.

Dinosaurus.synonyms_of('word')
Dinosaurus.antonyms_of('word')
Dinosaurus.related_to('word')
Dinosaurus.similar_to('word')

Slightly more information can be found on the RubyDocs.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request