<commit_before>module Sidewalk
  module Oniguruma
    module MatchData
      def names
        if @named_captures
          @named_captures.keys.map(&:to_s)
        else
          []
        end
      end
    end
  end

  USING_ONIGURUMA = RUBY_VERSION.start_with?('1.8.')
  if USING_ONIGURUMA
    require 'oniguruma'
    Regexp = ::Oniguruma::ORegexp

    ::MatchData.send(:include, Sidewalk::Oniguruma::MatchData)
  else
    Regexp = ::Regexp
  end
end
<commit_msg>restructure the Regexp class<commit_after>module Sidewalk
  module Oniguruma
    module MatchData
      def names
        if @named_captures
          @named_captures.keys.map(&:to_s)
        else
          []
        end
      end
    end
  end

  REGEXP_USING_ONIGURUMA = RUBY_VERSION.start_with?('1.8.')
  if REGEXP_USING_ONIGURUMA
    require 'oniguruma'
    REGEXP_BASE = ::Oniguruma::ORegexp
    ::MatchData.send(:include, Sidewalk::Oniguruma::MatchData)
  else
    REGEXP_BASE = ::Regexp
  end

  # A Regexp class that supports named captures.
  #
  # This class exists just to give a portable class name to refer to.
  #
  # * On Ruby 1.9, this inherits +::Regexp+.
  # * On Ruby 1.8, this inherits +Oniguruma::ORegexp+ (which is basically
  #   the same library that Ruby 1.9 uses for +::Regexp+)
  #
  # @example Using named captures
  #   regexp = Sidewalk::Regexp.new('(?<foo>bar)')
  #   match = regexp.match(regexp)
  #   match['foo'].should == 'bar'
  class Regexp < REGEXP_BASE
    # Whether we're using +Onigirumua::ORegexp+.
    #
    # Inverse of {#native?}.
    def self.oniguruma?
      Sidewalk::REGEXP_USING_ONIGURUMA
    end

    # Whether we're using +::Regexp+
    #
    # Inverse of {#native?}.
    def self.native?
      !self.oniguruma?
    end
  end
end

{'fraction_non_alphanumeric': 0.10622501427755568, 'fraction_numerical': 0.0057110222729868645, 'mean_word_length': 2.6348547717842323, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '4973978', 'n_tokens_mistral': 662, 'n_tokens_neox': 635, 'n_words': 145}