<commit_before># encoding: utf-8
DataMapper::Resource.class_eval do
  yaml_as "tag:ruby.yaml.org,2002:DataMapper"

  def self.yaml_new(klass, tag, val)
    klass.get!(val['id'])
  end

  def to_yaml_properties
    ['@id']
  end
end<commit_msg>Add an encoder for psych parsing.<commit_after># encoding: utf-8
if YAML.parser.class.name =~ /syck/i
  DataMapper::Resource.class_eval do
    yaml_as "tag:ruby.yaml.org,2002:DataMapper"

    def self.yaml_new(klass, tag, val)
      klass.get!(val['attributes']['id'])
    end

    def to_yaml_properties
      ['@attributes']
    end
  end
else
  DataMapper::Resource.class_eval do
    def encode_with(coder)
      coder["attributes"] = @attributes
      coder.tag = ['!ruby/DataMapper', self.class.name].join(':')
    end
  end
end
{'fraction_non_alphanumeric': 0.13917525773195877, 'fraction_numerical': 0.01288659793814433, 'mean_word_length': 3.709090909090909, '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': '5923694', 'n_tokens_mistral': 290, 'n_tokens_neox': 275, 'n_words': 56}