Top Level Namespace

Defined Under Namespace

Modules: ArticleTools, CSV_MODULE, HyperLastic, Net, OprData, RestClient2, SemanticService, Sentra, Storm, StormDRPC, StormDrpcTopology, Text, Util

Instance Method Summary collapse

Instance Method Details

#prepare_article(content, url, title, domain = 'GENERAL') ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/sentra/opr.rb', line 75

def prepare_article content, url, title, domain='GENERAL'
  tweet = OprData::Article.new

  calendar = Util::Calendar.getInstance();
  tweet.setUrl(Net::URL.new(url));
  tweet.setDate(calendar.getTime)
  tweet.setTitle(title)
  tweet.setChannel(domain)
  tweet.setContent(content)
  tweet
end

#process_result(statistics) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/sentra/opr.rb', line 88

def process_result statistics
  response = {}
  # puts 'here statistics'
  # p statistics
  if statistics[3].getValue.to_f > 0
    response['negative'] = statistics[0].getValue.to_f / statistics[3].getValue.to_f
    response['positive'] = statistics[1].getValue.to_f / statistics[3].getValue.to_f
    response['neutral'] = statistics[2].getValue.to_f / statistics[3].getValue.to_f

  else
    response['negative'] = 0
    response['positive'] = 0
    response['neutral'] = 1

  end
  response['details'] = {}
  response
end