<commit_before>"use strict";

angular.module('arethusa').controller('MorphImportCtrl', [
  '$scope', 'plugins',
  'latinAttrs',
  'greekAttrs',
  'configurator',
  '$http',
  function($scope, plugins, latinAttrs, greekAttrs, configurator, $http) {
    var morph;
    var attrs = {
      lat: latinAttrs.data,
      grc: greekAttrs.data
    };

    var config = configurator.configuration;

    $scope.useLanguage = function(attr) {
      config.plugins.morph = attrs[attr];
      $scope.usedLanguage = attr;
    };

    // Use a starting value so the morph service can load properly
    $scope.useLanguage('lat');

    var data = "Caesar,Caesar,n-s---mn-,lfdm";
    plugins.start(['morph']).then(function() {
      morph = plugins.get('morph');
      $scope.ready = true;
    });

    $scope.files = [
      {
        name: 'Latin Morphology',
        language: 'lat',
        route: '...'
      },
      {
        name: 'Greek Morphology',
        language: 'grc',
        route: '...'
      }
    ];

    function loadForms(data, filter) {
      var lines = data.split('\n');
      for (var i=0; i < lines.length; i++) {
        // Fields are organized like
        // Form       - Lemma   - Postag   - User
        // Caesaris   - Caesar  - .......  - ....
        var fields = lines[i].split(',');
        var form = {
          lemma: fields[1],
          postag: fields[2],
          origin: fields[3]
        };
        morph.postagToAttributes(form);
        morph.addToLocalStorage(fields[0], form);
      }
    }

    $scope.loadFile = function(fileObj) {
      $http.get(fileObj.route).then(function(res) {
        $scope.useLanguage(fileObj.language);
        loadForms(res.data);
      });

    };
  }
]);<commit_msg>More private variables in MorphImportCtrl<commit_after>"use strict";

angular.module('arethusa').controller('MorphImportCtrl', [
  '$scope', 'plugins',
  'latinAttrs',
  'greekAttrs',
  'configurator',
  '$http', function($scope, plugins, latinAttrs, greekAttrs, configurator, $http) {
    var morph;
    var attrs = {
      lat: latinAttrs.data,
      grc: greekAttrs.data
    };

    var config = configurator.configuration;

    function useLanguage(attr) {
      config.plugins.morph = attrs[attr];
      $scope.usedLanguage = attr;
    }

    // Use a starting value so the morph service can load properly
    useLanguage('lat');

    var data = "Caesar,Caesar,n-s---mn-,lfdm";

    plugins.start(['morph']).then(function() {
      morph = plugins.get('morph');
      $scope.ready = true;
    });

    $scope.files = [
      {
        name: 'Latin Morphology',
        language: 'lat',
        route: '...'
      },
      {
        name: 'Greek Morphology',
        language: 'grc',
        route: '...'
      }
    ];

    function loadForms(data, filter) {
      var lines = data.split('\n');
      for (var i=0; i < lines.length; i++) {
        // Fields are organized like
        // Form       - Lemma   - Postag   - User
        // Caesaris   - Caesar  - .......  - ....
        var fields = lines[i].split(',');
        var form = {
          lemma: fields[1],
          postag: fields[2],
          origin: fields[3]
        };

        morph.postagToAttributes(form);
        morph.addToLocalStorage(fields[0], form);
      }
    }

    $scope.loadFile = function(fileObj) {
      $http.get(fileObj.route).then(function(res) {
        useLanguage(fileObj.language);
        loadForms(res.data);
      });

    };
  }
]);
{'fraction_non_alphanumeric': 0.1605080831408776, 'fraction_numerical': 0.002886836027713626, 'mean_word_length': 2.00520381613183, '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': '3381363', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1102, 'n_words': 216}