<commit_before># utf-8

module ONIX
  module Inflector
    
    def initialize(options = {})
      initialize_attributes(options)
    end
    
    def attributes
      public_methods.map {|meth| meth.match(/^(?!roxml|taguri|=)(.+)=$/) ? $1 : nil }.compact
    end
    
    private
    
    def initialize_attributes(options)
      options.symbolize_keys!
      attributes.each do |attribute|
        self.send("#{attribute}=", options[attribute.to_sym])
      end
    end
    
  end
end<commit_msg>Only initialize attribute if value given when creating instance<commit_after># utf-8

module ONIX
  module Inflector
    
    def initialize(options = {})
      initialize_attributes(options)
    end
    
    def attributes
      public_methods.map {|meth| meth.match(/^(?!roxml|taguri|=)(.+)=$/) ? $1 : nil }.compact
    end
    
    private
    
    def initialize_attributes(options)
      options.symbolize_keys!
      attributes.each do |attribute|
        self.send("#{attribute}=", options[attribute.to_sym]) if options[attribute.to_sym]
      end
    end
    
  end
end
{'fraction_non_alphanumeric': 0.1144186046511628, 'fraction_numerical': 0.0037209302325581397, 'mean_word_length': 2.635135135135135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3909892', 'n_tokens_mistral': 334, 'n_tokens_neox': 329, 'n_words': 73}