<commit_before>(function() {


	var extend		= require('stratum-framework/lib/extend'),
		glob		= require('glob'),
		path		= require('path'),

		dirname		= path.dirname,
		basename	= path.basename,
		sep			= path.sep;


	var Sokkit = extend(function Sokkit(options) {
		this.failed		= [];
		this.plugins	= {};
		this.paths		= {};
		this.disabled	= {};

		this.configure(options);
	},

	Array,

	{

		configure: function(options) {
			options		= options || {};

			var path	= dirname(dirname(require.main.filename)),
				auto	= dirname(path);

			this.module		= options.module || basename(path);
			this.pattern	= options.pattern || (this.module + '-*');

			if (options.disable) {
				var disable = options.disable;
				for(var index = 0, length = disable.length; index < length; index++) {
					this.disabled[disable[index]] = {};
				}
			}

			var $DEFAULT = auto + sep + this.pattern;

			this.path		= options.path || $DEFAULT;

			if (this.path instanceof Array) {
				this.path = '{' + this.path.map(function(path) {
					return path === '$DEFAULT' ? $DEFAULT : path
				}).join(',') + '}';
			}
		},

		load: function(callback) {
			var sokkit	= this,
				prefix	= this.module + '-';

			function process(files) {
				for(var index = 0, length = files.length; index < length; index++) {
					var name = basename(files[index]);

					if (name.substring(name.length - 3) === '.js') {
						name = name.substring(0, name.length - 3);
					}

					if (name.substring(0, prefix.length) === prefix) {
						name = name.substring(prefix.length);
					}

					if (sokkit.disabled[name]) {
						sokkit.disabled[name].path = files[index];
						continue;
					}

					try{
						var result = require(files[index]);
						sokkit.push(result);
						sokkit.plugins[name] = result;
						sokkit.paths[name] = files[index];
					}catch(error) {
						sokkit.failed.push({
							name: name,
							error: error
						});
					}
				}
				if (callback) { callback(null, sokkit); }
			}

			if (callback) {
				glob(this.path, function(error, files) {
					if (error) {
						callback(error);
						return;
					}
					process(files);
				});
			}else{
				process(glob.sync(this.path));
			}
			return this;
		},

		subset: function(filter) {
			var clone = new Sokkit({
				module:		this.module,
				pattern:	this.pattern,
				path:		this.path
			});

			var plugins	= this.plugins,
				paths	= this.paths;
			for(var name in plugins) {
				if (!plugins.hasOwnProperty(name)) { continue; }
				var plugin = plugins[name];

				if (filter && filter(name, plugin)) {
					clone.push(plugin);
					clone.paths[name]	= paths[name];
					clone.plugins[name]	= plugin;
				}
			}
			return clone;
		},

		instantiate: function() {
			var args	= Array.prototype.slice.call(arguments, 1),
				errors	= [],
				plugins	= this.plugins;

			var index = 0;

			for(var name in plugins) {
				if (!plugins.hasOwnProperty(name)) { continue; }

				try{
					var plugin		= require(this.paths[name]),
						instance	= Object.create(plugin.prototype);

					plugin.apply(instance, args);
					this[index++]	= instance;
					plugins[name]	= instance;
				}catch(error) {
					errors.push({
						name:	name,
						error:	error
					});
					index++
				}
			}
			return errors;
		},

		call: function(method) {
			return this.apply(method, Array.prototype.slice.call(arguments, 1));
		},

		apply: function(method, args) {
			var result	= [],
				errors	= [],
				plugins	= this.plugins;

			result.errors = errors;
<commit_msg>Fix instantiate parameter passing to not skip the first param.<commit_after>(function() {


	var extend		= require('stratum-framework/lib/extend'),
		fs			= require('fs'),
		glob		= require('glob'),
		path		= require('path'),

		dirname		= path.dirname,
		basename	= path.basename,
		sep			= path.sep;


	var Sokkit = extend(function Sokkit(options) {
		this.failed		= [];
		this.plugins	= {};
		this.paths		= {};
		this.disabled	= {};

		this.configure(options);
	},

	Array,

	{

		configure: function(options) {
			options		= options || {};

			var path	= this.root(),
				auto	= dirname(path);

			this.module		= options.module || basename(path);
			this.pattern	= options.pattern || (this.module + '-*');

			if (options.disable) {
				var disable = options.disable;
				for(var index = 0, length = disable.length; index < length; index++) {
					this.disabled[disable[index]] = {};
				}
			}

			var $DEFAULT = auto + sep + this.pattern;

			this.path		= options.path || $DEFAULT;

			if (this.path instanceof Array) {
				this.path = '{' + this.path.map(function(path) {
					return path === '$DEFAULT' ? $DEFAULT : path
				}).join(',') + '}';
			}
		},

		root: function() {
			var path = dirname(require.main.filename);
			while(path.length) {
				if (fs.existsSync(path + sep + 'package.json')) { return path; }
				path = dirname(path);
			}
			throw new Error('Failed to find module root');
		},

		load: function(callback) {
			var sokkit	= this,
				prefix	= this.module + '-';

			function process(files) {
				for(var index = 0, length = files.length; index < length; index++) {
					var name = basename(files[index]);

					if (name.substring(name.length - 3) === '.js') {
						name = name.substring(0, name.length - 3);
					}

					if (name.substring(0, prefix.length) === prefix) {
						name = name.substring(prefix.length);
					}

					if (sokkit.disabled[name]) {
						sokkit.disabled[name].path = files[index];
						continue;
					}

					try{
						var result = require(files[index]);
						sokkit.push(result);
						sokkit.plugins[name] = result;
						sokkit.paths[name] = files[index];
					}catch(error) {
						sokkit.failed.push({
							name: name,
							error: error
						});
					}
				}
				if (callback) { callback(null, sokkit); }
			}

			if (callback) {
				glob(this.path, function(error, files) {
					if (error) {
						callback(error);
						return;
					}
					process(files);
				});
			}else{
				process(glob.sync(this.path));
			}
			return this;
		},

		subset: function(filter) {
			var clone = new Sokkit({
				module:		this.module,
				pattern:	this.pattern,
				path:		this.path
			});

			var plugins	= this.plugins,
				paths	= this.paths;
			for(var name in plugins) {
				if (!plugins.hasOwnProperty(name)) { continue; }
				var plugin = plugins[name];

				if (filter && filter(name, plugin)) {
					clone.push(plugin);
					clone.paths[name]	= paths[name];
					clone.plugins[name]	= plugin;
				}
			}
			return clone;
		},

		instantiate: function() {
			var errors	= [],
				plugins	= this.plugins;

			var index = 0;

			for(var name in plugins) {
				if (!plugins.hasOwnProperty(name)) { continue; }

				try{
					var plugin		= require(this.paths[name]),
						instance	= Object.create(plugin.prototype);

					plugin.apply(instance, arguments);
					this[index++]	= instance;
					plugins[name]	= instance;
				}catch(error) {
					errors.push({
						name:	name,
						error:	error
					});
					index++
				}
			}
			return errors;
		},

		call: function(method) {
			return this.apply(method, Array.prototype.slice.call(arguments, 1));
		},

		apply: function(method, args) {
			var result	= [],
				errors	= [],
				plugins	= this.plugins;

			result.errors = errors;

{'fraction_non_alphanumeric': 0.15958620689655173, 'fraction_numerical': 0.0023448275862068967, 'mean_word_length': 2.5284671532846716, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1012164', 'n_tokens_mistral': 3229, 'n_tokens_neox': 2416, 'n_words': 507}