Skip to content

Instantly share code, notes, and snippets.

@ixixi
Created July 6, 2014 13:24
Show Gist options
  • Save ixixi/ae6c91f318d40c7b0112 to your computer and use it in GitHub Desktop.
Save ixixi/ae6c91f318d40c7b0112 to your computer and use it in GitHub Desktop.
analyze_comment_wrapper.js
#!/usr/bin/env node
var utf8 = require('utf8');
var msgpack = require('msgpack');
var module = require('./analyze');
var key = 'message';
var readline = require('readline'),
rl = readline.createInterface( {
input: process.stdin,
output: process.stdout,
terminal: false
});
rl.on('line', function (msgline) {
var msg = JSON.parse(msgline);
msg.classified = module.analyzeComment(msg[key]);
process.stdout.write(msgpack.pack(msg));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment