<commit_before>begin
  require 'sinatra'
  require 'yajl'
  require '/opt/engines/lib/ruby/system/system_debug.rb'
  require '/opt/engines/lib/ruby/api/system/engines_core/engines_core.rb'

  require_relative 'utils.rb'

  set :sessions, true
  set :logging, true
  set :run, true

  @@core_api = EnginesCore.new

  require_relative 'api/routes.rb'

  get '/v0/*' do
    p :No_Such_GET
    p :params
    status(404)
  end
  
  def assemble_params(params, address_params, accept_params )
    
    a_params = address_params(params, address_params)
    r_params = required_params(params,accept_params)
    a_params.merge!(r_params)
#    address_params = [:engine_name]
#    accept_params = [:all]
#    cparams = assemble_params(params, address_params, accept_params )
#    cparams = address_params(params,  :engine_name) # , :variables)
#    vars = params[:api_vars]
#    Utils.symbolize_keys(vars)
#    cparams.merge!(vars)
  end
  def required_params(params, keys)
    mparams = params[:api_vars]
    Utils.symbolize_keys(mparams)
      return nil if mparams.nil?
    match_params(mparams, keys)   
  end
  
  def address_params(params, keys)
    match_params(params, keys)
  end
  
  def match_params(params, keys)
    return params if keys == :all
     
    cparams =  {}
            for key in keys
              cparams[key] = params[key]
            end
            cparams
  end
  
def accept_params(params , *keys)
  cparams = {}
      for key in keys
        cparams[key] = params[key]<commit_msg>api_vars no a sym<commit_after>begin
  require 'sinatra'
  require 'yajl'
  require '/opt/engines/lib/ruby/system/system_debug.rb'
  require '/opt/engines/lib/ruby/api/system/engines_core/engines_core.rb'

  require_relative 'utils.rb'

  set :sessions, true
  set :logging, true
  set :run, true

  @@core_api = EnginesCore.new

  require_relative 'api/routes.rb'

  get '/v0/*' do
    p :No_Such_GET
    p :params
    status(404)
  end
  
  def assemble_params(params, address_params, accept_params )
    
    a_params = address_params(params, address_params)
    r_params = required_params(params,accept_params)
    a_params.merge!(r_params)
#    address_params = [:engine_name]
#    accept_params = [:all]
#    cparams = assemble_params(params, address_params, accept_params )
#    cparams = address_params(params,  :engine_name) # , :variables)
#    vars = params[:api_vars]
#    Utils.symbolize_keys(vars)
#    cparams.merge!(vars)
  end
  def required_params(params, keys)
    mparams = params['api_vars']
    Utils.symbolize_keys(mparams)
      return nil if mparams.nil?
    match_params(mparams, keys)   
  end
  
  def address_params(params, keys)
    match_params(params, keys)
  end
  
  def match_params(params, keys)
    return params if keys == :all
     
    cparams =  {}
            for key in keys
              cparams[key] = params[key]
            end
            cparams
  end
  
def accept_params(params , *keys)
  cparams = {}
      for key in keys
        cparams[key] = params[key]
{'fraction_non_alphanumeric': 0.10388317291735812, 'fraction_numerical': 0.002655160969133754, 'mean_word_length': 2.9973474801061006, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6252882', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1028, 'n_words': 216}