{"action":"created","comment":{"url":"https://api.github.com/repos/nltk/nltk/pulls/comments/37181988","id":37181988,"diff_hunk":"@@ -198,17 +198,20 @@ def extract_rels(subjclass, objclass, doc, corpus='ace', pattern=None, window=10\n     :return: see ``mk_reldicts``\n     :rtype: list(defaultdict)\n     \"\"\"\n-\n-    if subjclass and subjclass not in NE_CLASSES[corpus]:\n-        if _expand(subjclass) in NE_CLASSES[corpus]:\n-            subjclass = _expand(subjclass)\n-        else:\n-            raise ValueError(\"your value for the subject type has not been recognized: %s\" % subjclass)\n-    if objclass and objclass not in NE_CLASSES[corpus]:\n-        if _expand(objclass) in NE_CLASSES[corpus]:\n-            objclass = _expand(objclass)\n-        else:\n-            raise ValueError(\"your value for the object type has not been recognized: %s\" % objclass)\n+    \n+    for i, s in enumerate(subjclass):","path":"nltk/sem/relextract.py","position":45,"original_position":45,"commit_id":"12dcadf7e4bf1f0f375b0de77c898956a9ac7c71","original_commit_id":"12dcadf7e4bf1f0f375b0de77c898956a9ac7c71","user":{"login":"helshowk","id":1168492,"avatar_url":"https://avatars.githubusercontent.com/u/1168492?v=3","gravatar_id":"","url":"https://api.github.com/users/helshowk","html_url":"https://github.com/helshowk","followers_url":"https://api.github.com/users/helshowk/followers","following_url":"https://api.github.com/users/helshowk/following{/other_user}","gists_url":"https://api.github.com/users/helshowk/gists{/gist_id}","starred_url":"https://api.github.com/users/helshowk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helshowk/subscriptions","organizations_url":"https://api.github.com/users/helshowk/orgs","repos_url":"https://api.github.com/users/helshowk/repos","events_url":"https://api.github.com/users/helshowk/events{/privacy}","received_events_url":"https://api.github.com/users/helshowk/received_events","type":"User","site_admin":false},"body":"I don't disagree that it would be faster but I wasn't clear on why you think we need to optimize these containment checks and change the structure of the code.  Although your code is more compact I think it's less readable but I agree it would also be a bit faster to use a set instead of a list here (there are maybe a dozen elements here so I don't think it would really make a huge difference).  I think it's cleaner to leave the for loop with nested if's and you can explicitly see that the execution won't get to 216 unless all elements of subjclass (or their expansions) are recognized.  I agree the two loops can be pulled out to a helper function if you think that would be helpful.","created_at":"2015-08-17T12:22:39Z","updated_at":"2015-08-17T12:22:39Z","html_url":"https://github.com/nltk/nltk/pull/967#discussion_r37181988","pull_request_url":"https://api.github.com/repos/nltk/nltk/pulls/967","_links":{"self":{"href":"https://api.github.com/repos/nltk/nltk/pulls/comments/37181988"},"html":{"href":"https://github.com/nltk/nltk/pull/967#discussion_r37181988"},"pull_request":{"href":"https://api.github.com/repos/nltk/nltk/pulls/967"}}},"pull_request":{"url":"https://api.github.com/repos/nltk/nltk/pulls/967","id":34283369,"html_url":"https://github.com/nltk/nltk/pull/967","diff_url":"https://github.com/nltk/nltk/pull/967.diff","patch_url":"https://github.com/nltk/nltk/pull/967.patch","issue_url":"https://api.github.com/repos/nltk/nltk/issues/967","number":967,"state":"open","locked":false,"title":"Modified sem/relextract.py extract_rels() to accept lists instead of strings, added 'NE' to NE_CLASSES","user":{"login":"helshowk","id":1168492,"avatar_url":"https://avatars.githubusercontent.com/u/1168492?v=3","gravatar_id":"","url":"https://api.github.com/users/helshowk","html_url":"https://github.com/helshowk","followers_url":"https://api.github.com/users/helshowk/followers","following_url":"https://api.github.com/users/helshowk/following{/other_user}","gists_url":"https://api.github.com/users/helshowk/gists{/gist_id}","starred_url":"https://api.github.com/users/helshowk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helshowk/subscriptions","organizations_url":"https://api.github.com/users/helshowk/orgs","repos_url":"https://api.github.com/users/helshowk/repos","events_url":"https://api.github.com/users/helshowk/events{/privacy}","received_events_url":"https://api.github.com/users/helshowk/received_events","type":"User","site_admin":false},"body":"Modified extract_rels() to accept lists instead of strings for subjclass and objclass and matches against all entity types in the lists.  Also included 'NE' in all NE_CLASSES values so that binary ne_chunk tree results can also be used.","created_at":"2015-04-28T16:09:30Z","updated_at":"2015-08-17T12:22:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c75652aaa1d3031e550135f0f22a0decf86d23dc","assignee":{"login":"ewan-klein","id":1103150,"avatar_url":"https://avatars.githubusercontent.com/u/1103150?v=3","gravatar_id":"","url":"https://api.github.com/users/ewan-klein","html_url":"https://github.com/ewan-klein","followers_url":"https://api.github.com/users/ewan-klein/followers","following_url":"https://api.github.com/users/ewan-klein/following{/other_user}","gists_url":"https://api.github.com/users/ewan-klein/gists{/gist_id}","starred_url":"https://api.github.com/users/ewan-klein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewan-klein/subscriptions","organizations_url":"https://api.github.com/users/ewan-klein/orgs","repos_url":"https://api.github.com/users/ewan-klein/repos","events_url":"https://api.github.com/users/ewan-klein/events{/privacy}","received_events_url":"https://api.github.com/users/ewan-klein/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/nltk/nltk/milestones/8","html_url":"https://github.com/nltk/nltk/milestones/3.0.5","labels_url":"https://api.github.com/repos/nltk/nltk/milestones/8/labels","id":1114552,"number":8,"title":"3.0.5","description":"","creator":{"login":"stevenbird","id":55406,"avatar_url":"https://avatars.githubusercontent.com/u/55406?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenbird","html_url":"https://github.com/stevenbird","followers_url":"https://api.github.com/users/stevenbird/followers","following_url":"https://api.github.com/users/stevenbird/following{/other_user}","gists_url":"https://api.github.com/users/stevenbird/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenbird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenbird/subscriptions","organizations_url":"https://api.github.com/users/stevenbird/orgs","repos_url":"https://api.github.com/users/stevenbird/repos","events_url":"https://api.github.com/users/stevenbird/events{/privacy}","received_events_url":"https://api.github.com/users/stevenbird/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":6,"state":"open","created_at":"2015-05-18T03:18:05Z","updated_at":"2015-08-15T04:14:41Z","due_on":"2015-08-14T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/nltk/nltk/pulls/967/commits","review_comments_url":"https://api.github.com/repos/nltk/nltk/pulls/967/comments","review_comment_url":"https://api.github.com/repos/nltk/nltk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nltk/nltk/issues/967/comments","statuses_url":"https://api.github.com/repos/nltk/nltk/statuses/12dcadf7e4bf1f0f375b0de77c898956a9ac7c71","head":{"label":"helshowk:develop","ref":"develop","sha":"12dcadf7e4bf1f0f375b0de77c898956a9ac7c71","user":{"login":"helshowk","id":1168492,"avatar_url":"https://avatars.githubusercontent.com/u/1168492?v=3","gravatar_id":"","url":"https://api.github.com/users/helshowk","html_url":"https://github.com/helshowk","followers_url":"https://api.github.com/users/helshowk/followers","following_url":"https://api.github.com/users/helshowk/following{/other_user}","gists_url":"https://api.github.com/users/helshowk/gists{/gist_id}","starred_url":"https://api.github.com/users/helshowk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helshowk/subscriptions","organizations_url":"https://api.github.com/users/helshowk/orgs","repos_url":"https://api.github.com/users/helshowk/repos","events_url":"https://api.github.com/users/helshowk/events{/privacy}","received_events_url":"https://api.github.com/users/helshowk/received_events","type":"User","site_admin":false},"repo":{"id":34739388,"name":"nltk","full_name":"helshowk/nltk","owner":{"login":"helshowk","id":1168492,"avatar_url":"https://avatars.githubusercontent.com/u/1168492?v=3","gravatar_id":"","url":"https://api.github.com/users/helshowk","html_url":"https://github.com/helshowk","followers_url":"https://api.github.com/users/helshowk/followers","following_url":"https://api.github.com/users/helshowk/following{/other_user}","gists_url":"https://api.github.com/users/helshowk/gists{/gist_id}","starred_url":"https://api.github.com/users/helshowk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helshowk/subscriptions","organizations_url":"https://api.github.com/users/helshowk/orgs","repos_url":"https://api.github.com/users/helshowk/repos","events_url":"https://api.github.com/users/helshowk/events{/privacy}","received_events_url":"https://api.github.com/users/helshowk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/helshowk/nltk","description":"NLTK Source","fork":true,"url":"https://api.github.com/repos/helshowk/nltk","forks_url":"https://api.github.com/repos/helshowk/nltk/forks","keys_url":"https://api.github.com/repos/helshowk/nltk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/helshowk/nltk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/helshowk/nltk/teams","hooks_url":"https://api.github.com/repos/helshowk/nltk/hooks","issue_events_url":"https://api.github.com/repos/helshowk/nltk/issues/events{/number}","events_url":"https://api.github.com/repos/helshowk/nltk/events","assignees_url":"https://api.github.com/repos/helshowk/nltk/assignees{/user}","branches_url":"https://api.github.com/repos/helshowk/nltk/branches{/branch}","tags_url":"https://api.github.com/repos/helshowk/nltk/tags","blobs_url":"https://api.github.com/repos/helshowk/nltk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/helshowk/nltk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/helshowk/nltk/git/refs{/sha}","trees_url":"https://api.github.com/repos/helshowk/nltk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/helshowk/nltk/statuses/{sha}","languages_url":"https://api.github.com/repos/helshowk/nltk/languages","stargazers_url":"https://api.github.com/repos/helshowk/nltk/stargazers","contributors_url":"https://api.github.com/repos/helshowk/nltk/contributors","subscribers_url":"https://api.github.com/repos/helshowk/nltk/subscribers","subscription_url":"https://api.github.com/repos/helshowk/nltk/subscription","commits_url":"https://api.github.com/repos/helshowk/nltk/commits{/sha}","git_commits_url":"https://api.github.com/repos/helshowk/nltk/git/commits{/sha}","comments_url":"https://api.github.com/repos/helshowk/nltk/comments{/number}","issue_comment_url":"https://api.github.com/repos/helshowk/nltk/issues/comments{/number}","contents_url":"https://api.github.com/repos/helshowk/nltk/contents/{+path}","compare_url":"https://api.github.com/repos/helshowk/nltk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/helshowk/nltk/merges","archive_url":"https://api.github.com/repos/helshowk/nltk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/helshowk/nltk/downloads","issues_url":"https://api.github.com/repos/helshowk/nltk/issues{/number}","pulls_url":"https://api.github.com/repos/helshowk/nltk/pulls{/number}","milestones_url":"https://api.github.com/repos/helshowk/nltk/milestones{/number}","notifications_url":"https://api.github.com/repos/helshowk/nltk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/helshowk/nltk/labels{/name}","releases_url":"https://api.github.com/repos/helshowk/nltk/releases{/id}","created_at":"2015-04-28T15:36:56Z","updated_at":"2015-04-28T16:03:06Z","pushed_at":"2015-04-28T16:03:06Z","git_url":"git://github.com/helshowk/nltk.git","ssh_url":"git@github.com:helshowk/nltk.git","clone_url":"https://github.com/helshowk/nltk.git","svn_url":"https://github.com/helshowk/nltk","homepage":"http://nltk.github.com/","size":71439,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"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":"develop"}},"base":{"label":"nltk:develop","ref":"develop","sha":"867000bd127ac34edd3102bcd461082ebb0d7364","user":{"login":"nltk","id":124114,"avatar_url":"https://avatars.githubusercontent.com/u/124114?v=3","gravatar_id":"","url":"https://api.github.com/users/nltk","html_url":"https://github.com/nltk","followers_url":"https://api.github.com/users/nltk/followers","following_url":"https://api.github.com/users/nltk/following{/other_user}","gists_url":"https://api.github.com/users/nltk/gists{/gist_id}","starred_url":"https://api.github.com/users/nltk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nltk/subscriptions","organizations_url":"https://api.github.com/users/nltk/orgs","repos_url":"https://api.github.com/users/nltk/repos","events_url":"https://api.github.com/users/nltk/events{/privacy}","received_events_url":"https://api.github.com/users/nltk/received_events","type":"Organization","site_admin":false},"repo":{"id":299862,"name":"nltk","full_name":"nltk/nltk","owner":{"login":"nltk","id":124114,"avatar_url":"https://avatars.githubusercontent.com/u/124114?v=3","gravatar_id":"","url":"https://api.github.com/users/nltk","html_url":"https://github.com/nltk","followers_url":"https://api.github.com/users/nltk/followers","following_url":"https://api.github.com/users/nltk/following{/other_user}","gists_url":"https://api.github.com/users/nltk/gists{/gist_id}","starred_url":"https://api.github.com/users/nltk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nltk/subscriptions","organizations_url":"https://api.github.com/users/nltk/orgs","repos_url":"https://api.github.com/users/nltk/repos","events_url":"https://api.github.com/users/nltk/events{/privacy}","received_events_url":"https://api.github.com/users/nltk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nltk/nltk","description":"NLTK Source","fork":false,"url":"https://api.github.com/repos/nltk/nltk","forks_url":"https://api.github.com/repos/nltk/nltk/forks","keys_url":"https://api.github.com/repos/nltk/nltk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nltk/nltk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nltk/nltk/teams","hooks_url":"https://api.github.com/repos/nltk/nltk/hooks","issue_events_url":"https://api.github.com/repos/nltk/nltk/issues/events{/number}","events_url":"https://api.github.com/repos/nltk/nltk/events","assignees_url":"https://api.github.com/repos/nltk/nltk/assignees{/user}","branches_url":"https://api.github.com/repos/nltk/nltk/branches{/branch}","tags_url":"https://api.github.com/repos/nltk/nltk/tags","blobs_url":"https://api.github.com/repos/nltk/nltk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nltk/nltk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nltk/nltk/git/refs{/sha}","trees_url":"https://api.github.com/repos/nltk/nltk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nltk/nltk/statuses/{sha}","languages_url":"https://api.github.com/repos/nltk/nltk/languages","stargazers_url":"https://api.github.com/repos/nltk/nltk/stargazers","contributors_url":"https://api.github.com/repos/nltk/nltk/contributors","subscribers_url":"https://api.github.com/repos/nltk/nltk/subscribers","subscription_url":"https://api.github.com/repos/nltk/nltk/subscription","commits_url":"https://api.github.com/repos/nltk/nltk/commits{/sha}","git_commits_url":"https://api.github.com/repos/nltk/nltk/git/commits{/sha}","comments_url":"https://api.github.com/repos/nltk/nltk/comments{/number}","issue_comment_url":"https://api.github.com/repos/nltk/nltk/issues/comments{/number}","contents_url":"https://api.github.com/repos/nltk/nltk/contents/{+path}","compare_url":"https://api.github.com/repos/nltk/nltk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nltk/nltk/merges","archive_url":"https://api.github.com/repos/nltk/nltk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nltk/nltk/downloads","issues_url":"https://api.github.com/repos/nltk/nltk/issues{/number}","pulls_url":"https://api.github.com/repos/nltk/nltk/pulls{/number}","milestones_url":"https://api.github.com/repos/nltk/nltk/milestones{/number}","notifications_url":"https://api.github.com/repos/nltk/nltk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nltk/nltk/labels{/name}","releases_url":"https://api.github.com/repos/nltk/nltk/releases{/id}","created_at":"2009-09-07T10:53:58Z","updated_at":"2015-08-17T06:30:50Z","pushed_at":"2015-08-17T05:56:38Z","git_url":"git://github.com/nltk/nltk.git","ssh_url":"git@github.com:nltk/nltk.git","clone_url":"https://github.com/nltk/nltk.git","svn_url":"https://github.com/nltk/nltk","homepage":"http://nltk.github.com/","size":377372,"stargazers_count":2477,"watchers_count":2477,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":740,"mirror_url":null,"open_issues_count":250,"forks":740,"open_issues":250,"watchers":2477,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/nltk/nltk/pulls/967"},"html":{"href":"https://github.com/nltk/nltk/pull/967"},"issue":{"href":"https://api.github.com/repos/nltk/nltk/issues/967"},"comments":{"href":"https://api.github.com/repos/nltk/nltk/issues/967/comments"},"review_comments":{"href":"https://api.github.com/repos/nltk/nltk/pulls/967/comments"},"review_comment":{"href":"https://api.github.com/repos/nltk/nltk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nltk/nltk/pulls/967/commits"},"statuses":{"href":"https://api.github.com/repos/nltk/nltk/statuses/12dcadf7e4bf1f0f375b0de77c898956a9ac7c71"}}}}