Node.js module/CLI tool for semantic analysis of text using the OpenCalais web service.
JavaScript CoffeeScript Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib test for undefined response - close mcantelon/node-calais#11 Jan 13, 2015
test
.gitignore
.jshintrc add jshint May 31, 2014
LICENSE
Makefile add jshint May 31, 2014
README.md
calais.js Made CLI tool work with recent changes. Aug 24, 2014
example.coffee
example.js
package.json bump 0.3.3 Feb 5, 2015

README.md

node-calais

node-calais allows semantic analysis of text using the Calais web service.

Install

Install using npm: $ npm install calais

Usage

var calais = new Calais('<YOUR API KEY>')
calais.set('content', 'The Federal Reserve is the enemy of Ron Paul.')
calais.fetch(function(err, result) {
  // do something with result
})

Example

Run quick example: $ node example.js

Options

In addition to using the "set" method, a hash of option settings can be passed as the second argument during intialization. For example:

var calais = new Calais('<YOUR API KEY>', {'cleanResult': false})

By default, node-calais will return fetched results as a Javascript object. Alternatively, the Calais standard "outputFormat" input parameter can be set to standard output formats (see Calais documentation).

Any standard Calais input parameter can be specified as an option, as well as the 'cleanResult' parameter which will return a simplified Javascript object if "outputFormat" hasn't been set to something other than the default ('object').

CLI Tool

The library also comes with a CLI tool for sending text files to Calais for analysis.

Example:

calais some_key_file -k my_api_key

If you use the CLI tool regularly, you can specify a default API key by setting the api_key property in an .ini file at $HOME/.calais.

Test

Run tests: $ expresso test/calais.test.js

Tested with node.js v0.11.13

Contributors

Mike Cantelon (github: mcantelon)

D. Charbonnier (github: dcharbonnier)

Dirk Gorissen (github: dgorissen)

Harry Guillermo (github: hguillermo)

(c) 2010-2014 Mike Cantelon, MIT license