<commit_before>require 'api/generator'

class LocalTransactionsController < ApplicationController
  respond_to :json

  def verify_snac
    publication = Publication.first(conditions: {slug: params[:id]})
    head 404 and return if publication.nil?

    snac_codes = params[:snac_codes]
    verified_codes = snac_codes.collect do |snac|
      snac if publication.verify_snac(snac)
    end.compact
    if verified_codes.first
      render :json => {'snac' => verified_codes.first}
    else
      render :text => '', :status => 422<commit_msg>Enumerable#detect was made for this<commit_after>require 'api/generator'

class LocalTransactionsController < ApplicationController
  respond_to :json

  def verify_snac
    publication = Publication.where(slug: params[:id]).first
    head 404 and return if publication.nil?

    matching_code = params[:snac_codes].detect { |snac| publication.verify_snac(snac) }

    if matching_code
      render :json => { snac: matching_code }
    else
      render :text => '', :status => 422
{'fraction_non_alphanumeric': 0.09784735812133072, 'fraction_numerical': 0.011741682974559686, 'mean_word_length': 4.039408866995074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '5621388', 'n_tokens_mistral': 312, 'n_tokens_neox': 296, 'n_words': 76}