{"action":"created","comment":{"url":"https://api.github.com/repos/mrlifetime/bayesian/pulls/comments/55923970","id":55923970,"diff_hunk":"@@ -0,0 +1,35 @@\n+import string\n+from copy import deepcopy\n+\n+\n+class Type(object):\n+\tdef __init__(self, document, name):\n+\t\tself.name = name\n+\t\tself.words = {}\n+\t\tself.numDocuments = 1\n+\t\tfor word in document.words.iteritems()\n+\t\t\tif word in self.words:\n+\t\t\telse:\n+\t\t\t\ttmp = deepcopy word;\n+\t\t\t\ttmp.probability = 1\n+\t\t\t\tself.words[ word.text ] = tmp\n+\tdef train(self, document):\n+\t\tself.numDocuments++\n+\t\tfor word in document.words.iteritems()\n+\t\t\tif word in self.words:\n+\t\t\t\tself.words[ word.text ].probability = (self.words[word.text].probability * (numDocuments - 1) + 1 ) / self.numDocuments\n+\t\t\telse:\n+\t\t\t\ttmp = deepcopy word\n+\t\t\t\ttmp.Probability = 1 / self.numDocuments\n+\t\t\t\tself.words[ word.text ] = tmp\n+\tdef getProb(self, word):\n+\t\tif word in self.words:\n+\t\t\treturn self.words[ word.text ].probability\n+\t\telse:\n+\t\t\treturn 0\n+\n+def test():\n+\t","path":"TypeClass.py","position":32,"original_position":32,"commit_id":"1cb04c1ac2b6976287af4f6b4aaf2f19d6f7b251","original_commit_id":"1cb04c1ac2b6976287af4f6b4aaf2f19d6f7b251","user":{"login":"mrlifetime","id":13847735,"avatar_url":"https://avatars.githubusercontent.com/u/13847735?v=3","gravatar_id":"","url":"https://api.github.com/users/mrlifetime","html_url":"https://github.com/mrlifetime","followers_url":"https://api.github.com/users/mrlifetime/followers","following_url":"https://api.github.com/users/mrlifetime/following{/other_user}","gists_url":"https://api.github.com/users/mrlifetime/gists{/gist_id}","starred_url":"https://api.github.com/users/mrlifetime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrlifetime/subscriptions","organizations_url":"https://api.github.com/users/mrlifetime/orgs","repos_url":"https://api.github.com/users/mrlifetime/repos","events_url":"https://api.github.com/users/mrlifetime/events{/privacy}","received_events_url":"https://api.github.com/users/mrlifetime/received_events","type":"User","site_admin":false},"body":"you need to add `pass` keyword if you want an empty function","created_at":"2016-03-12T17:02:01Z","updated_at":"2016-03-12T17:02:01Z","html_url":"https://github.com/mrlifetime/bayesian/pull/3#discussion_r55923970","pull_request_url":"https://api.github.com/repos/mrlifetime/bayesian/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/mrlifetime/bayesian/pulls/comments/55923970"},"html":{"href":"https://github.com/mrlifetime/bayesian/pull/3#discussion_r55923970"},"pull_request":{"href":"https://api.github.com/repos/mrlifetime/bayesian/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/mrlifetime/bayesian/pulls/3","id":62646060,"html_url":"https://github.com/mrlifetime/bayesian/pull/3","diff_url":"https://github.com/mrlifetime/bayesian/pull/3.diff","patch_url":"https://github.com/mrlifetime/bayesian/pull/3.patch","issue_url":"https://api.github.com/repos/mrlifetime/bayesian/issues/3","number":3,"state":"open","locked":false,"title":"Type Class Draft1","user":{"login":"ArcanePhysics","id":17799556,"avatar_url":"https://avatars.githubusercontent.com/u/17799556?v=3","gravatar_id":"","url":"https://api.github.com/users/ArcanePhysics","html_url":"https://github.com/ArcanePhysics","followers_url":"https://api.github.com/users/ArcanePhysics/followers","following_url":"https://api.github.com/users/ArcanePhysics/following{/other_user}","gists_url":"https://api.github.com/users/ArcanePhysics/gists{/gist_id}","starred_url":"https://api.github.com/users/ArcanePhysics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArcanePhysics/subscriptions","organizations_url":"https://api.github.com/users/ArcanePhysics/orgs","repos_url":"https://api.github.com/users/ArcanePhysics/repos","events_url":"https://api.github.com/users/ArcanePhysics/events{/privacy}","received_events_url":"https://api.github.com/users/ArcanePhysics/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-12T16:59:56Z","updated_at":"2016-03-12T17:02:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ccc431977cf98fa1f6410c4cc96fc63cadbd8ab5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mrlifetime/bayesian/pulls/3/commits","review_comments_url":"https://api.github.com/repos/mrlifetime/bayesian/pulls/3/comments","review_comment_url":"https://api.github.com/repos/mrlifetime/bayesian/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mrlifetime/bayesian/issues/3/comments","statuses_url":"https://api.github.com/repos/mrlifetime/bayesian/statuses/1cb04c1ac2b6976287af4f6b4aaf2f19d6f7b251","head":{"label":"ArcanePhysics:master","ref":"master","sha":"1cb04c1ac2b6976287af4f6b4aaf2f19d6f7b251","user":{"login":"ArcanePhysics","id":17799556,"avatar_url":"https://avatars.githubusercontent.com/u/17799556?v=3","gravatar_id":"","url":"https://api.github.com/users/ArcanePhysics","html_url":"https://github.com/ArcanePhysics","followers_url":"https://api.github.com/users/ArcanePhysics/followers","following_url":"https://api.github.com/users/ArcanePhysics/following{/other_user}","gists_url":"https://api.github.com/users/ArcanePhysics/gists{/gist_id}","starred_url":"https://api.github.com/users/ArcanePhysics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArcanePhysics/subscriptions","organizations_url":"https://api.github.com/users/ArcanePhysics/orgs","repos_url":"https://api.github.com/users/ArcanePhysics/repos","events_url":"https://api.github.com/users/ArcanePhysics/events{/privacy}","received_events_url":"https://api.github.com/users/ArcanePhysics/received_events","type":"User","site_admin":false},"repo":{"id":53736807,"name":"bayesian","full_name":"ArcanePhysics/bayesian","owner":{"login":"ArcanePhysics","id":17799556,"avatar_url":"https://avatars.githubusercontent.com/u/17799556?v=3","gravatar_id":"","url":"https://api.github.com/users/ArcanePhysics","html_url":"https://github.com/ArcanePhysics","followers_url":"https://api.github.com/users/ArcanePhysics/followers","following_url":"https://api.github.com/users/ArcanePhysics/following{/other_user}","gists_url":"https://api.github.com/users/ArcanePhysics/gists{/gist_id}","starred_url":"https://api.github.com/users/ArcanePhysics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArcanePhysics/subscriptions","organizations_url":"https://api.github.com/users/ArcanePhysics/orgs","repos_url":"https://api.github.com/users/ArcanePhysics/repos","events_url":"https://api.github.com/users/ArcanePhysics/events{/privacy}","received_events_url":"https://api.github.com/users/ArcanePhysics/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ArcanePhysics/bayesian","description":"","fork":true,"url":"https://api.github.com/repos/ArcanePhysics/bayesian","forks_url":"https://api.github.com/repos/ArcanePhysics/bayesian/forks","keys_url":"https://api.github.com/repos/ArcanePhysics/bayesian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ArcanePhysics/bayesian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ArcanePhysics/bayesian/teams","hooks_url":"https://api.github.com/repos/ArcanePhysics/bayesian/hooks","issue_events_url":"https://api.github.com/repos/ArcanePhysics/bayesian/issues/events{/number}","events_url":"https://api.github.com/repos/ArcanePhysics/bayesian/events","assignees_url":"https://api.github.com/repos/ArcanePhysics/bayesian/assignees{/user}","branches_url":"https://api.github.com/repos/ArcanePhysics/bayesian/branches{/branch}","tags_url":"https://api.github.com/repos/ArcanePhysics/bayesian/tags","blobs_url":"https://api.github.com/repos/ArcanePhysics/bayesian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ArcanePhysics/bayesian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ArcanePhysics/bayesian/git/refs{/sha}","trees_url":"https://api.github.com/repos/ArcanePhysics/bayesian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ArcanePhysics/bayesian/statuses/{sha}","languages_url":"https://api.github.com/repos/ArcanePhysics/bayesian/languages","stargazers_url":"https://api.github.com/repos/ArcanePhysics/bayesian/stargazers","contributors_url":"https://api.github.com/repos/ArcanePhysics/bayesian/contributors","subscribers_url":"https://api.github.com/repos/ArcanePhysics/bayesian/subscribers","subscription_url":"https://api.github.com/repos/ArcanePhysics/bayesian/subscription","commits_url":"https://api.github.com/repos/ArcanePhysics/bayesian/commits{/sha}","git_commits_url":"https://api.github.com/repos/ArcanePhysics/bayesian/git/commits{/sha}","comments_url":"https://api.github.com/repos/ArcanePhysics/bayesian/comments{/number}","issue_comment_url":"https://api.github.com/repos/ArcanePhysics/bayesian/issues/comments{/number}","contents_url":"https://api.github.com/repos/ArcanePhysics/bayesian/contents/{+path}","compare_url":"https://api.github.com/repos/ArcanePhysics/bayesian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ArcanePhysics/bayesian/merges","archive_url":"https://api.github.com/repos/ArcanePhysics/bayesian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ArcanePhysics/bayesian/downloads","issues_url":"https://api.github.com/repos/ArcanePhysics/bayesian/issues{/number}","pulls_url":"https://api.github.com/repos/ArcanePhysics/bayesian/pulls{/number}","milestones_url":"https://api.github.com/repos/ArcanePhysics/bayesian/milestones{/number}","notifications_url":"https://api.github.com/repos/ArcanePhysics/bayesian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ArcanePhysics/bayesian/labels{/name}","releases_url":"https://api.github.com/repos/ArcanePhysics/bayesian/releases{/id}","deployments_url":"https://api.github.com/repos/ArcanePhysics/bayesian/deployments","created_at":"2016-03-12T14:51:49Z","updated_at":"2016-03-12T16:59:46Z","pushed_at":"2016-03-12T16:59:45Z","git_url":"git://github.com/ArcanePhysics/bayesian.git","ssh_url":"git@github.com:ArcanePhysics/bayesian.git","clone_url":"https://github.com/ArcanePhysics/bayesian.git","svn_url":"https://github.com/ArcanePhysics/bayesian","homepage":null,"size":1,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":"mrlifetime:master","ref":"master","sha":"a123f6125c489671712b2f2df0d64beaf72e73eb","user":{"login":"mrlifetime","id":13847735,"avatar_url":"https://avatars.githubusercontent.com/u/13847735?v=3","gravatar_id":"","url":"https://api.github.com/users/mrlifetime","html_url":"https://github.com/mrlifetime","followers_url":"https://api.github.com/users/mrlifetime/followers","following_url":"https://api.github.com/users/mrlifetime/following{/other_user}","gists_url":"https://api.github.com/users/mrlifetime/gists{/gist_id}","starred_url":"https://api.github.com/users/mrlifetime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrlifetime/subscriptions","organizations_url":"https://api.github.com/users/mrlifetime/orgs","repos_url":"https://api.github.com/users/mrlifetime/repos","events_url":"https://api.github.com/users/mrlifetime/events{/privacy}","received_events_url":"https://api.github.com/users/mrlifetime/received_events","type":"User","site_admin":false},"repo":{"id":53736537,"name":"bayesian","full_name":"mrlifetime/bayesian","owner":{"login":"mrlifetime","id":13847735,"avatar_url":"https://avatars.githubusercontent.com/u/13847735?v=3","gravatar_id":"","url":"https://api.github.com/users/mrlifetime","html_url":"https://github.com/mrlifetime","followers_url":"https://api.github.com/users/mrlifetime/followers","following_url":"https://api.github.com/users/mrlifetime/following{/other_user}","gists_url":"https://api.github.com/users/mrlifetime/gists{/gist_id}","starred_url":"https://api.github.com/users/mrlifetime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrlifetime/subscriptions","organizations_url":"https://api.github.com/users/mrlifetime/orgs","repos_url":"https://api.github.com/users/mrlifetime/repos","events_url":"https://api.github.com/users/mrlifetime/events{/privacy}","received_events_url":"https://api.github.com/users/mrlifetime/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrlifetime/bayesian","description":"","fork":false,"url":"https://api.github.com/repos/mrlifetime/bayesian","forks_url":"https://api.github.com/repos/mrlifetime/bayesian/forks","keys_url":"https://api.github.com/repos/mrlifetime/bayesian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrlifetime/bayesian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrlifetime/bayesian/teams","hooks_url":"https://api.github.com/repos/mrlifetime/bayesian/hooks","issue_events_url":"https://api.github.com/repos/mrlifetime/bayesian/issues/events{/number}","events_url":"https://api.github.com/repos/mrlifetime/bayesian/events","assignees_url":"https://api.github.com/repos/mrlifetime/bayesian/assignees{/user}","branches_url":"https://api.github.com/repos/mrlifetime/bayesian/branches{/branch}","tags_url":"https://api.github.com/repos/mrlifetime/bayesian/tags","blobs_url":"https://api.github.com/repos/mrlifetime/bayesian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrlifetime/bayesian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrlifetime/bayesian/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrlifetime/bayesian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrlifetime/bayesian/statuses/{sha}","languages_url":"https://api.github.com/repos/mrlifetime/bayesian/languages","stargazers_url":"https://api.github.com/repos/mrlifetime/bayesian/stargazers","contributors_url":"https://api.github.com/repos/mrlifetime/bayesian/contributors","subscribers_url":"https://api.github.com/repos/mrlifetime/bayesian/subscribers","subscription_url":"https://api.github.com/repos/mrlifetime/bayesian/subscription","commits_url":"https://api.github.com/repos/mrlifetime/bayesian/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrlifetime/bayesian/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrlifetime/bayesian/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrlifetime/bayesian/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrlifetime/bayesian/contents/{+path}","compare_url":"https://api.github.com/repos/mrlifetime/bayesian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrlifetime/bayesian/merges","archive_url":"https://api.github.com/repos/mrlifetime/bayesian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrlifetime/bayesian/downloads","issues_url":"https://api.github.com/repos/mrlifetime/bayesian/issues{/number}","pulls_url":"https://api.github.com/repos/mrlifetime/bayesian/pulls{/number}","milestones_url":"https://api.github.com/repos/mrlifetime/bayesian/milestones{/number}","notifications_url":"https://api.github.com/repos/mrlifetime/bayesian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrlifetime/bayesian/labels{/name}","releases_url":"https://api.github.com/repos/mrlifetime/bayesian/releases{/id}","deployments_url":"https://api.github.com/repos/mrlifetime/bayesian/deployments","created_at":"2016-03-12T14:46:03Z","updated_at":"2016-03-12T15:58:36Z","pushed_at":"2016-03-12T16:59:56Z","git_url":"git://github.com/mrlifetime/bayesian.git","ssh_url":"git@github.com:mrlifetime/bayesian.git","clone_url":"https://github.com/mrlifetime/bayesian.git","svn_url":"https://github.com/mrlifetime/bayesian","homepage":null,"size":9,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mrlifetime/bayesian/pulls/3"},"html":{"href":"https://github.com/mrlifetime/bayesian/pull/3"},"issue":{"href":"https://api.github.com/repos/mrlifetime/bayesian/issues/3"},"comments":{"href":"https://api.github.com/repos/mrlifetime/bayesian/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/mrlifetime/bayesian/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/mrlifetime/bayesian/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mrlifetime/bayesian/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/mrlifetime/bayesian/statuses/1cb04c1ac2b6976287af4f6b4aaf2f19d6f7b251"}}}}