<commit_before>function include_keyword_replacement() {
    var comment_add_timer = setInterval(checkForCommentInput, 100);

    var emote_map = {
        "NotLikeThis" : "😱",
        "FailFish" : "😑",
        "Keepo" : "🐼",
        "KappaPride" : "👬",
        "Kreygasm" : "😚",
        "SwiftRage" : "😠",
        "OhMyDog" : "🐶",
        "ResidentSleeper" : "😴",
        "BabyRage" : "😨",
        "PogChamp" : "😯",
        "WutFace" : "😧",
        "FeelsBadMan" : "😖",
        "BibleThumb" : "😭",
        "4Head" : "😏",
        "MingLee" : "🐯",
        "EleGiggle" : "😁",
        "DansGame" : "👿"
    };

    var all_triggers = new RegExp(Object.keys(emote_map).join("|"));

    function checkForCommentInput() {
      if (document.readyState != 'complete') return;
      var textInput = document.getElementById("live-comments-input-field");
      
      // are we on Youtube live? Here, the chat loads later
      if (document.getElementById("watch-sidebar-discussion") != null && textInput == null) return;
      if (textInput != null) {
        textInput.addEventListener("keyup", function(event) {
            if (all_triggers.test(textInput.innerHTML)) {
                var theInnerHTML = textInput.innerHTML;
                for (var key in emote_map) {
                    if (emote_map.hasOwnProperty(key)) {
                        theInnerHTML = theInnerHTML.replace(key, emote_map[key]);
                    }
                }
                textInput.innerHTML = theInnerHTML;
                placeCaretAtEnd(textInput);
            }
        });
      }
      clearInterval(comment_add_timer);
    }

    // http://stackoverflow.com/questions/4233265/contenteditable-set-caret-at-the-end-of-the-text-cross-browser
}
<commit_msg>use proper RegExp for replacement<commit_after>function include_keyword_replacement() {
    var comment_add_timer = setInterval(checkForCommentInput, 100);

    var emote_map = {
        "NotLikeThis" : "😱",
        "FailFish" : "😑",
        "Keepo" : "🐼",
        "KappaPride" : "👬",
        "Kreygasm" : "😚",
        "SwiftRage" : "😠",
        "OhMyDog" : "🐶",
        "ResidentSleeper" : "😴",
        "BabyRage" : "😨",
        "PogChamp" : "😯",
        "WutFace" : "😧",
        "FeelsBadMan" : "😖",
        "BibleThumb" : "😭",
        "4Head" : "😏",
        "MingLee" : "🐯",
        "EleGiggle" : "😁",
        "DansGame" : "👿"
    };

    var emotePattern = new RegExp(Object.keys(emote_map).join("|"));

    function checkForCommentInput() {
      if (document.readyState != 'complete') return;
      var textInput = document.getElementById("live-comments-input-field");
      
      // are we on Youtube live? Here, the chat loads later
      if (document.getElementById("watch-sidebar-discussion") != null && textInput == null) return;
      if (textInput != null) {
        textInput.addEventListener("keyup", function(event) {
            var replaced = false;
            var theInnerHTML = textInput.innerHTML.replace(emotePattern, function(token) {
                replaced = true;
                return emote_map[token];
            });
            if (replaced) textInput.innerHTML = theInnerHTML;
            placeCaretAtEnd(textInput);
        });
      }
      clearInterval(comment_add_timer);
    }

    // http://stackoverflow.com/questions/4233265/contenteditable-set-caret-at-the-end-of-the-text-cross-browser
}

{'fraction_non_alphanumeric': 0.1532997928381178, 'fraction_numerical': 0.006510802012429713, 'mean_word_length': 2.120960295475531, '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': '2934863', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1129, 'n_words': 194}