Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

2269-3 #291

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

2269-3 #291

wants to merge 2 commits into from

Conversation

Evenstein
Copy link
Contributor

@Evenstein Evenstein commented Jul 27, 2018

Номер

2269

Номер задания

3

Ссылка на видео с демо

https://youtu.be/COpNSShZnDY

Комментарии

Готово

request
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingBlankLines: 1 trailing blank lines detected.

@Evenstein Evenstein changed the title [WIP] 2269-3 2269-3 Jul 28, 2018
@rubizza-camp rubizza-camp deleted a comment from houndci-bot Aug 2, 2018

def retrieve_comments(path)
article_id = @agent.get(path).css('.news_view_count').last.values[1]
url = "https://comments.api.onliner.by/news/tech.post/#{article_id}/comments?limit=50&_=0.9841189675826583"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL = 'https://comments.api.onliner.by/news/tech.post/%{article_id}/comments?limit=50&_=0.9841189675826583'.freeze

url = URL % { article_id: article_id }

url = "https://comments.api.onliner.by/news/tech.post/#{article_id}/comments?limit=50&_=0.9841189675826583"
response = agent.get(url)
comments = []
JSON.parse(response.body)['comments'].each { |elem| comments << elem['text'].tr("\n", ' ') }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON.parse(response.body, symbolize_names: true)[:comments].inject([]) { |comment, comments| comments << comment[:text].tr("\n", ' ') }

article_id = @agent.get(path).css('.news_view_count').last.values[1]
url = "https://comments.api.onliner.by/news/tech.post/#{article_id}/comments?limit=50&_=0.9841189675826583"
response = agent.get(url)
comments = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inject

response = agent.get(url)
comments = []
JSON.parse(response.body)['comments'].each { |elem| comments << elem['text'].tr("\n", ' ') }
comments
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inject

def retrieve_rating(comments)
@data = { documents: [] }
comments.each_with_index do |comment, index|
@data[:documents] << { 'id' => index.to_s, 'language' => 'ru', 'text' => comment }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ id: index.to_s, language: 'ru', text: comment }

May you use :ru instead of 'ru' ??

end

def calculate_rating
url = URI('https://westeurope.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constant

<% end %>
</table>
<br>
<div align="center"><a href='/articles/new' class='btn btn-primary'>Add Article</a></div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line?

<br>
<div align="center"><a href='/articles' class='btn btn-primary'>Back</a></div>
<br>
<br>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants