<commit_before>angular.module('annotationLevel', [
    'pgdb.corpora',
    'pgdb.enrichment'
]).controller('AnnotationLevelCtrl', function ($scope, $rootScope, Enrichment, Corpora, $state, $stateParams) {
	$scope.annotation_options = [{name: "Utterances",
				  type: "utterances"},
				 {name: "Pauses",
				  type: "pauses"}];
	$scope.enrichment = {};
	$scope.count = 25;

	$scope.getWords = function(){
		Corpora.words($stateParams.corpus_id, $scope.count).then(function(res){
			$scope.words = JSON.parse(res.data);
		}).catch(function(res){
			$scope.error_message = res.data
		});
	};

	$scope.getWords();

	$scope.getCheckedWords = function(){
	    var arr = [];
	    for (var i = 0; i < $scope.words.length; i++) {   
		    if($scope.words[i].checked){
			    arr.push($scope.words[i].label);
		    }
	    }
	    //add user inputted strings
	    arr = arr.concat($scope.customWords.split(","));
	    //strip empty strings, null values, etc.
	    arr = arr.filter(function(e) {return e});
	    return arr;
	};

	$scope.save = function(){
		$scope.enrichment.pause_length = $scope.enrichment.pause_length/1000;
		if($scope.enrichment.enrichment_type == "pauses"){
			$scope.enrichment.pause_label = $scope.getCheckedWords();
		}
		Enrichment.create($stateParams.corpus_id, $scope.enrichment).then(function (res){
			$state.go('enrichment', {corpus_id: $stateParams.corpus_id});
		}).catch(function(res){
			$scope.error_message = res.data;
		});<commit_msg>fixed minor glitch<commit_after>angular.module('annotationLevel', [
    'pgdb.corpora',
    'pgdb.enrichment'
]).controller('AnnotationLevelCtrl', function ($scope, $rootScope, Enrichment, Corpora, $state, $stateParams) {
	$scope.annotation_options = [{name: "Utterances",
				  type: "utterances"},
				 {name: "Pauses",
				  type: "pauses"}];
	$scope.enrichment = {};
	$scope.count = 25;

	$scope.getWords = function(){
		Corpora.words($stateParams.corpus_id, $scope.count).then(function(res){
			$scope.words = JSON.parse(res.data);
		}).catch(function(res){
			$scope.error_message = res.data
		});
	};

	$scope.getWords();

	$scope.getCheckedWords = function(){
	    var arr = [];
	    for (var i = 0; i < $scope.words.length; i++) {   
		    if($scope.words[i].checked){
			    arr.push($scope.words[i].label);
		    }
	    }
	    //add user inputted strings
	    arr = arr.concat($scope.customWords.split(","));
	    //strip empty strings, null values, etc.
	    arr = arr.filter(function(e) {return e === "0" || e});
	    return arr;
	};

	$scope.save = function(){
		$scope.enrichment.pause_length = $scope.enrichment.pause_length/1000;
		if($scope.enrichment.enrichment_type == "pauses"){
			$scope.enrichment.pause_label = $scope.getCheckedWords();
		}
		Enrichment.create($stateParams.corpus_id, $scope.enrichment).then(function (res){
			$state.go('enrichment', {corpus_id: $stateParams.corpus_id});
		}).catch(function(res){
			$scope.error_message = res.data;
		});
{'fraction_non_alphanumeric': 0.18376358695652173, 'fraction_numerical': 0.005095108695652174, 'mean_word_length': 3.8839137645107793, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1218018', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1015, 'n_words': 166}