<commit_before>module KoiReferenceCompiler

  class Compiler
    
    def self.compile(tree)
      bytecode = tree.compile
      return bytecode
    end
    
    def self.load_ast_hash(hash)
      unless(hash[:elements].nil?)
        elements = hash[:elements].map {|x| self.load_ast_hash(x) }
      else
        elements = nil
      end
      tree = Kernel.const_get("KoiReferenceCompiler").const_get(hash[:name]).new(hash[:text_value], hash[:offset], elements)
      return tree
    end
    <commit_msg>Updated the Compiler.compile method so that it accepts and AST hash insteat of an AST object.<commit_after>module KoiReferenceCompiler

  class Compiler
    
    def self.compile(ast_hash)
      tree = self.load_ast_hash(ast_hash)
      bytecode = tree.compile
      return bytecode
    end
    
    def self.load_ast_hash(hash)
      unless(hash[:elements].nil?)
        elements = hash[:elements].map {|x| self.load_ast_hash(x) }
      else
        elements = nil
      end
      tree = Kernel.const_get("KoiReferenceCompiler").const_get(hash[:name]).new(hash[:text_value], hash[:offset], elements)
      return tree
    end
    
{'fraction_non_alphanumeric': 0.10035211267605634, 'fraction_numerical': 0.0, 'mean_word_length': 2.8412162162162162, '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': '5102463', 'n_tokens_mistral': 347, 'n_tokens_neox': 341, 'n_words': 75}