Created
July 6, 2014 13:24
-
-
Save ixixi/ae6c91f318d40c7b0112 to your computer and use it in GitHub Desktop.
analyze_comment_wrapper.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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