word-counter-om
v1.0.5
Published
A simple CLI tool to count words from files
Downloads
9
Readme
word-counter-om
A simple yet powerful NPM CLI tool to count word occurrences in a given file.
It also allows you to search for the frequency of a specific word.
📦 Installation
You can install the package either locally (via npx) or globally.
Global Installation:
npm install -g word-counter-omRun Without Installation (Using npx):
npx countin <filename> [singleWord]
countinis the CLI command (alias) defined in the package.
🚀 Usage
countin <filename> [singleWord]<filename>: Required. Path to the text file you want to analyze.[singleWord]: Optional. A specific word to search for in the file.
Example 1 – Count all words:
countin sample.txtOutput (example):
{
hello: 3,
world: 2,
javascript: 5,
...
}Example 2 – Count a single word:
countin sample.txt javascriptOutput:
The word "javascript" appeared 5 times.📝 Word Splitting Rules
This CLI tool intelligently splits words by recognizing special characters and punctuation marks.
Some key rules:
- Words like
Jay'swill be split into:jayands. - Compound terms like
express.jswill be split into:expressandjs. - Hyphenated words like
time-passwill be split into:timeandpass.
This ensures a more accurate word frequency analysis.
📂 Use Cases
- Word frequency analysis for text files
- Keyword density checker
- Text analytics for blogs, articles, or transcripts
🔧 Author
Created by Om Vaghela
📸 Instagram: @om_2804_
Try it out and feel free to share feedback or suggestions!
