<commit_before>module Taggable
  extend ActiveSupport::Concern

  included do
    scope :tagged_with, ->(tag){ where("? = ANY (tags)", tag) }
    scope :tagged_with_rank, ->(tag){ select("*,1 as rank").where("? = ANY (tags)", tag) }
  end

  def tag_list
    tags && tags.join(", ")
  end

  def tag_list=(tag_list)
    self.tags = Array(tag_list.to_s.split(/,\s*/))
  end

  module ClassMethods

    def all_tags
      pluck(:tags).flatten.compact
    end

    def tag_list
      all_tags.uniq.sort
    end

    def tag_cloud
      Hash[all_tags.group_by(&:to_s).values.map {|v| [v.first, v.size]}.sort]
    end

    def find_like_tag(pattern)

       all_tags.uniq.select{|t| t=~ /#{pattern}/}

    end

    def alphabetical_grouped_tags

       tag_cloud.group_by{ |l| l[0][0].capitalize }
    end
  end

end<commit_msg>test commit to check if HoundCI is actually working<commit_after>module Taggable
  extend ActiveSupport::Concern

  included do
    scope :tagged_with, ->(tag){ where("? = ANY (tags)", tag) }
    scope :tagged_with_rank, ->(tag){ select("*,1 as rank").where("? = ANY (tags)", tag) }
  end

  def tag_list
    tags && tags.join(", ")
  end

  def tag_list=(tag_list)
    self.tags = Array(tag_list.to_s.split(/,\s*/))
  end

  module ClassMethods

    def all_tags
      pluck(:tags).flatten.compact.reject(&:empty?)
    end

    def tag_list
      all_tags.uniq.sort
    end

    def tag_cloud
      Hash[all_tags.group_by(&:to_s).values.map {|v| [v.first, v.size]}.sort]
    end

    def find_like_tag(pattern)

       all_tags.uniq.select{|t| t=~ /#{pattern}/}

    end

    def alphabetical_grouped_tags

        tag_cloud.group_by{ |l| l[0][0].capitalize }
    end
  end

end
{'fraction_non_alphanumeric': 0.14571092831962398, 'fraction_numerical': 0.0035252643948296123, 'mean_word_length': 2.8442437923250563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4799579', 'n_tokens_mistral': 657, 'n_tokens_neox': 622, 'n_words': 135}