<commit_before>require 'wordlist/unique_filter'
require 'wordlist/mutator'

module Wordlist
  class List

    include Enumerable

    # Maximum length of words
    attr_accessor :max_length

    # Minimum length of words
    attr_accessor :min_length

    #
    # Creates a new List object with the given _options_.
    #
    # _options_ may include the following keys:
    # <tt>:max_length</tt>:: The maximum length of words produced by the
    #                        list.
    # <tt>:min_length</tt>:: The minimum length of words produced by the
    #                        list.
    #
    def initialize(options={})
      @mutators = []

      @max_length = nil
      @min_length = 0
    end

    #
    # Adds a mutation rule for the specified _pattern_, to be replaced
    # using the specified _substitute_.
    #
    #   list.mutate 'o', '0'
    #
    #   list.mutate '0', 0x41
    #
    #   list.mutate /[oO]/, lambda { |match|
    #     match.swapcase
    #   }<commit_msg>Have List#initialize actually process the given options.<commit_after>require 'wordlist/unique_filter'
require 'wordlist/mutator'

module Wordlist
  class List

    include Enumerable

    # Maximum length of words
    attr_accessor :max_length

    # Minimum length of words
    attr_accessor :min_length

    #
    # Creates a new List object with the given _options_.
    #
    # _options_ may include the following keys:
    # <tt>:max_length</tt>:: The maximum length of words produced by the
    #                        list.
    # <tt>:min_length</tt>:: The minimum length of words produced by the
    #                        list.
    #
    def initialize(options={})
      @mutators = []

      @max_length = nil
      @min_length = 0

      if options[:max_length]
        @max_length = options[:max_length]
      end

      if options[:min_length]
        @min_length = options[:min_length]
      end
    end

    #
    # Adds a mutation rule for the specified _pattern_, to be replaced
    # using the specified _substitute_.
    #
    #   list.mutate 'o', '0'
    #
    #   list.mutate '0', 0x41
    #
    #   list.mutate /[oO]/, lambda { |match|
    #     match.swapcase
    #   }
{'fraction_non_alphanumeric': 0.08986703347088491, 'fraction_numerical': 0.005502063273727648, 'mean_word_length': 2.0646067415730336, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3907833', 'n_tokens_mistral': 681, 'n_tokens_neox': 645, 'n_words': 198}