{"action":"created","comment":{"url":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/comments/31499717","id":31499717,"diff_hunk":"@@ -108,34 +119,26 @@ Analyzer.prototype.keywordDensity = function() {\n  * @returns {number}\n  */\n Analyzer.prototype.keywordDensityCheck = function(){\n-    var keywordMatches = yst_stringHelper.matchString(yst_preProcessor.__store.cleanText,[this.config.keyword]);\n+    var keywordCount = this.keywordCount();\n     var keywordDensity = 0;\n-    if ( keywordMatches !== null ) {\n-        var keywordCount = keywordMatches.length;\n-        keywordDensity = (keywordCount / yst_preProcessor.__store.wordcount - (keywordCount - 1 * keywordCount)) * 100;\n+    if ( keywordCount !== 0 ) {\n+        keywordDensity = (keywordCount / this.preProcessor.__store.wordcount - (keywordCount - 1 * keywordCount)) * 100;\n     }\n     return keywordDensity;\n };\n \n /**\n- * rates the keyword density against given number\n- * @param keywordDensity\n- * @returns {number}\n+ * counts the number of keyword occurrences of the keyword. Saves this in the __store and returns it.\n+ * @returns {*}\n  */\n-Analyzer.prototype.keywordDensityRating = function(keywordDensity){\n-    var rating;\n-    switch (true) {\n-        case (keywordDensity < 1):\n-            rating =  4;\n-            break;\n-        case (keywordDensity > 4.5):\n-            rating = -50;\n-            break;\n-        default:\n-            rating = 9;\n-            break;\n+Analyzer.prototype.keywordCount = function(){","path":"js/analyzer.js","position":133,"original_position":133,"commit_id":"80f59cb1914ca66371033d1a8ff224bb38c24e36","original_commit_id":"80f59cb1914ca66371033d1a8ff224bb38c24e36","user":{"login":"andizer","id":325040,"avatar_url":"https://avatars.githubusercontent.com/u/325040?v=3","gravatar_id":"","url":"https://api.github.com/users/andizer","html_url":"https://github.com/andizer","followers_url":"https://api.github.com/users/andizer/followers","following_url":"https://api.github.com/users/andizer/following{/other_user}","gists_url":"https://api.github.com/users/andizer/gists{/gist_id}","starred_url":"https://api.github.com/users/andizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andizer/subscriptions","organizations_url":"https://api.github.com/users/andizer/orgs","repos_url":"https://api.github.com/users/andizer/repos","events_url":"https://api.github.com/users/andizer/events{/privacy}","received_events_url":"https://api.github.com/users/andizer/received_events","type":"User","site_admin":false},"body":"Space before `{` ?","created_at":"2015-06-02T07:59:49Z","updated_at":"2015-06-02T07:59:49Z","html_url":"https://github.com/Yoast/js-text-analysis/pull/27#discussion_r31499717","pull_request_url":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/comments/31499717"},"html":{"href":"https://github.com/Yoast/js-text-analysis/pull/27#discussion_r31499717"},"pull_request":{"href":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/27","id":36622734,"html_url":"https://github.com/Yoast/js-text-analysis/pull/27","diff_url":"https://github.com/Yoast/js-text-analysis/pull/27.diff","patch_url":"https://github.com/Yoast/js-text-analysis/pull/27.patch","issue_url":"https://api.github.com/repos/Yoast/js-text-analysis/issues/27","number":27,"state":"open","locked":false,"title":"scoring function for the analyzer","user":{"login":"terw-dan","id":11272096,"avatar_url":"https://avatars.githubusercontent.com/u/11272096?v=3","gravatar_id":"","url":"https://api.github.com/users/terw-dan","html_url":"https://github.com/terw-dan","followers_url":"https://api.github.com/users/terw-dan/followers","following_url":"https://api.github.com/users/terw-dan/following{/other_user}","gists_url":"https://api.github.com/users/terw-dan/gists{/gist_id}","starred_url":"https://api.github.com/users/terw-dan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terw-dan/subscriptions","organizations_url":"https://api.github.com/users/terw-dan/orgs","repos_url":"https://api.github.com/users/terw-dan/repos","events_url":"https://api.github.com/users/terw-dan/events{/privacy}","received_events_url":"https://api.github.com/users/terw-dan/received_events","type":"User","site_admin":false},"body":"creates a score output based on the scoring config and the results from the analyzer.","created_at":"2015-06-01T12:13:48Z","updated_at":"2015-06-02T07:59:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eec5073f260ad5fbe2d80b06d30ac336793540cc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/27/commits","review_comments_url":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/27/comments","review_comment_url":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Yoast/js-text-analysis/issues/27/comments","statuses_url":"https://api.github.com/repos/Yoast/js-text-analysis/statuses/80f59cb1914ca66371033d1a8ff224bb38c24e36","head":{"label":"Yoast:stories/DT/scoringprototype-#25","ref":"stories/DT/scoringprototype-#25","sha":"80f59cb1914ca66371033d1a8ff224bb38c24e36","user":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars.githubusercontent.com/u/4690436?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"repo":{"id":32734884,"name":"js-text-analysis","full_name":"Yoast/js-text-analysis","owner":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars.githubusercontent.com/u/4690436?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yoast/js-text-analysis","description":"Project bringing the Yoast text analysis functionality to the client side","fork":false,"url":"https://api.github.com/repos/Yoast/js-text-analysis","forks_url":"https://api.github.com/repos/Yoast/js-text-analysis/forks","keys_url":"https://api.github.com/repos/Yoast/js-text-analysis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yoast/js-text-analysis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yoast/js-text-analysis/teams","hooks_url":"https://api.github.com/repos/Yoast/js-text-analysis/hooks","issue_events_url":"https://api.github.com/repos/Yoast/js-text-analysis/issues/events{/number}","events_url":"https://api.github.com/repos/Yoast/js-text-analysis/events","assignees_url":"https://api.github.com/repos/Yoast/js-text-analysis/assignees{/user}","branches_url":"https://api.github.com/repos/Yoast/js-text-analysis/branches{/branch}","tags_url":"https://api.github.com/repos/Yoast/js-text-analysis/tags","blobs_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yoast/js-text-analysis/statuses/{sha}","languages_url":"https://api.github.com/repos/Yoast/js-text-analysis/languages","stargazers_url":"https://api.github.com/repos/Yoast/js-text-analysis/stargazers","contributors_url":"https://api.github.com/repos/Yoast/js-text-analysis/contributors","subscribers_url":"https://api.github.com/repos/Yoast/js-text-analysis/subscribers","subscription_url":"https://api.github.com/repos/Yoast/js-text-analysis/subscription","commits_url":"https://api.github.com/repos/Yoast/js-text-analysis/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yoast/js-text-analysis/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yoast/js-text-analysis/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yoast/js-text-analysis/contents/{+path}","compare_url":"https://api.github.com/repos/Yoast/js-text-analysis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yoast/js-text-analysis/merges","archive_url":"https://api.github.com/repos/Yoast/js-text-analysis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yoast/js-text-analysis/downloads","issues_url":"https://api.github.com/repos/Yoast/js-text-analysis/issues{/number}","pulls_url":"https://api.github.com/repos/Yoast/js-text-analysis/pulls{/number}","milestones_url":"https://api.github.com/repos/Yoast/js-text-analysis/milestones{/number}","notifications_url":"https://api.github.com/repos/Yoast/js-text-analysis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yoast/js-text-analysis/labels{/name}","releases_url":"https://api.github.com/repos/Yoast/js-text-analysis/releases{/id}","created_at":"2015-03-23T13:50:16Z","updated_at":"2015-05-15T01:13:40Z","pushed_at":"2015-06-01T12:20:39Z","git_url":"git://github.com/Yoast/js-text-analysis.git","ssh_url":"git@github.com:Yoast/js-text-analysis.git","clone_url":"https://github.com/Yoast/js-text-analysis.git","svn_url":"https://github.com/Yoast/js-text-analysis","homepage":"","size":564,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":5,"default_branch":"master"}},"base":{"label":"Yoast:master","ref":"master","sha":"51f977520906b6141dc56e16b8976107c2f8d9a3","user":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars.githubusercontent.com/u/4690436?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"repo":{"id":32734884,"name":"js-text-analysis","full_name":"Yoast/js-text-analysis","owner":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars.githubusercontent.com/u/4690436?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yoast/js-text-analysis","description":"Project bringing the Yoast text analysis functionality to the client side","fork":false,"url":"https://api.github.com/repos/Yoast/js-text-analysis","forks_url":"https://api.github.com/repos/Yoast/js-text-analysis/forks","keys_url":"https://api.github.com/repos/Yoast/js-text-analysis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yoast/js-text-analysis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yoast/js-text-analysis/teams","hooks_url":"https://api.github.com/repos/Yoast/js-text-analysis/hooks","issue_events_url":"https://api.github.com/repos/Yoast/js-text-analysis/issues/events{/number}","events_url":"https://api.github.com/repos/Yoast/js-text-analysis/events","assignees_url":"https://api.github.com/repos/Yoast/js-text-analysis/assignees{/user}","branches_url":"https://api.github.com/repos/Yoast/js-text-analysis/branches{/branch}","tags_url":"https://api.github.com/repos/Yoast/js-text-analysis/tags","blobs_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yoast/js-text-analysis/statuses/{sha}","languages_url":"https://api.github.com/repos/Yoast/js-text-analysis/languages","stargazers_url":"https://api.github.com/repos/Yoast/js-text-analysis/stargazers","contributors_url":"https://api.github.com/repos/Yoast/js-text-analysis/contributors","subscribers_url":"https://api.github.com/repos/Yoast/js-text-analysis/subscribers","subscription_url":"https://api.github.com/repos/Yoast/js-text-analysis/subscription","commits_url":"https://api.github.com/repos/Yoast/js-text-analysis/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yoast/js-text-analysis/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yoast/js-text-analysis/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yoast/js-text-analysis/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yoast/js-text-analysis/contents/{+path}","compare_url":"https://api.github.com/repos/Yoast/js-text-analysis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yoast/js-text-analysis/merges","archive_url":"https://api.github.com/repos/Yoast/js-text-analysis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yoast/js-text-analysis/downloads","issues_url":"https://api.github.com/repos/Yoast/js-text-analysis/issues{/number}","pulls_url":"https://api.github.com/repos/Yoast/js-text-analysis/pulls{/number}","milestones_url":"https://api.github.com/repos/Yoast/js-text-analysis/milestones{/number}","notifications_url":"https://api.github.com/repos/Yoast/js-text-analysis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yoast/js-text-analysis/labels{/name}","releases_url":"https://api.github.com/repos/Yoast/js-text-analysis/releases{/id}","created_at":"2015-03-23T13:50:16Z","updated_at":"2015-05-15T01:13:40Z","pushed_at":"2015-06-01T12:20:39Z","git_url":"git://github.com/Yoast/js-text-analysis.git","ssh_url":"git@github.com:Yoast/js-text-analysis.git","clone_url":"https://github.com/Yoast/js-text-analysis.git","svn_url":"https://github.com/Yoast/js-text-analysis","homepage":"","size":564,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/27"},"html":{"href":"https://github.com/Yoast/js-text-analysis/pull/27"},"issue":{"href":"https://api.github.com/repos/Yoast/js-text-analysis/issues/27"},"comments":{"href":"https://api.github.com/repos/Yoast/js-text-analysis/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Yoast/js-text-analysis/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/Yoast/js-text-analysis/statuses/80f59cb1914ca66371033d1a8ff224bb38c24e36"}}}}