{"action":"created","comment":{"url":"https://api.github.com/repos/lintool/Anserini/pulls/comments/104908611","pull_request_review_id":25763324,"id":104908611,"diff_hunk":"@@ -0,0 +1,50 @@\n+package io.anserini.qa.passage;\n+\n+import io.anserini.index.IndexUtils;\n+import io.anserini.index.generator.LuceneDocumentGenerator;\n+import org.apache.lucene.analysis.CharArraySet;\n+import org.apache.lucene.analysis.en.EnglishAnalyzer;\n+import org.apache.lucene.index.DirectoryReader;\n+import org.apache.lucene.index.Term;\n+import org.apache.lucene.queryparser.classic.QueryParser;\n+import org.apache.lucene.search.TermQuery;\n+import org.apache.lucene.search.similarities.ClassicSimilarity;\n+import org.apache.lucene.store.FSDirectory;\n+\n+import java.io.File;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+\n+public class IdfPassageScorer implements PassageScorer{\n+\n+  @Override\n+  public void score(List<String> sentences, String index, String output, Context context) throws Exception {\n+    IndexUtils util = new IndexUtils(index);\n+    FSDirectory directory = FSDirectory.open(new File(index).toPath());\n+    DirectoryReader reader = DirectoryReader.open(directory);\n+\n+    EnglishAnalyzer ea = new EnglishAnalyzer(CharArraySet.EMPTY_SET);\n+    QueryParser qp = new QueryParser(LuceneDocumentGenerator.FIELD_BODY, ea);\n+\n+    Map<String, Double> sentenceIDF = new HashMap();\n+    ClassicSimilarity similarity = new ClassicSimilarity();\n+\n+    for (String sent: sentences) {\n+      double idf = 0.0;\n+      String[] terms = sent.split(\" \");","path":"src/main/java/io/anserini/qa/passage/IdfPassageScorer.java","position":35,"original_position":35,"commit_id":"a40308f9b1c21daeaa9bf8de05f8e56ee4ad7593","original_commit_id":"a40308f9b1c21daeaa9bf8de05f8e56ee4ad7593","user":{"login":"lintool","id":313837,"avatar_url":"https://avatars2.githubusercontent.com/u/313837?v=3","gravatar_id":"","url":"https://api.github.com/users/lintool","html_url":"https://github.com/lintool","followers_url":"https://api.github.com/users/lintool/followers","following_url":"https://api.github.com/users/lintool/following{/other_user}","gists_url":"https://api.github.com/users/lintool/gists{/gist_id}","starred_url":"https://api.github.com/users/lintool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lintool/subscriptions","organizations_url":"https://api.github.com/users/lintool/orgs","repos_url":"https://api.github.com/users/lintool/repos","events_url":"https://api.github.com/users/lintool/events{/privacy}","received_events_url":"https://api.github.com/users/lintool/received_events","type":"User","site_admin":false},"body":"Don't you want to tokenize the sentences also?","created_at":"2017-03-08T12:43:29Z","updated_at":"2017-03-08T12:43:29Z","html_url":"https://github.com/lintool/Anserini/pull/141#discussion_r104908611","pull_request_url":"https://api.github.com/repos/lintool/Anserini/pulls/141","_links":{"self":{"href":"https://api.github.com/repos/lintool/Anserini/pulls/comments/104908611"},"html":{"href":"https://github.com/lintool/Anserini/pull/141#discussion_r104908611"},"pull_request":{"href":"https://api.github.com/repos/lintool/Anserini/pulls/141"}}},"pull_request":{"url":"https://api.github.com/repos/lintool/Anserini/pulls/141","id":109603274,"html_url":"https://github.com/lintool/Anserini/pull/141","diff_url":"https://github.com/lintool/Anserini/pull/141.diff","patch_url":"https://github.com/lintool/Anserini/pull/141.patch","issue_url":"https://api.github.com/repos/lintool/Anserini/issues/141","number":141,"state":"open","locked":false,"title":"Baseline passage (sentence) retrieval: idf overlap #140","user":{"login":"rosequ","id":8274617,"avatar_url":"https://avatars0.githubusercontent.com/u/8274617?v=3","gravatar_id":"","url":"https://api.github.com/users/rosequ","html_url":"https://github.com/rosequ","followers_url":"https://api.github.com/users/rosequ/followers","following_url":"https://api.github.com/users/rosequ/following{/other_user}","gists_url":"https://api.github.com/users/rosequ/gists{/gist_id}","starred_url":"https://api.github.com/users/rosequ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosequ/subscriptions","organizations_url":"https://api.github.com/users/rosequ/orgs","repos_url":"https://api.github.com/users/rosequ/repos","events_url":"https://api.github.com/users/rosequ/events{/privacy}","received_events_url":"https://api.github.com/users/rosequ/received_events","type":"User","site_admin":false},"body":"Fixed #140. Please review.","created_at":"2017-03-08T00:30:48Z","updated_at":"2017-03-08T12:43:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ed5bbf91b39e673d5000dfac8251974d61f42812","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/lintool/Anserini/pulls/141/commits","review_comments_url":"https://api.github.com/repos/lintool/Anserini/pulls/141/comments","review_comment_url":"https://api.github.com/repos/lintool/Anserini/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lintool/Anserini/issues/141/comments","statuses_url":"https://api.github.com/repos/lintool/Anserini/statuses/a40308f9b1c21daeaa9bf8de05f8e56ee4ad7593","head":{"label":"rosequ:master","ref":"master","sha":"a40308f9b1c21daeaa9bf8de05f8e56ee4ad7593","user":{"login":"rosequ","id":8274617,"avatar_url":"https://avatars0.githubusercontent.com/u/8274617?v=3","gravatar_id":"","url":"https://api.github.com/users/rosequ","html_url":"https://github.com/rosequ","followers_url":"https://api.github.com/users/rosequ/followers","following_url":"https://api.github.com/users/rosequ/following{/other_user}","gists_url":"https://api.github.com/users/rosequ/gists{/gist_id}","starred_url":"https://api.github.com/users/rosequ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosequ/subscriptions","organizations_url":"https://api.github.com/users/rosequ/orgs","repos_url":"https://api.github.com/users/rosequ/repos","events_url":"https://api.github.com/users/rosequ/events{/privacy}","received_events_url":"https://api.github.com/users/rosequ/received_events","type":"User","site_admin":false},"repo":{"id":75952583,"name":"Anserini","full_name":"rosequ/Anserini","owner":{"login":"rosequ","id":8274617,"avatar_url":"https://avatars0.githubusercontent.com/u/8274617?v=3","gravatar_id":"","url":"https://api.github.com/users/rosequ","html_url":"https://github.com/rosequ","followers_url":"https://api.github.com/users/rosequ/followers","following_url":"https://api.github.com/users/rosequ/following{/other_user}","gists_url":"https://api.github.com/users/rosequ/gists{/gist_id}","starred_url":"https://api.github.com/users/rosequ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosequ/subscriptions","organizations_url":"https://api.github.com/users/rosequ/orgs","repos_url":"https://api.github.com/users/rosequ/repos","events_url":"https://api.github.com/users/rosequ/events{/privacy}","received_events_url":"https://api.github.com/users/rosequ/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rosequ/Anserini","description":"An information retrieval toolkit built on Lucene","fork":true,"url":"https://api.github.com/repos/rosequ/Anserini","forks_url":"https://api.github.com/repos/rosequ/Anserini/forks","keys_url":"https://api.github.com/repos/rosequ/Anserini/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rosequ/Anserini/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rosequ/Anserini/teams","hooks_url":"https://api.github.com/repos/rosequ/Anserini/hooks","issue_events_url":"https://api.github.com/repos/rosequ/Anserini/issues/events{/number}","events_url":"https://api.github.com/repos/rosequ/Anserini/events","assignees_url":"https://api.github.com/repos/rosequ/Anserini/assignees{/user}","branches_url":"https://api.github.com/repos/rosequ/Anserini/branches{/branch}","tags_url":"https://api.github.com/repos/rosequ/Anserini/tags","blobs_url":"https://api.github.com/repos/rosequ/Anserini/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rosequ/Anserini/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rosequ/Anserini/git/refs{/sha}","trees_url":"https://api.github.com/repos/rosequ/Anserini/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rosequ/Anserini/statuses/{sha}","languages_url":"https://api.github.com/repos/rosequ/Anserini/languages","stargazers_url":"https://api.github.com/repos/rosequ/Anserini/stargazers","contributors_url":"https://api.github.com/repos/rosequ/Anserini/contributors","subscribers_url":"https://api.github.com/repos/rosequ/Anserini/subscribers","subscription_url":"https://api.github.com/repos/rosequ/Anserini/subscription","commits_url":"https://api.github.com/repos/rosequ/Anserini/commits{/sha}","git_commits_url":"https://api.github.com/repos/rosequ/Anserini/git/commits{/sha}","comments_url":"https://api.github.com/repos/rosequ/Anserini/comments{/number}","issue_comment_url":"https://api.github.com/repos/rosequ/Anserini/issues/comments{/number}","contents_url":"https://api.github.com/repos/rosequ/Anserini/contents/{+path}","compare_url":"https://api.github.com/repos/rosequ/Anserini/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rosequ/Anserini/merges","archive_url":"https://api.github.com/repos/rosequ/Anserini/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rosequ/Anserini/downloads","issues_url":"https://api.github.com/repos/rosequ/Anserini/issues{/number}","pulls_url":"https://api.github.com/repos/rosequ/Anserini/pulls{/number}","milestones_url":"https://api.github.com/repos/rosequ/Anserini/milestones{/number}","notifications_url":"https://api.github.com/repos/rosequ/Anserini/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rosequ/Anserini/labels{/name}","releases_url":"https://api.github.com/repos/rosequ/Anserini/releases{/id}","deployments_url":"https://api.github.com/repos/rosequ/Anserini/deployments","created_at":"2016-12-08T15:56:16Z","updated_at":"2016-12-13T21:49:48Z","pushed_at":"2017-03-08T05:50:32Z","git_url":"git://github.com/rosequ/Anserini.git","ssh_url":"git@github.com:rosequ/Anserini.git","clone_url":"https://github.com/rosequ/Anserini.git","svn_url":"https://github.com/rosequ/Anserini","homepage":"","size":8117,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"lintool:master","ref":"master","sha":"e9d4053c6a0cf8d0fb6cd278ef6847c4f4d3f031","user":{"login":"lintool","id":313837,"avatar_url":"https://avatars2.githubusercontent.com/u/313837?v=3","gravatar_id":"","url":"https://api.github.com/users/lintool","html_url":"https://github.com/lintool","followers_url":"https://api.github.com/users/lintool/followers","following_url":"https://api.github.com/users/lintool/following{/other_user}","gists_url":"https://api.github.com/users/lintool/gists{/gist_id}","starred_url":"https://api.github.com/users/lintool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lintool/subscriptions","organizations_url":"https://api.github.com/users/lintool/orgs","repos_url":"https://api.github.com/users/lintool/repos","events_url":"https://api.github.com/users/lintool/events{/privacy}","received_events_url":"https://api.github.com/users/lintool/received_events","type":"User","site_admin":false},"repo":{"id":43719677,"name":"Anserini","full_name":"lintool/Anserini","owner":{"login":"lintool","id":313837,"avatar_url":"https://avatars2.githubusercontent.com/u/313837?v=3","gravatar_id":"","url":"https://api.github.com/users/lintool","html_url":"https://github.com/lintool","followers_url":"https://api.github.com/users/lintool/followers","following_url":"https://api.github.com/users/lintool/following{/other_user}","gists_url":"https://api.github.com/users/lintool/gists{/gist_id}","starred_url":"https://api.github.com/users/lintool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lintool/subscriptions","organizations_url":"https://api.github.com/users/lintool/orgs","repos_url":"https://api.github.com/users/lintool/repos","events_url":"https://api.github.com/users/lintool/events{/privacy}","received_events_url":"https://api.github.com/users/lintool/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lintool/Anserini","description":"An information retrieval toolkit built on Lucene","fork":false,"url":"https://api.github.com/repos/lintool/Anserini","forks_url":"https://api.github.com/repos/lintool/Anserini/forks","keys_url":"https://api.github.com/repos/lintool/Anserini/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lintool/Anserini/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lintool/Anserini/teams","hooks_url":"https://api.github.com/repos/lintool/Anserini/hooks","issue_events_url":"https://api.github.com/repos/lintool/Anserini/issues/events{/number}","events_url":"https://api.github.com/repos/lintool/Anserini/events","assignees_url":"https://api.github.com/repos/lintool/Anserini/assignees{/user}","branches_url":"https://api.github.com/repos/lintool/Anserini/branches{/branch}","tags_url":"https://api.github.com/repos/lintool/Anserini/tags","blobs_url":"https://api.github.com/repos/lintool/Anserini/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lintool/Anserini/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lintool/Anserini/git/refs{/sha}","trees_url":"https://api.github.com/repos/lintool/Anserini/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lintool/Anserini/statuses/{sha}","languages_url":"https://api.github.com/repos/lintool/Anserini/languages","stargazers_url":"https://api.github.com/repos/lintool/Anserini/stargazers","contributors_url":"https://api.github.com/repos/lintool/Anserini/contributors","subscribers_url":"https://api.github.com/repos/lintool/Anserini/subscribers","subscription_url":"https://api.github.com/repos/lintool/Anserini/subscription","commits_url":"https://api.github.com/repos/lintool/Anserini/commits{/sha}","git_commits_url":"https://api.github.com/repos/lintool/Anserini/git/commits{/sha}","comments_url":"https://api.github.com/repos/lintool/Anserini/comments{/number}","issue_comment_url":"https://api.github.com/repos/lintool/Anserini/issues/comments{/number}","contents_url":"https://api.github.com/repos/lintool/Anserini/contents/{+path}","compare_url":"https://api.github.com/repos/lintool/Anserini/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lintool/Anserini/merges","archive_url":"https://api.github.com/repos/lintool/Anserini/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lintool/Anserini/downloads","issues_url":"https://api.github.com/repos/lintool/Anserini/issues{/number}","pulls_url":"https://api.github.com/repos/lintool/Anserini/pulls{/number}","milestones_url":"https://api.github.com/repos/lintool/Anserini/milestones{/number}","notifications_url":"https://api.github.com/repos/lintool/Anserini/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lintool/Anserini/labels{/name}","releases_url":"https://api.github.com/repos/lintool/Anserini/releases{/id}","deployments_url":"https://api.github.com/repos/lintool/Anserini/deployments","created_at":"2015-10-05T23:27:54Z","updated_at":"2017-03-02T14:37:00Z","pushed_at":"2017-03-08T05:50:34Z","git_url":"git://github.com/lintool/Anserini.git","ssh_url":"git@github.com:lintool/Anserini.git","clone_url":"https://github.com/lintool/Anserini.git","svn_url":"https://github.com/lintool/Anserini","homepage":"","size":8092,"stargazers_count":18,"watchers_count":18,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":26,"forks":27,"open_issues":26,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lintool/Anserini/pulls/141"},"html":{"href":"https://github.com/lintool/Anserini/pull/141"},"issue":{"href":"https://api.github.com/repos/lintool/Anserini/issues/141"},"comments":{"href":"https://api.github.com/repos/lintool/Anserini/issues/141/comments"},"review_comments":{"href":"https://api.github.com/repos/lintool/Anserini/pulls/141/comments"},"review_comment":{"href":"https://api.github.com/repos/lintool/Anserini/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lintool/Anserini/pulls/141/commits"},"statuses":{"href":"https://api.github.com/repos/lintool/Anserini/statuses/a40308f9b1c21daeaa9bf8de05f8e56ee4ad7593"}}}}
{"actor":{"display_login":"lintool"}}