<commit_before>class Company < ApplicationRecord
  belongs_to :creator, class_name: "User"
  has_many :reviews


  ratyrate_rateable "gender","identity", "management","hr",
  "whole_self","community","leadership","equal_opportunities",
  "promotions","job_description","responsiveness","onsite","overall",
  "culture", "inclusion", "diversity"
  
  validates :name, :city_name, :region_name, :country_code, presence: true

  # Returns the average rating for the whole company
  # def avg_rating
  #   if self.reviews.any?
  #     sum = self.reviews.reduce(0){|sum,review| sum + review.culture_rating.to_f } / self.reviews.length
  #     sum += self.reviews.reduce(0){|sum,review| sum + review.inclusion_rating.to_f } / self.reviews.length
  #     sum += self.reviews.reduce(0){|sum,review| sum + review.diversity_rating.to_f } / self.reviews.length
  #     return sum / 3
  #   else
  #     return 0
  #   end
  # end<commit_msg>before pull commit<commit_after>class Company < ApplicationRecord
  belongs_to :creator, class_name: "User"
  has_many :reviews


  ratyrate_rateable "gender","identity", "management","hr",
  "whole_self","community","leadership","equal_opportunities",
  "promotions","job_description","responsiveness","onsite","overall",
  "culture", "inclusion", "diversity"
  
  validates :name, :city_name, :region_name, :country_code, presence: true

  # Returns the average rating for the whole company
  # def avg_rating
  #   if self.reviews.any?
  #     sum = self.reviews.reduce(0){|sum,review| sum + review.culture_rating.to_f } / self.reviews.length
  #     sum += self.reviews.reduce(0){|sum,review| sum + review.inclusion_rating.to_f } / self.reviews.length
  #     sum += self.reviews.reduce(0){|sum,review| sum + review.diversity_rating.to_f } / self.reviews.length
  #     return sum / 3
  #   else
  #     return 0
  #   end
  # end
  def multiple_dimension_avg_rating
     ratings = Rate.where("rateable_type = ? and rateable_id = ?", "Company", self.id)
     sum = ratings.reduce(0){|sum , r| sum+= r.stars} 
     sum/ratings.length
  end

{'fraction_non_alphanumeric': 0.14044401544401544, 'fraction_numerical': 0.005308880308880309, 'mean_word_length': 4.156716417910448, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2446054', 'n_tokens_mistral': 724, 'n_tokens_neox': 697, 'n_words': 134}