<commit_before>var fs = require('fs');
var _ = require('lodash');

var Datastore = require('nedb'),
	db = new Datastore({ filename: './data/xkcd', autoload: true });


module.exports = function (words, callback) {

	db.find({ word: { $in: words } }, function (err, docs) {

		if (err) return callback(err);

		if (!docs.length) {
			callback(null, []);
			return;
		}

		var entries = _.map(docs, 'entries');
		var result = _.intersection.apply(_, entries);

		if (result.length && docs.length == words.length) {
			callback(null, result)
		} else {
			callback(null, [])
		}
	});
<commit_msg>Use an absolute path to load the db file<commit_after>var fs = require('fs');
var _ = require('lodash');

var Datastore = require('nedb'),
	db = new Datastore({ filename: __dirname + '/data/xkcd', autoload: true });


module.exports = function (words, callback) {

	db.find({ word: { $in: words } }, function (err, docs) {

		if (err) return callback(err);

		if (!docs.length) {
			callback(null, []);
			return;
		}

		var entries = _.map(docs, 'entries');
		var result = _.intersection.apply(_, entries);

		if (result.length && docs.length == words.length) {
			callback(null, result)
		} else {
			callback(null, [])
		}
	});

{'fraction_non_alphanumeric': 0.1830065359477124, 'fraction_numerical': 0.0, 'mean_word_length': 3.6755725190839694, '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': '1928015', 'n_tokens_mistral': 466, 'n_tokens_neox': 415, 'n_words': 109}