<commit_before>module Textoken
  # camelize input
  # create option if option is avaliable
  module OptionFactory
    def self.build(key, value)
      option_klass(key).new(value)
    end

    private

    def self.camelize(key)
      key.to_s.split('_').map(&:capitalize).join
    end

    def self.option_klass(key)
      Object.const_get(klass_name(key))
    rescue NameError
      Textoken.expression_error("#{key}: is not a valid option.")
    end

    def self.klass_name(key)
      name = camelize(key)
      RUBY_VERSION < "2.0.0" ? name.to_sym : 'Textoken::' + name
    end
  end
end<commit_msg>1.9.3 fix 2<commit_after>module Textoken
  # camelize input
  # create option if option is avaliable
  module OptionFactory
    def self.build(key, value)
      option_klass(key).new(value)
    end

    private

    def self.camelize(key)
      key.to_s.split('_').map(&:capitalize).join
    end

    def self.option_klass(key)
      Object.const_get(klass_name(key))
    rescue NameError
      Textoken.expression_error("#{key}: is not a valid option.")
    end

    def self.klass_name(key)
      name = 'Textoken::' + camelize(key)
      name.to_sym if RUBY_VERSION < '2.0.0'
      name
    end
  end
end
{'fraction_non_alphanumeric': 0.10900082576383155, 'fraction_numerical': 0.008257638315441783, 'mean_word_length': 2.7875, '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': '3940587', 'n_tokens_mistral': 429, 'n_tokens_neox': 419, 'n_words': 94}