{"action":"created","comment":{"url":"https://api.github.com/repos/HIIT/hybra-core/pulls/comments/170998120","pull_request_review_id":99774169,"id":170998120,"diff_hunk":"@@ -0,0 +1,50 @@\n+import os\n+import time\n+from string import Template\n+import random\n+\n+from IPython.core.display import HTML, display\n+\n+from collections import Counter\n+\n+path = os.path.dirname(os.path.abspath(__file__))\n+\n+def create_wordcloud( data, plt, stopwords = [\"the\", \"a\", \"or\", \"tai\", \"and\", \"ja\", \"to\", \"on\", \"in\", \"of\", \"for\", \"is\", \"i\", \"this\", \"http\", \"www\", \"fi\", \"com\"], width=850, height=350 ):\n+\n+    import codecs\n+    html_template = Template( codecs.open( path + '/wordcloud.html', 'r').read() )\n+    js_template = Template(codecs.open(path + '/wordcloud.js', 'r').read())\n+    css_text = codecs.open(path + '/wordcloud.css', 'r').read()\n+\n+    texts = \"\"\n+    for node in data:\n+        text = node['text_content']\n+        text = text.replace(\",\", \"\")\n+        text = text.replace(\".\", \"\")\n+        text = text.replace(\"!\", \"\")\n+        text = text.replace(\"?\", \"\")\n+        for word in text.split(\" \"):\n+            if word not in stopwords:\n+                texts += word + \" \"\n+\n+    frequencies = Counter(texts.split())\n+    freqs_list = []\n+    colors = [\"#A5E6BA\", \"#9AC6C5\", \"#7785AC\", \"#248757\", \"#360568\", \"#F0544F\", \"#e07f9f\", \"#1d7059\", \"#3e6282\"]\n+\n+    for key, value in frequencies.iteritems():\n+        freqs_list.append({\"text\":encode_utf8(key),\"size\":str(value), \"color\": random.choice(colors)})\n+\n+    graph_div_id = int(time.time() * 1000)\n+\n+    js_text = js_template.substitute({'frequencies': str(freqs_list), 'graph_div_id': graph_div_id, 'width': width, 'height': height})\n+    html_template = html_template.substitute({'js': js_text, 'graph_div_id': graph_div_id, 'css': css_text})\n+\n+    display( HTML( html_template ) )\n+\n+    return None\n+\n+def encode_utf8( string ):","path":"hybra/wordcloud/module_wordclouds.py","position":44,"original_position":46,"commit_id":"2bc9fe42a7a0b22b91b15d0a8b4c67d664dd5949","original_commit_id":"a0cfe9f3a0ecfd74bf6c47236717ff900de852ac","user":{"login":"matnel","id":301760,"avatar_url":"https://avatars1.githubusercontent.com/u/301760?v=4","gravatar_id":"","url":"https://api.github.com/users/matnel","html_url":"https://github.com/matnel","followers_url":"https://api.github.com/users/matnel/followers","following_url":"https://api.github.com/users/matnel/following{/other_user}","gists_url":"https://api.github.com/users/matnel/gists{/gist_id}","starred_url":"https://api.github.com/users/matnel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matnel/subscriptions","organizations_url":"https://api.github.com/users/matnel/orgs","repos_url":"https://api.github.com/users/matnel/repos","events_url":"https://api.github.com/users/matnel/events{/privacy}","received_events_url":"https://api.github.com/users/matnel/received_events","type":"User","site_admin":false},"body":"UTF8 encoded kuulostaa aina vaaralliselta :D","created_at":"2018-02-27T17:14:41Z","updated_at":"2018-02-27T17:14:41Z","html_url":"https://github.com/HIIT/hybra-core/pull/67#discussion_r170998120","pull_request_url":"https://api.github.com/repos/HIIT/hybra-core/pulls/67","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/HIIT/hybra-core/pulls/comments/170998120"},"html":{"href":"https://github.com/HIIT/hybra-core/pull/67#discussion_r170998120"},"pull_request":{"href":"https://api.github.com/repos/HIIT/hybra-core/pulls/67"}},"in_reply_to_id":170948019},"pull_request":{"url":"https://api.github.com/repos/HIIT/hybra-core/pulls/67","id":171667395,"html_url":"https://github.com/HIIT/hybra-core/pull/67","diff_url":"https://github.com/HIIT/hybra-core/pull/67.diff","patch_url":"https://github.com/HIIT/hybra-core/pull/67.patch","issue_url":"https://api.github.com/repos/HIIT/hybra-core/issues/67","number":67,"state":"open","locked":false,"title":"Wordcloud implementation for d3","user":{"login":"UMTti","id":5732178,"avatar_url":"https://avatars1.githubusercontent.com/u/5732178?v=4","gravatar_id":"","url":"https://api.github.com/users/UMTti","html_url":"https://github.com/UMTti","followers_url":"https://api.github.com/users/UMTti/followers","following_url":"https://api.github.com/users/UMTti/following{/other_user}","gists_url":"https://api.github.com/users/UMTti/gists{/gist_id}","starred_url":"https://api.github.com/users/UMTti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UMTti/subscriptions","organizations_url":"https://api.github.com/users/UMTti/orgs","repos_url":"https://api.github.com/users/UMTti/repos","events_url":"https://api.github.com/users/UMTti/events{/privacy}","received_events_url":"https://api.github.com/users/UMTti/received_events","type":"User","site_admin":false},"body":"Removed old wordcloud implementation and coded new with d3-cloud ","created_at":"2018-02-27T13:49:31Z","updated_at":"2018-02-27T17:14:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f7665fefaf2d71e0f4a2d65f8a2396ee0bc9fa7","assignee":null,"assignees":[],"requested_reviewers":[{"login":"juhopaak","id":16080355,"avatar_url":"https://avatars2.githubusercontent.com/u/16080355?v=4","gravatar_id":"","url":"https://api.github.com/users/juhopaak","html_url":"https://github.com/juhopaak","followers_url":"https://api.github.com/users/juhopaak/followers","following_url":"https://api.github.com/users/juhopaak/following{/other_user}","gists_url":"https://api.github.com/users/juhopaak/gists{/gist_id}","starred_url":"https://api.github.com/users/juhopaak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juhopaak/subscriptions","organizations_url":"https://api.github.com/users/juhopaak/orgs","repos_url":"https://api.github.com/users/juhopaak/repos","events_url":"https://api.github.com/users/juhopaak/events{/privacy}","received_events_url":"https://api.github.com/users/juhopaak/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/HIIT/hybra-core/pulls/67/commits","review_comments_url":"https://api.github.com/repos/HIIT/hybra-core/pulls/67/comments","review_comment_url":"https://api.github.com/repos/HIIT/hybra-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HIIT/hybra-core/issues/67/comments","statuses_url":"https://api.github.com/repos/HIIT/hybra-core/statuses/2bc9fe42a7a0b22b91b15d0a8b4c67d664dd5949","head":{"label":"HIIT:wordcloud_d3","ref":"wordcloud_d3","sha":"2bc9fe42a7a0b22b91b15d0a8b4c67d664dd5949","user":{"login":"HIIT","id":909687,"avatar_url":"https://avatars1.githubusercontent.com/u/909687?v=4","gravatar_id":"","url":"https://api.github.com/users/HIIT","html_url":"https://github.com/HIIT","followers_url":"https://api.github.com/users/HIIT/followers","following_url":"https://api.github.com/users/HIIT/following{/other_user}","gists_url":"https://api.github.com/users/HIIT/gists{/gist_id}","starred_url":"https://api.github.com/users/HIIT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HIIT/subscriptions","organizations_url":"https://api.github.com/users/HIIT/orgs","repos_url":"https://api.github.com/users/HIIT/repos","events_url":"https://api.github.com/users/HIIT/events{/privacy}","received_events_url":"https://api.github.com/users/HIIT/received_events","type":"Organization","site_admin":false},"repo":{"id":89355138,"name":"hybra-core","full_name":"HIIT/hybra-core","owner":{"login":"HIIT","id":909687,"avatar_url":"https://avatars1.githubusercontent.com/u/909687?v=4","gravatar_id":"","url":"https://api.github.com/users/HIIT","html_url":"https://github.com/HIIT","followers_url":"https://api.github.com/users/HIIT/followers","following_url":"https://api.github.com/users/HIIT/following{/other_user}","gists_url":"https://api.github.com/users/HIIT/gists{/gist_id}","starred_url":"https://api.github.com/users/HIIT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HIIT/subscriptions","organizations_url":"https://api.github.com/users/HIIT/orgs","repos_url":"https://api.github.com/users/HIIT/repos","events_url":"https://api.github.com/users/HIIT/events{/privacy}","received_events_url":"https://api.github.com/users/HIIT/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HIIT/hybra-core","description":"Core data management and analysis tools for \"Racisms and public communications in the hybrid media environment\" project","fork":false,"url":"https://api.github.com/repos/HIIT/hybra-core","forks_url":"https://api.github.com/repos/HIIT/hybra-core/forks","keys_url":"https://api.github.com/repos/HIIT/hybra-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HIIT/hybra-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HIIT/hybra-core/teams","hooks_url":"https://api.github.com/repos/HIIT/hybra-core/hooks","issue_events_url":"https://api.github.com/repos/HIIT/hybra-core/issues/events{/number}","events_url":"https://api.github.com/repos/HIIT/hybra-core/events","assignees_url":"https://api.github.com/repos/HIIT/hybra-core/assignees{/user}","branches_url":"https://api.github.com/repos/HIIT/hybra-core/branches{/branch}","tags_url":"https://api.github.com/repos/HIIT/hybra-core/tags","blobs_url":"https://api.github.com/repos/HIIT/hybra-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HIIT/hybra-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HIIT/hybra-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/HIIT/hybra-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HIIT/hybra-core/statuses/{sha}","languages_url":"https://api.github.com/repos/HIIT/hybra-core/languages","stargazers_url":"https://api.github.com/repos/HIIT/hybra-core/stargazers","contributors_url":"https://api.github.com/repos/HIIT/hybra-core/contributors","subscribers_url":"https://api.github.com/repos/HIIT/hybra-core/subscribers","subscription_url":"https://api.github.com/repos/HIIT/hybra-core/subscription","commits_url":"https://api.github.com/repos/HIIT/hybra-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/HIIT/hybra-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/HIIT/hybra-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/HIIT/hybra-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/HIIT/hybra-core/contents/{+path}","compare_url":"https://api.github.com/repos/HIIT/hybra-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HIIT/hybra-core/merges","archive_url":"https://api.github.com/repos/HIIT/hybra-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HIIT/hybra-core/downloads","issues_url":"https://api.github.com/repos/HIIT/hybra-core/issues{/number}","pulls_url":"https://api.github.com/repos/HIIT/hybra-core/pulls{/number}","milestones_url":"https://api.github.com/repos/HIIT/hybra-core/milestones{/number}","notifications_url":"https://api.github.com/repos/HIIT/hybra-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HIIT/hybra-core/labels{/name}","releases_url":"https://api.github.com/repos/HIIT/hybra-core/releases{/id}","deployments_url":"https://api.github.com/repos/HIIT/hybra-core/deployments","created_at":"2017-04-25T11:56:19Z","updated_at":"2018-02-19T11:42:33Z","pushed_at":"2018-02-27T15:19:50Z","git_url":"git://github.com/HIIT/hybra-core.git","ssh_url":"git@github.com:HIIT/hybra-core.git","clone_url":"https://github.com/HIIT/hybra-core.git","svn_url":"https://github.com/HIIT/hybra-core","homepage":"","size":2404,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":16,"watchers":1,"default_branch":"master"}},"base":{"label":"HIIT:master","ref":"master","sha":"7bc10d83100cbf53c81531b0c0d62baef6a3538c","user":{"login":"HIIT","id":909687,"avatar_url":"https://avatars1.githubusercontent.com/u/909687?v=4","gravatar_id":"","url":"https://api.github.com/users/HIIT","html_url":"https://github.com/HIIT","followers_url":"https://api.github.com/users/HIIT/followers","following_url":"https://api.github.com/users/HIIT/following{/other_user}","gists_url":"https://api.github.com/users/HIIT/gists{/gist_id}","starred_url":"https://api.github.com/users/HIIT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HIIT/subscriptions","organizations_url":"https://api.github.com/users/HIIT/orgs","repos_url":"https://api.github.com/users/HIIT/repos","events_url":"https://api.github.com/users/HIIT/events{/privacy}","received_events_url":"https://api.github.com/users/HIIT/received_events","type":"Organization","site_admin":false},"repo":{"id":89355138,"name":"hybra-core","full_name":"HIIT/hybra-core","owner":{"login":"HIIT","id":909687,"avatar_url":"https://avatars1.githubusercontent.com/u/909687?v=4","gravatar_id":"","url":"https://api.github.com/users/HIIT","html_url":"https://github.com/HIIT","followers_url":"https://api.github.com/users/HIIT/followers","following_url":"https://api.github.com/users/HIIT/following{/other_user}","gists_url":"https://api.github.com/users/HIIT/gists{/gist_id}","starred_url":"https://api.github.com/users/HIIT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HIIT/subscriptions","organizations_url":"https://api.github.com/users/HIIT/orgs","repos_url":"https://api.github.com/users/HIIT/repos","events_url":"https://api.github.com/users/HIIT/events{/privacy}","received_events_url":"https://api.github.com/users/HIIT/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HIIT/hybra-core","description":"Core data management and analysis tools for \"Racisms and public communications in the hybrid media environment\" project","fork":false,"url":"https://api.github.com/repos/HIIT/hybra-core","forks_url":"https://api.github.com/repos/HIIT/hybra-core/forks","keys_url":"https://api.github.com/repos/HIIT/hybra-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HIIT/hybra-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HIIT/hybra-core/teams","hooks_url":"https://api.github.com/repos/HIIT/hybra-core/hooks","issue_events_url":"https://api.github.com/repos/HIIT/hybra-core/issues/events{/number}","events_url":"https://api.github.com/repos/HIIT/hybra-core/events","assignees_url":"https://api.github.com/repos/HIIT/hybra-core/assignees{/user}","branches_url":"https://api.github.com/repos/HIIT/hybra-core/branches{/branch}","tags_url":"https://api.github.com/repos/HIIT/hybra-core/tags","blobs_url":"https://api.github.com/repos/HIIT/hybra-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HIIT/hybra-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HIIT/hybra-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/HIIT/hybra-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HIIT/hybra-core/statuses/{sha}","languages_url":"https://api.github.com/repos/HIIT/hybra-core/languages","stargazers_url":"https://api.github.com/repos/HIIT/hybra-core/stargazers","contributors_url":"https://api.github.com/repos/HIIT/hybra-core/contributors","subscribers_url":"https://api.github.com/repos/HIIT/hybra-core/subscribers","subscription_url":"https://api.github.com/repos/HIIT/hybra-core/subscription","commits_url":"https://api.github.com/repos/HIIT/hybra-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/HIIT/hybra-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/HIIT/hybra-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/HIIT/hybra-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/HIIT/hybra-core/contents/{+path}","compare_url":"https://api.github.com/repos/HIIT/hybra-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HIIT/hybra-core/merges","archive_url":"https://api.github.com/repos/HIIT/hybra-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HIIT/hybra-core/downloads","issues_url":"https://api.github.com/repos/HIIT/hybra-core/issues{/number}","pulls_url":"https://api.github.com/repos/HIIT/hybra-core/pulls{/number}","milestones_url":"https://api.github.com/repos/HIIT/hybra-core/milestones{/number}","notifications_url":"https://api.github.com/repos/HIIT/hybra-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HIIT/hybra-core/labels{/name}","releases_url":"https://api.github.com/repos/HIIT/hybra-core/releases{/id}","deployments_url":"https://api.github.com/repos/HIIT/hybra-core/deployments","created_at":"2017-04-25T11:56:19Z","updated_at":"2018-02-19T11:42:33Z","pushed_at":"2018-02-27T15:19:50Z","git_url":"git://github.com/HIIT/hybra-core.git","ssh_url":"git@github.com:HIIT/hybra-core.git","clone_url":"https://github.com/HIIT/hybra-core.git","svn_url":"https://github.com/HIIT/hybra-core","homepage":"","size":2404,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":16,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HIIT/hybra-core/pulls/67"},"html":{"href":"https://github.com/HIIT/hybra-core/pull/67"},"issue":{"href":"https://api.github.com/repos/HIIT/hybra-core/issues/67"},"comments":{"href":"https://api.github.com/repos/HIIT/hybra-core/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/HIIT/hybra-core/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/HIIT/hybra-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HIIT/hybra-core/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/HIIT/hybra-core/statuses/2bc9fe42a7a0b22b91b15d0a8b4c67d664dd5949"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"matnel"}}