A simple word-stats manipulation library
npm install @kitsuyui/word-stats
yarn add @kitsuyui/word-stats
pnpm add @kitsuyui/word-stats
import { wordCount } from '@kitsuyui/word-stats';
const documents = [
['a', 'b', 'c'],
['a', 'b', 'd'],
]
const result = wordCount(documents)
result // => { a: 2, b: 2, c: 1, d: 1 }
- wordCount: Count the number of words in the documents
- computeTermFrequencies: Compute the term frequencies of the documents
- computeInverseDocumentFrequency: Compute the inverse document frequencies of the documents
- extractUniqueWords: Extract unique words from the documents
MIT