<commit_before>module ApartmentRatings
  class Review < Hashie::Trash
    include Hashie::Extensions::IndifferentAccess
    include Hashie::Extensions::Coercion

    property :created_at, from: :datePosted
    property :text, from: :fullReviewText
    property :responses
    property :author, from: :reviewerScreenName
    property :rating, from: :starRatings
    property :updated_at, from: :lastUpdatedDate
    property :url

    coerce_key :responses, Set[ApartmentRatings::Reviews::Response]
    coerce_key :rating, Hash[String => ApartmentRatings::Reviews::Rating]

    def avg_rating
      rating.sum { |_, rating| (rating.value.nil? ? 0 : rating.value) } / [rating.keys.size, 1].max.to_f
    end<commit_msg>add recommend property in reviews<commit_after>module ApartmentRatings
  class Review < Hashie::Trash
    include Hashie::Extensions::IndifferentAccess
    include Hashie::Extensions::Coercion

    property :created_at, from: :datePosted
    property :text, from: :fullReviewText
    property :responses
    property :recommend
    property :author, from: :reviewerScreenName
    property :rating, from: :starRatings
    property :updated_at, from: :lastUpdatedDate
    property :url

    coerce_key :responses, Set[ApartmentRatings::Reviews::Response]
    coerce_key :rating, Hash[String => ApartmentRatings::Reviews::Rating]

    def avg_rating
      rating.sum { |_, rating| (rating.value.nil? ? 0 : rating.value) } / [rating.keys.size, 1].max.to_f
    end
{'fraction_non_alphanumeric': 0.10379918588873813, 'fraction_numerical': 0.0027137042062415195, 'mean_word_length': 4.483271375464684, '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': '2990654', 'n_tokens_mistral': 470, 'n_tokens_neox': 440, 'n_words': 105}