<commit_before>class TopicsController < ApplicationController
  def related_user_channels
    authorize! :show, topic

    top_users = topic.top_users(5)

    top_channels = top_users.map do |user|
      @topic.channel_for_user(user)
    end.delete_if {|t| t.nil?}

    render json: top_channels.map {|ch| Channels::Channel.for(channel: ch,view: view_context)}
  end

  def top
    render json: Topic.top(10)
  end

  private
    def topic
      @topic ||= Topic.by_slug(params[:id])
      @topic || raise_404("Topic not found")
    end
end
<commit_msg>hacky hacky filter out non-topics<commit_after>class TopicsController < ApplicationController
  def related_user_channels
    authorize! :show, topic

    top_users = topic.top_users(5)

    top_channels = top_users.map do |user|
      @topic.channel_for_user(user)
    end.delete_if {|t| t.nil?}

    render json: top_channels.map {|ch| Channels::Channel.for(channel: ch,view: view_context)}
  end

  def top
    render json: Topic.top(12).delete_if {|t| ['created','all'].include? t.slug_title}
  end

  private
    def topic
      @topic ||= Topic.by_slug(params[:id])
      @topic || raise_404("Topic not found")
    end
end

{'fraction_non_alphanumeric': 0.116751269035533, 'fraction_numerical': 0.01015228426395939, 'mean_word_length': 3.62109375, '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': '119770', 'n_tokens_mistral': 419, 'n_tokens_neox': 405, 'n_words': 93}