Skip to content

Instantly share code, notes, and snippets.

var _ = require('underscore'),
cheerio = require('cheerio'),
request = require('request'),
AYLIENTextAPI = require("aylien_textapi");
var textapi = new AYLIENTextAPI({
application_id: "YourApplicationId",
application_key: "YourApplicationKey"
});
@AYLIEN
AYLIEN / aylien_textapi_sample_important_concepts.js
Last active February 2, 2016 13:05
Sort Concepts by Relevance
var _ = require('underscore'),
AYLIENTextAPI = require("aylien_textapi");
var textapi = new AYLIENTextAPI({
application_id: "YourApplicationId",
application_key: "YourApplicationKey"
});
function escapeRegExp(r) {
return r.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
@AYLIEN
AYLIEN / aylien_textapi_sample_related.js
Last active August 29, 2015 14:24
Randomly rewrite a news article
@AYLIEN
AYLIEN / rssToEmail.js
Created April 10, 2015 16:56
Newswire Sample
//**************************************
//Configuration details specific to you.
//**************************************
const AYLIEN_APP_ID = YOUR_AYLIEN_APP_ID;
const AYLIEN_APP_KEY = YOUR_AYLIEN_APP_KEY;
const MAILGUN_API_KEY = YOUR_MAILGUN_API_KEY;
const SENDING_EMAIL_ACCOUNT = 'sending@example.com';
const RECIPIENTS = 'Recipient 1 <recipient@example.com>';
const NUM_STORRIES_PER_RSS_FEED = 3;
var rssFeeds = [
@AYLIEN
AYLIEN / aylien_textapi_sample_feed.js
Created January 26, 2015 17:52
News Extraction and Analysis
//**********************************************************
// This application takes a web site address 'webSite'and
// searches it for an RSS feed. If an RSS feed is found the
// address is displayed along with the first 'numberOfStories'.
// Try it for yourself by specififying a website below.
//**********************************************************
var webSite = 'http://gigaom.com/';
var numberOfStories = 3;
@AYLIEN
AYLIEN / aylien_textapi_sample_subreddits.js
Last active August 29, 2015 14:11
Analyzing SubReddits
//**********************************************************************
// Enter a SubReddit below (var subReddit = 'technology') to
// receive an analysis of the top stories.
//**********************************************************************
var subReddit = 'technology';
var numberOfStories = 3;
var AYLIENTextAPI = require('aylien_textapi'),
request = require('request'),
@AYLIEN
AYLIEN / aylien_textapi_sample_tweets_sentiment.js
Last active April 22, 2016 09:11
Twitter Sentiment Analysis
//**********************************************************************
// Enter the Twitter handle below (var twitterHandle = 'BBCBreaking') to
// see a Sentiment Analysis of the first 10 tweets.
// :-) = positive, :-| = neutral, :-( = negative
//**********************************************************************
var AYLIENTextAPI = require('aylien_textapi'),
request = require('request'),
cheerio = require('cheerio');
var textapi = new AYLIENTextAPI({
@AYLIEN
AYLIEN / aylien_textapi_sample_basic.js
Last active August 29, 2015 14:11
Basic functions
//**********************************************************
// Here's a basic app that uses AYLIEN's Text Analysis API
// through the Node.js SDK. To install the SDK using `npm`:
// $ npm install aylien_textapi
//**********************************************************
var AYLIENTextAPI = require('aylien_textapi');
var textapi = new AYLIENTextAPI({
application_id: 'YourApplicationId',
application_key: 'YourApplicationKey'
});
@AYLIEN
AYLIEN / aylien_textapi_sample_hntop.js
Created December 12, 2014 12:47
HN Top 5 Stories with Summary
var AYLIENTextAPI = require('aylien_textapi'),
request = require('request'),
xml2js = require('xml2js');
var textapi = new AYLIENTextAPI({
application_id: 'YourApplicationId',
application_key: 'YourApplicationKey'
});
var parser = new xml2js.Parser();
@AYLIEN
AYLIEN / index.js
Created November 17, 2014 15:31
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")