<commit_before>$( document ).ready(function(){

  $("input").attr("maxlength", 1);

  var matrix = undefined;
  var dimension = undefined;
  var letters = [];
  var words = [];
  var alphabet = '<KEY>';
  var dict_en = {};

  // fetch English dictionary
  $.get('/dict_en', null, function(response){
    dict_en = response;
    $('#finder').removeAttr('disabled');
  });

  $("#ramdomizer").click(function(event){
    $('.results').hide();
    $.makeArray($('input')).forEach(function(el){
      var random = Math.ceil( (Math.random() * 25) );
      $(el).val( alphabet[random] );
    });
  });


  $("#finder").click(function(event){
    timer.start();

    // can't have it working properly :(
    // $('.loading').show();

    // build matrix of all letters
    letters = jQuery.makeArray($('input')).map(function(el){
      return $(el).val();
    });
    dimension = Math.sqrt( letters.length );
    matrix = new Array(dimension);
    for(var i=0; i < dimension; i++){
      matrix[i] = new Array(dimension);
      for(var j=0; j < dimension; j++){
        matrix[i][j] = letters[j*dimension + i];
      }
    }

    // find all possible letter combinations
    words = [];
    for(i = 0; i < dimension; i++){
      for(j = 0; j < dimension; j++){
        spread( new Word([[i, j]]) );
      }
    }

    // max of 5-letter words for now (otherwise too slow)
    for(i = 0; i < 3; i++){
      words.forEach(function(e){<commit_msg>sets a limit of 4 letters per word (otherwise too slow)<commit_after>$( document ).ready(function(){

  $("input").attr("maxlength", 1);

  var matrix = undefined;
  var dimension = undefined;
  var letters = [];
  var words = [];
  var alphabet = 'abcdefghijklmnopqrstuvwxyz';
  var dict_en = {};

  // fetch English dictionary
  $.get('/dict_en', null, function(response){
    dict_en = response;
    $('#finder').removeAttr('disabled');
  });

  $("#ramdomizer").click(function(event){
    $('.results').hide();
    $.makeArray($('input')).forEach(function(el){
      var random = Math.ceil( (Math.random() * 25) );
      $(el).val( alphabet[random] );
    });
  });


  $("#finder").click(function(event){
    timer.start();

    // can't have it working properly :(
    // $('.loading').show();

    // build matrix of all letters
    letters = jQuery.makeArray($('input')).map(function(el){
      return $(el).val();
    });
    dimension = Math.sqrt( letters.length );
    matrix = new Array(dimension);
    for(var i=0; i < dimension; i++){
      matrix[i] = new Array(dimension);
      for(var j=0; j < dimension; j++){
        matrix[i][j] = letters[j*dimension + i];
      }
    }

    // find all possible letter combinations
    words = [];
    for(i = 0; i < dimension; i++){
      for(j = 0; j < dimension; j++){
        spread( new Word([[i, j]]) );
      }
    }

    // max of 4-letter words for now (otherwise too slow)
    for(i = 0; i < 2; i++){
      words.forEach(function(e){
{'fraction_non_alphanumeric': 0.2010221465076661, 'fraction_numerical': 0.007155025553662692, 'mean_word_length': 2.759282970550576, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 4, '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': '6244026', 'n_tokens_mistral': 966, 'n_tokens_neox': 918, 'n_words': 235}