<commit_before># vim: et sw=2

require_relative 'gcov_reading'
require 'stringio'

class Stcoverage
  def self.coverage(files = nil)
    c = self.new(files)
    yield c if block_given?
    c.coverage
  end

  def initialize(files = nil)
    @functions = []

    unless files.nil?
      files.select{ |x| x.end_with?('.gcno') }.each{ |f| add_gcno_file(f) }<commit_msg>Accept a single filename at initialization<commit_after># vim: et sw=2

require_relative 'gcov_reading'
require 'stringio'

class Stcoverage
  def self.coverage(files = nil)
    c = self.new(files)
    yield c if block_given?
    c.coverage
  end

  def initialize(files = nil)
    @functions = []

    unless files.nil?
      files = [*files]
      files.select{ |x| x.end_with?('.gcno') }.each{ |f| add_gcno_file(f) }
{'fraction_non_alphanumeric': 0.1272264631043257, 'fraction_numerical': 0.002544529262086514, 'mean_word_length': 3.3966480446927374, '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': '3281679', 'n_tokens_mistral': 296, 'n_tokens_neox': 286, 'n_words': 73}