{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/price-wise/pulls/comments/235123339","pull_request_review_id":176912473,"id":235123339,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNTEyMzMzOQ==","diff_hunk":"@@ -32,8 +32,22 @@ const FEATURE_DEFAULTS = {\n const PRODUCT_FEATURES = {\n   image: {\n     ...FEATURE_DEFAULTS,\n+    /**\n+     * @return the URL of an image resource\n+     */\n     getValueFromElement(element) {\n-      return element.src;\n+      /**\n+       * Given a CSS url() declaration 'url(\"http://foo\")', return 'http://foo'.\n+       */\n+      function urlFromCssDeclaration(declaration) {\n+        return declaration.substring(5, declaration.length - 2);\n+      }\n+      if (element.tagName === 'IMG') {\n+        return element.src;\n+      }\n+      // The other thing the ruleset can return is an arbitrary element with\n+      // a CSS background image.\n+      return urlFromCssDeclaration(getComputedStyle(element)['background-image']);","path":"src/extraction/fathom/index.js","position":20,"original_position":20,"commit_id":"57ca2953ca3985621f8bbda5176370914112b543","original_commit_id":"57ca2953ca3985621f8bbda5176370914112b543","user":{"login":"Osmose","id":193106,"node_id":"MDQ6VXNlcjE5MzEwNg==","avatar_url":"https://avatars1.githubusercontent.com/u/193106?v=4","gravatar_id":"","url":"https://api.github.com/users/Osmose","html_url":"https://github.com/Osmose","followers_url":"https://api.github.com/users/Osmose/followers","following_url":"https://api.github.com/users/Osmose/following{/other_user}","gists_url":"https://api.github.com/users/Osmose/gists{/gist_id}","starred_url":"https://api.github.com/users/Osmose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Osmose/subscriptions","organizations_url":"https://api.github.com/users/Osmose/orgs","repos_url":"https://api.github.com/users/Osmose/repos","events_url":"https://api.github.com/users/Osmose/events{/privacy}","received_events_url":"https://api.github.com/users/Osmose/received_events","type":"User","site_admin":false},"body":"A bit of a nit, but I've always found that function declarations at the top break the flow of the function and make it harder to read. The function name helps the readability, but a variable can do just as well without interrupting the order:\r\n\r\n```js\r\nconst backgroundImage = getComputedStyle(element)['background-image'];\r\nreturn backgroundImage.substring(5, background.length - 2);\r\n```","created_at":"2018-11-20T18:41:27Z","updated_at":"2018-11-20T18:57:00Z","html_url":"https://github.com/mozilla/price-wise/pull/275#discussion_r235123339","pull_request_url":"https://api.github.com/repos/mozilla/price-wise/pulls/275","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mozilla/price-wise/pulls/comments/235123339"},"html":{"href":"https://github.com/mozilla/price-wise/pull/275#discussion_r235123339"},"pull_request":{"href":"https://api.github.com/repos/mozilla/price-wise/pulls/275"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/price-wise/pulls/275","id":231658401,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxNjU4NDAx","html_url":"https://github.com/mozilla/price-wise/pull/275","diff_url":"https://github.com/mozilla/price-wise/pull/275.diff","patch_url":"https://github.com/mozilla/price-wise/pull/275.patch","issue_url":"https://api.github.com/repos/mozilla/price-wise/issues/275","number":275,"state":"open","locked":false,"title":"92% price accuracy","user":{"login":"erikrose","id":295816,"node_id":"MDQ6VXNlcjI5NTgxNg==","avatar_url":"https://avatars3.githubusercontent.com/u/295816?v=4","gravatar_id":"","url":"https://api.github.com/users/erikrose","html_url":"https://github.com/erikrose","followers_url":"https://api.github.com/users/erikrose/followers","following_url":"https://api.github.com/users/erikrose/following{/other_user}","gists_url":"https://api.github.com/users/erikrose/gists{/gist_id}","starred_url":"https://api.github.com/users/erikrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikrose/subscriptions","organizations_url":"https://api.github.com/users/erikrose/orgs","repos_url":"https://api.github.com/users/erikrose/repos","events_url":"https://api.github.com/users/erikrose/events{/privacy}","received_events_url":"https://api.github.com/users/erikrose/received_events","type":"User","site_admin":false},"body":"As per this morning's email, this bumps the price accuracy up to 92% and the title to 100%, for a total of 8 percentage points improvement.\r\n```\r\nNew testing results (samples 26-75):\r\nEntity        Accuracy       95% Confidence Interval\r\n----------------------------------------------------\r\ntitle         100%           100.0 - 100%\r\nimage         100%           100.0 - 100%\r\nprice          92%            84.5 - 99.5%\r\n```\r\nIt's also tested on a corpus twice as big:\r\n```\r\nOld testing results:\r\nEntity        Accuracy       95% Confidence Interval\r\n----------------------------------------------------\r\nimage          96%            88.3 - 100%\r\ntitle         100%           100.0 - 100%\r\nprice          88%            75.3 - 100%\r\n```\r\n\r\nThough my goal was a price accuracy bump, my strategy was to attack image recognition first, since everything else hinges on that. And it worked out pretty well! I added rules to…\r\n\r\n* Consider images found as the background-image of divs\r\n* Punish images with extreme aspect ratios\r\n* Punish images with \"background\" in nearby IDs\r\n\r\nI also re-expressed (and sometimes rewrote) the rules to compute [0, 1] fuzzy-logic confidences, from which we might be able to draw overall confidences that a given page is a product one, toward making the menu enable and disable more intelligently.\r\n\r\nPlease excuse the weird metadata on the commits. These are painstakingly extracted from the fathom-trainees fork where I developed them and retconned into this repo to preserve as much history as I could. One consequence of all this cherry-picking is that I change some stuff in the first few commits to glue it into fathom-trainees the way I wanted it, and then I change it back in the last \"Put the glue code back\" commit. So maybe look at the last commit before picking nits with the first few. :-)\r\n\r\n~~Note that reality has suddenly shifted under my feet. I'd love for someone to softlink the trainees.js, coefficients.json, and ruleset_factory.js into this from a recent fork of fathom-trainees, as everything has started returning really low numbers on my machine in the past hour or so. I can't even repro my earlier training runs. I suspect (and hope) I broke something local to my machine.~~ I had mistranscribed a number. See ba89ed4fd54e27d113d5f08451710b7ffc5b34bc. That's why this is now 92% accurate instead of 90%.","created_at":"2018-11-16T21:19:48Z","updated_at":"2018-11-20T18:57:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4bd1aa7ebd334a98233ed0acfe84cbfb648ad357","assignee":null,"assignees":[],"requested_reviewers":[{"login":"biancadanforth","id":17437436,"node_id":"MDQ6VXNlcjE3NDM3NDM2","avatar_url":"https://avatars3.githubusercontent.com/u/17437436?v=4","gravatar_id":"","url":"https://api.github.com/users/biancadanforth","html_url":"https://github.com/biancadanforth","followers_url":"https://api.github.com/users/biancadanforth/followers","following_url":"https://api.github.com/users/biancadanforth/following{/other_user}","gists_url":"https://api.github.com/users/biancadanforth/gists{/gist_id}","starred_url":"https://api.github.com/users/biancadanforth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biancadanforth/subscriptions","organizations_url":"https://api.github.com/users/biancadanforth/orgs","repos_url":"https://api.github.com/users/biancadanforth/repos","events_url":"https://api.github.com/users/biancadanforth/events{/privacy}","received_events_url":"https://api.github.com/users/biancadanforth/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/price-wise/pulls/275/commits","review_comments_url":"https://api.github.com/repos/mozilla/price-wise/pulls/275/comments","review_comment_url":"https://api.github.com/repos/mozilla/price-wise/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/price-wise/issues/275/comments","statuses_url":"https://api.github.com/repos/mozilla/price-wise/statuses/57ca2953ca3985621f8bbda5176370914112b543","head":{"label":"erikrose:90%-price","ref":"90%-price","sha":"57ca2953ca3985621f8bbda5176370914112b543","user":{"login":"erikrose","id":295816,"node_id":"MDQ6VXNlcjI5NTgxNg==","avatar_url":"https://avatars3.githubusercontent.com/u/295816?v=4","gravatar_id":"","url":"https://api.github.com/users/erikrose","html_url":"https://github.com/erikrose","followers_url":"https://api.github.com/users/erikrose/followers","following_url":"https://api.github.com/users/erikrose/following{/other_user}","gists_url":"https://api.github.com/users/erikrose/gists{/gist_id}","starred_url":"https://api.github.com/users/erikrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikrose/subscriptions","organizations_url":"https://api.github.com/users/erikrose/orgs","repos_url":"https://api.github.com/users/erikrose/repos","events_url":"https://api.github.com/users/erikrose/events{/privacy}","received_events_url":"https://api.github.com/users/erikrose/received_events","type":"User","site_admin":false},"repo":{"id":157921795,"node_id":"MDEwOlJlcG9zaXRvcnkxNTc5MjE3OTU=","name":"price-wise","full_name":"erikrose/price-wise","private":false,"owner":{"login":"erikrose","id":295816,"node_id":"MDQ6VXNlcjI5NTgxNg==","avatar_url":"https://avatars3.githubusercontent.com/u/295816?v=4","gravatar_id":"","url":"https://api.github.com/users/erikrose","html_url":"https://github.com/erikrose","followers_url":"https://api.github.com/users/erikrose/followers","following_url":"https://api.github.com/users/erikrose/following{/other_user}","gists_url":"https://api.github.com/users/erikrose/gists{/gist_id}","starred_url":"https://api.github.com/users/erikrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikrose/subscriptions","organizations_url":"https://api.github.com/users/erikrose/orgs","repos_url":"https://api.github.com/users/erikrose/repos","events_url":"https://api.github.com/users/erikrose/events{/privacy}","received_events_url":"https://api.github.com/users/erikrose/received_events","type":"User","site_admin":false},"html_url":"https://github.com/erikrose/price-wise","description":"Price Wise is a Firefox extension that spots price drops on things you’re interested in.","fork":true,"url":"https://api.github.com/repos/erikrose/price-wise","forks_url":"https://api.github.com/repos/erikrose/price-wise/forks","keys_url":"https://api.github.com/repos/erikrose/price-wise/keys{/key_id}","collaborators_url":"https://api.github.com/repos/erikrose/price-wise/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/erikrose/price-wise/teams","hooks_url":"https://api.github.com/repos/erikrose/price-wise/hooks","issue_events_url":"https://api.github.com/repos/erikrose/price-wise/issues/events{/number}","events_url":"https://api.github.com/repos/erikrose/price-wise/events","assignees_url":"https://api.github.com/repos/erikrose/price-wise/assignees{/user}","branches_url":"https://api.github.com/repos/erikrose/price-wise/branches{/branch}","tags_url":"https://api.github.com/repos/erikrose/price-wise/tags","blobs_url":"https://api.github.com/repos/erikrose/price-wise/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/erikrose/price-wise/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/erikrose/price-wise/git/refs{/sha}","trees_url":"https://api.github.com/repos/erikrose/price-wise/git/trees{/sha}","statuses_url":"https://api.github.com/repos/erikrose/price-wise/statuses/{sha}","languages_url":"https://api.github.com/repos/erikrose/price-wise/languages","stargazers_url":"https://api.github.com/repos/erikrose/price-wise/stargazers","contributors_url":"https://api.github.com/repos/erikrose/price-wise/contributors","subscribers_url":"https://api.github.com/repos/erikrose/price-wise/subscribers","subscription_url":"https://api.github.com/repos/erikrose/price-wise/subscription","commits_url":"https://api.github.com/repos/erikrose/price-wise/commits{/sha}","git_commits_url":"https://api.github.com/repos/erikrose/price-wise/git/commits{/sha}","comments_url":"https://api.github.com/repos/erikrose/price-wise/comments{/number}","issue_comment_url":"https://api.github.com/repos/erikrose/price-wise/issues/comments{/number}","contents_url":"https://api.github.com/repos/erikrose/price-wise/contents/{+path}","compare_url":"https://api.github.com/repos/erikrose/price-wise/compare/{base}...{head}","merges_url":"https://api.github.com/repos/erikrose/price-wise/merges","archive_url":"https://api.github.com/repos/erikrose/price-wise/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/erikrose/price-wise/downloads","issues_url":"https://api.github.com/repos/erikrose/price-wise/issues{/number}","pulls_url":"https://api.github.com/repos/erikrose/price-wise/pulls{/number}","milestones_url":"https://api.github.com/repos/erikrose/price-wise/milestones{/number}","notifications_url":"https://api.github.com/repos/erikrose/price-wise/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/erikrose/price-wise/labels{/name}","releases_url":"https://api.github.com/repos/erikrose/price-wise/releases{/id}","deployments_url":"https://api.github.com/repos/erikrose/price-wise/deployments","created_at":"2018-11-16T21:11:55Z","updated_at":"2018-11-16T21:11:57Z","pushed_at":"2018-11-20T17:49:34Z","git_url":"git://github.com/erikrose/price-wise.git","ssh_url":"git@github.com:erikrose/price-wise.git","clone_url":"https://github.com/erikrose/price-wise.git","svn_url":"https://github.com/erikrose/price-wise","homepage":"https://testpilot.firefox.com/experiments/price-wise","size":736,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"c04cb829d981b6fa49a6935bf5b81f0704d3ac6f","user":{"login":"mozilla","id":131524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTUyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":138964230,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg5NjQyMzA=","name":"price-wise","full_name":"mozilla/price-wise","private":false,"owner":{"login":"mozilla","id":131524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTUyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mozilla/price-wise","description":"Price Wise is a Firefox extension that spots price drops on things you’re interested in.","fork":false,"url":"https://api.github.com/repos/mozilla/price-wise","forks_url":"https://api.github.com/repos/mozilla/price-wise/forks","keys_url":"https://api.github.com/repos/mozilla/price-wise/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/price-wise/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/price-wise/teams","hooks_url":"https://api.github.com/repos/mozilla/price-wise/hooks","issue_events_url":"https://api.github.com/repos/mozilla/price-wise/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/price-wise/events","assignees_url":"https://api.github.com/repos/mozilla/price-wise/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/price-wise/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/price-wise/tags","blobs_url":"https://api.github.com/repos/mozilla/price-wise/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/price-wise/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/price-wise/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/price-wise/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/price-wise/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/price-wise/languages","stargazers_url":"https://api.github.com/repos/mozilla/price-wise/stargazers","contributors_url":"https://api.github.com/repos/mozilla/price-wise/contributors","subscribers_url":"https://api.github.com/repos/mozilla/price-wise/subscribers","subscription_url":"https://api.github.com/repos/mozilla/price-wise/subscription","commits_url":"https://api.github.com/repos/mozilla/price-wise/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/price-wise/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/price-wise/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/price-wise/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/price-wise/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/price-wise/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/price-wise/merges","archive_url":"https://api.github.com/repos/mozilla/price-wise/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/price-wise/downloads","issues_url":"https://api.github.com/repos/mozilla/price-wise/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/price-wise/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/price-wise/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/price-wise/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/price-wise/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/price-wise/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/price-wise/deployments","created_at":"2018-06-28T03:59:25Z","updated_at":"2018-11-20T17:38:20Z","pushed_at":"2018-11-20T17:49:36Z","git_url":"git://github.com/mozilla/price-wise.git","ssh_url":"git@github.com:mozilla/price-wise.git","clone_url":"https://github.com/mozilla/price-wise.git","svn_url":"https://github.com/mozilla/price-wise","homepage":"https://testpilot.firefox.com/experiments/price-wise","size":710,"stargazers_count":16,"watchers_count":16,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":53,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":6,"open_issues":53,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/price-wise/pulls/275"},"html":{"href":"https://github.com/mozilla/price-wise/pull/275"},"issue":{"href":"https://api.github.com/repos/mozilla/price-wise/issues/275"},"comments":{"href":"https://api.github.com/repos/mozilla/price-wise/issues/275/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/price-wise/pulls/275/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/price-wise/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/price-wise/pulls/275/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/price-wise/statuses/57ca2953ca3985621f8bbda5176370914112b543"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"Osmose"}}