<commit_before>function ListCtrl($scope, $http) {
  function titleMatchesPattern(pattern, show) {
    var tmp = show.title.substr(0,pattern.length).toLowerCase();
    return tmp === pattern.toLowerCase();
  };

  function filterByPattern(condition, pattern, showsArray) {
    var result = [];
    for (show in showsArray) {
      if (condition(pattern,showsArray[show])) {
        result.push(showsArray[show]);
      }
    }
    return result;
  };

  function getProperties(showsArray, property) {
    var result = [];
    for (show in showsArray) {
      result.push(showsArray[show][property]);
    }
    return result;
  };

  function getProperty(showId, property) {
    return $scope.rawShows[showId][property];
  };

  function getShowsIdTitleLogoDescription(showsArray) {
    var result = [];
    for (show in showsArray) {
      result.push({id: showsArray[show].id, title: showsArray[show].title, logoUrl: showsArray[show].channel.logo, description: showsArray[show].description});
    }
    return result;
  };

  function sortByProperty(showsArray, property) {
    showsArray.sort(function(showA, showB) {
      return showA[property].toLowerCase() > showB[property].toLowerCase();
    });
    return showsArray;
  };

  function sortByTitle(showsArray) {
    return sortByProperty(showsArray,"title");
  };

  $scope.getFilteredShows = function() {
    return filterByPattern(titleMatchesPattern, $scope.searchParameter, $scope.showsPropertiesOfInterest);
  };

  $scope.select = function(show) {
    if (angular.isDefined(show.comment) && show.comment.length > 0) {
      if ($scope.markedShows.indexOf(show) === -1) {
        $scope.markedShows.push(show);

        var index = $scope.showsPropertiesOfInterest.indexOf(show);
        if (index > -1) {
          $scope.showsPropertiesOfInterest.splice(index, 1);
        }
      }
    }
  };

  $scope.unSelect = function(show) {
    var index = $scope.markedShows.indexOf(show);
    if (index > -1) {
      $scope.markedShows.splice(index, 1);
      $scope.showsPropertiesOfInterest.push(show);
      sortByTitle($scope.showsPropertiesOfInterest);
    }
    console.log($scope.markedShows);
  };
  <commit_msg>After unselecting a show, its comment is erased.<commit_after>function ListCtrl($scope, $http) {
  function titleMatchesPattern(pattern, show) {
    var tmp = show.title.substr(0,pattern.length).toLowerCase();
    return tmp === pattern.toLowerCase();
  };

  function filterByPattern(condition, pattern, showsArray) {
    var result = [];
    for (show in showsArray) {
      if (condition(pattern,showsArray[show])) {
        result.push(showsArray[show]);
      }
    }
    return result;
  };

  function getProperties(showsArray, property) {
    var result = [];
    for (show in showsArray) {
      result.push(showsArray[show][property]);
    }
    return result;
  };

  function getProperty(showId, property) {
    return $scope.rawShows[showId][property];
  };

  function getShowsIdTitleLogoDescription(showsArray) {
    var result = [];
    for (show in showsArray) {
      result.push({id: showsArray[show].id, title: showsArray[show].title, logoUrl: showsArray[show].channel.logo, description: showsArray[show].description});
    }
    return result;
  };

  function sortByProperty(showsArray, property) {
    showsArray.sort(function(showA, showB) {
      return showA[property].toLowerCase() > showB[property].toLowerCase();
    });
    return showsArray;
  };

  function sortByTitle(showsArray) {
    return sortByProperty(showsArray,"title");
  };

  $scope.getFilteredShows = function() {
    return filterByPattern(titleMatchesPattern, $scope.searchParameter, $scope.showsPropertiesOfInterest);
  };

  $scope.select = function(show) {
    if (angular.isDefined(show.comment) && show.comment.length > 0) {
      if ($scope.markedShows.indexOf(show) === -1) {
        $scope.markedShows.push(show);

        var index = $scope.showsPropertiesOfInterest.indexOf(show);
        if (index > -1) {
          $scope.showsPropertiesOfInterest.splice(index, 1);
        }
      }
    }
  };

  $scope.unSelect = function(show) {
    var index = $scope.markedShows.indexOf(show);
    if (index > -1) {
      show.comment = "";
      $scope.markedShows.splice(index, 1);
      $scope.showsPropertiesOfInterest.push(show);
      sortByTitle($scope.showsPropertiesOfInterest);
    }
    console.log($scope.markedShows);
  };
  
{'fraction_non_alphanumeric': 0.13797009515178976, 'fraction_numerical': 0.0031717263253285004, 'mean_word_length': 3.482233502538071, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2593869', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1373, 'n_words': 234}