<commit_before># frozen_string_literal: true

require 'yaml'
require 'diffy'

# Check Yaml if Alphabetically sorted
class YamlSortChecker
  class NotSortedError < StandardError; end

  def initialize(filename)
    @yaml = YAML.load_file(filename)
  end

  def sorted?(type=:key)
    case type.to_sym
    when :key   then key_sorted?
    when :value then value_sorted?
    end

    true
  end
<commit_msg>Workaround `NameError` in diffy 3.4.2<commit_after># frozen_string_literal: true

require 'yaml'
require 'open3' # workaround https://github.com/samg/diffy#119
require 'diffy'

# Check Yaml if Alphabetically sorted
class YamlSortChecker
  class NotSortedError < StandardError; end

  def initialize(filename)
    @yaml = YAML.load_file(filename)
  end

  def sorted?(type=:key)
    case type.to_sym
    when :key   then key_sorted?
    when :value then value_sorted?
    end

    true
  end

{'fraction_non_alphanumeric': 0.08044692737430167, 'fraction_numerical': 0.00782122905027933, 'mean_word_length': 3.843243243243243, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '2116495', 'n_tokens_mistral': 311, 'n_tokens_neox': 302, 'n_words': 84}