<commit_before>var _ = require('lodash');
var moment = require('moment');
var http = require('http');
// emails with this label are displayed as a yellow rectangle
var label = 'mondrian;'

var emailReader = require('./fakeEmailReader.js');

emailReader.init();

var EMAIL_DOMAIN;
emailReader.getAccountInfo(function(accountInfo) {
	if (accountInfo !== undefined && accountInfo.email_addresses != undefined) {
		var email = accountInfo.email_addresses[0];
		EMAIL_DOMAIN = email.substring(email.indexOf('@') + 1);
	} else {
		console.log('could not read account info!');
		EMAIL_DOMAIN = 'gmail.com';
	}
});

exports.readEmail = function(callWhenDone) {
	emailReader.readEmail(mapEmailDataToRectangles, callWhenDone);	
};

var LAST_RECTANGLES = [];

function mapEmailDataToRectangles(messages, callback) {
	
	// get labeled mails: in folder 'label'

	// get labeled mails: in folder 'label'

	// get labeled mails: in folder 'label'

	var unreadMessages = _.filter(messages, function(message) {
		return ! _.contains(message.flags, '\\Seen');
	});
	console.log('Got UNREAD emails from', _.map(unreadMessages, function(message) {
		return message.addresses.from.email + ', ' + message.date;
	}));

	var messagesToday = _.filter(unreadMessages, function(message) {
		return moment().diff(moment(message.date, 'X'), 'days') === 0;
	});
	var messagesYesterday = _.filter(unreadMessages, function(message) {
		return moment().diff(moment(message.date, 'X'), 'days') === 1;
	});
	var messagesOld = _.filter(unreadMessages, function(message) {
		return moment().diff(moment(message.date, 'X'), 'days') > 1;
	});

	function isFromSameDomain(message) {
		return message.addresses.from.email.indexOf(EMAIL_DOMAIN) > -1;
	}
<commit_msg>activated fake data for presentation<commit_after>var _ = require('lodash');
var moment = require('moment');
var http = require('http');
// emails with this label are displayed as a yellow rectangle
var label = 'mondrian;'

var emailReader = require('./fakeEmailReader.js');

emailReader.init();

var EMAIL_DOMAIN;
emailReader.getAccountInfo(function(accountInfo) {
	if (accountInfo !== undefined && accountInfo.email_addresses != undefined) {
		var email = accountInfo.email_addresses[0];
		EMAIL_DOMAIN = email.substring(email.indexOf('@') + 1);
	} else {
		console.log('could not read account info!');
		EMAIL_DOMAIN = 'gmail.com';
	}
});

exports.readEmail = function(callWhenDone) {
	emailReader.readEmail(mapEmailDataToRectangles, callWhenDone);	
};

var LAST_RECTANGLES = [];

function mapEmailDataToRectangles(messages, callback) {
	
	// get labeled mails: in folder 'label'

	var unreadMessages = _.filter(messages, function(message) {
		return ! _.contains(message.flags, '\\Seen');
	});
	console.log('Got UNREAD emails from', _.map(unreadMessages, function(message) {
		return message.addresses.from.email + ', ' + message.date;
	}));

	var messagesToday = _.filter(unreadMessages, function(message) {
		return moment().diff(moment(message.date, 'X'), 'days') === 0;
	});
	var messagesYesterday = _.filter(unreadMessages, function(message) {
		return moment().diff(moment(message.date, 'X'), 'days') === 1;
	});
	var messagesOld = _.filter(unreadMessages, function(message) {
		return moment().diff(moment(message.date, 'X'), 'days') > 1;
	});

	function isFromSameDomain(message) {
		return message.addresses.from.email.indexOf(EMAIL_DOMAIN) > -1;
	}

{'fraction_non_alphanumeric': 0.15529967522881605, 'fraction_numerical': 0.00354295837023915, 'mean_word_length': 5.356472795497186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1152372', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1064, 'n_words': 236}