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'
= OprData::Article.new
calendar = Util::Calendar.getInstance();
.setUrl(Net::URL.new(url));
.setDate(calendar.getTime)
.setTitle(title)
.setChannel(domain)
.setContent(content)
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 = {}
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
|