diff --git a/src/index.js b/src/index.js index c2e4838..b23d719 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ var stopWords = ['about', 'after', 'all', 'also', 'am', 'an', 'and', 'another', 'any', 'are', 'as', 'at', 'be', 'because', 'been', 'before', 'being', 'between', 'both', 'but', 'by', 'came', 'can', 'come', 'could', 'did', 'do', 'each', 'for', 'from', 'get', 'got', 'has', 'had', 'he', 'have', 'her', 'here', 'him', 'himself', 'his', 'how', 'if', 'in', 'into', 'is', 'it', 'like', 'make', 'many', 'me', 'might', 'more', 'most', 'much', 'must', 'my', 'never', 'now', 'of', 'on', 'only', 'or', 'other', 'our', 'out', 'over', 'said', 'same', 'see', 'should', 'since', 'some', 'still', 'such', 'take', 'than', 'that', 'the', 'their', 'them', 'then', 'there', 'these', 'they', 'this', 'those', 'through', 'to', 'too', 'under', 'up', 'very', 'was', 'way', 'we', 'well', 'were', 'what', 'where', 'which', 'while', 'who', 'with', 'would', 'you', 'your', 'a', 'i']; -var punctuationRE = /\.|\,|\!/g; +var punctuationRE = /[.,!?:;"']/g; var getRoot = function(pattern, index) { var node = index; @@ -86,7 +86,7 @@ var lowercase = function(str) { } var removePunctuation = function(str) { - return str.replace(punctuationRE, ""); + return str.replace(Wade.config.punctuationRE, ""); } var removeStopWords = function(str) { @@ -94,7 +94,7 @@ var removeStopWords = function(str) { var i = words.length; while((i--) !== 0) { - if(stopWords.indexOf(words[i]) !== -1) { + if(Wade.config.stopWords.indexOf(words[i]) !== -1) { words.splice(i, 1); } } @@ -207,7 +207,8 @@ Wade.save = function(search) { } Wade.config = { - stopWords: stopWords + stopWords: stopWords, + punctuationRE: punctuationRE, }; Wade.version = "__VERSION__";