<commit_before>/**
	Execute of a view with the extended time key as key and integers as values,
	builds an html table conformant to the timepedia chronoscope microformat
	(http://timepedia.org/chronoscope/docs/microformats/).
	
	MANDATORY group_level 1-6 to control grouping
	OPTIONAL table_only [true|false] to disable/enable chronoscope (default enabled)
*/
function(head, req) {
	// !json templates
	// !code lib/mustache.js
	// !code lib/stats.js
	
 	start({"headers":{"Content-Type" : "text/html"}});
	
	// group_level 6
	// key is rebuilt skipping element 4 as it's a 5-minutes span and
	// is not understood by chronoscope dtformat (better done in the template?)
	
	var dt = get_dtformat(parseInt(req.query.group_level));
	var table_only = (req.query.table_only && req.query.table_only=='true');
	
	if (!table_only)
		send(Mustache.to_html(templates.chronoscope.html_head));
			
	var keys = null;	
	while(row = getRow()) {		
		if (keys == null) {
			keys = [];
			for (var key in row.value) {
				keys.push(key);
			}
			keys.sort();
			send(Mustache.to_html(templates.chronoscope.table_head_multi, {keys: keys, dtformat: dt.dtformat}));
		}
		var values = [];
		keys.forEach(function(k) {
			values.push(row.value[k]);
		});
		send(Mustache.to_html(templates.chronoscope.table_item_multi, {
			key: dt.f_key(row.key),
			value: values
		}));
		send('\n');
	}
	send(Mustache.to_html(templates.chronoscope.table_foot));
	
	if (!table_only)
		send(Mustache.to_html(templates.chronoscope.html_foot));
}<commit_msg>added root extraction function<commit_after>/**
	Execute of a view with the extended time key as key and integers as values,
	builds an html table conformant to the timepedia chronoscope microformat
	(http://timepedia.org/chronoscope/docs/microformats/).
	
	MANDATORY group_level 1-6 to control grouping
	OPTIONAL table_only [true|false] to disable/enable chronoscope (default enabled)
*/
function(head, req) {
	// !json templates
	// !code lib/mustache.js
	// !code lib/stats.js
	
 	start({"headers":{"Content-Type" : "text/html"}});
	
	// group_level 6
	// key is rebuilt skipping element 4 as it's a 5-minutes span and
	// is not understood by chronoscope dtformat (better done in the template?)
	
	var dt = get_dtformat(parseInt(req.query.group_level));
	var table_only = (req.query.table_only && req.query.table_only=='true');
	
	if (!table_only)
		send(Mustache.to_html(templates.chronoscope.html_head));
	send(Mustache.to_html(templates.app_head, {root:app_root(req.path)}));			
	
	var keys = null;	
	while(row = getRow()) {		
		if (keys == null) {
			keys = [];
			for (var key in row.value) {
				keys.push(key);
			}
			keys.sort();
			send(Mustache.to_html(templates.chronoscope.table_head_multi, {keys: keys, dtformat: dt.dtformat}));
		}
		var values = [];
		keys.forEach(function(k) {
			values.push(row.value[k]);
		});
		send(Mustache.to_html(templates.chronoscope.table_item_multi, {
			key: dt.f_key(row.key),
			value: values
		}));
		send('\n');
	}
	send(Mustache.to_html(templates.chronoscope.table_foot));
	send(Mustache.to_html(templates.app_foot));
	
	if (!table_only)
		send(Mustache.to_html(templates.chronoscope.html_foot));
}
{'fraction_non_alphanumeric': 0.14222642699463892, 'fraction_numerical': 0.00315357931251971, 'mean_word_length': 4.157723577235773, 'pattern_counts': {'":': 2, '<': 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': '5490170', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1086, 'n_words': 248}