<commit_before># encoding: utf-8
# frozen_string_literal: true
require 'contact-data/text/results'

module ContactData
  class Text
    BASE = :text

    class << self
      def search(text = nil, params = {})
        if params.is_a? Hash
          params[:timeout] ||= 600
          params[:api_base] ||= 'api/v3'
        end

        Results.new text, params
      end

      def common_phrase(raw_params = {})
        params = raw_params.is_a?(String) ? { name: raw_params } : raw_params
        params[:api_base] ||= 'api/v3'
        Fetcher.get :commmon_phrase, params.to_options(BASE)
      end
    end
  end
end<commit_msg>Fix url constructor for common_phrase<commit_after># encoding: utf-8
# frozen_string_literal: true
require 'contact-data/text/results'

module ContactData
  class Text
    BASE = :text

    class << self
      def search(text = nil, params = {})
        if params.is_a? Hash
          params[:timeout] ||= 600
          params[:api_base] ||= 'api/v3'
        end

        Results.new text, params
      end

      def common_phrase(raw_params = {})
        params = raw_params.is_a?(String) ? { name: raw_params } : raw_params
        params[:api_base] ||= 'api/v3'
        Fetcher.get :common_phrase, params.to_options(BASE)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11379579111457522, 'fraction_numerical': 0.009353078721745909, 'mean_word_length': 2.424, 'pattern_counts': {'":': 0, '<': 7, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1517756', 'n_tokens_mistral': 422, 'n_tokens_neox': 413, 'n_words': 97}