1.0.4 • Published 9 years ago
personality-insights-input v1.0.4
Personality Insights Input
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.- Metadataparameter is optional.
Where:
- Tweetis a tweet as described in Twitter's Documentation.
- ContentItemsis an- Objectof the form- { "ContentItems" : [ ContentItem ] }.
- ContentItemis an- Objectas described in IBM Watson Personality Insights documentation.
- Metadatais 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.