<commit_before>var crypto = require('crypto')
  , async = require('async')
  , inflect = require('i')();

// Get the application config
var config = require('./../config');

// Setup ORM
var Sequelize = require('sequelize');
var sequelize = new Sequelize(
    config.db.database, 
    config.db.username, 
    config.db.password,
    config.db.options
);

// Get our models
var models = require('./../src/model')(sequelize);

var seedData = require('./../schema/seedData.json');

var assocMap = {};

async.forEachSeries(
	Object.keys(seedData),
	function forEachModelType(modelName, cb) {
		var ModelType = models[modelName]
		  , Models = seedData[modelName];

		assocMap[modelName] = [];

		async.forEach(
			Models,
			function forEachModel(data, modelCb) {
				ModelType.create(data).success(function(model) {
					console.log('Created ' + modelName);
					assocMap[modelName].push(model);

					if (data.assocations != undefined) {
						Object.keys(data.assocations).forEach(function(assocModelName) {
							var required = data.assocations[assocModelName]
							  , assocations = []

							assocMap[assocModelName].forEach(function(m) {
								var isMatched = null;

								Object.keys(required).forEach(function(reqKey) {
									if (isMatched != false) {
										if (m[reqKey] == required[reqKey]) {
											isMatched = true
										} else {
											isMatched = false
										}
									}
								})

								if (isMatched) {
									assocations.push(m);
								}
							});

							if (assocations.length) {
								var funcName = 'set'+inflect.pluralize(assocModelName);
								
								console.log('Calling ' + funcName);
								model[funcName](assocations).success(function() {
									modelCb(null);
								}).error(modelCb)
							}
						});
					} else {
						modelCb(null);
					}<commit_msg>Fixing up a spelling mistake<commit_after>var crypto = require('crypto')
  , async = require('async')
  , inflect = require('i')();

// Get the application config
var config = require('./../config');

// Setup ORM
var Sequelize = require('sequelize');
var sequelize = new Sequelize(
    config.db.database, 
    config.db.username, 
    config.db.password,
    config.db.options
);

// Get our models
var models = require('./../src/model')(sequelize);

var seedData = require('./../schema/seedData.json');

var assocMap = {};

async.forEachSeries(
	Object.keys(seedData),
	function forEachModelType(modelName, cb) {
		var ModelType = models[modelName]
		  , Models = seedData[modelName];

		assocMap[modelName] = [];

		async.forEach(
			Models,
			function forEachModel(data, modelCb) {
				ModelType.create(data).success(function(model) {
					console.log('Created ' + modelName);
					assocMap[modelName].push(model);

					if (data.associations != undefined) {
						Object.keys(data.associations).forEach(function(assocModelName) {
							var required = data.associations[assocModelName]
							  , associations = []

							assocMap[assocModelName].forEach(function(m) {
								var isMatched = null;

								Object.keys(required).forEach(function(reqKey) {
									if (isMatched != false) {
										if (m[reqKey] == required[reqKey]) {
											isMatched = true
										} else {
											isMatched = false
										}
									}
								})

								if (isMatched) {
									associations.push(m);
								}
							});

							if (associations.length) {
								var funcName = 'set'+inflect.pluralize(assocModelName);
								
								console.log('Calling ' + funcName);
								model[funcName](associations).success(function() {
									modelCb(null);
								}).error(modelCb)
							}
						});
					} else {
						modelCb(null);
					}
{'fraction_non_alphanumeric': 0.14254742547425475, 'fraction_numerical': 0.0, 'mean_word_length': 2.5185891325071497, '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': '6390741', 'n_tokens_mistral': 1627, 'n_tokens_neox': 1139, 'n_words': 198}