<commit_before>var composebox_typeahead = (function () {

//************************************
// AN IMPORTANT NOTE ABOUT TYPEAHEADS
//************************************
// They do not do any HTML escaping, at all.
// And your input to them is rendered as though it were HTML by
// the default highlighter.
//
// So if you are not using trusted input, you MUST use the a
// highlighter that escapes (i.e. one that calls
// typeahead_helper.highlight_with_escaping).

var exports = {};

function get_pm_recipients(query_string) {
    // Assumes email addresses don't have commas or semicolons in them
    return query_string.split(/\s*[,;]\s*/);
}

// Returns an array of private message recipients, removing empty elements.
// For example, "a,,b, " => ["a", "b"]
exports.get_cleaned_pm_recipients = function (query_string) {
    var recipients = get_pm_recipients(query_string);
    recipients = _.filter(recipients, function (elem) {
        return elem.match(/\S/);
    });
    return recipients;
};

function case_insensitive_find(term, array) {
    var lowered_term = term.toLowerCase();
    return _.filter(array, function (elt) {
        return elt.toLowerCase() === lowered_term;
    }).length !== 0;
}

var seen_topics = new Dict();

exports.add_topic = function (stream, topic) {
    if (! seen_topics.has(stream)) {
        seen_topics.set(stream, []);
    }
    if (! case_insensitive_find(topic, seen_topics.get(stream))) {
        seen_topics.get(stream).push(topic);
        seen_topics.get(stream).sort();
    }
};

exports.topics_seen_for = function (stream) {
    if (seen_topics.has(stream)) {
        return seen_topics.get(stream);<commit_msg>Make topic autocompletes be case-insensitive w/r/t streams.<commit_after>var composebox_typeahead = (function () {

//************************************
// AN IMPORTANT NOTE ABOUT TYPEAHEADS
//************************************
// They do not do any HTML escaping, at all.
// And your input to them is rendered as though it were HTML by
// the default highlighter.
//
// So if you are not using trusted input, you MUST use the a
// highlighter that escapes (i.e. one that calls
// typeahead_helper.highlight_with_escaping).

var exports = {};

function get_pm_recipients(query_string) {
    // Assumes email addresses don't have commas or semicolons in them
    return query_string.split(/\s*[,;]\s*/);
}

// Returns an array of private message recipients, removing empty elements.
// For example, "a,,b, " => ["a", "b"]
exports.get_cleaned_pm_recipients = function (query_string) {
    var recipients = get_pm_recipients(query_string);
    recipients = _.filter(recipients, function (elem) {
        return elem.match(/\S/);
    });
    return recipients;
};

function case_insensitive_find(term, array) {
    var lowered_term = term.toLowerCase();
    return _.filter(array, function (elt) {
        return elt.toLowerCase() === lowered_term;
    }).length !== 0;
}

var seen_topics = new Dict();

exports.add_topic = function (stream, topic) {
    stream = stream.toLowerCase();
    if (! seen_topics.has(stream)) {
        seen_topics.set(stream, []);
    }
    if (! case_insensitive_find(topic, seen_topics.get(stream))) {
        seen_topics.get(stream).push(topic);
        seen_topics.get(stream).sort();
    }
};

exports.topics_seen_for = function (stream) {
    stream = stream.toLowerCase();
    if (seen_topics.has(stream)) {
        return seen_topics.get(stream);
{'fraction_non_alphanumeric': 0.16753623188405797, 'fraction_numerical': 0.0005797101449275362, 'mean_word_length': 3.6698240866035183, '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': '2116797', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1052, 'n_words': 283}