<commit_before>module SearchHelper
  class GoogleCustomSearch

    #code for connecting to google search api
    def self.initialize_search
      @my_search_client = Google::APIClient.new(
        key: "<KEY>" , authorization: nil)
      @google_search = @my_search_client.discovered_api("customsearch")
#    response = my_search_client.execute(google_search.cse.list, 'q' => 'hello world')
    end

    def self.execute_query(query)
      if @google_search.nil?
        self.initialize_search
        @response = @my_search_client.execute(api_method: @google_search.cse.list,
          parameters: {q: query,
                     key: "<KEY>",
                      cx: "000177987223272125020:4z21ktdyx88"})
      else
      @response = @my_search_client.execute(api_method: @google_search.cse.list,
        parameters: {q: query,
                     key: "<KEY>",
                     cx: "000177987223272125020:4z21ktdyx88"})
      end
    end

    def self.get_response<commit_msg>adding search_helper class without keys<commit_after>module SearchHelper
  class GoogleCustomSearch

    #code for connecting to google search api
    def self.initialize_search
      @my_search_client = Google::APIClient.new(
        key: "YOUR_API_KEY_HERE" , authorization: nil)
      @google_search = @my_search_client.discovered_api("customsearch")
#    response = my_search_client.execute(google_search.cse.list, 'q' => 'hello world')
    end

    def self.execute_query(query)
      if @google_search.nil?
        self.initialize_search
        @response = @my_search_client.execute(api_method: @google_search.cse.list,
          parameters: {q: query,
                     key: "YOUR_API_KEY_HERE",
                      cx: "YOUR_CSE_CODE_HERE"})
      else
      @response = @my_search_client.execute(api_method: @google_search.cse.list,
        parameters: {q: query,
                     key: "YOUR_API_KEY_HERE",
                     cx: "YOUR_CSE_CODE_HERE"})
      end
    end

    def self.get_response
{'fraction_non_alphanumeric': 0.0968063872255489, 'fraction_numerical': 0.02594810379241517, 'mean_word_length': 2.6126126126126126, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '7220570', 'n_tokens_mistral': 659, 'n_tokens_neox': 614, 'n_words': 117}