<commit_before>var _ = require('lodash'),
    glob = require('glob'),
    q = require('q');

var Model = function(options) {
    this.modelPath = (options && options.modelPath) ? options.modelPath : __dirname + '/../lib/models/';
    this.models = {};

};

Model.prototype.getModelName = function(modelName) {
    return _.capitalize(modelName);
};

Model.prototype.getModels = function() {

    var defer = q.defer();

    // Autoload Models
    glob(this.modelPath + '*', function (err, files) {

        if(err) {
            return err;
        }

        _.forEach(files, function(filePath) {

            var chunks = filePath.split('/'),
                fileName = chunks[chunks.length - 1],
                modelName = fileName.split('.')[0];

            this.models[this.getModelName(modelName)] = require(this.modelPath + modelName);
        }.bind(this));

        defer.resolve(this.models);

    }.bind(this));

    return defer.promise;

};

Model.prototype.getSchema = function(options) {

    return require('./schemas/' + options.modelName + '.json');

};

Model.prototype.getFields = function(options) {

    var schema = this.getSchema(options),
        _fields = Object.keys(schema),
        fields = [];

    _.each(_fields, function(value) {
        if(value.charAt('0') !== '_') {
            fields.push(value);
        }
    });

    fields.unshift('_id');

    return fields;
};


module.exports = Model;<commit_msg>keep module lowercase<commit_after>var _ = require('lodash'),
    glob = require('glob'),
    q = require('q');

var Model = function(options) {
    this.modelPath = (options && options.modelPath) ? options.modelPath : __dirname + '/../lib/models/';
    this.models = {};

};

Model.prototype.getModelName = function(modelName) {
    return _.capitalize(modelName);
};

Model.prototype.getModels = function() {

    var defer = q.defer();

    // Autoload Models
    glob(this.modelPath + '*', function (err, files) {

        if(err) {
            return err;
        }

        _.forEach(files, function(filePath) {

            var chunks = filePath.split('/'),
                fileName = chunks[chunks.length - 1],
                modelName = fileName.split('.')[0];

            this.models[this.getModelName(modelName)] = require(this.modelPath + modelName);
        }.bind(this));

        defer.resolve(this.models);

    }.bind(this));

    return defer.promise;

};

Model.prototype.getSchema = function(options) {

    return require('./schemas/' + options.modelName.toLowerCase() + '.json');

};

Model.prototype.getFields = function(options) {

    var schema = this.getSchema(options),
        _fields = Object.keys(schema),
        fields = [];

    _.each(_fields, function(value) {
        if(value.charAt('0') !== '_') {
            fields.push(value);
        }
    });

    fields.unshift('_id');

    return fields;
};


module.exports = Model;
{'fraction_non_alphanumeric': 0.1640302613480055, 'fraction_numerical': 0.0020632737276478678, 'mean_word_length': 2.471360381861575, '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': '1488103', 'n_tokens_mistral': 911, 'n_tokens_neox': 859, 'n_words': 151}