Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 1.49 KB

readme.md

File metadata and controls

69 lines (49 loc) · 1.49 KB

Word Counter Tea

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.

Features

  • Count the number of words in a text
  • Ignore punctuation and special characters
  • Handle multiple languages
  • Fast and lightweight

Installation


npm install word-counter-tea

Usage

First, import the countWords function from the library:


const { countWords } = require('word-counter-tea');

Counting Words

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);

API

countWords(text)

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.

Example


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

License

This project is licensed under the MIT License.