<commit_before>module Mobilize
  module Gbook
    def Gbook.find_all_by_path(path,gdrive_slot)
      Gdrive.books(gdrive_slot,{"title"=>path,"title-exact"=>"true"})
    end

    def Gbook.find_by_http_url(http_url,gdrive_slot)
      key = http_url.split("key=").last.split("#").first
      Gdrive.root(gdrive_slot).spreadsheet_by_key(key)
    end

    def Gbook.find_by_path(path,gdrive_slot)
      #first try to find a dataset with the URL
      dst = Dataset.find_by_handler_and_path('gbook',path)
      if dst and dst.http_url.to_s.length>0
        book = Gbook.find_by_http_url(dst.http_url,gdrive_slot)
        if book
          return book
        else
          raise "Could not find book #{path} with url #{dst.http_url}, please check dataset"
        end<commit_msg>Modifed the way to get spread sheets to be able to handle the new url structure as well.<commit_after>module Mobilize
  module Gbook
    def Gbook.find_all_by_path(path,gdrive_slot)
      Gdrive.books(gdrive_slot,{"title"=>path,"title-exact"=>"true"})
    end

    def Gbook.find_by_http_url(http_url,gdrive_slot)
      Gdrive.root(gdrive_slot).spreadsheet_by_url(http_url)
    end

    def Gbook.find_by_path(path,gdrive_slot)
      #first try to find a dataset with the URL
      dst = Dataset.find_by_handler_and_path('gbook',path)
      if dst and dst.http_url.to_s.length>0
        book = Gbook.find_by_http_url(dst.http_url,gdrive_slot)
        if book
          return book
        else
          raise "Could not find book #{path} with url #{dst.http_url}, please check dataset"
        end
{'fraction_non_alphanumeric': 0.09535918626827718, 'fraction_numerical': 0.0012714558169103624, 'mean_word_length': 3.2311827956989245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2128337', 'n_tokens_mistral': 549, 'n_tokens_neox': 538, 'n_words': 116}