<commit_before># frozen_string_literal: true

# == Schema Information
#
# Table name: audios
#
#  id                 :integer          not null, primary key
#  audioable_id       :integer
#  audioable_type     :string(255)
#  audio_file_name    :string(255)
#  audio_content_type :string(255)
#  audio_file_size    :integer
#  audio_updated_at   :datetime
#  online             :boolean
#  created_at         :datetime         not null
#  updated_at         :datetime         not null
#
# Indexes
#
#  index_audios_on_audioable_type_and_audioable_id  (audioable_type,audioable_id)
#

#
# == Audio Model
#
class Audio < ActiveRecord::Base
  include Assets::Attachable

  belongs_to :audioable, polymorphic: true, touch: true

  handle_attachment :audio

  validates_attachment_size :audio, less_than: 5.megabytes
  validates_attachment_content_type :audio, content_type: ['audio/mpeg', 'audio/mp3']
end<commit_msg>Setup 'process in background' for Audio file upload<commit_after># frozen_string_literal: true

# == Schema Information
#
# Table name: audios
#
#  id                 :integer          not null, primary key
#  audioable_id       :integer
#  audioable_type     :string(255)
#  audio_file_name    :string(255)
#  audio_content_type :string(255)
#  audio_file_size    :integer
#  audio_updated_at   :datetime
#  online             :boolean
#  created_at         :datetime         not null
#  updated_at         :datetime         not null
#
# Indexes
#
#  index_audios_on_audioable_type_and_audioable_id  (audioable_type,audioable_id)
#

#
# == Audio Model
#
class Audio < ActiveRecord::Base
  include Assets::Attachable

  belongs_to :audioable, polymorphic: true, touch: true

  handle_attachment :audio

  validates_attachment_size :audio, less_than: 5.megabytes
  validates_attachment_content_type :audio, content_type: ['audio/mpeg', 'audio/mp3']

  process_in_background :audio, processing_image_url: ActionController::Base.helpers.image_path('loader-dark.gif')
end
{'fraction_non_alphanumeric': 0.08737373737373737, 'fraction_numerical': 0.011111111111111112, 'mean_word_length': 3.617715617715618, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2884669', 'n_tokens_mistral': 658, 'n_tokens_neox': 631, 'n_words': 138}