1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-07-03 00:30:05 +01:00

Improve accuracy of keyword counts.

This commit is contained in:
hacksalot 2016-01-03 07:36:05 -05:00
parent 247eec396c
commit 0b7ef16a41

View File

@ -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) {