<commit_before>#
# Lists symbols of an ontology
#
class SymbolsController < InheritedResources::Base

  belongs_to :ontology
  before_filter :check_read_permissions

  actions :index, :show
  has_scope :kind
  has_pagination

  respond_to :html

  def index
    ontology = Ontology.find params[:ontology_id]

    if ontology && (ontology.is?('OWL2') || ontology.is?('OWL'))
      begin
        symbols = ontology.symbol_groups
        @nodes = SymbolGroup.roots_of(*symbols)
      rescue
        @nodes = []
      end
      @hierarchy_exists = !@nodes.empty?
    end

    @page_selected = !! params[:page]

    index! do |format|
      format.html do
        unless collection.blank?
          first_symbol = collection.first
          @show_name_column =
            !(first_symbol.display_name ||
            first_symbol.text.include?(first_symbol.name))
        end
      end
    end
  end<commit_msg>adding groups without children or parent to nodes<commit_after>#
# Lists symbols of an ontology
#
class SymbolsController < InheritedResources::Base

  belongs_to :ontology
  before_filter :check_read_permissions

  actions :index, :show
  has_scope :kind
  has_pagination

  respond_to :html

  def index
    ontology = Ontology.find params[:ontology_id]

    if ontology && (ontology.is?('OWL2') || ontology.is?('OWL'))
      begin
        symbols = ontology.symbol_groups
        extra_notes = ontology.symbol_groups.where('id NOT IN (SELECT DISTINCT(parent_id) FROM e_edges UNION SELECT DISTINCT(child_id) FROM e_edges)')
        @nodes = SymbolGroup.roots_of(*symbols)
        @nodes = @nodes + extra_notes
      rescue
        @nodes = []
      end
      @hierarchy_exists = !@nodes.empty?
    end

    @page_selected = !! params[:page]

    index! do |format|
      format.html do
        unless collection.blank?
          first_symbol = collection.first
          @show_name_column =
            !(first_symbol.display_name ||
            first_symbol.text.include?(first_symbol.name))
        end
      end
    end
  end
{'fraction_non_alphanumeric': 0.09287469287469287, 'fraction_numerical': 0.0009828009828009828, 'mean_word_length': 2.6817359855334537, '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': '3088687', 'n_tokens_mistral': 637, 'n_tokens_neox': 616, 'n_words': 140}