<commit_before># frozen_string_literal: true
require "graphql/language/definition_slice"
require "graphql/language/generation"
require "graphql/language/lexer"
require "graphql/language/nodes"
require "graphql/language/parser"
require "graphql/language/token"
require "graphql/language/visitor"
require "graphql/language/comments"

module GraphQL
  module Language
    # @api private
    def self.serialize(value)
      JSON.generate(value, quirks_mode: true)
    end
  end
end<commit_msg>correctly serialize hashes<commit_after># frozen_string_literal: true
require "graphql/language/definition_slice"
require "graphql/language/generation"
require "graphql/language/lexer"
require "graphql/language/nodes"
require "graphql/language/parser"
require "graphql/language/token"
require "graphql/language/visitor"
require "graphql/language/comments"

module GraphQL
  module Language
    # @api private
    def self.serialize(value)
      if value.is_a?(Hash)
        serialized_hash = value.map do |k, v|
          "#{k}:#{serialize v}"
        end.join(",")

        "{#{serialized_hash}}"
      else
        JSON.generate(value, quirks_mode: true)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10656436487638533, 'fraction_numerical': 0.0, 'mean_word_length': 4.26457399103139, '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': '6308632', 'n_tokens_mistral': 364, 'n_tokens_neox': 365, 'n_words': 80}