<commit_before>require './lib/evaluator/evaluation_engine'

class EvaluatorJob
  def self.execute
    response_job = ResponseQueue.first
    return if response_job.nil?
    response = Response.find(response_job.response_id)
    passage = response.passage
    e = EvaluationEngine.new
    errors = e.evaluate(passage.text,response.text)
    response_job.destroy unless errors.nil?
    errors.each {|err|
      tag = Tag.find_or_create_by(name: err.type+' error')
      tag.taggings.create({response_id: response.id})
    }
  end
end<commit_msg>[Vathsala/Sooraj] [tweetable/#58] Auto evaluate response - add description and weight for a tag<commit_after>require './lib/evaluator/evaluation_engine'

class EvaluatorJob
  def self.execute
    response_job = ResponseQueue.first
    return if response_job.nil?
    response = Response.find(response_job.response_id)
    passage = response.passage
    e = EvaluationEngine.new
    errors = e.evaluate(passage.text,response.text)
    response_job.destroy unless errors.nil?
    errors.each {|err|
      tag = Tag.find_or_create_by(name: err.type+' error', description: err.description, weight: -5)
      tag.taggings.create({response_id: response.id})
    }
  end
end
{'fraction_non_alphanumeric': 0.1024793388429752, 'fraction_numerical': 0.0024793388429752068, 'mean_word_length': 3.8830645161290325, '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': '7188070', 'n_tokens_mistral': 386, 'n_tokens_neox': 384, 'n_words': 78}