{"action":"created","comment":{"url":"https://api.github.com/repos/allenai/corvid/pulls/comments/177895055","pull_request_review_id":107856378,"id":177895055,"diff_hunk":"@@ -103,20 +82,140 @@ def _compute_cell_match(self,\n                                                       index_table2)]\n                                )\n \n+    def _compute_cell_similarity(self, cell1: Cell, cell2: Cell) -> float:\n+        \"\"\"\n+        Returns similarity between two cells;\n+        currently it tests for equality\n+        \"\"\"\n+        return float(str(cell1).strip().lower() == str(cell2).strip().lower())\n \n-class ColValueSchemaMatcher(SchemaMatcher):\n+\n+class ColNameSchemaMatcher(SchemaMatcher):\n \n     def map_tables(self, tables: List[Table], target_schema: Table) -> \\\n             List[PairwiseMapping]:\n         pairwise_mappings = []\n \n-        for idx1 in range(len(tables)):\n-            for idx2 in range(idx1+1, len(tables)):\n-                pairwise_mappings.append(\n-                    self._compute_cell_match(tables[idx1], tables[idx2]))\n+        for table in tables:\n+            pairwise_mappings.append(\n+                self._compute_cell_match_header(table, target_schema))\n \n         return pairwise_mappings\n \n+\n+class ColValueSchemaMatcher(SchemaMatcher):\n+\n+    def map_tables(self, tables: List[Table], target_schema: Table) -> \\\n+            List[PairwiseMapping]:\n+\n+        n = len(tables)\n+        adj_matrix_pairwise_mappings = [[]]\n+        adj_matrix_pairwise_mappings = [[0 for i in range(n)] for j in range(n)]\n+\n+        for idx1 in range(n):\n+            for idx2 in range(idx1 + 1, n):\n+                # check if its a schema table; calculate match by header if so\n+                adj_matrix_pairwise_mappings[idx1][idx2] = \\\n+                    self._compute_cell_match(\n+                        tables[idx1], tables[idx2])\n+\n+                # since matrix is symmetric we can copy to the other triangle too\n+                adj_matrix_pairwise_mappings[idx2][idx1] = \\\n+                    adj_matrix_pairwise_mappings[idx1][idx2]\n+\n+        adj_matrix_scores = np.zeros((n,n))\n+\n+        adj_matrix_scores = [\n+            [pairwise_mapping.score if isinstance(\n+                pairwise_mapping,PairwiseMapping) else 0\n+            for pairwise_mapping in row] for row in adj_matrix_pairwise_mappings]\n+        mst = minimum_spanning_tree(\n+            csr_matrix(adj_matrix_scores)).toarray().astype(int)\n+\n+        adj_matrix_col_maps = [\n+                    [pairwise_mapping.column_mappings\n+                        if mst[idx_r, idx_c] > 0 else None","path":"corvid/schema_matcher/schema_matcher.py","position":113,"original_position":113,"commit_id":"8e5dc31e90407a936dbd4d80d4372a261b9e7655","original_commit_id":"8e5dc31e90407a936dbd4d80d4372a261b9e7655","user":{"login":"kyleclo","id":13603748,"avatar_url":"https://avatars3.githubusercontent.com/u/13603748?v=4","gravatar_id":"","url":"https://api.github.com/users/kyleclo","html_url":"https://github.com/kyleclo","followers_url":"https://api.github.com/users/kyleclo/followers","following_url":"https://api.github.com/users/kyleclo/following{/other_user}","gists_url":"https://api.github.com/users/kyleclo/gists{/gist_id}","starred_url":"https://api.github.com/users/kyleclo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyleclo/subscriptions","organizations_url":"https://api.github.com/users/kyleclo/orgs","repos_url":"https://api.github.com/users/kyleclo/repos","events_url":"https://api.github.com/users/kyleclo/events{/privacy}","received_events_url":"https://api.github.com/users/kyleclo/received_events","type":"User","site_admin":false},"body":"why this reliance on `>0`?  why should this matter at all","created_at":"2018-03-28T21:24:46Z","updated_at":"2018-03-28T21:24:46Z","html_url":"https://github.com/allenai/corvid/pull/16#discussion_r177895055","pull_request_url":"https://api.github.com/repos/allenai/corvid/pulls/16","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/allenai/corvid/pulls/comments/177895055"},"html":{"href":"https://github.com/allenai/corvid/pull/16#discussion_r177895055"},"pull_request":{"href":"https://api.github.com/repos/allenai/corvid/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/allenai/corvid/pulls/16","id":177965928,"html_url":"https://github.com/allenai/corvid/pull/16","diff_url":"https://github.com/allenai/corvid/pull/16.diff","patch_url":"https://github.com/allenai/corvid/pull/16.patch","issue_url":"https://api.github.com/repos/allenai/corvid/issues/16","number":16,"state":"open","locked":false,"title":"Column Value Matcher Baseline","user":{"login":"cmkumar87","id":1673676,"avatar_url":"https://avatars0.githubusercontent.com/u/1673676?v=4","gravatar_id":"","url":"https://api.github.com/users/cmkumar87","html_url":"https://github.com/cmkumar87","followers_url":"https://api.github.com/users/cmkumar87/followers","following_url":"https://api.github.com/users/cmkumar87/following{/other_user}","gists_url":"https://api.github.com/users/cmkumar87/gists{/gist_id}","starred_url":"https://api.github.com/users/cmkumar87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmkumar87/subscriptions","organizations_url":"https://api.github.com/users/cmkumar87/orgs","repos_url":"https://api.github.com/users/cmkumar87/repos","events_url":"https://api.github.com/users/cmkumar87/events{/privacy}","received_events_url":"https://api.github.com/users/cmkumar87/received_events","type":"User","site_admin":false},"body":"- Implements column value matcher\r\n- Code to find optimized acyclic merge tree using minimum spanning tree method\r\n- Code to merge target schema to the minimum spanning tree\r\n- Aggregate table method no longer sorts. It simply copies rows over to the from source tables to a final aggregate table\r\n- Tests for map table\r\n","created_at":"2018-03-28T08:38:16Z","updated_at":"2018-03-28T21:24:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[{"login":"wammar","id":1858803,"avatar_url":"https://avatars2.githubusercontent.com/u/1858803?v=4","gravatar_id":"","url":"https://api.github.com/users/wammar","html_url":"https://github.com/wammar","followers_url":"https://api.github.com/users/wammar/followers","following_url":"https://api.github.com/users/wammar/following{/other_user}","gists_url":"https://api.github.com/users/wammar/gists{/gist_id}","starred_url":"https://api.github.com/users/wammar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wammar/subscriptions","organizations_url":"https://api.github.com/users/wammar/orgs","repos_url":"https://api.github.com/users/wammar/repos","events_url":"https://api.github.com/users/wammar/events{/privacy}","received_events_url":"https://api.github.com/users/wammar/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/allenai/corvid/pulls/16/commits","review_comments_url":"https://api.github.com/repos/allenai/corvid/pulls/16/comments","review_comment_url":"https://api.github.com/repos/allenai/corvid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/allenai/corvid/issues/16/comments","statuses_url":"https://api.github.com/repos/allenai/corvid/statuses/8e5dc31e90407a936dbd4d80d4372a261b9e7655","head":{"label":"allenai:muthu/colval_baseline","ref":"muthu/colval_baseline","sha":"8e5dc31e90407a936dbd4d80d4372a261b9e7655","user":{"login":"allenai","id":5667695,"avatar_url":"https://avatars3.githubusercontent.com/u/5667695?v=4","gravatar_id":"","url":"https://api.github.com/users/allenai","html_url":"https://github.com/allenai","followers_url":"https://api.github.com/users/allenai/followers","following_url":"https://api.github.com/users/allenai/following{/other_user}","gists_url":"https://api.github.com/users/allenai/gists{/gist_id}","starred_url":"https://api.github.com/users/allenai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenai/subscriptions","organizations_url":"https://api.github.com/users/allenai/orgs","repos_url":"https://api.github.com/users/allenai/repos","events_url":"https://api.github.com/users/allenai/events{/privacy}","received_events_url":"https://api.github.com/users/allenai/received_events","type":"Organization","site_admin":false},"repo":{"id":110862336,"name":"corvid","full_name":"allenai/corvid","owner":{"login":"allenai","id":5667695,"avatar_url":"https://avatars3.githubusercontent.com/u/5667695?v=4","gravatar_id":"","url":"https://api.github.com/users/allenai","html_url":"https://github.com/allenai","followers_url":"https://api.github.com/users/allenai/followers","following_url":"https://api.github.com/users/allenai/following{/other_user}","gists_url":"https://api.github.com/users/allenai/gists{/gist_id}","starred_url":"https://api.github.com/users/allenai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenai/subscriptions","organizations_url":"https://api.github.com/users/allenai/orgs","repos_url":"https://api.github.com/users/allenai/repos","events_url":"https://api.github.com/users/allenai/events{/privacy}","received_events_url":"https://api.github.com/users/allenai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allenai/corvid","description":"Extract and aggregate tables of empirical results from computer science papers","fork":false,"url":"https://api.github.com/repos/allenai/corvid","forks_url":"https://api.github.com/repos/allenai/corvid/forks","keys_url":"https://api.github.com/repos/allenai/corvid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allenai/corvid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allenai/corvid/teams","hooks_url":"https://api.github.com/repos/allenai/corvid/hooks","issue_events_url":"https://api.github.com/repos/allenai/corvid/issues/events{/number}","events_url":"https://api.github.com/repos/allenai/corvid/events","assignees_url":"https://api.github.com/repos/allenai/corvid/assignees{/user}","branches_url":"https://api.github.com/repos/allenai/corvid/branches{/branch}","tags_url":"https://api.github.com/repos/allenai/corvid/tags","blobs_url":"https://api.github.com/repos/allenai/corvid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allenai/corvid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allenai/corvid/git/refs{/sha}","trees_url":"https://api.github.com/repos/allenai/corvid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allenai/corvid/statuses/{sha}","languages_url":"https://api.github.com/repos/allenai/corvid/languages","stargazers_url":"https://api.github.com/repos/allenai/corvid/stargazers","contributors_url":"https://api.github.com/repos/allenai/corvid/contributors","subscribers_url":"https://api.github.com/repos/allenai/corvid/subscribers","subscription_url":"https://api.github.com/repos/allenai/corvid/subscription","commits_url":"https://api.github.com/repos/allenai/corvid/commits{/sha}","git_commits_url":"https://api.github.com/repos/allenai/corvid/git/commits{/sha}","comments_url":"https://api.github.com/repos/allenai/corvid/comments{/number}","issue_comment_url":"https://api.github.com/repos/allenai/corvid/issues/comments{/number}","contents_url":"https://api.github.com/repos/allenai/corvid/contents/{+path}","compare_url":"https://api.github.com/repos/allenai/corvid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allenai/corvid/merges","archive_url":"https://api.github.com/repos/allenai/corvid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allenai/corvid/downloads","issues_url":"https://api.github.com/repos/allenai/corvid/issues{/number}","pulls_url":"https://api.github.com/repos/allenai/corvid/pulls{/number}","milestones_url":"https://api.github.com/repos/allenai/corvid/milestones{/number}","notifications_url":"https://api.github.com/repos/allenai/corvid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allenai/corvid/labels{/name}","releases_url":"https://api.github.com/repos/allenai/corvid/releases{/id}","deployments_url":"https://api.github.com/repos/allenai/corvid/deployments","created_at":"2017-11-15T17:04:43Z","updated_at":"2018-03-27T07:57:32Z","pushed_at":"2018-03-28T20:57:09Z","git_url":"git://github.com/allenai/corvid.git","ssh_url":"git@github.com:allenai/corvid.git","clone_url":"https://github.com/allenai/corvid.git","svn_url":"https://github.com/allenai/corvid","homepage":"","size":13071,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":3,"watchers":4,"default_branch":"master"}},"base":{"label":"allenai:master","ref":"master","sha":"bd2b7287f6cffe371cf5017f865de61d839c244d","user":{"login":"allenai","id":5667695,"avatar_url":"https://avatars3.githubusercontent.com/u/5667695?v=4","gravatar_id":"","url":"https://api.github.com/users/allenai","html_url":"https://github.com/allenai","followers_url":"https://api.github.com/users/allenai/followers","following_url":"https://api.github.com/users/allenai/following{/other_user}","gists_url":"https://api.github.com/users/allenai/gists{/gist_id}","starred_url":"https://api.github.com/users/allenai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenai/subscriptions","organizations_url":"https://api.github.com/users/allenai/orgs","repos_url":"https://api.github.com/users/allenai/repos","events_url":"https://api.github.com/users/allenai/events{/privacy}","received_events_url":"https://api.github.com/users/allenai/received_events","type":"Organization","site_admin":false},"repo":{"id":110862336,"name":"corvid","full_name":"allenai/corvid","owner":{"login":"allenai","id":5667695,"avatar_url":"https://avatars3.githubusercontent.com/u/5667695?v=4","gravatar_id":"","url":"https://api.github.com/users/allenai","html_url":"https://github.com/allenai","followers_url":"https://api.github.com/users/allenai/followers","following_url":"https://api.github.com/users/allenai/following{/other_user}","gists_url":"https://api.github.com/users/allenai/gists{/gist_id}","starred_url":"https://api.github.com/users/allenai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenai/subscriptions","organizations_url":"https://api.github.com/users/allenai/orgs","repos_url":"https://api.github.com/users/allenai/repos","events_url":"https://api.github.com/users/allenai/events{/privacy}","received_events_url":"https://api.github.com/users/allenai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allenai/corvid","description":"Extract and aggregate tables of empirical results from computer science papers","fork":false,"url":"https://api.github.com/repos/allenai/corvid","forks_url":"https://api.github.com/repos/allenai/corvid/forks","keys_url":"https://api.github.com/repos/allenai/corvid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allenai/corvid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allenai/corvid/teams","hooks_url":"https://api.github.com/repos/allenai/corvid/hooks","issue_events_url":"https://api.github.com/repos/allenai/corvid/issues/events{/number}","events_url":"https://api.github.com/repos/allenai/corvid/events","assignees_url":"https://api.github.com/repos/allenai/corvid/assignees{/user}","branches_url":"https://api.github.com/repos/allenai/corvid/branches{/branch}","tags_url":"https://api.github.com/repos/allenai/corvid/tags","blobs_url":"https://api.github.com/repos/allenai/corvid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allenai/corvid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allenai/corvid/git/refs{/sha}","trees_url":"https://api.github.com/repos/allenai/corvid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allenai/corvid/statuses/{sha}","languages_url":"https://api.github.com/repos/allenai/corvid/languages","stargazers_url":"https://api.github.com/repos/allenai/corvid/stargazers","contributors_url":"https://api.github.com/repos/allenai/corvid/contributors","subscribers_url":"https://api.github.com/repos/allenai/corvid/subscribers","subscription_url":"https://api.github.com/repos/allenai/corvid/subscription","commits_url":"https://api.github.com/repos/allenai/corvid/commits{/sha}","git_commits_url":"https://api.github.com/repos/allenai/corvid/git/commits{/sha}","comments_url":"https://api.github.com/repos/allenai/corvid/comments{/number}","issue_comment_url":"https://api.github.com/repos/allenai/corvid/issues/comments{/number}","contents_url":"https://api.github.com/repos/allenai/corvid/contents/{+path}","compare_url":"https://api.github.com/repos/allenai/corvid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allenai/corvid/merges","archive_url":"https://api.github.com/repos/allenai/corvid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allenai/corvid/downloads","issues_url":"https://api.github.com/repos/allenai/corvid/issues{/number}","pulls_url":"https://api.github.com/repos/allenai/corvid/pulls{/number}","milestones_url":"https://api.github.com/repos/allenai/corvid/milestones{/number}","notifications_url":"https://api.github.com/repos/allenai/corvid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allenai/corvid/labels{/name}","releases_url":"https://api.github.com/repos/allenai/corvid/releases{/id}","deployments_url":"https://api.github.com/repos/allenai/corvid/deployments","created_at":"2017-11-15T17:04:43Z","updated_at":"2018-03-27T07:57:32Z","pushed_at":"2018-03-28T20:57:09Z","git_url":"git://github.com/allenai/corvid.git","ssh_url":"git@github.com:allenai/corvid.git","clone_url":"https://github.com/allenai/corvid.git","svn_url":"https://github.com/allenai/corvid","homepage":"","size":13071,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":3,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/allenai/corvid/pulls/16"},"html":{"href":"https://github.com/allenai/corvid/pull/16"},"issue":{"href":"https://api.github.com/repos/allenai/corvid/issues/16"},"comments":{"href":"https://api.github.com/repos/allenai/corvid/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/allenai/corvid/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/allenai/corvid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/allenai/corvid/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/allenai/corvid/statuses/8e5dc31e90407a936dbd4d80d4372a261b9e7655"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"kyleclo"}}