GithubHelp home page GithubHelp logo

isabella232 / open_calais Goto Github PK

View Code? Open in Web Editor NEW

This project forked from documentcloud/open_calais

0.0 0.0 0.0 49 KB

Ruby gem to access and parse OpenCalais API

License: MIT License

Ruby 100.00%

open_calais's Introduction

OpenCalais

License Build Status Code Climate Coverage Status Dependency Status

Gem Version 0.1.* supports the original OpenCalais API

Gem Version 0.2.* now uses the upgraded API http://www.opencalais.com/

If you are upgrading the the new version of the API, you will need a new API key. You should also review the upgrade guide.

This is a ruby gem to access the OpenCalais API, using the REST API, and JSON responses.

It uses Faraday to abstract HTTP library (defaults to use excon because it is excellent), and multi_json to abstract JSON parsing.

It returns a parsed version of the response, but the response also contains the raw response (converted from json to hashes/arrays/string/etc).

Installation

Add this line to your application's Gemfile:

gem 'open_calais'

And then execute:

$ bundle

Or install it yourself as:

$ gem install open_calais

Usage

OpenCalais has one main method, enrich, and so does the gem:

require 'open_calais'

# you can configure for all calls
OpenCalais.configure do |c|
  c.api_key = "this is a test key"
end

# or you can configure for a single call
open_calais = OpenCalais::Client.new(:api_key=>'an api key')

# it returns a OpenCalais::Response instance
response = open_calais.enrich('Ruby on Rails is a fantastic web framework. It uses MVC, and the Ruby programming language invented by Matz in Japan.')

# which has the 'raw' response
response.raw

# and has been parsed a bit to get :language, :topics, :tags, :entities, :relations, :locations
# as lists of hashes
response.tags.each{|t| puts t[:name] }

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

open_calais's People

Contributors

kookster avatar knowtheory avatar farski avatar sravich2 avatar cbeer avatar kant avatar marksim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.