Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
A JavaScript based library that allows easy access to IBM Watson features utilizing Twitter data
A JavaScript based library that allows easy access to IBM Watson features utilizing Twitter data. IBM Watson has some of the most advanced linguistic analytics tools available today. Twitter is one of the world's most popular text-based communication platforms. Leverage the power of both with minimal effort through Personify.js.
Our current version implements:
##Installing
npm install personify --save
##Usage:
var Personify = require('personify');
// For every service you use through Watson, IBM will provide you with a separate set of
// OAuth credentials. See below to find out where to get these credentials.
var config = {
// example credentials for Watson Machine Translation service
translateConfig : {
service_url: '...',
service_username: '...',
service_password: '...'
},
// example credentials for Watson User Modeling service
personalityConfig : {
service_url: '...',
service_username: '...',
service_password: '...'
},
// example credentials for Twitter API
twitterConfig : {
consumer_key: '...',
consumer_secret: '...',
access_token: '...',
access_token_secret: '...'
}
};
//
// Instantiate a new Personify object and pass in OAuth credentials
// inside of an object literal
//
var P = new Personify(config);
//
// Use Watson to discover personality traits, values and needs for a Twitter user
// '@' can be used before a username, but is not required (e.g. '@userName')
//
var params1 = {
screen_name: 'userName'
count: 100
};
P.userPersonify( params1 , function (data, error) {
console.log(data, error);
});
//
// Watson provides a personality assessment of the combined input of tweets in a
// user's home timeline. Includes tweets from friends and accounts the user is following,
// and their retweets
//
var params2 = {
count: 100,
exclude_tweets: true
};
P.homePersonify( params2, function (data, error) {
console.log(data, error);
});
//
// Search Twitter with a (required) keyword. Accepts all of Twitter's optional search
// parameters and a few additional ones we've created for your convenience.
//
var params3 = {
q: '#JavaScript',
geocode: 'San Francisco' //geocode takes most major US cities and all US states
};
P.searchPersonify( params3 , function (data, error) {
console.log(data, error);
});
//
// Grab a number of Tweets in a specified language and get back both the original text and its
// translation in another destination language. Most of the search parameters available
// here are the same as those in our searchTweet method.
//
var params4 = {
q: 'JavaScript',
fromLanguage: 'ar', // Translate from Arabic
toLanguage: 'en', // to English
outputType: 'text' // Choose from text, json or XML
};
P.searchTranslate( params4 , function (data, error) {
console.log(data, error);
});
//
// Input a Twitter handle and get back their tweets translated
//
var params5 = {
screen_name: 'userName',
fromLanguage: 'en',
toLanguage: 'fr',
outputType: 'json'
};
P.userTranslate( params5, function(data, error){
console.log(data, error);
});
//
// Get tweets from your home timeline and have them translated into another language
//
var params6 = {
count: 150,
fromLanguage: 'en',
toLanguage: 'fr',
outputType: 'json'
};
P.homeTranslate( params6, function(data, error){
console.log(data, error);
});
//
// Find public tweets talkng about the Large Hadron Collider using Twitter's Streaming API and
// translate them into another language
//
var params7 = {
track: 'Large Hadron Collider'
fromLanguage: 'en',
toLanguage: 'fr',
outputType: 'text'
};
P.streamTranslate( params7, function(data, error){
console.log(data, error);
});
Instantiate a new Personify object and pass in a config.
config - Type: Object
At least one set of OAuth credentials from both Twitter and IBM Bluemix are required to use the services Personify.js leverages for you.
userName - Type: String
Required. Represents a Twitter handle. Optionally you can include an '@' before the username.
See here for more information on optional parameters.
[params] - Type: Object
Key-value pairs inside of [params] are optional, but at least an empty object literal is required.
See here for more information on optional parameters.
input Type: String
The 'q' key and its associated value, which is a string, are required. input can be any word you may use to search in Twitter's internal search engine. Any additional search parameters are optional.
See here for more information on optional parameters.
var params = { q: input, fromLanguage: 'en', toLanguage: 'fr', outputType: 'json' }
params - Type: Object
input - Type: String
or Number
or Array
Language key:
Output Types:
All keys shown in params
are required.
See here for more information on optional parameters.
var params = { screen_name: input, fromLanguage: 'en', toLanguage: 'fr', outputType: 'json' }
params - Type: Object
Please see Language key and Output Types under searchTranslate method in API.
See here for more information on optional parameters.
var params = { fromLanguage: 'en', toLanguage: 'fr', outputType: 'json' }
All keys in params are required. Optionally you can specify a count
key. This limits the number of Tweets for the search.
count : val
val - Type: Number
val defaults to 20 and has a max of 200.
See here for more information on optional parameters.
var params = { track: input, fromLanguage: 'en', toLanguage: 'fr', outputType: 'json' }
All keys in params are required for streaming. Please see Language key and Output Type options under searchTranslate method in API.
Additionally, optional search parameters that can be added to params:
boundingBox - Type: Array
boundingBox coordinates can be found here
boundingBox example: var sanFrancisco = [ '-122.75', '36.8', '-121.75', '37.8' ];
time - Type: Number
time is the number of miliseconds after the stream starts that you want the stream to stop
See here for more information on optional parameters.
Type: Function
##Find your OAuth credentials
Go here to create a Twitter app and get OAuth credentials (if you haven't already): https://dev.twitter.com/apps/new
In order to use IBM Watson, you need to:
##How do I run the tests?
To make the tests pass you will need to fill out the file: config.js
inside the tests folder.
To run the tests:
npm test
See
Our PersonifyApp grabs tweets based on a keyword search and geolocation parameters and returns a Big Five assessment based on those tweets. It then compares that local result to the US in general. A company for example, might be interested to know about the collective Big Five traits of people who are talking about their products, services or brand.
FAQs
A JavaScript based library that allows easy access to IBM Watson features utilizing Twitter data
The npm package personify receives a total of 0 weekly downloads. As such, personify popularity was classified as not popular.
We found that personify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.