mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
18 lines
527 B
Ruby
18 lines
527 B
Ruby
class DocumentAnalysis < ApplicationRecord
|
|
belongs_to :document
|
|
has_many :document_entities, dependent: :destroy
|
|
has_many :document_concepts, dependent: :destroy
|
|
has_many :document_categories, dependent: :destroy
|
|
|
|
serialize :words_per_sentence, Array
|
|
serialize :n_syllable_words, Hash
|
|
|
|
# usage: analysis.pos_percentage(:adjective) => 23.4
|
|
def pos_percentage(pos_symbol)
|
|
(send(pos_symbol.to_s + '_count').to_f / word_count * 100).round(2)
|
|
end
|
|
|
|
def complete?
|
|
self.completed_at.present?
|
|
end
|
|
end |