Module: ZombieWriter

Defined in:
lib/zombie_writer.rb,
lib/zombie_writer/version.rb

Defined Under Namespace

Classes: MachineLearning, Randomization

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.citation_constructor(paragraph) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/zombie_writer.rb', line 8

def self.citation_constructor(paragraph)
  if (paragraph[:sourceurl] && paragraph[:sourcetext])
    "---[#{paragraph[:sourcetext]}](#{paragraph[:sourceurl]})"
  elsif paragraph[:sourcetext]
    "---#{paragraph[:sourcetext]}"
  elsif paragraph[:sourceurl]
    "---[#{paragraph[:sourceurl]}](#{paragraph[:sourceurl]})"
  else
    ""
  end
end

.formatted_article(header, final_article) ⇒ Object



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

def self.formatted_article(header, final_article)
  "#{header}\n\n#{final_article}\n"
end

.header(index, article_for_summarization) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/zombie_writer.rb', line 20

def self.header(index, article_for_summarization)
  begin
    generated_title = ClassifierReborn::Summarizer.summary(article_for_summarization, 1)
  rescue Exception
    generated_title = nil
  end
  if generated_title
    "## #{index} - #{generated_title}"
  else
    "## #{index}"
  end
end