Welcome to the Word Counter Tea. This library provides a simple and efficient way to count the number of words in a given text. It can be used in various applications where text analysis is required.
- Count the number of words in a text
- Ignore punctuation and special characters
- Handle multiple languages
- Fast and lightweight
npm install word-counter-tea
First, import the countWords
function from the library:
const { countWords } = require('word-counter-tea');
Use the countWords
function to count the number of words in a text:
const text = "Hello, world! This is a simple word counter example.";
const wordCount = countWords(text);
console.log('Word count:', wordCount);
Counts the number of words in a given text.
- text (string): The text to count words in.
- Returns: The number of words in the text.
const { countWords } = require('word-counter-tea');
const text = "OpenAI's ChatGPT is an advanced language model.";
const wordCount = countWords(text);
console.log('Word count:', wordCount); // Output: Word count: 7
This project is licensed under the MIT License.