<commit_before>var sep = '`';

function rr(min, max) {
  if (!max) {
    max = min;
    min = 0;
  }
  return Math.floor(Math.random()*(max - min) + min);
}

function choose(collection, space) {
  var after = (space) ? ' ' : '';
  return collection[rr(collection.length)] + after;
}

function resolveNode(node) {
  var alternatives = node.innerHTML;
  if (alternatives.length > 1) {
    node
      .html(choose(alternatives.split(sep)))
      .addClass('is-done');
  }
}

function writeNovel(novel) {
  //$('q').each(resolveNode);
}

var novel = document.querySelector('.c-main');
writeNovel(novel);<commit_msg>Text expansion code tweaks (still broken, though!)<commit_after>var sep = '`';

function rr(min, max) {
  if (!max) {
    max = min;
    min = 0;
  }
  return Math.floor(Math.random()*(max - min) + min);
}

function choose(collection, space) {
  var after = (space) ? ' ' : '';
  return collection[rr(collection.length)] + after;
}

function resolveNode(node) {
  var alternatives = node.innerHTML;
  if (alternatives.indexOf(sep) > 0) {
    node
      .html(choose(alternatives.split(sep)))
      .addClass('is-done');
  }
}

function writeNovel(novel) {
  $('q').each(resolveNode);
}

var novel = document.querySelector('.c-main');
writeNovel(novel);
{'fraction_non_alphanumeric': 0.1789390340459224, 'fraction_numerical': 0.003167062549485352, 'mean_word_length': 3.6988847583643123, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7081225', 'n_tokens_mistral': 452, 'n_tokens_neox': 442, 'n_words': 89}