<commit_before> 'use strict';

angular.module('hyphe.summarizeTagCatComponent', [])

  .directive('summarizeTagCat', ['$timeout', function($timeout){
    return {
      restrict: 'E'
      ,templateUrl: 'components/summarizeTagCategory.html'
      ,scope: {
        tagCat: '=',
        webentities: '=',
        tagCategories: '=',
        setValue: '=',
        deleteValue: '='
      }
      ,link: function($scope, el, attrs) {
        $scope.$watch('tagCat', update)
        $scope.$watch('webentities', update)

        $scope.transformChip = function(chip) {
          return {value: chip, count:0}
        }

        $scope.addValue = function(chip, freetag) {
          var webentities
          if (freetag) {
            webentities = $scope.webentities
          } else {
            webentities = $scope.webentities.filter(function(we){
              return we.tags.USER === undefined
                || we.tags.USER[$scope.tagCat] === undefined
                || we.tags.USER[$scope.tagCat].length == 0
            })
          }
          $scope.setValue(chip.value, $scope.tagCat, webentities)
        }

        $scope.removeValue = function(chip) {
          var webentities = $scope.webentities.filter(function(webentity){
            return webentity.tags.USER
              && webentity.tags.USER[$scope.tagCat]
              && webentity.tags.USER[$scope.tagCat].some(function(val){
                return val == chip.value
              })
          })
          $scope.deleteValue(chip.value, $scope.tagCat, webentities)
        }

        $scope.autoComplete = function(query, category){
          var searchQuery = searchable(query)
            , res = []
          Object.keys($scope.tagCategories[category] || {})
          .forEach(function(k){
            var candidateTag = k.toLowerCase()
            if (candidateTag && (!searchQuery || ~candidateTag.indexOf(searchQuery))) {
              res.push(k)
            }
          })
          res.sort(function(a,b){return a.localeCompare(b) })
          return res
        }

        function update() {
          $timeout(function(){
            var valuesIndex = {}
            $scope.undefinedValues = 0<commit_msg>more clever fix<commit_after> 'use strict';

angular.module('hyphe.summarizeTagCatComponent', [])

  .directive('summarizeTagCat', ['$timeout', function($timeout){
    return {
      restrict: 'E'
      ,templateUrl: 'components/summarizeTagCategory.html'
      ,scope: {
        tagCat: '=',
        webentities: '=',
        tagCategories: '=',
        setValue: '=',
        deleteValue: '='
      }
      ,link: function($scope, el, attrs) {
        $scope.$watch('tagCat', update)
        $scope.$watch('webentities', update)

        $scope.transformChip = function(chip) {
          return {value: chip, count:0}
        }

        $scope.addValue = function(chip, freetag) {
          var webentities
          if (freetag) {
            webentities = $scope.webentities
          } else {
            webentities = $scope.webentities.filter(function(we){
              return we.tags.USER === undefined
                || we.tags.USER[$scope.tagCat] === undefined
                || we.tags.USER[$scope.tagCat].length == 0
            })
          }
          $scope.setValue(chip.value, $scope.tagCat, webentities)
        }

        $scope.removeValue = function(chip) {
          var webentities = $scope.webentities.filter(function(webentity){
            return webentity.tags.USER
              && webentity.tags.USER[$scope.tagCat]
              && webentity.tags.USER[$scope.tagCat].some(function(val){
                return val == chip.value
              })
          })
          $scope.deleteValue(chip.value, $scope.tagCat, webentities)
        }

        $scope.autoComplete = function(query, category){
          var searchQuery = searchable(query)
            , res = []
          Object.keys($scope.tagCategories[category] || {})
          .forEach(function(k){
            var candidateTag = searchable(k)
            if (candidateTag && (!searchQuery || ~candidateTag.indexOf(searchQuery))) {
              res.push(k)
            }
          })
          res.sort(function(a,b){return a.localeCompare(b) })
          return res
        }

        function update() {
          $timeout(function(){
            var valuesIndex = {}
            $scope.undefinedValues = 0
{'fraction_non_alphanumeric': 0.1361982719417917, 'fraction_numerical': 0.001364256480218281, 'mean_word_length': 1.8490932642487046, 'pattern_counts': {'":': 0, '<': 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': '5522234', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1237, 'n_words': 195}