<commit_before>$(document).ready(function() {
  var secondsBetweenReloads = 5;

  // loadTweets(10);
  // window.setInterval(function() {loadTweets(10);}, secondsBetweenReloads * 1000);
});

/*
 * load tweets from our rest endpoint and list the in the tweet-listing <ul>
 */
 function loadTweets(number, topic) {
  var query = '/data?number=' + number + '&' + 'topic=' + topic;
  $('#tweet-listing-pos').empty();
  $('#tweet-listing-neg').empty();
  $('#neg-header').empty();
  $('#pos-header').empty();
  $('#neg-count').empty();
  $('#pos-count').empty();


  $('#spinner').append('<img src="/static/img/ajax-loader.gif">')
  $.ajax({
    url: query
  }).then(function(data) {
    $('#spinner').empty();
    data = $.parseJSON(data);
    console.log(data[0]);

    $('#tweet-listing').empty();
    $('#neg-header').append($('<h3>Negative</h3>'));
    $('#pos-header').append($('<h3>Positive</h3>'));

    counterPos = 0;
    counterNeg = 0;

    data = data.sort(function (a, b) {
      return b.rt_count - a.rt_count;
    });

    for (var i = 0; i < data.length; i++) {
      //print negative tweets
      if(data[i].sentiment=="negative"){
        // $('#tweet-listing-neg').append($('<li/>').append(data[i].text + '<br><span class="retweet">Retweet count: </span>' + data[i].rt_count));
        twttr.widgets.createTweet(data[i].tweet_id, document.getElementById('neg-tweets'));

        counterNeg++;
      }<commit_msg>clears tweets on new search<commit_after>$(document).ready(function() {
  var secondsBetweenReloads = 5;

  // loadTweets(10);
  // window.setInterval(function() {loadTweets(10);}, secondsBetweenReloads * 1000);
});

/*
 * load tweets from our rest endpoint and list the in the tweet-listing <ul>
 */
 function loadTweets(number, topic) {
  var query = '/data?number=' + number + '&' + 'topic=' + topic;
  $('#tweet-listing-pos').empty();
  $('#tweet-listing-neg').empty();
  $('#neg-header').empty();
  $('#pos-header').empty();
  $('#neg-count').empty();
  $('#pos-count').empty();


  $('#spinner').append('<img src="/static/img/ajax-loader.gif">')
  $.ajax({
    url: query
  }).then(function(data) {
    $('#spinner').empty();
    data = $.parseJSON(data);
    console.log(data[0]);

    $('#tweet-listing').empty();
    $('#neg-tweets').empty();
    $('#pos-tweets').empty();

    $('#neg-header').append($('<h3>Negative</h3>'));
    $('#pos-header').append($('<h3>Positive</h3>'));

    counterPos = 0;
    counterNeg = 0;

    data = data.sort(function (a, b) {
      return b.rt_count - a.rt_count;
    });

    for (var i = 0; i < data.length; i++) {
      //print negative tweets
      if(data[i].sentiment=="negative"){
        // $('#tweet-listing-neg').append($('<li/>').append(data[i].text + '<br><span class="retweet">Retweet count: </span>' + data[i].rt_count));
        twttr.widgets.createTweet(data[i].tweet_id, document.getElementById('neg-tweets'));

        counterNeg++;
      }
{'fraction_non_alphanumeric': 0.24376920450665757, 'fraction_numerical': 0.011608057357459884, 'mean_word_length': 3.5638629283489096, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, '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': '2239029', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1004, 'n_words': 168}