<commit_before>var Gopigo = require('../node-gopigo');
var Commands = Gopigo.commands;
var Robot = Gopigo.robot;

class piJS
{
  /**
   * Constructor function. Gets called when class is made into a object
   * @param {Object} cfg
   */
  constructor(cfg) {

    this._robot = null;
    this._cfg = cfg;

    this.createRobot();
    this.initRobot();
    this.listenEvents();
    this.sendReadyMessage();
  }

  sendReadyMessage() {
    console.log('piJS Module ready');
    console.log(' Welcome to the GoPiGo test application             ')
    console.log(' When asked, insert a command to test your GoPiGo   ')
    console.log(' (!) For a complete list of commands, please type help')
  }

  listenEvents() {
    this._robot.on('init', (res) => {
      this.onInit(res);
    });
    this._robot.on('error', (err) => {
      this.onError(err);
    });<commit_msg>First init listeners, then init<commit_after>var Gopigo = require('../node-gopigo');
var Commands = Gopigo.commands;
var Robot = Gopigo.robot;

class piJS
{
  /**
   * Constructor function. Gets called when class is made into a object
   * @param {Object} cfg
   */
  constructor(cfg) {

    this._robot = null;
    this._cfg = cfg;

    this.createRobot();
    this.listenEvents();
    this.initRobot();
    this.sendReadyMessage();
  }

  sendReadyMessage() {
    console.log('piJS Module ready');
    console.log(' Welcome to the GoPiGo test application             ')
    console.log(' When asked, insert a command to test your GoPiGo   ')
    console.log(' (!) For a complete list of commands, please type help')
  }

  listenEvents() {
    this._robot.on('init', (res) => {
      console.log('INIT DONE');
      this.onInit(res);
    });
    this._robot.on('error', (err) => {
      this.onError(err);
    });
{'fraction_non_alphanumeric': 0.1455056179775281, 'fraction_numerical': 0.0, 'mean_word_length': 2.7893617021276595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1871570', 'n_tokens_mistral': 582, 'n_tokens_neox': 573, 'n_words': 150}