<commit_before>
/* 
	nodejs script to update scores(likely hood of random selection) of MEPs
	@Author: <NAME>
	@Licence: CC0
	current logic
		shadow + rapporteur 0.9
		greens 0.25
		epp 
			members 0.8
			substitutes 0.5
		rest
			members 0.7
			substitutes 0.4
*/


var data = require('./data.json');

var nlen = 0;
for (var i = 0; i < data.length; i++) {
	console.log(i, data[i].name, data[i].name.length);
	nlen = Math.max(data[i].name.length, nlen);
}
console.log(nlen);<commit_msg>f*mail.tmpl<commit_after>
/* 
	nodejs script to update scores(likely hood of random selection) of MEPs
	@Author: <NAME>
	@Licence: CC0
	current logic
		shadow + rapporteur 0.9
		greens 0.25
		epp 
			members 0.8
			substitutes 0.5
		rest
			members 0.7
			substitutes 0.4
*/


var data = require('./data.json');

for (var i = 0; i < data.length; i++) {
	try {
		if (data[i].role.indexOf('shadow') !== -1 || data[i].role.indexOf('rapporteur') !== -1 ) {
			data[i].score = 0.9;
		}
		else if (data[i].group_short.indexOf('epp') !== -1) {
			if (data[i].role.indexOf('member') !== -1) {
				data[i].score = 0.8;
			} else if (data[i].role.indexOf('shadow') !== -1 ) {
				data[i].score = 0.5;
			}
		}
		else if (data[i].group_short.indexOf('greensefa') !== -1) {
			data[i].score = 0.25;
		}
		else {
			if (data[i].role.indexOf('member') !== -1) {
				data[i].score = 0.7;
			} else if (data[i].role.indexOf('shadow') !== -1 ) {
				data[i].score = 0.4;
			}
		}
	} catch (e) {
		console.error('couldn\'t update score of MEP # ' + i + ' because of ', e);
	}
}

//console.log(data); 

var fs = require('fs');
fs.writeFile("data.json", JSON.stringify(data), function(err) {
    if(err) {
        console.log(err);
    } else {
        console.log("Scores updated. The file was saved!");
    }
});

{'fraction_non_alphanumeric': 0.19371139809096014, 'fraction_numerical': 0.029197080291970802, 'mean_word_length': 2.832258064516129, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '4352531', 'n_tokens_mistral': 801, 'n_tokens_neox': 702, 'n_words': 163}