<commit_before>var redis = require('redis-url');

var config = require('./config');

module.exports = redis.connect(config.REDIS_URL);
<commit_msg>[#11] Fix Redis database not selected.<commit_after>var redis = require('redis-url');

var config = require('./config');

var db = redis.connect(config.REDIS_URL);

if (typeof config.REDIS_URL !== 'undefined') {
  var matches = config.REDIS_URL.match(/\/(\d+)$/);
  
  if (matches && typeof matches[1] !== 'undefined') {
    var dbnum = matches[1];
    
    db.select(dbnum);
  }
}

module.exports = db;

{'fraction_non_alphanumeric': 0.1851179673321234, 'fraction_numerical': 0.007259528130671506, 'mean_word_length': 4.158878504672897, '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': '5742043', 'n_tokens_mistral': 194, 'n_tokens_neox': 191, 'n_words': 40}