<commit_before>require 'watir-webdriver'
require 'fileutils'
require 'date'

module Gucci
  module House
    class Search

      attr_accessor :download_dir, :search_params, :status, :pages, :filings

      def initialize(opts={})
        @search_type = opts[:contributions]? opts[:contributions]=="contributions"? :contributions : :contribution_filings : :disclosure_filings
        opts.delete(:contributions) if opts[:contributions]
        @verbose = opts[:verbose] ? true : false
        opts.delete(:verbose) if opts[:verbose]
        @browser = browser
        @search_params = validate_params(make_params(opts))
        search(@search_params)
        @browser.close
      end

      def browser
        browser = Watir::Browser.new :phantomjs
        url = ''
        if @search_type =~ /contribution/
          url = 'disclosures.house.gov/lc/lcsearch.aspx'
        else
           url = 'disclosures.house.gov/ld/ldsearch.aspx'
        end
        browser.goto url
        return browser
      end
<commit_msg>adding comments to code<commit_after>require 'watir-webdriver'
require 'fileutils'
require 'date'

module Gucci
  module House
    # Gucci::House::Search is an interface for the Clerk of the House's lobbying filing search forms
    # (http://disclosures.house.gov/ld/ldsearch.aspx)
    # (http://disclosures.house.gov/lc/lcsearch.aspx)
    class Search

      attr_accessor :download_dir, :search_params, :status, :pages, :filings
      
    # @param [Hash] opts a hash of parameters to be
    # passed to the search form.
      def initialize(opts={})
        @search_type = opts[:contributions]? opts[:contributions]=="contributions"? :contributions : :contribution_filings : :disclosure_filings
        opts.delete(:contributions) if opts[:contributions]
        @verbose = opts[:verbose] ? true : false
        opts.delete(:verbose) if opts[:verbose]
        @browser = browser
        @search_params = validate_params(make_params(opts))
        search(@search_params)
        @browser.close
      end

      def browser
        browser = Watir::Browser.new :phantomjs
        url = ''
        if @search_type =~ /contribution/
          url = 'disclosures.house.gov/lc/lcsearch.aspx'
        else
           url = 'disclosures.house.gov/ld/ldsearch.aspx'
        end
        browser.goto url
        return browser
      end

{'fraction_non_alphanumeric': 0.10553191489361702, 'fraction_numerical': 0.0, 'mean_word_length': 2.7199367088607596, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '484190', 'n_tokens_mistral': 711, 'n_tokens_neox': 672, 'n_words': 159}