0.1.5 • Published 10 years ago

freq v0.1.5

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

freq Build Status: Master

Tally word frequency from a string or an array of strings.

NPM

Install

npm install freq --save

Use

var freq = require('freq');

freq('My, my, my music hits me so hard Makes me say Oh my Lord');
//	[ 
//		{ word: 'my', count: 4 },
//		{ word: 'me', count: 2 },
//		{ word: 'music', count: 1 },
//		{ word: 'hits', count: 1 },
//		{ word: 'so', count: 1 },
//		{ word: 'hard', count: 1 },
//		{ word: 'makes', count: 1 },
//		{ word: 'say', count: 1 },
//		{ word: 'oh', count: 1 },
//		{ word: 'lord', count: 1 } 
//	]

Freq tries to remove any non-letter character from your string, normalizes them to lowercase, then counts them.

Freq can also take an array of strings (it's original purpose) and will tally across all given strings.

freq(['Kris Kross will make you', 'Jump', 'Jump']);
//	[
//		{ word: 'jump', count: 2 },
//		{ word: 'kris', count: 1 },
//		{ word: 'kross', count: 1 },
//		{ word: 'will', count: 1 },
//		{ word: 'make', count: 1 },
//		{ word: 'you', count: 1 }
//	]
0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago