<commit_before>require "sinatra/base"
require "json"
require "gemstash"

module Gemstash
  #:nodoc:
  class Web < Sinatra::Base
    API_REQUEST_LIMIT = 200

    def initialize(gem_strategy: nil, web_helper: nil)
      @web_helper   = web_helper || Gemstash::RubygemsWebHelper.new
      @strategy     = gem_strategy || Gemstash::RedirectionStrategy.new(web_helper: @web_helper)
      @dependencies = Gemstash::Dependencies.new(@web_helper)
      super()
    end

    not_found do
      status 404
      body JSON.dump("error" => "Not found", "code" => 404)
    end
<commit_msg>Add require strategies to web<commit_after>require "sinatra/base"
require "json"
require "gemstash"
require "gemstash/strategy"

module Gemstash
  #:nodoc:
  class Web < Sinatra::Base
    API_REQUEST_LIMIT = 200

    def initialize(gem_strategy: nil, web_helper: nil)
      @web_helper   = web_helper || Gemstash::RubygemsWebHelper.new
      @strategy     = gem_strategy || Gemstash::RedirectionStrategy.new(web_helper: @web_helper)
      @dependencies = Gemstash::Dependencies.new(@web_helper)
      super()
    end

    not_found do
      status 404
      body JSON.dump("error" => "Not found", "code" => 404)
    end

{'fraction_non_alphanumeric': 0.10953177257525083, 'fraction_numerical': 0.015050167224080268, 'mean_word_length': 3.67578125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4184033', 'n_tokens_mistral': 419, 'n_tokens_neox': 390, 'n_words': 88}