This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tokenize(str) | |
// extracts semantically useful tokens from a string containing English-language sentences | |
// @param {String} the string to tokenize | |
// @returns {Array} containing extracted tokens | |
function tokenize(str) { | |
var punct = '\\[' + '\\!' + '\\"' + '\\#' + '\\$' + // since javascript does not | |
'\\%' + '\\&' + '\\\'' + '\\(' + '\\)' + // support POSIX character | |
'\\*' + '\\+' + '\\,' + '\\\\' + '\\-' + // classes, we'll need our |