<commit_before>(function(tree) {

tree.Filter = function Filter(key, op, val, index) {
    this.key = key instanceof tree.Quoted ? key.value : key;
    this.op = op;
    this.val = val instanceof tree.Quoted ? val.value : val;
    if (op !== '=' && op !== '!=') {
        this.val = 1*this.val;
        if (isNaN(this.val)) {
            throw {
                message: 'Cannot use operator "' + op + '" with value ' + val,
                index: index
            };
        }
    }
    this.id = this.key + this.op + this.val;
};


var opXML = {
    '<': '&lt;',
    '>': '&gt;',
    '=': '=',
    '!=': '!=',
    '<=': '&lt;=',
    '>=': '&gt;='
};

var opNegate = {
    '<': '>=',
    '<=': '>',
    '>': '<=',
    '>=': '<',
    '=': '!=',
    '!=': '='
};


tree.Filter.prototype.toXML = function(env) {
    if (typeof this.val === 'number') var value = this.val;
    else var value = '\'' + ('' + this.val).replace(/'/g, '\'') + '\'';
    return '[' + this.key + '] ' + opXML[this.op] + ' ' + value;
};

tree.Filter.prototype.toString = function() {
    return '[' + this.id + ']';
};

/**
 * Negate this filter: warning - this changes
 * the filter itself.
 */<commit_msg>fix escaping<commit_after>(function(tree) {

tree.Filter = function Filter(key, op, val, index) {
    this.key = key instanceof tree.Quoted ? key.value : key;
    this.op = op;
    this.val = val instanceof tree.Quoted ? val.value : val;
    if (op !== '=' && op !== '!=') {
        this.val = 1*this.val;
        if (isNaN(this.val)) {
            throw {
                message: 'Cannot use operator "' + op + '" with value ' + val,
                index: index
            };
        }
    }
    this.id = this.key + this.op + this.val;
};


var opXML = {
    '<': '&lt;',
    '>': '&gt;',
    '=': '=',
    '!=': '!=',
    '<=': '&lt;=',
    '>=': '&gt;='
};

var opNegate = {
    '<': '>=',
    '<=': '>',
    '>': '<=',
    '>=': '<',
    '=': '!=',
    '!=': '='
};


tree.Filter.prototype.toXML = function(env) {
    if (this.key.indexOf("'") >= 0)
        var key = "'" + this.key.replace(/'/g, "\\'") + "'";
    if (this.val.replace)
        var val = "'" + this.val.replace(/'/g, "\\'") + "'";

    return '[' + (key || this.key) + '] ' + opXML[this.op] + ' ' + (val || this.val);
};

tree.Filter.prototype.toString = function() {
    return '[' + this.id + ']';
};

/**
 * Negate this filter: warning - this changes
 * the filter itself.
 */
{'fraction_non_alphanumeric': 0.26036960985626284, 'fraction_numerical': 0.0012320328542094457, 'mean_word_length': 2.0, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 16, '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': '4787835', 'n_tokens_mistral': 921, 'n_tokens_neox': 901, 'n_words': 167}