Skip to content

Instantly share code, notes, and snippets.

@rahulspace
Created September 20, 2019 12:23
Show Gist options
  • Save rahulspace/08187b9480357b1e2194cd0fc05c1639 to your computer and use it in GitHub Desktop.
Save rahulspace/08187b9480357b1e2194cd0fc05c1639 to your computer and use it in GitHub Desktop.
keywords generate from sentance
var message = 'a quick brown fox jumps over the lazy dog'
const splited = _.split(message, ' ')
var keywords = []
_.forEach(splited, (item, index) => {
for(var i = 0; i < splited.length ; i++) {
var data = _.take(splited, i + 1)
data = _.join(data, ' ')
keywords.push(data)
console.log(data)
}
splited.shift()
})
console.log(keywords.length)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment