AI-powered document analysis CLI with beautiful visualizations
npm install doc-analyze> AI-powered document analysis tool that generates beautiful, interactive HTML reports with summaries, statistics, charts, and word clouds.
- š¤ AI-Powered Summaries - Leverages Ollama for intelligent document summarization
- š Multiple Formats - Supports PDF, DOCX, Markdown, and TXT files
- š Interactive Charts - Beautiful visualizations using Chart.js
- āļø Dynamic Word Cloud - Visual representation of word frequency
- šØ Dark Theme UI - Stunning, responsive HTML reports with Tailwind CSS
- š Detailed Statistics - Word count, sentences, paragraphs, and more
- ā” Fast & Easy - Simple command-line interface with Commander.js
The tool generates a beautiful HTML report with:
```
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā š Document Analysis Report ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā š Statistics Cards ā
ā š¤ AI Summary ā
ā š Word Frequency Chart ā
ā š Document Metrics Chart ā
ā āļø Interactive Word Cloud ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
- Node.js (v14 or higher)
- Ollama installed and running locally (Install Ollama)
npm install -g doc-analyze`Pull the default model
ollama pull llama3.2Or pull alternative models
`
ollama pull mistral
`š» Usage
$3
` bash
doc-analyze -d document.pdf -m llama3.2:latest `$3
`bash
Specify Ollama model
doc-analyze -d report.docx -m mistralCustom output file
doc-analyze -d article.md -o my-analysis.htmlCustom Ollama URL
doc-analyze -d paper.pdf --ollama-url http://192.168.1.100:11434 -m mistral
`š Command Options
| Option | Alias | Description | Default |
|--------|-------|-------------|---------|
|
--document | -d | Input document path (required) | - |
| --model | -m | Ollama model to use | llama3.2 |
| --output | -o | Output HTML file path | analysis-report.html |
| --ollama-url | - | Ollama API URL | http://localhost:11434 |
| --help | -h | Display help information | - |
| --version | -V | Show version number | - |š Supported File Formats
| Format | Extension | Description |
|--------|-----------|-------------|
| PDF |
.pdf | Portable Document Format |
| Word | .docx | Microsoft Word documents |
| Markdown | .md | Markdown files |
| Text | .txt | Plain text files |šØ Output Report Features
The generated HTML report includes:
$3
- Word Count - Total words in document
- Sentence Count - Number of sentences
- Paragraph Count - Document structure analysis
- Average Word Length - Writing complexity metric
- Words per Sentence - Readability indicator$3
- Intelligent, concise summary generated by Ollama
- Captures key points and main ideas
- Easy-to-read format$3
- Bar Chart - Top 15 most frequent words
- Doughnut Chart - Document composition breakdown
- Responsive and interactive visualizations$3
- Top 50 most frequent words
- Size indicates frequency
- Color-coded for visual appeal
- Hover effects for engagement
- Excludes common stopwords`bash
$ doc-analyze -d sample.pdfš Starting document analysis...
š Reading document: sample.pdf
ā
Extracted 15,842 characters
š Calculating statistics...
ā
Statistics generated
āļø Generating word cloud...
ā
Word cloud data ready
š¤ Calling Ollama model: llama3.2...
ā
AI summary completed
š Generating HTML report...
⨠Analysis complete!
š Report saved to: analysis-report.html
š Summary Statistics:
Words: 2,456
Sentences: 124
Paragraphs: 18
š Open analysis-report.html in your browser to view the results!
`š§ Configuration
$3
You can use any Ollama model you have installed:
`bash
List available models
ollama listUse a specific model
doc-analyze -d document.pdf -m mistral
doc-analyze -d document.pdf -m codellama
doc-analyze -d document.pdf -m llama2
`$3
Connect to Ollama running on another machine:
`bash
doc-analyze -d document.pdf --ollama-url http://192.168.1.100:11434
`š Troubleshooting
$3
Problem:
Error calling Ollama: connect ECONNREFUSEDSolution:
1. Ensure Ollama is running:
ollama serve
2. Check Ollama is accessible: curl http://localhost:11434/api/tags
3. Verify the model is installed: ollama list$3
Problem:
Error: model 'xyz' not foundSolution:
`bash
ollama pull
``Problem: Unable to extract text from PDF
Solution:
- Ensure PDF is not image-based (use OCR if needed)
- Try re-saving the PDF
- Check file is not corrupted
MIT License - (c) Mohan Chinnappan
---
Made with ā¤ļø and ā by developers, for developers