0.0.2 • Published 10 years ago

senti v0.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

senti

About

A wrapper for the sentiment analysis API provided by text-processing.com. User provides string(s) to analyze and a callback function detailing what to do with the analysis object(s).

Install

npm install senti -- save

Usage

var senti = require('senti');

senti(obj, callback, fullBody);

Parameters:

Object is either a string or array of strings (to be analyzed for sentiment), callback is a function which takes the analysis object as a parameter (to be executed when analysis is complete), fullBody is a boolean indicating whether a full description of the analysis is desired (defaults to false).

Examples

var senti = require('senti');

var logfun = function(something){
  console.log(something);
}

var string1 = 'this is a very fun string';
var string2 = "i don't like this string. it's bad.";
var array = [string1,string2];

senti(string1, logfun);
//console.logs: pos

senti(array, logfun);
//console.logs: ['pos', 'neg']

senti(string2, logfun, true);
//console.logs: { probability:
//   { neg: 0.8563832969689797,
//     neutral: 0.11138614200367986,
//     pos: 0.14361670303102028 },
//  label: 'neg' }

License

The MIT License (MIT)

Copyright (c) 2014 Nathan Epstein

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.