<commit_before>/**
 *
 * @source: https://github.com/voxity/voxity-chrome-extension/blob/master/parseNumbers.js
 *
 * @licstart  The following is the entire license notice for the 
 *  JavaScript code in this page.
 *
 * Copyright (C) 2014  Voxity
 *
 *
 * The JavaScript code in this page is free software: you can
 * redistribute it and/or modify it under the terms of the GNU
 * General Public License (GNU GPL) as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option)
 * any later version.  The code is distributed WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
 *
 * As additional permission under GNU GPL version 3 section 7, you
 * may distribute non-source (e.g., minimized or compacted) forms of
 * that code without the copy of the GNU GPL normally required by
 * section 4, provided you include this license notice and a URL
 * through which recipients can access the Corresponding Source.
 *
 * @licend  The above is the entire license notice
 * for the JavaScript code in this page.
 *
 */

function replaceInElement(element, find, replace) {
  // iterate over child nodes in reverse, as replacement may increase
  // length of child node list.
  for (var i = element.childNodes.length; i-->0;) {
    var child = element.childNodes[i];
    if (child.nodeType == 1) { // ELEMENT_NODE
      var tag = child.nodeName.toLowerCase();
      var exclude_elem = Array('style','script', 'textarea')
      if(exclude_elem.indexOf(tag) == -1){
	console.log(tag);
	replaceInElement(child, find, replace);
      }
    } else if (child.nodeType == 3) { // TEXT_NODE
      replaceInText(child, find, replace);
    }
  }
}

function replaceInText(text, find, replace) {
  var match;
  while (match = find.exec(text.data)) {
    text.splitText(match.index);
    text.nextSibling.splitText(match[0].length);
    text.parentNode.replaceChild(replace(match), text.nextSibling);
  }
}

// keywords to match. This *must* be a 'g'lobal regexp or it'll fail bad
var find = /\+?([0-9]\s?\.?){10,}/gi;

function callbackReplace(match) {
  var link = document.createElement('a');
  link.href = '#';
  link.className = 'voxity-tel';
  link.appendChild(document.createTextNode(match[0]));
  return link;
}
// replace matched strings with wiki links
replaceInElement(document.body, find, callbackReplace);
<commit_msg>Remove logging<commit_after>/**
 *
 * @source: https://github.com/voxity/voxity-chrome-extension/blob/master/parseNumbers.js
 *
 * @licstart  The following is the entire license notice for the 
 *  JavaScript code in this page.
 *
 * Copyright (C) 2014  Voxity
 *
 *
 * The JavaScript code in this page is free software: you can
 * redistribute it and/or modify it under the terms of the GNU
 * General Public License (GNU GPL) as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option)
 * any later version.  The code is distributed WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
 *
 * As additional permission under GNU GPL version 3 section 7, you
 * may distribute non-source (e.g., minimized or compacted) forms of
 * that code without the copy of the GNU GPL normally required by
 * section 4, provided you include this license notice and a URL
 * through which recipients can access the Corresponding Source.
 *
 * @licend  The above is the entire license notice
 * for the JavaScript code in this page.
 *
 */

function replaceInElement(element, find, replace) {
  // iterate over child nodes in reverse, as replacement may increase
  // length of child node list.
  for (var i = element.childNodes.length; i-->0;) {
    var child = element.childNodes[i];
    if (child.nodeType == 1) { // ELEMENT_NODE
      var tag = child.nodeName.toLowerCase();
      var exclude_elem = Array('style','script', 'textarea')
      if(exclude_elem.indexOf(tag) == -1){
	replaceInElement(child, find, replace);
      }
    } else if (child.nodeType == 3) { // TEXT_NODE
      replaceInText(child, find, replace);
    }
  }
}

function replaceInText(text, find, replace) {
  var match;
  while (match = find.exec(text.data)) {
    text.splitText(match.index);
    text.nextSibling.splitText(match[0].length);
    text.parentNode.replaceChild(replace(match), text.nextSibling);
  }
}

// keywords to match. This *must* be a 'g'lobal regexp or it'll fail bad
var find = /\+?([0-9]\s?\.?){10,}/gi;

function callbackReplace(match) {
  var link = document.createElement('a');
  link.href = '#';
  link.className = 'voxity-tel';
  link.appendChild(document.createTextNode(match[0]));
  return link;
}
// replace matched strings with wiki links
replaceInElement(document.body, find, callbackReplace);

{'fraction_non_alphanumeric': 0.10970118706508392, 'fraction_numerical': 0.007367990176013099, 'mean_word_length': 3.712632594021215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '2045051', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1411, 'n_words': 526}