<commit_before>/*!
 * multilang-extract-comments <https://github.com/nknapp/multilang-extract-comments>
 *
 * Copyright (c) 2015 <NAME>.
 * Released under the MIT license.
 */

'use strict'

var q = require('quotemeta')
var LineCounter = require('line-counter')
var EventEmitter = require('events').EventEmitter
var util = require('util')

/**
 *
 * @param {object} pattern
 * @param {RegExp} pattern.regex
 * @param {RegExp[]} pattern.middle
 * @param {object[]} pattern.info
 * @param {object} pattern.cg
 * @param {number} pattern.cg.indent
 * @param {number} pattern.cg.wholeComment
 * @param {number} pattern.cg.contentStart
 * @constructor
 */
function Scanner (pattern) {
  var _this = this
  // Shortcut for capturing group constants
  var cg = pattern.cg

  /**
   * Return the spec that was responsible for a comment match
   * @param commentMatch
   * @returns {*}
   */
  function contentCg (commentMatch) {
    var start = cg.contentStart
    var end = start + pattern.middle.length
    for (var i = start; i < end; i++) {
      if (typeof commentMatch[i] !== 'undefined') {
        return i
      }
    }
    console.log(commentMatch)
    throw new Error('No comment-part had a match. This should not happen')
  }

  this.scan = function (contents) {
    var counter = new LineCounter(contents)
    var match<commit_msg>Remove console.log<commit_after>/*!
 * multilang-extract-comments <https://github.com/nknapp/multilang-extract-comments>
 *
 * Copyright (c) 2015 <NAME>.
 * Released under the MIT license.
 */

'use strict'

var q = require('quotemeta')
var LineCounter = require('line-counter')
var EventEmitter = require('events').EventEmitter
var util = require('util')

/**
 *
 * @param {object} pattern
 * @param {RegExp} pattern.regex
 * @param {RegExp[]} pattern.middle
 * @param {object[]} pattern.info
 * @param {object} pattern.cg
 * @param {number} pattern.cg.indent
 * @param {number} pattern.cg.wholeComment
 * @param {number} pattern.cg.contentStart
 * @constructor
 */
function Scanner (pattern) {
  var _this = this
  // Shortcut for capturing group constants
  var cg = pattern.cg

  /**
   * Return the spec that was responsible for a comment match
   * @param commentMatch
   * @returns {*}
   */
  function contentCg (commentMatch) {
    var start = cg.contentStart
    var end = start + pattern.middle.length
    for (var i = start; i < end; i++) {
      if (typeof commentMatch[i] !== 'undefined') {
        return i
      }
    }
    throw new Error('No comment-part had a match. This should not happen')
  }

  this.scan = function (contents) {
    var counter = new LineCounter(contents)
    var match
{'fraction_non_alphanumeric': 0.13318199016269391, 'fraction_numerical': 0.003026863412788498, 'mean_word_length': 3.355848434925865, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '2909912', 'n_tokens_mistral': 821, 'n_tokens_neox': 806, 'n_words': 243}