✨ Features
🎯 Smart Analysis - Count every word with precision
🔍 Word Search - Find specific word occurrences instantly
🎨 Case-Insensitive - Automatically handles uppercase/lowercase
🚀 Blazing Fast - Pure Node.js with zero dependencies
📋 Clean Output - Beautiful formatted results
📦 Installation
npm install -g @parth_pipermintwala/wordfreq
🚀 Quick Start
Count All Words
count ./text.txt
Output:
─────────────────────────────────────────────────────────────────
{ theory: 5, is: 4, in: 6, general: 1, any: 5, practice: 3 }
─────────────────────────────────────────────────────────────────
Total words: 250
─────────────────────────────────────────────────────────────────
Search for Specific Word
count ./text.txt theory
Output:
─────────────────────────────────────────────────────────────────
The word "theory" appears 5 times.
─────────────────────────────────────────────────────────────────
💡 Use Cases
📝 Content Writers - Analyze your writing patterns
🎓 Students - Study text composition and word usage
🔎 SEO Specialists - Check keyword density
📚 Researchers - Perform quick text analysis
✍️ Authors - Track word frequency in manuscripts
🛠️ How It Works
- 📖 Reads your text file
- 🔄 Converts to lowercase for consistency
- ✂️ Splits into individual words
- 🧹 Filters out numbers and punctuation
- 📊 Counts and displays results
⚙️ Technical Details
- Runtime: Node.js 25.2.1+ (ESM modules)
- Dependencies: Zero! Pure Node.js
- File Support: Any text-based file format
- Word Detection: Regex-based (
/\W+/ split + alpha filter)
- Error Handling: Clear messages for missing files or invalid paths
📖 Command Syntax
count <filePath> [wordToFind]
| Argument |
Required |
Description |
filePath |
✅ Yes |
Path to the text file to analyze |
wordToFind |
⬜ Optional |
Specific word to search for |
🎯 Pro Tips
💾 Export Results - Save counts to a file:
count document.txt > results.txt
🔗 Chain Commands - Combine with other tools:
cat *.txt | count combined.txt
📁 Analyze Multiple Files - Use a loop:
for file in *.txt; do count "$file"; done
📄 License
MIT © 2025
评论