<commit_before># @todo Do speed comparison between these gsl and narray, to load fastest first.
begin
  require 'gsl'
rescue LoadError
  require 'narray'
rescue LoadError
  require 'matrix'
end

class TfIdfSimilarity::Collection
  # The documents in the collection.
  attr_reader :documents
  # The number of times each term appears in all documents.
  attr_reader :term_counts
  # The number of documents each term appears in.
  attr_reader :document_counts

  def initialize
    @documents       = []
    @term_counts     = Hash.new 0
    @document_counts = Hash.new 0<commit_msg>LoadError not being caught because statements are not nested.<commit_after># @todo Do speed comparison between these gsl and narray, to load fastest first.
begin
  require 'gsl'
rescue LoadError
  begin
    require 'narray'
  rescue LoadError
    require 'matrix'
  end
end

class TfIdfSimilarity::Collection
  # The documents in the collection.
  attr_reader :documents
  # The number of times each term appears in all documents.
  attr_reader :term_counts
  # The number of documents each term appears in.
  attr_reader :document_counts

  def initialize
    @documents       = []
    @term_counts     = Hash.new 0
    @document_counts = Hash.new 0
{'fraction_non_alphanumeric': 0.056006493506493504, 'fraction_numerical': 0.003246753246753247, 'mean_word_length': 3.6353383458646618, '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': '4607811', 'n_tokens_mistral': 370, 'n_tokens_neox': 358, 'n_words': 141}