<commit_before>var Montage = require("montage").Montage;

/**
 * Defines the criteria that objects must satisfy to be included in a data set
 * as well as other characteristics the data set must possess.
 *
 * @class
 * @extends external:Montage
 */
exports.DataSelector = Montage.specialize(/** @lends DataSelector# */{

    /**
     * The type of the data object to retrieve.
     *
     * @type {ObjectDescriptor}
     */
    type: {
        value: undefined
    },

    /**
     * A set of named values defining the criteria that must be satisfied by
     * objects for them to be included in the data set defined by this selector.
     *
     * Properties and corresponding values can be added or removed from the
     * criteria object but that criteria object itself cannot be replaced.
     *
     * @type {Object}
     */
    criteria: {
        get: function () {
            if (!this._criteria) {
                this._criteria = {};
            }
            return this._criteria;
        }
    }

});<commit_msg>Add a DataSelector creation convenience method<commit_after>var Montage = require("montage").Montage;

/**
 * Defines the criteria that objects must satisfy to be included in a data set
 * as well as other characteristics the data set must possess.
 *
 * @class
 * @extends external:Montage
 */
exports.DataSelector = Montage.specialize(/** @lends DataSelector# */{

    /**
     * The type of the data object to retrieve.
     *
     * @type {ObjectDescriptor}
     */
    type: {
        value: undefined
    },

    /**
     * A set of named values defining the criteria that must be satisfied by
     * objects for them to be included in the data set defined by this selector.
     *
     * Properties and corresponding values can be added or removed from the
     * criteria object but that criteria object itself cannot be replaced.
     *
     * @type {Object}
     */
    criteria: {
        get: function () {
            if (!this._criteria) {
                this._criteria = {};
            }
            return this._criteria;
        }
    }

}, {

    for: {
        value: function (type, criteria) {
            var selector, key;
            selector = new DataSelector;
            selector.type = type;
            if (criteria) {
                for (key in criteria) {
                    selector.criteria[key] = criteria[key];
                }
            }
            return selector;
        }
    }

});
{'fraction_non_alphanumeric': 0.09068727124847499, 'fraction_numerical': 0.0, 'mean_word_length': 1.8941176470588235, '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': '4529137', 'n_tokens_mistral': 640, 'n_tokens_neox': 631, 'n_words': 240}