<commit_before>angular.module('qmsk.e2.tally', [
        'qmsk.e2.web',
        'ngResource',
        'ngRoute',
        'ngWebSocket',
        'luegg.directives',
        'jsonFormatter',
])

.config(function($routeProvider) {
    $routeProvider
        .when('/sources', {
            templateUrl: '/static/qmsk.e2/tally-sources.html',
            controller: 'SourcesCtrl',
            reloadOnSearch: false,
        })

        .when('/tally', {
            templateUrl: '/static/qmsk.e2/tally.html',
            controller: 'TallyCtrl',
            reloadOnSearch: false,
        })
        .otherwise({
            redirectTo: '/tally',
        });
})

.factory('Sources', function($http) {
    return $http.get('/api/sources').then(
        function success(r) {
            return r.data;
        }
    );
})

.factory('Tally', function($http) {
    return $http.get('/api/tally').then(
        function success(r) {
            return r.data;
        }
    );
})

.controller('HeaderCtrl', function($scope, $location, httpState) {
    $scope.state = httpState;

    $scope.isActive = function(prefix) {
        return $location.path().startsWith(prefix);
    };
})

.controller('SourcesCtrl', function($scope, Sources) {
    Sources.then(function(sources){
        $scope.sources = sources;
    });
})

.controller('TallyCtrl', function($scope, Tally) {
    Tally.then(function(tally){
        $scope.tally = tally;
    });
})

<commit_msg>tally web: use /api/events tally instead of REST /api/tally<commit_after>angular.module('qmsk.e2.tally', [
        'qmsk.e2.web',
        'ngResource',
        'ngRoute',
        'ngWebSocket',
        'luegg.directives',
        'jsonFormatter',
])

.config(function($routeProvider) {
    $routeProvider
        .when('/sources', {
            templateUrl: '/static/qmsk.e2/tally-sources.html',
            controller: 'SourcesCtrl',
            reloadOnSearch: false,
        })

        .when('/tally', {
            templateUrl: '/static/qmsk.e2/tally.html',
            controller: 'TallyCtrl',
            reloadOnSearch: false,
        })
        .otherwise({
            redirectTo: '/tally',
        });
})

.factory('Sources', function($http) {
    return $http.get('/api/sources').then(
        function success(r) {
            return r.data;
        }
    );
})

.factory('Tally', function($http) {
    return $http.get('/api/tally').then(
        function success(r) {
            return r.data;
        }
    );
})

.controller('HeaderCtrl', function($scope, $location, httpState) {
    $scope.state = httpState;

    $scope.isActive = function(prefix) {
        return $location.path().startsWith(prefix);
    };
})

.controller('SourcesCtrl', function($scope, Sources) {
    Sources.then(function(sources){
        $scope.sources = sources;
    });
})

.controller('TallyCtrl', function($scope, Events) {
    $scope.$on('qmsk.e2.event', function($e, event){
        $scope.tally = Events.state.tally;
    });
})
{'fraction_non_alphanumeric': 0.16862613369163587, 'fraction_numerical': 0.0030231776956667787, 'mean_word_length': 2.1714589989350372, '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': '5967991', 'n_tokens_mistral': 947, 'n_tokens_neox': 931, 'n_words': 138}