{"action":"created","comment":{"url":"https://api.github.com/repos/atlasapi/atlas/pulls/comments/76420748","id":76420748,"diff_hunk":"@@ -0,0 +1,97 @@\n+package org.atlasapi.equiv.scorers;\n+\n+import java.util.ArrayList;\n+import java.util.HashSet;\n+import java.util.LinkedList;\n+import java.util.List;\n+import java.util.Set;\n+import java.util.regex.Matcher;\n+import java.util.regex.Pattern;\n+\n+import org.atlasapi.equiv.results.description.ResultDescription;\n+import org.atlasapi.equiv.results.scores.DefaultScoredCandidates;\n+import org.atlasapi.equiv.results.scores.Score;\n+import org.atlasapi.equiv.results.scores.ScoredCandidates;\n+import org.atlasapi.media.entity.Item;\n+\n+import com.google.common.base.Strings;\n+import com.google.common.collect.ImmutableSet;\n+import com.google.common.collect.Sets;\n+\n+public class DescriptionMatchingScorer implements EquivalenceScorer<Item> {\n+\n+    public static final String NAME = \"Description Matching\";\n+    private final Set<String> commonWords = ImmutableSet.of(\n+            \"the\", \"in\", \"a\", \"and\", \"&\", \"of\", \"to\", \"show\"\n+    );\n+\n+    private DescriptionMatchingScorer() {\n+    }\n+\n+    public static DescriptionMatchingScorer makeScorer(){\n+        return new DescriptionMatchingScorer();\n+    }\n+\n+    @Override\n+    public ScoredCandidates<Item> score(Item subject, Set<? extends Item> candidates,\n+            ResultDescription desc) {\n+        DefaultScoredCandidates.Builder<Item> equivalents = DefaultScoredCandidates.fromSource(NAME);\n+\n+        for (Item candidate : candidates) {\n+            equivalents.addEquivalent(candidate, score(subject, candidate, desc));\n+        }\n+\n+        return equivalents.build();\n+    }\n+\n+    private Score score(Item subject, Item candidate, ResultDescription desc) {\n+        Score score = Score.nullScore();\n+\n+        score = score(subject, candidate);\n+        desc.appendText(\"%s (%s) scored: %s\", candidate.getTitle(), candidate.getCanonicalUri(), score);\n+\n+        return score;\n+    }\n+\n+    private Score score(Item subject, Item candidate) {\n+        return descriptionMatch(subject, candidate)? Score.ONE: Score.nullScore();\n+    }\n+\n+    private boolean descriptionMatch(Item subject, Item candidate) {\n+        List<String> candidateList = descriptionToProcessedList(candidate.getDescription());","path":"src/main/java/org/atlasapi/equiv/scorers/DescriptionMatchingScorer.java","position":61,"original_position":61,"commit_id":"dcfa86d1b2c05405d1b1cfc4cf4bd59a129ef1ac","original_commit_id":"dcfa86d1b2c05405d1b1cfc4cf4bd59a129ef1ac","user":{"login":"emilssolmanis","id":663720,"avatar_url":"https://avatars.githubusercontent.com/u/663720?v=3","gravatar_id":"","url":"https://api.github.com/users/emilssolmanis","html_url":"https://github.com/emilssolmanis","followers_url":"https://api.github.com/users/emilssolmanis/followers","following_url":"https://api.github.com/users/emilssolmanis/following{/other_user}","gists_url":"https://api.github.com/users/emilssolmanis/gists{/gist_id}","starred_url":"https://api.github.com/users/emilssolmanis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emilssolmanis/subscriptions","organizations_url":"https://api.github.com/users/emilssolmanis/orgs","repos_url":"https://api.github.com/users/emilssolmanis/repos","events_url":"https://api.github.com/users/emilssolmanis/events{/privacy}","received_events_url":"https://api.github.com/users/emilssolmanis/received_events","type":"User","site_admin":false},"body":"You have `List`s here, yet below `filterCommon` actually converts them to `Set`s and then back to a list. At this point, these all only have unique items and should therefore be `Set`s to match the semantics. For a `List` I'd expect these to be the tokenized descriptions **with tokens in order of appearance**, maybe minus the common words.","created_at":"2016-08-26T13:47:05Z","updated_at":"2016-08-26T13:47:05Z","html_url":"https://github.com/atlasapi/atlas/pull/1077#discussion_r76420748","pull_request_url":"https://api.github.com/repos/atlasapi/atlas/pulls/1077","_links":{"self":{"href":"https://api.github.com/repos/atlasapi/atlas/pulls/comments/76420748"},"html":{"href":"https://github.com/atlasapi/atlas/pull/1077#discussion_r76420748"},"pull_request":{"href":"https://api.github.com/repos/atlasapi/atlas/pulls/1077"}}},"pull_request":{"url":"https://api.github.com/repos/atlasapi/atlas/pulls/1077","id":82751937,"html_url":"https://github.com/atlasapi/atlas/pull/1077","diff_url":"https://github.com/atlasapi/atlas/pull/1077.diff","patch_url":"https://github.com/atlasapi/atlas/pull/1077.patch","issue_url":"https://api.github.com/repos/atlasapi/atlas/issues/1077","number":1077,"state":"open","locked":false,"title":"Feature/equiv title description scorer","user":{"login":"AdamDM","id":1735506,"avatar_url":"https://avatars.githubusercontent.com/u/1735506?v=3","gravatar_id":"","url":"https://api.github.com/users/AdamDM","html_url":"https://github.com/AdamDM","followers_url":"https://api.github.com/users/AdamDM/followers","following_url":"https://api.github.com/users/AdamDM/following{/other_user}","gists_url":"https://api.github.com/users/AdamDM/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamDM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamDM/subscriptions","organizations_url":"https://api.github.com/users/AdamDM/orgs","repos_url":"https://api.github.com/users/AdamDM/repos","events_url":"https://api.github.com/users/AdamDM/events{/privacy}","received_events_url":"https://api.github.com/users/AdamDM/received_events","type":"User","site_admin":false},"body":"added scorers for Levenshtein distance and description matching and implemented their use in EquivModule","created_at":"2016-08-25T16:29:12Z","updated_at":"2016-08-26T13:47:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78744adf0e526dcf4ef54919074e643647fc93fb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/atlasapi/atlas/pulls/1077/commits","review_comments_url":"https://api.github.com/repos/atlasapi/atlas/pulls/1077/comments","review_comment_url":"https://api.github.com/repos/atlasapi/atlas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/atlasapi/atlas/issues/1077/comments","statuses_url":"https://api.github.com/repos/atlasapi/atlas/statuses/dcfa86d1b2c05405d1b1cfc4cf4bd59a129ef1ac","head":{"label":"atlasapi:feature/equivTitleDescriptionScorer","ref":"feature/equivTitleDescriptionScorer","sha":"dcfa86d1b2c05405d1b1cfc4cf4bd59a129ef1ac","user":{"login":"atlasapi","id":325129,"avatar_url":"https://avatars.githubusercontent.com/u/325129?v=3","gravatar_id":"","url":"https://api.github.com/users/atlasapi","html_url":"https://github.com/atlasapi","followers_url":"https://api.github.com/users/atlasapi/followers","following_url":"https://api.github.com/users/atlasapi/following{/other_user}","gists_url":"https://api.github.com/users/atlasapi/gists{/gist_id}","starred_url":"https://api.github.com/users/atlasapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlasapi/subscriptions","organizations_url":"https://api.github.com/users/atlasapi/orgs","repos_url":"https://api.github.com/users/atlasapi/repos","events_url":"https://api.github.com/users/atlasapi/events{/privacy}","received_events_url":"https://api.github.com/users/atlasapi/received_events","type":"Organization","site_admin":false},"repo":{"id":762119,"name":"atlas","full_name":"atlasapi/atlas","owner":{"login":"atlasapi","id":325129,"avatar_url":"https://avatars.githubusercontent.com/u/325129?v=3","gravatar_id":"","url":"https://api.github.com/users/atlasapi","html_url":"https://github.com/atlasapi","followers_url":"https://api.github.com/users/atlasapi/followers","following_url":"https://api.github.com/users/atlasapi/following{/other_user}","gists_url":"https://api.github.com/users/atlasapi/gists{/gist_id}","starred_url":"https://api.github.com/users/atlasapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlasapi/subscriptions","organizations_url":"https://api.github.com/users/atlasapi/orgs","repos_url":"https://api.github.com/users/atlasapi/repos","events_url":"https://api.github.com/users/atlasapi/events{/privacy}","received_events_url":"https://api.github.com/users/atlasapi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atlasapi/atlas","description":"the global video & audio index","fork":false,"url":"https://api.github.com/repos/atlasapi/atlas","forks_url":"https://api.github.com/repos/atlasapi/atlas/forks","keys_url":"https://api.github.com/repos/atlasapi/atlas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atlasapi/atlas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atlasapi/atlas/teams","hooks_url":"https://api.github.com/repos/atlasapi/atlas/hooks","issue_events_url":"https://api.github.com/repos/atlasapi/atlas/issues/events{/number}","events_url":"https://api.github.com/repos/atlasapi/atlas/events","assignees_url":"https://api.github.com/repos/atlasapi/atlas/assignees{/user}","branches_url":"https://api.github.com/repos/atlasapi/atlas/branches{/branch}","tags_url":"https://api.github.com/repos/atlasapi/atlas/tags","blobs_url":"https://api.github.com/repos/atlasapi/atlas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atlasapi/atlas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atlasapi/atlas/git/refs{/sha}","trees_url":"https://api.github.com/repos/atlasapi/atlas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atlasapi/atlas/statuses/{sha}","languages_url":"https://api.github.com/repos/atlasapi/atlas/languages","stargazers_url":"https://api.github.com/repos/atlasapi/atlas/stargazers","contributors_url":"https://api.github.com/repos/atlasapi/atlas/contributors","subscribers_url":"https://api.github.com/repos/atlasapi/atlas/subscribers","subscription_url":"https://api.github.com/repos/atlasapi/atlas/subscription","commits_url":"https://api.github.com/repos/atlasapi/atlas/commits{/sha}","git_commits_url":"https://api.github.com/repos/atlasapi/atlas/git/commits{/sha}","comments_url":"https://api.github.com/repos/atlasapi/atlas/comments{/number}","issue_comment_url":"https://api.github.com/repos/atlasapi/atlas/issues/comments{/number}","contents_url":"https://api.github.com/repos/atlasapi/atlas/contents/{+path}","compare_url":"https://api.github.com/repos/atlasapi/atlas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atlasapi/atlas/merges","archive_url":"https://api.github.com/repos/atlasapi/atlas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atlasapi/atlas/downloads","issues_url":"https://api.github.com/repos/atlasapi/atlas/issues{/number}","pulls_url":"https://api.github.com/repos/atlasapi/atlas/pulls{/number}","milestones_url":"https://api.github.com/repos/atlasapi/atlas/milestones{/number}","notifications_url":"https://api.github.com/repos/atlasapi/atlas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atlasapi/atlas/labels{/name}","releases_url":"https://api.github.com/repos/atlasapi/atlas/releases{/id}","deployments_url":"https://api.github.com/repos/atlasapi/atlas/deployments","created_at":"2010-07-07T16:28:33Z","updated_at":"2016-06-18T02:14:42Z","pushed_at":"2016-08-25T16:29:12Z","git_url":"git://github.com/atlasapi/atlas.git","ssh_url":"git@github.com:atlasapi/atlas.git","clone_url":"https://github.com/atlasapi/atlas.git","svn_url":"https://github.com/atlasapi/atlas","homepage":"http://atlas.metabroadcast.com/","size":25679,"stargazers_count":31,"watchers_count":31,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":18,"forks":11,"open_issues":18,"watchers":31,"default_branch":"master"}},"base":{"label":"atlasapi:master","ref":"master","sha":"ec8f6f68bee494072c96934d193882582c7576c1","user":{"login":"atlasapi","id":325129,"avatar_url":"https://avatars.githubusercontent.com/u/325129?v=3","gravatar_id":"","url":"https://api.github.com/users/atlasapi","html_url":"https://github.com/atlasapi","followers_url":"https://api.github.com/users/atlasapi/followers","following_url":"https://api.github.com/users/atlasapi/following{/other_user}","gists_url":"https://api.github.com/users/atlasapi/gists{/gist_id}","starred_url":"https://api.github.com/users/atlasapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlasapi/subscriptions","organizations_url":"https://api.github.com/users/atlasapi/orgs","repos_url":"https://api.github.com/users/atlasapi/repos","events_url":"https://api.github.com/users/atlasapi/events{/privacy}","received_events_url":"https://api.github.com/users/atlasapi/received_events","type":"Organization","site_admin":false},"repo":{"id":762119,"name":"atlas","full_name":"atlasapi/atlas","owner":{"login":"atlasapi","id":325129,"avatar_url":"https://avatars.githubusercontent.com/u/325129?v=3","gravatar_id":"","url":"https://api.github.com/users/atlasapi","html_url":"https://github.com/atlasapi","followers_url":"https://api.github.com/users/atlasapi/followers","following_url":"https://api.github.com/users/atlasapi/following{/other_user}","gists_url":"https://api.github.com/users/atlasapi/gists{/gist_id}","starred_url":"https://api.github.com/users/atlasapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlasapi/subscriptions","organizations_url":"https://api.github.com/users/atlasapi/orgs","repos_url":"https://api.github.com/users/atlasapi/repos","events_url":"https://api.github.com/users/atlasapi/events{/privacy}","received_events_url":"https://api.github.com/users/atlasapi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atlasapi/atlas","description":"the global video & audio index","fork":false,"url":"https://api.github.com/repos/atlasapi/atlas","forks_url":"https://api.github.com/repos/atlasapi/atlas/forks","keys_url":"https://api.github.com/repos/atlasapi/atlas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atlasapi/atlas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atlasapi/atlas/teams","hooks_url":"https://api.github.com/repos/atlasapi/atlas/hooks","issue_events_url":"https://api.github.com/repos/atlasapi/atlas/issues/events{/number}","events_url":"https://api.github.com/repos/atlasapi/atlas/events","assignees_url":"https://api.github.com/repos/atlasapi/atlas/assignees{/user}","branches_url":"https://api.github.com/repos/atlasapi/atlas/branches{/branch}","tags_url":"https://api.github.com/repos/atlasapi/atlas/tags","blobs_url":"https://api.github.com/repos/atlasapi/atlas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atlasapi/atlas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atlasapi/atlas/git/refs{/sha}","trees_url":"https://api.github.com/repos/atlasapi/atlas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atlasapi/atlas/statuses/{sha}","languages_url":"https://api.github.com/repos/atlasapi/atlas/languages","stargazers_url":"https://api.github.com/repos/atlasapi/atlas/stargazers","contributors_url":"https://api.github.com/repos/atlasapi/atlas/contributors","subscribers_url":"https://api.github.com/repos/atlasapi/atlas/subscribers","subscription_url":"https://api.github.com/repos/atlasapi/atlas/subscription","commits_url":"https://api.github.com/repos/atlasapi/atlas/commits{/sha}","git_commits_url":"https://api.github.com/repos/atlasapi/atlas/git/commits{/sha}","comments_url":"https://api.github.com/repos/atlasapi/atlas/comments{/number}","issue_comment_url":"https://api.github.com/repos/atlasapi/atlas/issues/comments{/number}","contents_url":"https://api.github.com/repos/atlasapi/atlas/contents/{+path}","compare_url":"https://api.github.com/repos/atlasapi/atlas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atlasapi/atlas/merges","archive_url":"https://api.github.com/repos/atlasapi/atlas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atlasapi/atlas/downloads","issues_url":"https://api.github.com/repos/atlasapi/atlas/issues{/number}","pulls_url":"https://api.github.com/repos/atlasapi/atlas/pulls{/number}","milestones_url":"https://api.github.com/repos/atlasapi/atlas/milestones{/number}","notifications_url":"https://api.github.com/repos/atlasapi/atlas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atlasapi/atlas/labels{/name}","releases_url":"https://api.github.com/repos/atlasapi/atlas/releases{/id}","deployments_url":"https://api.github.com/repos/atlasapi/atlas/deployments","created_at":"2010-07-07T16:28:33Z","updated_at":"2016-06-18T02:14:42Z","pushed_at":"2016-08-25T16:29:12Z","git_url":"git://github.com/atlasapi/atlas.git","ssh_url":"git@github.com:atlasapi/atlas.git","clone_url":"https://github.com/atlasapi/atlas.git","svn_url":"https://github.com/atlasapi/atlas","homepage":"http://atlas.metabroadcast.com/","size":25679,"stargazers_count":31,"watchers_count":31,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":18,"forks":11,"open_issues":18,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/atlasapi/atlas/pulls/1077"},"html":{"href":"https://github.com/atlasapi/atlas/pull/1077"},"issue":{"href":"https://api.github.com/repos/atlasapi/atlas/issues/1077"},"comments":{"href":"https://api.github.com/repos/atlasapi/atlas/issues/1077/comments"},"review_comments":{"href":"https://api.github.com/repos/atlasapi/atlas/pulls/1077/comments"},"review_comment":{"href":"https://api.github.com/repos/atlasapi/atlas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/atlasapi/atlas/pulls/1077/commits"},"statuses":{"href":"https://api.github.com/repos/atlasapi/atlas/statuses/dcfa86d1b2c05405d1b1cfc4cf4bd59a129ef1ac"}}}}
{"actor":{"display_login":"emilssolmanis"}}