<commit_before>Fs    = require 'fs'
Url   = require 'url'
Path  = require 'path'
Redis = require 'redis'

class Robot
  # Robots receive messages from a chat source (Campfire, irc, etc), and
  # dispatch them to matching listeners.
  #
  # path - String directory full of Hubot scripts to load.
  constructor: (path, name = "Hubot") ->
    @name      = name
    @user      = []
    @commands  = []
    @listeners = []
    @loadPaths = []
    @Response  = Robot.Response
    @brain     = new Robot.Brain()
    if path then @load path

  # Public: Adds a Listener that attempts to match incoming messages based on
  # a Regex.
  #
  # regex    - A Regex that determines if the callback should be called.
  # callback - A Function that is called with a Response object.
  #
  # Returns nothing.
  hear: (regex, callback) ->
    @listeners.push new Listener(@, regex, callback)

  # Public: Adds a Listener that attempts to match incoming messages directed at the robot
  # based on a Regex.
  #
  # regex    - A Regex that determines if the callback should be called.
  # callback - A Function that is called with a Response object.
  #
  # Returns nothing.
  respond: (regex, callback) ->
    re = regex.toString().split("/")
    newRegex = new RegExp("#{@name}:?\\s*#{re[1]}", re[2])
    @listeners.push new Listener(@, newRegex, callback)<commit_msg>unused variable<commit_after>Fs    = require 'fs'
Url   = require 'url'
Path  = require 'path'
Redis = require 'redis'

class Robot
  # Robots receive messages from a chat source (Campfire, irc, etc), and
  # dispatch them to matching listeners.
  #
  # path - String directory full of Hubot scripts to load.
  constructor: (path, name = "Hubot") ->
    @name      = name
    @commands  = []
    @listeners = []
    @loadPaths = []
    @Response  = Robot.Response
    @brain     = new Robot.Brain()
    if path then @load path

  # Public: Adds a Listener that attempts to match incoming messages based on
  # a Regex.
  #
  # regex    - A Regex that determines if the callback should be called.
  # callback - A Function that is called with a Response object.
  #
  # Returns nothing.
  hear: (regex, callback) ->
    @listeners.push new Listener(@, regex, callback)

  # Public: Adds a Listener that attempts to match incoming messages directed at the robot
  # based on a Regex.
  #
  # regex    - A Regex that determines if the callback should be called.
  # callback - A Function that is called with a Response object.
  #
  # Returns nothing.
  respond: (regex, callback) ->
    re = regex.toString().split("/")
    newRegex = new RegExp("#{@name}:?\\s*#{re[1]}", re[2])
    @listeners.push new Listener(@, newRegex, callback)
{'fraction_non_alphanumeric': 0.10961968680089486, 'fraction_numerical': 0.0014914243102162564, 'mean_word_length': 2.8884057971014494, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6464013', 'n_tokens_mistral': 819, 'n_tokens_neox': 814, 'n_words': 317}