Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 2.98 KB

README.md

File metadata and controls

56 lines (42 loc) · 2.98 KB

Personality Insights Input

last-release npm-version npm-license npm-downloads

Generate valid IBM Watson Personality Insights service input from different sources.

Supported sources (will add more as requested):

  • Twitter tweets
  • List of texts

Getting Started

Just require the package and call the API with your data:

var
  tweets = require('./my_tweets'),
  texts = require('./my_texts'),
  PIInput = require('personality-insights-input'),
  inputFromTweets = PIInput.fromTweets(tweets),
  inputFromTexts = PIInput.fromTexts(texts);

You can use the result as payload for your IBM Watson Personality Insights service request.

See the complete example code for texts or the example code for tweets.

API Methods

Public methods:

  • fromTweets :: ([Tweet]) -> ContentItems - Transforms tweets into content items.
  • fromTexts :: ([String], Metadata) -> ContentItems - Transforms texts into content items. Metadata parameter is optional.

Where:

  • Tweet is a tweet as described in Twitter's Documentation.
  • ContentItems is an Object of the form { "ContentItems" : [ ContentItem ] }.
  • ContentItem is an Object as described in IBM Watson Personality Insights documentation.
  • Metadata is a subset of ContentItem, with attributes: Metadata { userid (string, optional): Unique identifier for the author of this content., sourceid (string, optional): Identifier for the source of this content, for example, blog123 or twitter., created (integer, optional): Timestamp that identifies when this content was created, in milliseconds since midnight 1/1/1970 UTC. Required only for results about temporal behavior data., language (string, optional): Language identifier (two-letter ISO 639-1 identifier). Both English ("en") and Spanish ("es") input content are supported. The default is English. In all cases, regional variants are treated as their parent language; for example, "en-US" is interpreted as "en". }

Build from source

You can run gulp command to build the component. Binaries will be deployed to bin folder.