<commit_before>require 'oj'
require 'set'
require 'git_cmd'

# A base class with a template method to run an algorithm to process `git log` output to compute different code churn metrics.
class Churn
  # A string with the name of the command line.
  COMMAND_NAME = "ichurn"
  # A string with a regular expresion to match a group with the commit ID from the line of `git log` with the commit SHA-1.
  COMMIT_SHA   = /^commit\s(\w*)$/
  # A string with a regular expresion to match a group with the author from `git log` line where author appears.
  AUTHOR       = /^Author:\s(.*\w)\s+</
  # A string with a regular expresion to match a group with the author from `git blame` line where author appears.
  AUTHOR_BLAME = /\((.*\w)\s+\d\d\d\d/
  # A string with a regular expresion to match a group with the file from `git log` line where file appears.
  FILE         = /^diff\s--git\sa\/.*\sb\/(.*)$/
  # A string with a regular expresion to match groups for each number in the patch-at line from `git log`.
  PATCH_AT     = /^@@\s-(\d*),?(\d*)?\s\+(\d*),?(\d*)?\s@@/

  # Attribute to get the number of commits found after computing churn metric.
  attr_reader :commits

  # Attribute to get the resulted churn metric value after computing the churn.
  attr_reader :result

  # Initializes a new instance of Churn.
  # @param wd [String] A string with the path of a directory.
  def initialize dir = Dir.getwd
    @commits = 0
    @result = 0
    @git = GitCmd.new(dir)<commit_msg>fix regex to match author's name that end with any character but space<commit_after>require 'oj'
require 'set'
require 'git_cmd'

# A base class with a template method to run an algorithm to process `git log` output to compute different code churn metrics.
class Churn
  # A string with the name of the command line.
  COMMAND_NAME = "ichurn"
  # A string with a regular expresion to match a group with the commit ID from the line of `git log` with the commit SHA-1.
  COMMIT_SHA   = /^commit\s(\w*)$/
  # A string with a regular expresion to match a group with the author from `git log` line where author appears.
  AUTHOR       = /^Author:\s(.*[^\s])\s+</
  # A string with a regular expresion to match a group with the author from `git blame` line where author appears.
  AUTHOR_BLAME = /\((.*[^\s])\s+\d\d\d\d/
  # A string with a regular expresion to match a group with the file from `git log` line where file appears.
  FILE         = /^diff\s--git\sa\/.*\sb\/(.*)$/
  # A string with a regular expresion to match groups for each number in the patch-at line from `git log`.
  PATCH_AT     = /^@@\s-(\d*),?(\d*)?\s\+(\d*),?(\d*)?\s@@/

  # Attribute to get the number of commits found after computing churn metric.
  attr_reader :commits

  # Attribute to get the resulted churn metric value after computing the churn.
  attr_reader :result

  # Initializes a new instance of Churn.
  # @param wd [String] A string with the path of a directory.
  def initialize dir = Dir.getwd
    @commits = 0
    @result = 0
    @git = GitCmd.new(dir)
{'fraction_non_alphanumeric': 0.10824230387288977, 'fraction_numerical': 0.0019860973187686196, 'mean_word_length': 3.1004070556309364, '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': '4839495', 'n_tokens_mistral': 963, 'n_tokens_neox': 936, 'n_words': 429}