<commit_before>class Document < ActiveRecord::Base
  include DC::Access

  # Accessors and constants:

  attr_accessor :highlight, :annotation_count, :hits
  attr_writer   :organization_name, :organization_slug, :account_name, :account_slug

  SEARCHABLE_ATTRIBUTES = [:title, :description, :source, :account, :group]

  DEFAULT_TITLE = "Untitled Document"

  DISPLAY_DATE_FORMAT = "%b %d, %Y"
  DISPLAY_DATETIME_FORMAT = "%I:%M %p – %a %b %d, %Y"

  DEFAULT_CANONICAL_OPTIONS = {:sections => true, :annotations => true, :contributor => true}

  # If the Document.pending count is greater than this number, send a warning.
  WARN_QUEUE_LENGTH = 25

  # DB Associations:

  belongs_to :account
  belongs_to :organization

  has_one  :full_text,            :dependent => :destroy
  has_many :pages,                :dependent => :destroy
  has_many :entities,             :dependent => :destroy
  has_many :entity_dates,         :dependent => :destroy
  has_many :sections,             :dependent => :destroy
  has_many :annotations,          :dependent => :destroy
  has_many :remote_urls,          :dependent => :destroy
  has_many :project_memberships,  :dependent => :destroy
  has_many :projects,             :through   => :project_memberships

  validates_presence_of :organization_id, :account_id, :access, :page_count,
                        :title, :slug

  before_validation_on_create :ensure_titled

  after_destroy :delete_assets

  delegate :text, :to => :full_text,    :allow_nil => true
  delegate :slug, :to => :organization, :allow_nil => true, :prefix => true
  delegate :slug, :to => :account,      :allow_nil => true, :prefix => true

  # Named scopes:

  named_scope :chronological, {:order => 'created_at desc'}<commit_msg>Raise the WARN_QUEUE_LENGTH to 50<commit_after>class Document < ActiveRecord::Base
  include DC::Access

  # Accessors and constants:

  attr_accessor :highlight, :annotation_count, :hits
  attr_writer   :organization_name, :organization_slug, :account_name, :account_slug

  SEARCHABLE_ATTRIBUTES = [:title, :description, :source, :account, :group]

  DEFAULT_TITLE = "Untitled Document"

  DISPLAY_DATE_FORMAT = "%b %d, %Y"
  DISPLAY_DATETIME_FORMAT = "%I:%M %p – %a %b %d, %Y"

  DEFAULT_CANONICAL_OPTIONS = {:sections => true, :annotations => true, :contributor => true}

  # If the Document.pending count is greater than this number, send a warning.
  WARN_QUEUE_LENGTH = 50

  # DB Associations:

  belongs_to :account
  belongs_to :organization

  has_one  :full_text,            :dependent => :destroy
  has_many :pages,                :dependent => :destroy
  has_many :entities,             :dependent => :destroy
  has_many :entity_dates,         :dependent => :destroy
  has_many :sections,             :dependent => :destroy
  has_many :annotations,          :dependent => :destroy
  has_many :remote_urls,          :dependent => :destroy
  has_many :project_memberships,  :dependent => :destroy
  has_many :projects,             :through   => :project_memberships

  validates_presence_of :organization_id, :account_id, :access, :page_count,
                        :title, :slug

  before_validation_on_create :ensure_titled

  after_destroy :delete_assets

  delegate :text, :to => :full_text,    :allow_nil => true
  delegate :slug, :to => :organization, :allow_nil => true, :prefix => true
  delegate :slug, :to => :account,      :allow_nil => true, :prefix => true

  # Named scopes:

  named_scope :chronological, {:order => 'created_at desc'}
{'fraction_non_alphanumeric': 0.11180832857957787, 'fraction_numerical': 0.0017113519680547634, 'mean_word_length': 3.6084099868593955, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '5486564', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1074, 'n_words': 285}