<commit_before>var markov = require('markov');


var Markov = function() {
  this.hooks = ['markov'];
};

Markov.prototype.markov = function (bot, to, from, msg, callback) {
  var nicks = bot.users(to);

  var random = Math.floor(Math.random() * nicks.length);

  var nick = nicks[random];

  bot.getLogs(to, 500, nick, function(err, logs) {
    if (err) {
      callback();
      return;
    }

    combinedLogs = logs.reduce(function(seed, val) {
      return seed + " " + val.msg;
    }, "");

    var m = markov(2);

    m.seed(combinedLogs, function() {
      bot.say(to, m.respond(msg).join(' '));
      callback();
      return;
    });
  })
};<commit_msg>Add name for markov chain.<commit_after>var markov = require('markov');


var Markov = function() {
  this.hooks = ['markov'];
};

Markov.prototype.markov = function (bot, to, from, msg, callback) {
  var nicks = bot.users(to);

  var random = Math.floor(Math.random() * nicks.length);

  var nick = nicks[random];

  bot.getLogs(to, 500, nick, function(err, logs) {
    if (err) {
      callback();
      return;
    }

    combinedLogs = logs.reduce(function(seed, val) {
      return seed + " " + val.msg;
    }, "");

    var m = markov(2);

    m.seed(combinedLogs, function() {
      bot.say(to, nick + " says: " + m.respond(msg).join(' '));
      callback();
    });
  })
};
{'fraction_non_alphanumeric': 0.18377976190476192, 'fraction_numerical': 0.005952380952380952, 'mean_word_length': 2.788732394366197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5128799', 'n_tokens_mistral': 493, 'n_tokens_neox': 476, 'n_words': 103}