<commit_before>class Infraction < ActiveRecord::Base
  belongs_to :tweet
  belongs_to :location

  has_many :evidences

  validates_presence_of :evidences

  # Builds an {Infraction} using the {Tweet}
  #
  # @param tweet [Tweet]
  # @return [Infraction]
  def self.build_from(tweet)
    result = self.new(tweet: tweet)
    json = tweet.json

    begin
      result.location = Location.find_or_create!(tweet)
      result.evidences = Evidence.build_from(tweet)
    rescue Exception => e
      raise e
    end

    result
  end

end<commit_msg>Added description to infraction and relationships<commit_after>class Infraction < ActiveRecord::Base
  belongs_to :tweet
  belongs_to :location

  has_many :evidences
  has_one :user, through: :tweet

  validates_presence_of :evidences
  validates_presence_of :location

  delegate :lat, :lng, to: :location
  delegate :username, to: :user

  # Builds an {Infraction} using the {Tweet}
  #
  # @param tweet [Tweet]
  # @return [Infraction]
  def self.build_from(tweet)
    result = self.new(tweet: tweet, description: tweet.source.text)
    json = tweet.json

    begin
      result.location = Location.find_or_create!(tweet)
      result.evidences = Evidence.build_from(tweet)
    rescue Exception => e
      raise e
    end

    result
  end

end
{'fraction_non_alphanumeric': 0.08752904725019364, 'fraction_numerical': 0.0, 'mean_word_length': 3.486111111111111, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5490176', 'n_tokens_mistral': 447, 'n_tokens_neox': 426, 'n_words': 107}