<commit_before>class Otu < ActiveRecord::Base
  attr_accessible :author, :name, :taxon, :import_job
  belongs_to :taxon
  belongs_to :import_job
  has_one :csv_dataset, :through => :import_job
  has_many :categorical_trait_values, :dependent => :destroy
  has_many :continuous_trait_values, :dependent => :destroy
  scope :sorted, order('name ASC')

  # scope the categories
  # scope the traits

  def dataset_name
    csv_dataset.csv_file_file_name if csv_dataset
  end
end<commit_msg>Add method to get categorical_traits from Otu<commit_after>class Otu < ActiveRecord::Base
  attr_accessible :author, :name, :taxon, :import_job
  belongs_to :taxon
  belongs_to :import_job
  has_one :csv_dataset, :through => :import_job
  has_many :categorical_trait_values, :dependent => :destroy
  has_many :categorical_trait_categories, :through => :categorical_trait_values
  has_many :continuous_trait_values, :dependent => :destroy
  scope :sorted, order('name ASC')

  def categorical_traits
    categorical_trait_categories.map{|x| x.categorical_trait}.uniq
  end

  def dataset_name
    csv_dataset.csv_file_file_name if csv_dataset
  end
end
{'fraction_non_alphanumeric': 0.08347978910369068, 'fraction_numerical': 0.0, 'mean_word_length': 5.779761904761905, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '2081468', 'n_tokens_mistral': 388, 'n_tokens_neox': 381, 'n_words': 90}