1.0.9 • Published 4 years ago

large-text-analyzer v1.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Large Text Analyzer

// OPTIONALLY override the word delimiters - this RegEx is the default one:

lta.delimiters = /\s|^a-zA-Z|0-9/

// OPTIONALLY override the processWord(word) function // to be executed for each word. // NOTE "this.map" - this is the result map, // that gets returned at the end of the stream. // It can be used to store all kinds of results // this here is the default - counts unique // word occurences

lta.processWord = function (word){ word = word.toLowerCase() let count = this.map.get(word) count = count? ++count : 1 this.map.set(word,count) }

// Define async block: async function processFile (fileName) { let vocabulary = await lta.processWords(fileName); console.log(Vocabulary consists of ${vocabulary.size} words) console.log(vocabulary); }

// And execute it. processFile('./test/data/testdata.txt')

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago