<commit_before>function highlight(words, wordNum) {
	$('#lyrics').html("");
	var el = $('<span></span>');
	var text = '';
	for (var i=0; i < wordNum; i++){
		text += words[i] + " ";
	}
	console.log("text", text);
	el.html(text);
	$('#lyrics').append(el);

	$('#lyrics').append($('<span style="color:red">'+words[wordNum]+'</span>'));

	el = $('<span></span>');
	text = '';
	for (var i=wordNum+1; i < words.length; i++) {
		text += " " + words[i];

	}
	el.html(text);
	$('#lyrics').append(el);
}

var globalTimes = [];
var globalCount = -1;

function saveTime(word) {
	globalTimes.push({word: word , time: (new Date()).getTime()});
};

function timeString(times) {
	var startTime = times[0].time;
	var ret = '';
	for (var i = 0; i < times.length; i++) {
		var t = times[i].time - startTime;
		ret += times[i].word + ': ' + t + '\n';
	}
	return ret;
}


$(function() {

	var lyrics = $('#lyrics');
	var words = lyrics.html().split(" "); //array of words

	
	// setInterval(function() {
	// 	globalCount = (globalCount + 1) % words.length;
	// 	highlight(words, globalCount);
	// }, 1000);
	console.log(words);

	var timestamps;
	var counter = 0;

	console.log('hello');

	$("#play").click(function() {
		setLyricsTimer(highlightNextWord, timestamps);
		//start timer
		//highlight word with each time
	});

	function setLyricsTimer(callback, count, times) {
		// var 
		var interval = timestamps[count] - timestamsp[count-1];
	}

	$(document).keypress(function(e) {
		globalCount = globalCount + 1;
		if (globalCount >= words.length) {
			return;
		}
		
		highlight(words, globalCount);
		saveTime(words[globalCount]);
		$('#times').html(timeString(globalTimes));
		// console.log(globalTimes);
		// var select = getNextWord();
		// select = new String(select).s plit(" ");
		// timestamps[counter] = new Date().getTime();
		// console.log(timestamps[counter]);
		// counter++;
	});
});<commit_msg>Highlight button is functional<commit_after>function highlight(words, wordNum) {
	$('#lyrics').html("");
	var el = $('<span></span>');
	var text = '';
	for (var i=0; i < wordNum; i++){
		text += words[i] + " ";
	}
	console.log("text", text);
	el.html(text);
	$('#lyrics').append(el);

	$('#lyrics').append($('<span style="color:red">'+words[wordNum]+'</span>'));

	el = $('<span></span>');
	text = '';
	for (var i=wordNum+1; i < words.length; i++) {
		text += " " + words[i];

	}
	el.html(text);
	$('#lyrics').append(el);
}

var globalTimes = [];
var globalCount = -1;

function saveTime(word) {
	globalTimes.push({word: word , time: (new Date()).getTime()});
};

function timeString(times) {
	var startTime = times[0].time;
	var ret = '';
	for (var i = 0; i < times.length; i++) {
		var t = times[i].time - startTime;
		ret += times[i].word + ': ' + t + '\n';
	}
	return ret;
}

//need to set time being passed into setInterval
function demoHighlight(words, times, count) {
	 setTimeout(function() {
	 	count = (count + 1) % words.length;
	 	highlight(words, count);
	 	demoHighlight(words, times, count);
	 }, times[count].time);
}

//make array 2D to account for line breaks

$(function() {

	var lyrics = $('#lyrics');
	var words = lyrics.html().split(" "); //array of words

	console.log(words);

	var timestamps;
	var counter = 0;

	console.log('hello');

	$("#play").click(function() {
		demoHighlight(words, globalTimes);
	});

	$(document).keypress(function(e) {
		globalCount = globalCount + 1;
		if (globalCount >= words.length) {
			return;
		}
		
		highlight(words, globalCount);
		saveTime(words[globalCount]);
		$('#times').html(timeString(globalTimes));
	});
});
{'fraction_non_alphanumeric': 0.22188024622271965, 'fraction_numerical': 0.006155567991046447, 'mean_word_length': 3.979108635097493, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, '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': '438597', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1272, 'n_words': 279}