<commit_before>var url = "192.168.127.12";
console.log('loaded');
$.post('http://' + url + '/api/entity', {url: document.URL}, function (entity_data) {
    var entities = entity_data.entities;
    console.log(entities);
    for (var i = 0; i < entities.length; i++) {
      var entity = entities[i];
      console.log(entity);
      $.post('http://' + url + '/api/sentiment', {query: entity}, function (sentiment_data) {
        console.log(sentiment_data);
        var sentiment = sentiment_data.sentiment;
        var entity = sentiment_data.query;
        console.log(entity);
        var red = Math.round(Math.round(100 - sentiment*100) * 255 / 100);
        var green = Math.round(Math.round(sentiment*100) * 255 / 100);
        $('body *').replaceText(entity, '<span style="color: rgb(' + red + ', ' + green + ', 0);">' + entity + '</span>');
      }, 'json')
    }
}, 'json');<commit_msg>Color function for extension<commit_after>var url = "192.168.127.12";
console.log('loaded');
$.post('http://' + url + '/api/entity', {url: document.URL}, function (entity_data) {
    var entities = entity_data.entities;
    console.log(entities);
    for (var i = 0; i < entities.length; i++) {
      var entity = entities[i];
      console.log(entity);
      $.post('http://' + url + '/api/sentiment', {query: entity}, function (sentiment_data) {
        console.log(sentiment_data);
        var sentiment = sentiment_data.sentiment;
        var entity = sentiment_data.query;
        console.log(entity);
        var red = Math.round(Math.round(100 - sentiment*100) * 255 / 100);
        var green = Math.round(Math.round(sentiment*100) * 255 / 100);
	var blue = Math.round(255 - Math.abs(red - green));
        $('body *').replaceText(entity, '<span style="color: rgb(' + red + ', ' + green + ', 0);">' + entity + '</span>');
      }, 'json')
    }
}, 'json');
{'fraction_non_alphanumeric': 0.19268030139935413, 'fraction_numerical': 0.03821313240043057, 'mean_word_length': 2.9978494623655916, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2950526', 'n_tokens_mistral': 647, 'n_tokens_neox': 592, 'n_words': 135}