<commit_before>require "valid_email2"
require "resolv"
require "mail"

module ValidEmail2
  class Address
    attr_accessor :address

    def initialize(address)
      @parse_error = false
      @raw_address = address

      begin
        @address = Mail::Address.new(address)
      rescue Mail::Field::ParseError
        @parse_error = true
      end
    end

    def valid?
      return false if @parse_error

      if address.domain && address.address == @raw_address
        tree = address.send(:tree)

        # Valid address needs to have a dot in the domain
        tree.domain.dot_atom_text.elements.size > 1
      else
        false
      end
    end

    def disposable?
      valid? && ValidEmail2.disposable_emails.include?(address.domain)<commit_msg>Count the dots in the domain without using the tree method<commit_after>require "valid_email2"
require "resolv"
require "mail"

module ValidEmail2
  class Address
    attr_accessor :address

    def initialize(address)
      @parse_error = false
      @raw_address = address

      begin
        @address = Mail::Address.new(address)
      rescue Mail::Field::ParseError
        @parse_error = true
      end
    end

    def valid?
      return false if @parse_error

      if address.domain && address.address == @raw_address
        # Valid address needs to have a dot in the domain
        !!address.domain.match(/\./)
      else
        false
      end
    end

    def disposable?
      valid? && ValidEmail2.disposable_emails.include?(address.domain)
{'fraction_non_alphanumeric': 0.07763157894736843, 'fraction_numerical': 0.004605263157894736, 'mean_word_length': 2.4726027397260273, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2615957', 'n_tokens_mistral': 439, 'n_tokens_neox': 426, 'n_words': 124}