{"action":"created","comment":{"url":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/comments/91620854","pull_request_review_id":12126143,"id":91620854,"diff_hunk":"@@ -0,0 +1,80 @@\n+\"\"\"This module implements the trigrams algorithm for a given text file.\"\"\"\n+\n+\n+from __future__ import print_function\n+import random\n+import io\n+import sys\n+import re\n+\n+\n+def open_file(path):\n+    \"\"\"Return a string of the contents of a given file.\"\"\"\n+    f = io.open(path)\n+    data = f.read()\n+    f.close()\n+    return data\n+\n+\n+def format_text(text):\n+    \"\"\"Format string returned from file.\"\"\"\n+    text = text.replace('--', ' ')  #Special case.\n+    text = text.replace('\\n', ' ')\n+    text = re.sub('[^ a-zA-Z]', '', text)\n+\n+    return text.lower()\n+\n+\n+def make_tri_dict(word_list):\n+    \"\"\"Make key value pairs of pairs of words to a list of words from a\n+    list of words from the text in order.\n+    \"\"\"\n+    tri_dict = {}\n+\n+    for i in range(len(word_list) - 2):\n+        key_pair = word_list[i] + ' ' + word_list[i + 1]\n+        next_word = word_list[i + 2]\n+        if key_pair in tri_dict:\n+            tri_dict[key_pair] += [next_word]\n+        else:\n+            tri_dict[key_pair] = [next_word]","path":"src/trigrams.py","position":40,"original_position":40,"commit_id":"2ee9f055c6324a0fa4ee763500128fcda3479521","original_commit_id":"2ee9f055c6324a0fa4ee763500128fcda3479521","user":{"login":"nhuntwalker","id":5581888,"avatar_url":"https://avatars.githubusercontent.com/u/5581888?v=3","gravatar_id":"","url":"https://api.github.com/users/nhuntwalker","html_url":"https://github.com/nhuntwalker","followers_url":"https://api.github.com/users/nhuntwalker/followers","following_url":"https://api.github.com/users/nhuntwalker/following{/other_user}","gists_url":"https://api.github.com/users/nhuntwalker/gists{/gist_id}","starred_url":"https://api.github.com/users/nhuntwalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhuntwalker/subscriptions","organizations_url":"https://api.github.com/users/nhuntwalker/orgs","repos_url":"https://api.github.com/users/nhuntwalker/repos","events_url":"https://api.github.com/users/nhuntwalker/events{/privacy}","received_events_url":"https://api.github.com/users/nhuntwalker/received_events","type":"User","site_admin":false},"body":"You could avoid this if-else block entirely:\r\n```python\r\ntri_dict.setdefault(key_pair, [])\r\ntri_dict[key_pair].append(next_word)\r\n```","created_at":"2016-12-08T22:22:49Z","updated_at":"2016-12-08T22:27:36Z","html_url":"https://github.com/iamrobinhood12345/trigrams/pull/2#discussion_r91620854","pull_request_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/comments/91620854"},"html":{"href":"https://github.com/iamrobinhood12345/trigrams/pull/2#discussion_r91620854"},"pull_request":{"href":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/2","id":97057150,"html_url":"https://github.com/iamrobinhood12345/trigrams/pull/2","diff_url":"https://github.com/iamrobinhood12345/trigrams/pull/2.diff","patch_url":"https://github.com/iamrobinhood12345/trigrams/pull/2.patch","issue_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues/2","number":2,"state":"closed","locked":false,"title":"Trigrams","user":{"login":"CCallahanIV","id":20152575,"avatar_url":"https://avatars.githubusercontent.com/u/20152575?v=3","gravatar_id":"","url":"https://api.github.com/users/CCallahanIV","html_url":"https://github.com/CCallahanIV","followers_url":"https://api.github.com/users/CCallahanIV/followers","following_url":"https://api.github.com/users/CCallahanIV/following{/other_user}","gists_url":"https://api.github.com/users/CCallahanIV/gists{/gist_id}","starred_url":"https://api.github.com/users/CCallahanIV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CCallahanIV/subscriptions","organizations_url":"https://api.github.com/users/CCallahanIV/orgs","repos_url":"https://api.github.com/users/CCallahanIV/repos","events_url":"https://api.github.com/users/CCallahanIV/events{/privacy}","received_events_url":"https://api.github.com/users/CCallahanIV/received_events","type":"User","site_admin":false},"body":"Initial submission for trigrams kata assignment.","created_at":"2016-12-08T04:25:12Z","updated_at":"2016-12-08T22:27:36Z","closed_at":"2016-12-08T17:32:23Z","merged_at":"2016-12-08T17:32:23Z","merge_commit_sha":"5776fd9dd2d22bd314f5d643428535c29bb09caa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/2/commits","review_comments_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/2/comments","review_comment_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues/2/comments","statuses_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/statuses/2ee9f055c6324a0fa4ee763500128fcda3479521","head":{"label":"iamrobinhood12345:trigrams","ref":"trigrams","sha":"2ee9f055c6324a0fa4ee763500128fcda3479521","user":{"login":"iamrobinhood12345","id":11498059,"avatar_url":"https://avatars.githubusercontent.com/u/11498059?v=3","gravatar_id":"","url":"https://api.github.com/users/iamrobinhood12345","html_url":"https://github.com/iamrobinhood12345","followers_url":"https://api.github.com/users/iamrobinhood12345/followers","following_url":"https://api.github.com/users/iamrobinhood12345/following{/other_user}","gists_url":"https://api.github.com/users/iamrobinhood12345/gists{/gist_id}","starred_url":"https://api.github.com/users/iamrobinhood12345/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamrobinhood12345/subscriptions","organizations_url":"https://api.github.com/users/iamrobinhood12345/orgs","repos_url":"https://api.github.com/users/iamrobinhood12345/repos","events_url":"https://api.github.com/users/iamrobinhood12345/events{/privacy}","received_events_url":"https://api.github.com/users/iamrobinhood12345/received_events","type":"User","site_admin":false},"repo":{"id":75874722,"name":"trigrams","full_name":"iamrobinhood12345/trigrams","owner":{"login":"iamrobinhood12345","id":11498059,"avatar_url":"https://avatars.githubusercontent.com/u/11498059?v=3","gravatar_id":"","url":"https://api.github.com/users/iamrobinhood12345","html_url":"https://github.com/iamrobinhood12345","followers_url":"https://api.github.com/users/iamrobinhood12345/followers","following_url":"https://api.github.com/users/iamrobinhood12345/following{/other_user}","gists_url":"https://api.github.com/users/iamrobinhood12345/gists{/gist_id}","starred_url":"https://api.github.com/users/iamrobinhood12345/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamrobinhood12345/subscriptions","organizations_url":"https://api.github.com/users/iamrobinhood12345/orgs","repos_url":"https://api.github.com/users/iamrobinhood12345/repos","events_url":"https://api.github.com/users/iamrobinhood12345/events{/privacy}","received_events_url":"https://api.github.com/users/iamrobinhood12345/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iamrobinhood12345/trigrams","description":null,"fork":false,"url":"https://api.github.com/repos/iamrobinhood12345/trigrams","forks_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/forks","keys_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/teams","hooks_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/hooks","issue_events_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues/events{/number}","events_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/events","assignees_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/assignees{/user}","branches_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/branches{/branch}","tags_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/tags","blobs_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/refs{/sha}","trees_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/statuses/{sha}","languages_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/languages","stargazers_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/stargazers","contributors_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/contributors","subscribers_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/subscribers","subscription_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/subscription","commits_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/commits{/sha}","git_commits_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/commits{/sha}","comments_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/comments{/number}","issue_comment_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues/comments{/number}","contents_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/contents/{+path}","compare_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/merges","archive_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/downloads","issues_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues{/number}","pulls_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls{/number}","milestones_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/milestones{/number}","notifications_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/labels{/name}","releases_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/releases{/id}","deployments_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/deployments","created_at":"2016-12-07T20:52:48Z","updated_at":"2016-12-08T17:32:26Z","pushed_at":"2016-12-08T17:32:24Z","git_url":"git://github.com/iamrobinhood12345/trigrams.git","ssh_url":"git@github.com:iamrobinhood12345/trigrams.git","clone_url":"https://github.com/iamrobinhood12345/trigrams.git","svn_url":"https://github.com/iamrobinhood12345/trigrams","homepage":null,"size":237,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"iamrobinhood12345:master","ref":"master","sha":"52241d6d1534796499039f3a5e684718dc57e0e3","user":{"login":"iamrobinhood12345","id":11498059,"avatar_url":"https://avatars.githubusercontent.com/u/11498059?v=3","gravatar_id":"","url":"https://api.github.com/users/iamrobinhood12345","html_url":"https://github.com/iamrobinhood12345","followers_url":"https://api.github.com/users/iamrobinhood12345/followers","following_url":"https://api.github.com/users/iamrobinhood12345/following{/other_user}","gists_url":"https://api.github.com/users/iamrobinhood12345/gists{/gist_id}","starred_url":"https://api.github.com/users/iamrobinhood12345/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamrobinhood12345/subscriptions","organizations_url":"https://api.github.com/users/iamrobinhood12345/orgs","repos_url":"https://api.github.com/users/iamrobinhood12345/repos","events_url":"https://api.github.com/users/iamrobinhood12345/events{/privacy}","received_events_url":"https://api.github.com/users/iamrobinhood12345/received_events","type":"User","site_admin":false},"repo":{"id":75874722,"name":"trigrams","full_name":"iamrobinhood12345/trigrams","owner":{"login":"iamrobinhood12345","id":11498059,"avatar_url":"https://avatars.githubusercontent.com/u/11498059?v=3","gravatar_id":"","url":"https://api.github.com/users/iamrobinhood12345","html_url":"https://github.com/iamrobinhood12345","followers_url":"https://api.github.com/users/iamrobinhood12345/followers","following_url":"https://api.github.com/users/iamrobinhood12345/following{/other_user}","gists_url":"https://api.github.com/users/iamrobinhood12345/gists{/gist_id}","starred_url":"https://api.github.com/users/iamrobinhood12345/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamrobinhood12345/subscriptions","organizations_url":"https://api.github.com/users/iamrobinhood12345/orgs","repos_url":"https://api.github.com/users/iamrobinhood12345/repos","events_url":"https://api.github.com/users/iamrobinhood12345/events{/privacy}","received_events_url":"https://api.github.com/users/iamrobinhood12345/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iamrobinhood12345/trigrams","description":null,"fork":false,"url":"https://api.github.com/repos/iamrobinhood12345/trigrams","forks_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/forks","keys_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/teams","hooks_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/hooks","issue_events_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues/events{/number}","events_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/events","assignees_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/assignees{/user}","branches_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/branches{/branch}","tags_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/tags","blobs_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/refs{/sha}","trees_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/statuses/{sha}","languages_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/languages","stargazers_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/stargazers","contributors_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/contributors","subscribers_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/subscribers","subscription_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/subscription","commits_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/commits{/sha}","git_commits_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/git/commits{/sha}","comments_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/comments{/number}","issue_comment_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues/comments{/number}","contents_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/contents/{+path}","compare_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/merges","archive_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/downloads","issues_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues{/number}","pulls_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls{/number}","milestones_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/milestones{/number}","notifications_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/labels{/name}","releases_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/releases{/id}","deployments_url":"https://api.github.com/repos/iamrobinhood12345/trigrams/deployments","created_at":"2016-12-07T20:52:48Z","updated_at":"2016-12-08T17:32:26Z","pushed_at":"2016-12-08T17:32:24Z","git_url":"git://github.com/iamrobinhood12345/trigrams.git","ssh_url":"git@github.com:iamrobinhood12345/trigrams.git","clone_url":"https://github.com/iamrobinhood12345/trigrams.git","svn_url":"https://github.com/iamrobinhood12345/trigrams","homepage":null,"size":237,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/2"},"html":{"href":"https://github.com/iamrobinhood12345/trigrams/pull/2"},"issue":{"href":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues/2"},"comments":{"href":"https://api.github.com/repos/iamrobinhood12345/trigrams/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iamrobinhood12345/trigrams/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/iamrobinhood12345/trigrams/statuses/2ee9f055c6324a0fa4ee763500128fcda3479521"}}}}
{"actor":{"display_login":"nhuntwalker"}}