Skip to content
Ruby gem for Open Calais
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.gitignore
.ruby-version
Gemfile
LICENSE.txt
README.rdoc
Rakefile
burghers.gemspec

README.rdoc

Burghers : Gem for OpenCalais

Burghers is a Ruby gem for Open Calais. Unlike some of the other gems out there, Burghers works with Ruby 2 and does not hardcode scores or add arbitrary methods to Ruby’s String class. Also it's freakin small. And it will accept URL's!

Installation

Add this line to your application's Gemfile:

gem 'burghers'

And then execute:

$ bundle

Or install it yourself as:

$ gem install burghers

Usage

client = Burghers::Client.new("your api key")

# call enrich on client with text or html content - Burghers will figure out what the
# content type is automagically

# give some Text
content = "The government of the United Kingdom has given corporations like fast food chain McDonald's the right to award high school qualifications to employees who complete a company training program."
puts client.enrich(content).topics
 => [{:name=>"Education", :score=>1.0}, {:name=>"Labor", :score=>0.952}, {:name=>"Business_Finance", :score=>0.875}, {:name=>"Politics", :score=>0.566}]

# give some HTML
content = "<html><body>The government of the United Kingdom has given corporations like fast food chain McDonald's the right to award high school qualifications to employees who complete a company training program.</html></body>"
puts client.enrich(content).topics
 => [{:name=>"Education", :score=>1.0}, {:name=>"Labor", :score=>0.952}, {:name=>"Business_Finance", :score=>0.875}, {:name=>"Politics", :score=>0.566}]

# But wait, THERE'S MORE - you can give a url too:
content = "http://www.washingtonpost.com/lifestyle/style/rep-vance-mcallister-kissed-now-can-he-make-up-with-voters-after-the-scandal/2014/04/16/9a898fde-c57c-11e3-9f37-7ce307c56815_story.html"
puts client.enrich(content).topics
 => [{:name=>"Politics", :score=>0.57}]

Responses to enrich will all respond to topics, tags, entities, and relations with the result from the API call.

Documentation

Run:

bundle exec rake doc

OpenCalais Test Account

This was an account made just for the tests.

username: createbubbles
email: createbubbles@mailinator.com
password: T3E3gCppAD
api key: 3zjwnzgr6ptek99nqgebwx9r

Running tests

rake
You can’t perform that action at this time.