<commit_before>require "recurring_select/engine"
require "ice_cube"

#TODO: remove monkey patch when https://github.com/seejohnrun/ice_cube/issues/136 is fixed
IceCube::ValidatedRule.class_eval do
  alias old_to_s to_s
  def to_s
    old_to_s.gsub("when it is", "and")
  end
end

module RecurringSelect

  def self.dirty_hash_to_rule(params)
    if params.is_a? IceCube::Rule
      params
    else
      if params.is_a?(String)
        params = JSON.parse(params)<commit_msg>remove IceCube::ValidatedRule#to_s monkeypatch<commit_after>require "recurring_select/engine"
require "ice_cube"

module RecurringSelect

  def self.dirty_hash_to_rule(params)
    if params.is_a? IceCube::Rule
      params
    else
      if params.is_a?(String)
        params = JSON.parse(params)
{'fraction_non_alphanumeric': 0.09067357512953368, 'fraction_numerical': 0.0038860103626943004, 'mean_word_length': 4.0855263157894735, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6054955', 'n_tokens_mistral': 284, 'n_tokens_neox': 275, 'n_words': 56}