Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Clone in Desktop Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (14 sloc) 486 Bytes
'use strict';
var Q = require('q');
var childProcess = require('child_process');
var chatBot = {
generateResponse: function(query) {
var deferred = Q.defer();
var execString = Math.random() <= 0.85 ? 'python alice.py ' + '"' + query + '"' : 'python generate_rude_text.py ' + '"' + query + '"';
childProcess.exec(execString, function(error, stdout, stderr) {
deferred.resolve(stdout);
});
return deferred.promise;
}
};
module.exports = chatBot;
Jump to Line
Something went wrong with that request. Please try again.