From 0b7ef16a41c2a8dea02d23485f19479a78f10c62 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Sun, 3 Jan 2016 07:36:05 -0500 Subject: [PATCH] Improve accuracy of keyword counts. --- src/inspectors/keyword-inspector.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/inspectors/keyword-inspector.js b/src/inspectors/keyword-inspector.js index d698c09..5a8e4a1 100644 --- a/src/inspectors/keyword-inspector.js +++ b/src/inspectors/keyword-inspector.js @@ -40,14 +40,15 @@ Keyword analysis for HackMyResume. // http://stackoverflow.com/a/2593661/4942583 function regex_quote(str) { return (str + '').replace(/[.?*+^$[\]\\(){}|-]/ig, "\\$&"); - }; + } var searchable = ''; - rez.transformStrings( [], function trxString( key, val ) { - searchable += val; + rez.transformStrings( ['imp', 'computed', 'safe'], function trxString( key, val ) { + searchable += ' ' + val; }); return rez.keywords().map(function(kw) { + var regex = new RegExp( '\\b' + regex_quote( kw )/* + '\\b'*/, 'ig'); var regex = new RegExp( regex_quote( kw ), 'ig'); var myArray, count = 0; while ((myArray = regex.exec( searchable )) !== null) {