<commit_before>require 'logger'
require 'digest/md5'
require 'murmurhash3'

require 'vector_embed/version'
require 'vector_embed/maker'

require 'vector_embed/stop_word'

class VectorEmbed
  # http://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly
  JUST_A_NUMBER = /\A\s*[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?\s*\z/
  BLANK = /\A\s*\z/
  NULL = /\Anull\z/i
  SLASH_N = '\N'
  TRUE = /\Atrue\z/i
  T = /\At\z/i
  FALSE = /\Afalse\z/i
  F = /\Af\z/i
  NULL_BYTE = "\x00"
  LABEL_MAKERS =   [Maker::Boolean, Maker::Number]
  FEATURE_MAKERS = [Maker::Boolean, Maker::Date, Maker::Number, Maker::Ngram, Maker::Phrase]

  attr_reader :options
  attr_accessor :logger
  attr_reader :dict

  def initialize(options = {})
    @options = options.dup
    @mutex = Mutex.new
    @feature_makers = {}
    @logger = options[:logger] || (l = Logger.new($stderr); l.level = Logger::INFO; l)
    if dict = @options.delete(:dict)
      @dict = dict.dup
    end<commit_msg>Easily enable verbose logging<commit_after>require 'logger'
require 'digest/md5'
require 'murmurhash3'

require 'vector_embed/version'
require 'vector_embed/maker'

require 'vector_embed/stop_word'

class VectorEmbed
  # http://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly
  JUST_A_NUMBER = /\A\s*[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?\s*\z/
  BLANK = /\A\s*\z/
  NULL = /\Anull\z/i
  SLASH_N = '\N'
  TRUE = /\Atrue\z/i
  T = /\At\z/i
  FALSE = /\Afalse\z/i
  F = /\Af\z/i
  NULL_BYTE = "\x00"
  LABEL_MAKERS =   [Maker::Boolean, Maker::Number]
  FEATURE_MAKERS = [Maker::Boolean, Maker::Date, Maker::Number, Maker::Ngram, Maker::Phrase]

  attr_reader :options
  attr_accessor :logger
  attr_reader :dict

  def initialize(options = {})
    @options = options.dup
    @mutex = Mutex.new
    @feature_makers = {}
    @logger = options[:logger] || (l = Logger.new($stderr); l.level = (ENV['VERBOSE'] == 'true') ? Logger::DEBUG : Logger::INFO; l)
    if dict = @options.delete(:dict)
      @dict = dict.dup
    end
{'fraction_non_alphanumeric': 0.19421284943599804, 'fraction_numerical': 0.012751348700343305, 'mean_word_length': 3.4933920704845813, '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': '1505455', 'n_tokens_mistral': 853, 'n_tokens_neox': 797, 'n_words': 141}