# Doc Analyzer: The New Release - More Formats, More Flexibility

> Discover Doc Analyzer's new features: multi-format support, a modular architecture, and flexibility in choosing the language model.

- URL: https://mautoblog.com/en/posts/doc-analyzer-evolution-new-features/
- Language: en
- Published: 2025-02-21
- Updated: 2026-10-15
- Author: Mauto
- Categories: Projects, Artificial Intelligence
- Tags: Doc Analyzer, RAG, DeepSeek, Ollama, Docker
- Guide: Doc Analyzer (part 2)
- Translation (it): https://mautoblog.com/posts/doc-analyzer-evoluzione-nuove-funzionalita/

---

After the [initial launch of Doc Analyzer](/en/posts/doc-analyzer-local-rag-privacy-deepseek-r1-2025/), the project has evolved significantly. In this post, we'll explore the new features and improvements introduced in the latest version.

## Key New Features

### 1. Multi-Format Support
The most significant new feature is extended support for more document formats:
- PDF (as in the original version)
- DOC (legacy Word documents)
- DOCX (modern Word documents)

This expansion makes Doc Analyzer far more versatile and usable in many more business scenarios.

### 2. Modular Architecture
The application has been completely restructured following the Factory pattern, making it easier to:
- Add new document formats
- Maintain the code
- Test new features

Here's an example of the new structure:

```python
class ProcessorFactory:
    @staticmethod
    def get_processor(file_path):
        if file_path.endswith('.pdf'):
            return PDFProcessor()
        elif file_path.endswith(('.doc', '.docx')):
            return WordProcessor()
        # Easy to add new processors
```

### 3. Role-Based Analysis
One of the most interesting new features is the introduction of specialized roles for analysis. Users can now choose between different roles that shape how the system analyzes documents and answers questions:

- **Default**: Objective, comprehensive analysis of the document
- **Legal**: Focus on legal implications and regulatory requirements
- **Financial**: Analysis of financial and economic aspects
- **Travel**: Geared toward logistics and travel planning
- **Technical**: Focus on technical and implementation details

Each role uses specialized prompts that steer the model toward a specific type of analysis. For example:

```python
ROLE_PROMPTS = {
    "legal": """Act as a legal consultant analyzing the content.
Focus on legal implications, regulatory requirements, and potential legal risks.""",
    "financial": """Act as a financial advisor analyzing the content.
Focus on financial implications, costs, benefits, and ROI."""
    # Other roles...
}
```

### 4. Language Model Flexibility
While the original version was tightly bound to DeepSeek R1, you can now use any Ollama model:
- DeepSeek R1 14B (the default, thanks to its excellent performance)
- Mistral 7B
- LLaMA 2
- And any other model supported by Ollama

Configuration is simple, via an environment variable:
```env
LLM_MODEL=mistral:7b  # or any other model
```

## Improved Document Processing

### Word Processor
The new WordProcessor handles both DOC and DOCX documents:
```python
def process(self, file_obj):
    # Smart format handling
    if file_path.endswith('.docx'):
        text = self._process_docx(file_path)
    else:  # .doc
        text = self._process_doc(file_path)

    # Chunking and processing
    chunks = self.text_splitter.split_documents([doc])
    return chunks
```

Key features:
- Automatic format handling
- Preservation of document structure
- Automatic cleanup of temporary files
- Optimized memory management

### Processing Pipeline
The pipeline is now more robust:
1. Automatic format detection
2. Selection of the appropriate processor
3. Text extraction
4. Optimized chunking
5. Embedding generation
6. Vector storage

## Interface Improvements

The Gradio interface has been completely revamped to support all the new features:

### Role Selection
A new dropdown menu lets you select the desired analysis role, directly influencing the type of answer you'll get. This lets you:
- Get specialized analyses for different domains
- Adapt answers to the specific context
- Receive insights that are more relevant to your use case

### Other Improvements
The Gradio interface has been enriched with:
- Drag-and-drop support for more formats
- Visual feedback during processing
- Better error handling
- Role selection for the analysis

## Configuration and Deployment

Configuration is more flexible thanks to new environment variables:
```env
OLLAMA_HOST=host.docker.internal
OLLAMA_PORT=11434
CHROMA_DB_PATH=/app/data/chroma
LLM_MODEL=deepseek-r1:14b  # Configurable
CHUNK_SIZE=1000
CHUNK_OVERLAP=200
PERSIST_VECTORDB=false
```

### Optimized Docker Compose
```yaml
services:
  web:
    build: .
    ports:
      - "8000:8000"
    volumes:
      - ./data:/app/data
    env_file: .env
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/"]
```

## What's Next

The project keeps evolving. Here's what's ahead:
1. Support for more formats (epub, txt, md)
2. Tokenization improvements
3. A complete REST API
4. An advanced caching system

## Conclusion

Doc Analyzer has grown from a simple PDF analyzer into a complete document analysis platform. The new modular architecture and multi-format support make it an even more powerful tool for privacy-first document analysis.

### Useful Resources
- [GitHub Repository](https://github.com/Mauto82/doc-analyzer)
- [Technical Documentation](/docs/doc-analyzer-paper/)
- [Original Post](/en/posts/doc-analyzer-local-rag-privacy-deepseek-r1-2025/)

