Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

t3h2mas/WordFrequenter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordFrequenter

JavaScript word frequency

CircleCI   NPM

Inspired by Python's DefaultDict, WordFrequenter provides an object to count the frequency of words

install

npm: npm i --save wordfrequenter

yarn: yarn add wordfrequenter

usage

const Freq = require('wordfrequenter')

const testWords = 'this is a cool test string this is cool cool cool'

const wf = new Freq(testWords.split(' '))

wf.set('string')
console.dir(wf.get('cool'))
console.dir(wf.list())

results in

Word { word: 'cool', count: 4 }
[ Word { word: 'a', count: 1 },
  Word { word: 'test', count: 1 },
  Word { word: 'this', count: 2 },
  Word { word: 'is', count: 2 },
  Word { word: 'string', count: 2 },
  Word { word: 'cool', count: 4 } ]

run test

npm test

About

Node.js word frequency

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published