<commit_before>module SmartAnswer
  class FlowRegistry
    class NotFound < StandardError; end
    FLOW_DIR = Rails.root.join("lib/smart_answer_flows")

    def self.instance
      @instance ||= new
    end

    def self.reset_instance(options = {})
      @instance = new(options)
    end

    def initialize(options = {})
      @load_path = Pathname.new(options[:smart_answer_load_path] || FLOW_DIR)
      preload_flows! if !Rails.env.development? || options[:preload_flows]
    end
    attr_reader :load_path
    def find(name)
      raise NotFound unless available?(name)

      find_by_name(name) || raise(NotFound)
    end

    def flows
      available_flows.map { |s| find_by_name(s) }.compact
    end<commit_msg>Output flow name in error message when flow not found<commit_after>module SmartAnswer
  class FlowRegistry
    class NotFound < StandardError; end
    FLOW_DIR = Rails.root.join("lib/smart_answer_flows")

    def self.instance
      @instance ||= new
    end

    def self.reset_instance(options = {})
      @instance = new(options)
    end

    def initialize(options = {})
      @load_path = Pathname.new(options[:smart_answer_load_path] || FLOW_DIR)
      preload_flows! if !Rails.env.development? || options[:preload_flows]
    end
    attr_reader :load_path
    def find(name)
      raise NotFound, "'#{name}' not found" unless available?(name)

      find_by_name(name) || raise(NotFound)
    end

    def flows
      available_flows.map { |s| find_by_name(s) }.compact
    end
{'fraction_non_alphanumeric': 0.10246174318030606, 'fraction_numerical': 0.0, 'mean_word_length': 3.2366197183098593, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5028276', 'n_tokens_mistral': 490, 'n_tokens_neox': 478, 'n_words': 107}