<commit_before>module = mean.module 'yournal.visualization', [
  'yournal.directives.fisheye'
]

module.config [
  '$stateProvider',
  ($stateProvider) ->
    $stateProvider.state('visualization',
      url: '/visualization'
      templateUrl: module.mean.resource('visualization/visualization.html')
      controller: module.mean.namespace('VisualisationCtrl')
    )
]

module.controller module.mean.namespace('VisualisationCtrl'), [
  '$scope',
  'Article',
  ($scope, Article) ->
    articlesPromise = Article.all()
    nodesList = []
    linksList = []
    authors = {}
    articlesPromise.$promise.then((articles) ->
      for article in articles
        articleNode =
          'name': article.title
          'year': article.year
          'volume': article.volume
          'issue': article.issue
          'section': article.section
          'group': 1
          '_id': article._id
        target = nodesList.push(articleNode) - 1
        for author in article.authors
          if authors[author]?
            source = authors[author]
          else
            authorNode =
              'name': author
              'group': 2
            source = nodesList.push(authorNode) - 1
          linkNode =
            'source': source
            'target': target,
            'value': 1
          linksList.push linkNode
      $scope.data =
        nodes: nodesList
        links: linksList
    )
]<commit_msg>fixed a bug in visualization<commit_after>module = mean.module 'yournal.visualization', [
  'yournal.directives.fisheye'
]

module.config [
  '$stateProvider',
  ($stateProvider) ->
    $stateProvider.state('visualization',
      url: '/visualization'
      templateUrl: module.mean.resource('visualization/visualization.html')
      controller: module.mean.namespace('VisualisationCtrl')
    )
]

module.controller module.mean.namespace('VisualisationCtrl'), [
  '$scope',
  'Article',
  ($scope, Article) ->
    articlesPromise = Article.all()
    nodesList = []
    linksList = []
    authors = {}
    articlesPromise.$promise.then((articles) ->
      for article in articles
        articleNode =
          'name': article.title
          'year': article.year
          'volume': article.volume
          'issue': article.issue
          'section': article.section
          'group': 1
          '_id': article._id
        target = nodesList.push(articleNode) - 1
        for author in article.authors
          if authors[author]?
            source = authors[author]
          else
            authorNode =
              'name': author
              'group': 2
            source = nodesList.push(authorNode) - 1
            authors[author] = source
          linkNode =
            'source': source
            'target': target,
            'value': 1
          linksList.push linkNode
      $scope.data =
        nodes: nodesList
        links: linksList
    )
]
{'fraction_non_alphanumeric': 0.11738227146814405, 'fraction_numerical': 0.0034626038781163434, 'mean_word_length': 2.0283018867924527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3216916', 'n_tokens_mistral': 797, 'n_tokens_neox': 769, 'n_words': 164}