<commit_before>"use strict";

angular.module('arethusa.morph').service('morph', function(state, configurator) {
  this.conf = configurator.configurationFor('morph');
  this.attributes = this.conf.attributes;
  this.template = this.conf.template;
  this.name = this.conf.name;
  this.postagSchema = this.conf.postagSchema;

  var morphRetrievers = configurator.getServices(this.conf.retrievers);

  this.seedAnalyses = function(tokens) {
    var analyses = {};
    angular.forEach(tokens, function(token, id) {
      analyses[id] = { string: token.string, forms: [], analyzed: false };
    });
    return analyses;
  };

  this.postagToAttributes = function(form) {
    var that = this;
    var attrs = {};
    angular.forEach(form.postag, function(postagVal, i) {
      var postagClass  = that.postagSchema[i];
      var possibleVals = that.attributeValues(postagClass);
      var attrObj = arethusaUtil.findObj(possibleVals, function(obj) {
        return obj.postag === postagVal;
      });

      // attrObj can be undefined when the postag is -
      if (attrObj) {
        attrs[postagClass] = attrObj.short;<commit_msg>Set this.analyses in morph to {} on load<commit_after>"use strict";

angular.module('arethusa.morph').service('morph', function(state, configurator) {
  this.conf = configurator.configurationFor('morph');
  this.attributes = this.conf.attributes;
  this.template = this.conf.template;
  this.name = this.conf.name;
  this.postagSchema = this.conf.postagSchema;
  this.analyses = {};

  var morphRetrievers = configurator.getServices(this.conf.retrievers);

  this.seedAnalyses = function(tokens) {
    var analyses = {};
    angular.forEach(tokens, function(token, id) {
      analyses[id] = { string: token.string, forms: [], analyzed: false };
    });
    return analyses;
  };

  this.postagToAttributes = function(form) {
    var that = this;
    var attrs = {};
    angular.forEach(form.postag, function(postagVal, i) {
      var postagClass  = that.postagSchema[i];
      var possibleVals = that.attributeValues(postagClass);
      var attrObj = arethusaUtil.findObj(possibleVals, function(obj) {
        return obj.postag === postagVal;
      });

      // attrObj can be undefined when the postag is -
      if (attrObj) {
        attrs[postagClass] = attrObj.short;
{'fraction_non_alphanumeric': 0.13136146150500216, 'fraction_numerical': 0.0, 'mean_word_length': 3.5544554455445545, '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': '4213383', 'n_tokens_mistral': 733, 'n_tokens_neox': 711, 'n_words': 142}