<commit_before>require 'cucumber/core/ast/describes_itself'
require 'cucumber/core/ast/names'
require 'cucumber/core/ast/location'
require 'gherkin3/dialect'

module Cucumber
  module Core
    module Ast
      # Represents the root node of a parsed feature.
      class Feature
        include Names
        include HasLocation
        include DescribesItself

        attr_reader :language, :location, :background,
                    :comments, :tags, :keyword, :description,
                    :feature_elements

        def initialize(language, location, background, comments, tags, keyword, name, description, scenario_definitions)
          @language = language
          @location = location
          @background = background
          @comments = comments
          @tags = tags
          @keyword = keyword
          @name = name
          @description = description
          @feature_elements = scenario_definitions
        end

        def children
          [background] + @feature_elements
        end

        def short_name
          first_line = name.split(/\n/)[0]
          if first_line =~ /#{language.feature_keywords}:(.*)/
            $1.strip
          else
            first_line
          end
        end

        def to_sexp
          sexp = [:feature, file, name]
          comment = @comment.to_sexp
          sexp += [comment] if comment
          tags = @tags.to_sexp
          sexp += tags if tags.any?
          sexp += [@background.to_sexp] if @background
          sexp += @feature_elements.map{|fe| fe.to_sexp}
          sexp
        end

        private

        def description_for_visitors
          :feature
        end

      end

      class NullFeature
        def method_missing(*args, &block)
          self
        end
      end

      class LanguageDelegator < SimpleDelegator
        attr_reader :iso_code

        def initialize(iso_code, obj)
          super(obj)
          @iso_code = iso_code
        end
      end
    end
  end
end<commit_msg>Add require so this file works when loaded on its own<commit_after>require 'cucumber/core/ast/describes_itself'
require 'cucumber/core/ast/names'
require 'cucumber/core/ast/location'
require 'gherkin3/dialect'

module Cucumber
  module Core
    module Ast
      # Represents the root node of a parsed feature.
      class Feature
        include Names
        include HasLocation
        include DescribesItself

        attr_reader :language, :location, :background,
                    :comments, :tags, :keyword, :description,
                    :feature_elements

        def initialize(language, location, background, comments, tags, keyword, name, description, scenario_definitions)
          @language = language
          @location = location
          @background = background
          @comments = comments
          @tags = tags
          @keyword = keyword
          @name = name
          @description = description
          @feature_elements = scenario_definitions
        end

        def children
          [background] + @feature_elements
        end

        def short_name
          first_line = name.split(/\n/)[0]
          if first_line =~ /#{language.feature_keywords}:(.*)/
            $1.strip
          else
            first_line
          end
        end

        def to_sexp
          sexp = [:feature, file, name]
          comment = @comment.to_sexp
          sexp += [comment] if comment
          tags = @tags.to_sexp
          sexp += tags if tags.any?
          sexp += [@background.to_sexp] if @background
          sexp += @feature_elements.map{|fe| fe.to_sexp}
          sexp
        end

        private

        def description_for_visitors
          :feature
        end

      end

      class NullFeature
        def method_missing(*args, &block)
          self
        end
      end

      require 'delegate'
      class LanguageDelegator < SimpleDelegator
        attr_reader :iso_code

        def initialize(iso_code, obj)
          super(obj)
          @iso_code = iso_code
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07190347205121891, 'fraction_numerical': 0.0014774686037921695, 'mean_word_length': 1.7134268537074149, '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': '5373745', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1072, 'n_words': 295}