<commit_before>/*!
 * Emojie
 *
 * Copyright (C) 2011 by <NAME>
 * Licensed under the MIT license
 */

(function(window, undefined) {
  var emojis = {};

  function traverseTextNodes(root, callback) {
    if (root == null) { return; }

    traverseTextNodes(root.nextSibling, callback);

    if (root.nodeType == 3) {
      return callback(root);
    }

    traverseTextNodes(root.firstChild, callback);
  }

  function emojiElement(emoji, options) {
    var element = document.createElement(options["elementName"] || "img");
    element.textContent = options["content"];

    for (attr in options) {
      if (attr != "content" && attr != "elementName") {
        element.setAttribute(attr, options[attr])
      }
    }
    return element
  }

  function textNodeReplacer(emojis) {
    return function replacer(node) {
      var string = node.data;
      var i = 0;
      var emoji, rest;
      var buffer = "";

      for (i = 0; i < string.length; i++) {
        buffer += string[i];
        if (emojis[buffer] === true) {
          continue;
        } else if (emojis[buffer]) {
          emoji = node.splitText(i - buffer.length + 1);

          if (emoji.length > buffer.length) {
            rest = emoji.splitText(buffer.length);
          }
          node.parentNode.replaceChild(emojiElement(emoji, emojis[buffer]), emoji);

          if (rest) {
            return replacer(rest);
          } else {<commit_msg>Don't try to set element.textContent unless it's defined<commit_after>/*!
 * Emojie
 *
 * Copyright (C) 2011 by <NAME>
 * Licensed under the MIT license
 */

(function(window, undefined) {
  var emojis = {};

  function traverseTextNodes(root, callback) {
    if (root == null) { return; }

    traverseTextNodes(root.nextSibling, callback);

    if (root.nodeType == 3) {
      return callback(root);
    }

    traverseTextNodes(root.firstChild, callback);
  }

  function emojiElement(emoji, options) {
    var element = document.createElement(options["elementName"] || "img");
    if (options["content"] != null) {
      element.textContent = options["content"];
    }

    for (attr in options) {
      if (attr != "content" && attr != "elementName") {
        element.setAttribute(attr, options[attr])
      }
    }
    return element
  }

  function textNodeReplacer(emojis) {
    return function replacer(node) {
      var string = node.data;
      var i = 0;
      var emoji, rest;
      var buffer = "";

      for (i = 0; i < string.length; i++) {
        buffer += string[i];
        if (emojis[buffer] === true) {
          continue;
        } else if (emojis[buffer]) {
          emoji = node.splitText(i - buffer.length + 1);

          if (emoji.length > buffer.length) {
            rest = emoji.splitText(buffer.length);
          }
          node.parentNode.replaceChild(emojiElement(emoji, emojis[buffer]), emoji);

          if (rest) {
            return replacer(rest);
          } else {
{'fraction_non_alphanumeric': 0.1360381861575179, 'fraction_numerical': 0.005455165359699966, 'mean_word_length': 2.407665505226481, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3886718', 'n_tokens_mistral': 926, 'n_tokens_neox': 899, 'n_words': 214}