{"action":"created","comment":{"url":"https://api.github.com/repos/textpipe/textpipe/pulls/comments/218700691","pull_request_review_id":156693926,"id":218700691,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODcwMDY5MQ==","diff_hunk":"@@ -274,3 +274,24 @@ def _set_default_nlp(self, lang):\n             self._spacy_nlps[lang] = {}\n         model = spacy.load('{}_core_{}_sm'.format(lang, 'web' if lang == 'en' else 'news'))\n         self._spacy_nlps[lang][None] = model\n+\n+    @functools.lru_cache()\n+    def sentiment(self, word_map={}):\n+        \"\"\"\n+        Returns sentiment in -1 to 1 (-1 beeing negative and 1 beeing positive).\n+\n+        Expects a dictionary of annotated words with the same scores where word\n+        is the key and sentiment score the value.\n+\n+        >>> doc = Doc('Sentence for testing this very happy sentiment')\n+        >>> doc.sentiment()\n+        0.0\n+        \"\"\"\n+\n+        sentiment_score = 0\n+\n+        for word in self.words:\n+            sentiment_score += word_map.get(word, 0)","path":"textpipe/doc.py","position":21,"original_position":21,"commit_id":"e4150d8ffd0e3840607833d422515d0e5a0ca138","original_commit_id":"e4150d8ffd0e3840607833d422515d0e5a0ca138","user":{"login":"graus","id":894054,"node_id":"MDQ6VXNlcjg5NDA1NA==","avatar_url":"https://avatars1.githubusercontent.com/u/894054?v=4","gravatar_id":"","url":"https://api.github.com/users/graus","html_url":"https://github.com/graus","followers_url":"https://api.github.com/users/graus/followers","following_url":"https://api.github.com/users/graus/following{/other_user}","gists_url":"https://api.github.com/users/graus/gists{/gist_id}","starred_url":"https://api.github.com/users/graus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graus/subscriptions","organizations_url":"https://api.github.com/users/graus/orgs","repos_url":"https://api.github.com/users/graus/repos","events_url":"https://api.github.com/users/graus/events{/privacy}","received_events_url":"https://api.github.com/users/graus/received_events","type":"User","site_admin":false},"body":"... specify you're accessing the first element of the tuple here (i.e., `word_map.get(word[0], 0)`) [2/2]","created_at":"2018-09-19T07:51:23Z","updated_at":"2018-09-19T07:51:23Z","html_url":"https://github.com/textpipe/textpipe/pull/67#discussion_r218700691","pull_request_url":"https://api.github.com/repos/textpipe/textpipe/pulls/67","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/textpipe/textpipe/pulls/comments/218700691"},"html":{"href":"https://github.com/textpipe/textpipe/pull/67#discussion_r218700691"},"pull_request":{"href":"https://api.github.com/repos/textpipe/textpipe/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/textpipe/textpipe/pulls/67","id":216531347,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2NTMxMzQ3","html_url":"https://github.com/textpipe/textpipe/pull/67","diff_url":"https://github.com/textpipe/textpipe/pull/67.diff","patch_url":"https://github.com/textpipe/textpipe/pull/67.patch","issue_url":"https://api.github.com/repos/textpipe/textpipe/issues/67","number":67,"state":"open","locked":false,"title":"adds basic sentiment analysis","user":{"login":"JeroenJansze2018","id":4158994,"node_id":"MDQ6VXNlcjQxNTg5OTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/4158994?v=4","gravatar_id":"","url":"https://api.github.com/users/JeroenJansze2018","html_url":"https://github.com/JeroenJansze2018","followers_url":"https://api.github.com/users/JeroenJansze2018/followers","following_url":"https://api.github.com/users/JeroenJansze2018/following{/other_user}","gists_url":"https://api.github.com/users/JeroenJansze2018/gists{/gist_id}","starred_url":"https://api.github.com/users/JeroenJansze2018/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeroenJansze2018/subscriptions","organizations_url":"https://api.github.com/users/JeroenJansze2018/orgs","repos_url":"https://api.github.com/users/JeroenJansze2018/repos","events_url":"https://api.github.com/users/JeroenJansze2018/events{/privacy}","received_events_url":"https://api.github.com/users/JeroenJansze2018/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-19T06:50:39Z","updated_at":"2018-09-19T07:51:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"845de76a8f48d889201346f8090d352e6ae54f65","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/textpipe/textpipe/pulls/67/commits","review_comments_url":"https://api.github.com/repos/textpipe/textpipe/pulls/67/comments","review_comment_url":"https://api.github.com/repos/textpipe/textpipe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/textpipe/textpipe/issues/67/comments","statuses_url":"https://api.github.com/repos/textpipe/textpipe/statuses/e4150d8ffd0e3840607833d422515d0e5a0ca138","head":{"label":"textpipe:feature/NP-158/add-sentiment-enrichment","ref":"feature/NP-158/add-sentiment-enrichment","sha":"e4150d8ffd0e3840607833d422515d0e5a0ca138","user":{"login":"textpipe","id":40492530,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNDkyNTMw","avatar_url":"https://avatars2.githubusercontent.com/u/40492530?v=4","gravatar_id":"","url":"https://api.github.com/users/textpipe","html_url":"https://github.com/textpipe","followers_url":"https://api.github.com/users/textpipe/followers","following_url":"https://api.github.com/users/textpipe/following{/other_user}","gists_url":"https://api.github.com/users/textpipe/gists{/gist_id}","starred_url":"https://api.github.com/users/textpipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/textpipe/subscriptions","organizations_url":"https://api.github.com/users/textpipe/orgs","repos_url":"https://api.github.com/users/textpipe/repos","events_url":"https://api.github.com/users/textpipe/events{/privacy}","received_events_url":"https://api.github.com/users/textpipe/received_events","type":"Organization","site_admin":false},"repo":{"id":138195162,"node_id":"MDEwOlJlcG9zaXRvcnkxMzgxOTUxNjI=","name":"textpipe","full_name":"textpipe/textpipe","private":false,"owner":{"login":"textpipe","id":40492530,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNDkyNTMw","avatar_url":"https://avatars2.githubusercontent.com/u/40492530?v=4","gravatar_id":"","url":"https://api.github.com/users/textpipe","html_url":"https://github.com/textpipe","followers_url":"https://api.github.com/users/textpipe/followers","following_url":"https://api.github.com/users/textpipe/following{/other_user}","gists_url":"https://api.github.com/users/textpipe/gists{/gist_id}","starred_url":"https://api.github.com/users/textpipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/textpipe/subscriptions","organizations_url":"https://api.github.com/users/textpipe/orgs","repos_url":"https://api.github.com/users/textpipe/repos","events_url":"https://api.github.com/users/textpipe/events{/privacy}","received_events_url":"https://api.github.com/users/textpipe/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/textpipe/textpipe","description":"Textpipe: clean and extract metadata from text","fork":false,"url":"https://api.github.com/repos/textpipe/textpipe","forks_url":"https://api.github.com/repos/textpipe/textpipe/forks","keys_url":"https://api.github.com/repos/textpipe/textpipe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/textpipe/textpipe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/textpipe/textpipe/teams","hooks_url":"https://api.github.com/repos/textpipe/textpipe/hooks","issue_events_url":"https://api.github.com/repos/textpipe/textpipe/issues/events{/number}","events_url":"https://api.github.com/repos/textpipe/textpipe/events","assignees_url":"https://api.github.com/repos/textpipe/textpipe/assignees{/user}","branches_url":"https://api.github.com/repos/textpipe/textpipe/branches{/branch}","tags_url":"https://api.github.com/repos/textpipe/textpipe/tags","blobs_url":"https://api.github.com/repos/textpipe/textpipe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/textpipe/textpipe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/textpipe/textpipe/git/refs{/sha}","trees_url":"https://api.github.com/repos/textpipe/textpipe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/textpipe/textpipe/statuses/{sha}","languages_url":"https://api.github.com/repos/textpipe/textpipe/languages","stargazers_url":"https://api.github.com/repos/textpipe/textpipe/stargazers","contributors_url":"https://api.github.com/repos/textpipe/textpipe/contributors","subscribers_url":"https://api.github.com/repos/textpipe/textpipe/subscribers","subscription_url":"https://api.github.com/repos/textpipe/textpipe/subscription","commits_url":"https://api.github.com/repos/textpipe/textpipe/commits{/sha}","git_commits_url":"https://api.github.com/repos/textpipe/textpipe/git/commits{/sha}","comments_url":"https://api.github.com/repos/textpipe/textpipe/comments{/number}","issue_comment_url":"https://api.github.com/repos/textpipe/textpipe/issues/comments{/number}","contents_url":"https://api.github.com/repos/textpipe/textpipe/contents/{+path}","compare_url":"https://api.github.com/repos/textpipe/textpipe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/textpipe/textpipe/merges","archive_url":"https://api.github.com/repos/textpipe/textpipe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/textpipe/textpipe/downloads","issues_url":"https://api.github.com/repos/textpipe/textpipe/issues{/number}","pulls_url":"https://api.github.com/repos/textpipe/textpipe/pulls{/number}","milestones_url":"https://api.github.com/repos/textpipe/textpipe/milestones{/number}","notifications_url":"https://api.github.com/repos/textpipe/textpipe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/textpipe/textpipe/labels{/name}","releases_url":"https://api.github.com/repos/textpipe/textpipe/releases{/id}","deployments_url":"https://api.github.com/repos/textpipe/textpipe/deployments","created_at":"2018-06-21T16:23:32Z","updated_at":"2018-09-14T12:18:16Z","pushed_at":"2018-09-19T06:54:18Z","git_url":"git://github.com/textpipe/textpipe.git","ssh_url":"git@github.com:textpipe/textpipe.git","clone_url":"https://github.com/textpipe/textpipe.git","svn_url":"https://github.com/textpipe/textpipe","homepage":"","size":116,"stargazers_count":38,"watchers_count":38,"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":14,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":14,"watchers":38,"default_branch":"master"}},"base":{"label":"textpipe:master","ref":"master","sha":"0e0e4a7579675194e475cf833ae0c2c9bf2e26fa","user":{"login":"textpipe","id":40492530,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNDkyNTMw","avatar_url":"https://avatars2.githubusercontent.com/u/40492530?v=4","gravatar_id":"","url":"https://api.github.com/users/textpipe","html_url":"https://github.com/textpipe","followers_url":"https://api.github.com/users/textpipe/followers","following_url":"https://api.github.com/users/textpipe/following{/other_user}","gists_url":"https://api.github.com/users/textpipe/gists{/gist_id}","starred_url":"https://api.github.com/users/textpipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/textpipe/subscriptions","organizations_url":"https://api.github.com/users/textpipe/orgs","repos_url":"https://api.github.com/users/textpipe/repos","events_url":"https://api.github.com/users/textpipe/events{/privacy}","received_events_url":"https://api.github.com/users/textpipe/received_events","type":"Organization","site_admin":false},"repo":{"id":138195162,"node_id":"MDEwOlJlcG9zaXRvcnkxMzgxOTUxNjI=","name":"textpipe","full_name":"textpipe/textpipe","private":false,"owner":{"login":"textpipe","id":40492530,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNDkyNTMw","avatar_url":"https://avatars2.githubusercontent.com/u/40492530?v=4","gravatar_id":"","url":"https://api.github.com/users/textpipe","html_url":"https://github.com/textpipe","followers_url":"https://api.github.com/users/textpipe/followers","following_url":"https://api.github.com/users/textpipe/following{/other_user}","gists_url":"https://api.github.com/users/textpipe/gists{/gist_id}","starred_url":"https://api.github.com/users/textpipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/textpipe/subscriptions","organizations_url":"https://api.github.com/users/textpipe/orgs","repos_url":"https://api.github.com/users/textpipe/repos","events_url":"https://api.github.com/users/textpipe/events{/privacy}","received_events_url":"https://api.github.com/users/textpipe/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/textpipe/textpipe","description":"Textpipe: clean and extract metadata from text","fork":false,"url":"https://api.github.com/repos/textpipe/textpipe","forks_url":"https://api.github.com/repos/textpipe/textpipe/forks","keys_url":"https://api.github.com/repos/textpipe/textpipe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/textpipe/textpipe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/textpipe/textpipe/teams","hooks_url":"https://api.github.com/repos/textpipe/textpipe/hooks","issue_events_url":"https://api.github.com/repos/textpipe/textpipe/issues/events{/number}","events_url":"https://api.github.com/repos/textpipe/textpipe/events","assignees_url":"https://api.github.com/repos/textpipe/textpipe/assignees{/user}","branches_url":"https://api.github.com/repos/textpipe/textpipe/branches{/branch}","tags_url":"https://api.github.com/repos/textpipe/textpipe/tags","blobs_url":"https://api.github.com/repos/textpipe/textpipe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/textpipe/textpipe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/textpipe/textpipe/git/refs{/sha}","trees_url":"https://api.github.com/repos/textpipe/textpipe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/textpipe/textpipe/statuses/{sha}","languages_url":"https://api.github.com/repos/textpipe/textpipe/languages","stargazers_url":"https://api.github.com/repos/textpipe/textpipe/stargazers","contributors_url":"https://api.github.com/repos/textpipe/textpipe/contributors","subscribers_url":"https://api.github.com/repos/textpipe/textpipe/subscribers","subscription_url":"https://api.github.com/repos/textpipe/textpipe/subscription","commits_url":"https://api.github.com/repos/textpipe/textpipe/commits{/sha}","git_commits_url":"https://api.github.com/repos/textpipe/textpipe/git/commits{/sha}","comments_url":"https://api.github.com/repos/textpipe/textpipe/comments{/number}","issue_comment_url":"https://api.github.com/repos/textpipe/textpipe/issues/comments{/number}","contents_url":"https://api.github.com/repos/textpipe/textpipe/contents/{+path}","compare_url":"https://api.github.com/repos/textpipe/textpipe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/textpipe/textpipe/merges","archive_url":"https://api.github.com/repos/textpipe/textpipe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/textpipe/textpipe/downloads","issues_url":"https://api.github.com/repos/textpipe/textpipe/issues{/number}","pulls_url":"https://api.github.com/repos/textpipe/textpipe/pulls{/number}","milestones_url":"https://api.github.com/repos/textpipe/textpipe/milestones{/number}","notifications_url":"https://api.github.com/repos/textpipe/textpipe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/textpipe/textpipe/labels{/name}","releases_url":"https://api.github.com/repos/textpipe/textpipe/releases{/id}","deployments_url":"https://api.github.com/repos/textpipe/textpipe/deployments","created_at":"2018-06-21T16:23:32Z","updated_at":"2018-09-14T12:18:16Z","pushed_at":"2018-09-19T06:54:18Z","git_url":"git://github.com/textpipe/textpipe.git","ssh_url":"git@github.com:textpipe/textpipe.git","clone_url":"https://github.com/textpipe/textpipe.git","svn_url":"https://github.com/textpipe/textpipe","homepage":"","size":116,"stargazers_count":38,"watchers_count":38,"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":14,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":14,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/textpipe/textpipe/pulls/67"},"html":{"href":"https://github.com/textpipe/textpipe/pull/67"},"issue":{"href":"https://api.github.com/repos/textpipe/textpipe/issues/67"},"comments":{"href":"https://api.github.com/repos/textpipe/textpipe/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/textpipe/textpipe/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/textpipe/textpipe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/textpipe/textpipe/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/textpipe/textpipe/statuses/e4150d8ffd0e3840607833d422515d0e5a0ca138"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"graus"}}