Class: Chomchom::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/chomchom.rb

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Document

Returns a new instance of Document.



11
12
13
14
15
# File 'lib/chomchom.rb', line 11

def initialize(html)
  @extr = Chomchom::Extractor.new(html)
  @title = @extr.title
  @fulltext = @extr.fulltext
end

Instance Method Details

#all_topicsObject



37
38
39
# File 'lib/chomchom.rb', line 37

def all_topics
  @all_topics = Chomchom::Topic.new(@fulltext, @title, 1).singles
end

#authorObject



29
30
31
# File 'lib/chomchom.rb', line 29

def author
  @extr.author
end

#best_sentences(length = 400) ⇒ Object



53
54
55
# File 'lib/chomchom.rb', line 53

def best_sentences(length=400)
  Chomchom::Summary.best_sentences(@fulltext, @all_topics, length)
end

#center_of_gravity(length = 400) ⇒ Object



41
42
43
# File 'lib/chomchom.rb', line 41

def center_of_gravity(length=400)
  Chomchom::Summary.new.center_of_gravity(@fulltext, @all_topics, length)
end

#consume_durationObject



33
34
35
# File 'lib/chomchom.rb', line 33

def consume_duration
  @extr.consume_duration
end

#first_mentions(length = 400) ⇒ Object



45
46
47
# File 'lib/chomchom.rb', line 45

def first_mentions(length=400)
  Chomchom::Summary.first_mentions(@fulltext, @all_topics, length)
end

#fulltextObject



21
22
23
# File 'lib/chomchom.rb', line 21

def fulltext
  @fulltext
end

#publish_dateObject



25
26
27
# File 'lib/chomchom.rb', line 25

def publish_date
  @extr.publish_date
end

#titleObject



17
18
19
# File 'lib/chomchom.rb', line 17

def title
  @title
end

#topic_sentences(length = 400) ⇒ Object



49
50
51
# File 'lib/chomchom.rb', line 49

def topic_sentences(length=400)
  Chomchom::Summary.topic_sentences(@fulltext, @all_topics, length)
end