word-frequency-basic
Single function code block for finding the number of repeating words in a text.
Install
yarn add word-frequency-basic
or
npm i word-frequency-basic
Usage
Parameters | Type | Default | Description |
---|
text | string | null | The text to be split into words |
caseSensitive | boolean | true | Allows you to count by paying attention to whether the letters are big or small. |
letter | "normal" / "upperCase" / "lowerCase" | "normal" | Words can be output in uppercase, lowercase or normal letters. |
noPunctuation | boolean | true | Determines whether to remove punctuation marks. |
import numberOfWords from "word-frequency-basic"
numberOfWords(text, caseSensitive, letter, noPunctuation)
Examples
import numberOfWords from "word-frequency-basic"
const text = "Hello world, count my words, hello again."
console.log(numberOfWords(text))
console.log(numberOfWords(text, false))
console.log(numberOfWords(text, true, "upperCase"))
console.log(numberOfWords(text, true, "normal", false))