<commit_before>'use strict';
const app = require('app');
const BrowserWindow = require('browser-window');
const Menu = require('menu');
const MenuItem = require('menu-item');
const child_process = require('child_process');
const fs = require('fs');

let mainWindow;
let menu;

app.on('ready', function() {
  menu = new Menu();

  menu.append(new MenuItem({
    label: 'Test'
  }));

  mainWindow = new BrowserWindow({
    width: 800,
    height: 600
  });

  callJava('resources/boa/boa-runner.jar');
  //mainWindow.setMenu(menu);

  mainWindow.loadUrl(`file://${__dirname}/index.html`);
  mainWindow.on('move', function() {
    //console.log(mainWindow.getTitle());
  });

  console.log(`The current version of io.js is ${process.version}`);
});



function callJava(uri) {
  var cp = child_process.exec(`java -jar ${uri}`, function(error, stdout, stderr) {
    console.log('stdout: ' + stdout);
  });
}<commit_msg>some regex on the boa output removing square brackets.<commit_after>'use strict';
const app = require('app');
const BrowserWindow = require('browser-window');
const Menu = require('menu');
const MenuItem = require('menu-item');
const child_process = require('child_process');
const fs = require('fs');

let mainWindow;
let menu;

app.on('ready', function() {
  menu = new Menu();

  menu.append(new MenuItem({
    label: 'Test'
  }));

  mainWindow = new BrowserWindow({
    width: 800,
    height: 600
  });

  callJava('resources/boa/boa-runner.jar');
  //mainWindow.setMenu(menu);

  mainWindow.loadUrl(`file://${__dirname}/index.html`);
  mainWindow.on('move', function() {
    //console.log(mainWindow.getTitle());
  });

  console.log(`The current version of io.js is ${process.version}`);
});

function parseToJSON(boa) {
  let lines = boa.split('\n');
  for (let line of lines) {
    console.log(line);
    let matches = line.match(/\[(.*?)\]/g);
    if (matches) {
      for (let match of matches) {
        console.log(match);
      }
    }
  }
}


function callJava(uri) {
  var cp = child_process.exec(`java -jar ${uri}`, function(error, stdout, stderr) {
    console.log('stdout: ' + stdout);
    let json = parseToJSON(stdout);
  });
}
{'fraction_non_alphanumeric': 0.18244803695150116, 'fraction_numerical': 0.005542725173210162, 'mean_word_length': 3.9452054794520546, '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': '2285960', 'n_tokens_mistral': 730, 'n_tokens_neox': 704, 'n_words': 163}