<commit_before>require 'gherkin/parser/table'
require 'gherkin/parser/misc'

module Gherkin
  module Parser
    def self.[](i18n_language)
      require "gherkin/parser/feature_#{i18n_language}"
      i18n_parser_class_name = i18n_language.gsub(/[\s-]/, '').capitalize + "Feature"
      parser_class = const_get(i18n_parser_class_name)
      parser_class
    end
  end
end<commit_msg>Add error handling when parser is not found<commit_after>require 'gherkin/parser/table'
require 'gherkin/parser/misc'

module Gherkin
  module Parser
    I18nParserNotFound = Class.new(LoadError)

    def self.[](i18n_language)
      begin
        require "gherkin/parser/feature_#{i18n_language}"
      rescue LoadError
        raise I18nParserNotFound, "No parser was found for #{i18n_language}. Supported languages are listed in gherkin/i18n.yml."
      end

      i18n_parser_class_name = i18n_language.gsub(/[\s-]/, '').capitalize + "Feature"
      parser_class = const_get(i18n_parser_class_name)
      parser_class
    end
  end
end
{'fraction_non_alphanumeric': 0.09775171065493646, 'fraction_numerical': 0.02737047898338221, 'mean_word_length': 3.740740740740741, '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': '3267634', 'n_tokens_mistral': 371, 'n_tokens_neox': 350, 'n_words': 70}