<commit_before>'use strict';

var fs, textToJSON, data;

textToJSON = require('plain-text-data-to-json');
fs = require('fs');

data = textToJSON(fs.readFileSync('data/AFINN/AFINN-111.txt', 'utf8'), {
    'delimiter': '\t'
});

Object.keys(data).forEach(function (key) {
    data[key] = Number(data[key]);
});

fs.writeFileSync('data/afinn-111.json', JSON.stringify(data));
<commit_msg>Refactor `script/build-data.js`<commit_after>'use strict';

/**
 * Dependencies.
 */

var fs,
    toJSON;

toJSON = require('plain-text-data-to-json');
fs = require('fs');

/**
 * Data.
 */

var data;

data = toJSON(fs.readFileSync('data/AFINN/AFINN-111.txt', 'utf8'), {
    'delimiter': '\t'
});

/**
 * Parse.
 */

Object.keys(data).forEach(function (key) {
    data[key] = Number(data[key]);
});

/**
 * Write.
 */

fs.writeFileSync('data/afinn-111.json', JSON.stringify(data));

{'fraction_non_alphanumeric': 0.22722029988465975, 'fraction_numerical': 0.016147635524798153, 'mean_word_length': 4.136094674556213, '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': '7279660', 'n_tokens_mistral': 349, 'n_tokens_neox': 341, 'n_words': 48}