https://github.com/biplo12/word-insight
Node.js package for text analysis and insights.
https://github.com/biplo12/word-insight
nodejs npm-package typescript
Last synced: 2 months ago
JSON representation
Node.js package for text analysis and insights.
- Host: GitHub
- URL: https://github.com/biplo12/word-insight
- Owner: Biplo12
- Created: 2023-08-25T18:03:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-25T18:04:30.000Z (over 1 year ago)
- Last Synced: 2025-03-02T18:02:53.398Z (3 months ago)
- Topics: nodejs, npm-package, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/word-insight
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# word-insight
A Node.js package for analyzing text content and gaining insights about words, sentences, and characters.
## Installation
Install the package using npm:
```bash
npm install word-insight
```### Or
```bash
yarn add word-insight
```## Usage
```
import * as wordInsight from 'word-insight';const text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
const wordCount = wordInsight.countWords(text);
console.log(`Word Count: ${wordCount}`);const timeToRead = wordInsight.timeToRead(text);
console.log(`Time to Read: ${timeToRead} minutes`);const sentenceCount = wordInsight.countSentences(text);
console.log(`Sentence Count: ${sentenceCount}`);const paragraphCount = wordInsight.countParagraphs(text);
console.log(`Paragraph Count: ${paragraphCount}`);const characterCount = wordInsight.countCharacters(text);
console.log(`Character Count: ${characterCount}`);const characterCountWithoutSpaces = wordInsight.countCharactersWithoutSpaces(text);
console.log(`Character Count (without spaces): ${characterCountWithoutSpaces}`);
```## Functions
countWords(str: string): number: Counts the number of words in the given text.
timeToRead(str: string): number: Estimates the time required to read the text (assuming an average reading speed of 200 words per minute).
countSentences(str: string): number: Counts the number of sentences in the given text.
countParagraphs(str: string): number: Counts the number of paragraphs in the given text.
countCharacters(str: string): number: Counts the total number of characters in the text.
countCharactersWithoutSpaces(str: string): number: Counts the total number of characters in the text, excluding spaces.
## License
This project is licensed under the MIT License - see the LICENSE file for details.