<commit_before>module Twilio
  module REST
    module Utils

      def twilify(something)
        if something.is_a? Hash
          Hash[*something.to_a.map {|a| [twilify(a[0]).to_sym, a[1]]}.flatten(1)]
        else
          something.to_s.split('_').map do |s|
            [s[0,1].capitalize, s[1..-1]].join
          end.join
        end
      end

      def detwilify(something)
        if something.is_a? Hash
          Hash[*something.to_a.map {|pair| [detwilify(pair[0]).to_sym, pair[1]]}.flatten]
        else
          something.to_s.gsub(/[A-Z][a-z]*/) {|s| "_#{s.downcase}"}.gsub(/^_/, '')
        end
      end

    end
  end
end<commit_msg>Change `map` to `map!` to save extra array creation on new array<commit_after>module Twilio
  module REST
    module Utils

      def twilify(something)
        if something.is_a? Hash
          Hash[*something.to_a.map! {|a| [twilify(a[0]).to_sym, a[1]]}.flatten(1)]
        else
          something.to_s.split('_').map! do |s|
            [s[0,1].capitalize, s[1..-1]].join
          end.join
        end
      end

      def detwilify(something)
        if something.is_a? Hash
          Hash[*something.to_a.map! {|pair| [detwilify(pair[0]).to_sym, pair[1]]}.flatten]
        else
          something.to_s.gsub(/[A-Z][a-z]*/) {|s| "_#{s.downcase}"}.gsub(/^_/, '')
        end
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.1644640234948605, 'fraction_numerical': 0.013215859030837005, 'mean_word_length': 2.015486725663717, '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': '1658459', 'n_tokens_mistral': 522, 'n_tokens_neox': 505, 'n_words': 94}