A Context-Aware, Knowledge-Adaptive Document Tutor Using Large Language Models
HTML
0
37 commits
updated Sep 23, 2026
Doc Explainer is an AI-augmented, document-centric intelligent tutoring system designed to deliver personalized, dependency-aware explanations of technical and educational content. Unlike generic AI assistants, Doc Explainer:
The system combines scalable document retrieval, structured concept modeling, and multimodal interaction to create a truly personalized tutoring experience.
| Feature | Description |
|---|---|
| Hierarchical Parsing | Processes documents into chapters, sections, paragraphs, and sentences |
| Multi-format Support | PDF, TXT, HTML, Markdown, DOCX, PPTX |
| Concept Extraction | Automatically identifies and extracts key concepts using LLM + NER |
| Knowledge Graph | Builds a dependency graph of concepts within the document |
| Semantic Search | Vector-based retrieval of relevant sections |
| Feature | Description |
|---|---|
| User Knowledge Model | Tracks which concepts the user knows and confidence levels |
| Bayesian Knowledge Tracing | Updates knowledge state based on interactions |
| Adaptive Explanations | Adjusts depth and complexity based on user expertise |
| Prerequisite Detection | Identifies and recommends prerequisite concepts |
| Learning Path Generation | Creates personalized curriculum based on knowledge gaps |
| Mode | Description |
|---|---|
| Text Selection | Select any text to get instant explanation |
| Question Answering | Ask questions about the document |
| Voice Input | Speak your questions naturally |
| Voice Output | Listen to explanations hands-free |
| Follow-up Questions | Suggested questions based on context |
┌─────────────────────────────────────────────────────────────┐
│ UI Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Main UI │ │ Voice │ │ Document Viewer │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────────┐
│ Orchestrator Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Pipeline │ │ Context │ │ Services │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────────┐
│ Core Modules │
├─────────────┬─────────────┬─────────────┬───────────────────┤
│ Document │ Memory │ Knowledge │ Explanation │
│ Processor │ Manager │ Graph │ Engine │
├─────────────┼─────────────┼─────────────┼───────────────────┤
│ Parser │ Long-term │ Concept │ Adaptive │
│ Builder │ Session │ Extraction │ Explainer │
│ Cacher │ Context │ Relations │ Recommender │
└─────────────┴─────────────┴─────────────┴───────────────────┘
│
┌─────────────────────────────────────────────────────────────┐
│ Storage Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Document │ │ User │ │ Knowledge Graph │ │
│ │ Store │ │ Store │ │ Store │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
| Module | Responsibility | Key Classes |
|---|---|---|
| Document | Document processing and management | DocumentParser, DocumentTree, DocumentEngine |
| Memory | User and session memory management | LongTermMemory, SessionManager, Context |
| Knowledge | Concept extraction and graph management | ConceptExtractor, KnowledgeGraph, PrerequisiteAnalyzer |
| Explanation | Adaptive explanation generation | AdaptiveExplainer, ResourceRecommender |
| Agent | LLM interaction and prompt management | LLMWrapper, PromptTemplates, OutputParsers |
| Orchestrator | Pipeline coordination | DocExplainerOrchestrator, Pipelines |
| UI | Graphical user interface | MainWindow, Sidebar, Viewers |
Raw Document → Parser → Document Tree → Chunking → Embeddings → Vector Store
↓
Knowledge Graph ← Concept Extraction
User Selects Text → Context Resolution → Section ID → Document Context
↓
User Knowledge State
↓
Adaptive Explanation Generation
↓
Follow-up Questions + Resource Recommendations
Initial State → Interaction → Bayesian Update → New Knowledge State
↑ ↓
User Feedback Confidence Score
Selected Text + Document Context + User Knowledge → Prompt Engineering
↓
LLM Generation
↓
Explanation + Follow-up Questions
↓
Resource Enrichment (Videos/Articles)
# Install uv
sudo snap install astral-uv --classic
# Install system dependencies
sudo apt update
sudo apt install -y portaudio19-dev python3.12-dev
# Clone the repository
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
# Install project dependencies and create the virtual environment
uv sync
# Activate the virtual environment (optional)
source .venv/bin/activate
Note:
uv syncautomatically creates the.venvvirtual environment and installs all dependencies defined inpyproject.toml. You do not need to manually create a virtual environment or runpip install -e ..
sudo apt-get update
sudo apt-get install -y \
python3-dev \
build-essential \
libssl-dev \
libffi-dev \
libxml2-dev \
libxslt1-dev \
poppler-utils \
tesseract-ocr \
portaudio19-dev \
libportaudio2 \
libsqlite3-dev \
libbz2-dev \
libreadline-dev
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
uv sync
uv run python -m spacy download en_core_web_sm
uv run doc-explainer
If Homebrew is not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install \
poppler \
tesseract \
portaudio \
libxml2 \
libxslt \
[email protected]
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
uv sync
uv run python -m spacy download en_core_web_sm
uv run doc-explainer
Apple Silicon: If MLX support is configured as an optional dependency in
pyproject.toml, install the corresponding extra with:uv sync --extra mlx
Install the required Microsoft C++ Build Tools if they are not already available:
https://visualstudio.microsoft.com/visual-cpp-build-tools/
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
uv sync
uv run python -m spacy download en_core_web_sm
uv run doc-explainer
Note:
uvautomatically manages the project virtual environment and dependencies. You do not need to usepipwinor manually install PyAudio wheels unless your platform requires a specific workaround.
docker build -t doc-explainer .
docker run -v /path/to/documents:/documents \
doc-explainer \
/documents/paper.pdf
Note: Docker manages its own Python environment. The host
uvenvironment is not used inside the container.
uv also manages development dependencies.
If development dependencies are defined in pyproject.toml:
uv sync --dev
If development dependencies are defined as an optional dependency group/extra:
uv sync --extra dev
uv run pre-commit install
uv run pytest tests/
uv run ruff check .
uv run ruff format .
After installing the project with uv sync, commands can be executed using uv run.
uv run doc-explainer
uv run python -m spacy download en_core_web_sm
uv run doc-explainer \
--uiconfig config/ui.yaml \
--llmconfig config/llm.yaml \
--backendconfig config/backend.yaml
uv run doc-explainer /path/to/document.pdf
uv run doc-explainer \
--theme dark \
document.pdf
uv run doc-explainer \
--config ~/.doc_explainer/config.json \
document.pdf
uv run doc-explainer \
--debug \
document.pdf
uv run doc-explainer \
--no-splash \
document.pdf
uv run doc-explainer \
--log-level DEBUG \
document.pdf
uv run doc-explainer \
--profile \
document.pdf
Use uv instead of pip for managing project dependencies.
uv add <package>
For example:
uv add requests
uv add --dev pytest
uv remove <package>
uv sync
uv lock --upgrade
uv sync
uv run python script.py
uv run doc-explainer
uv run pytest
Tip: You generally don't need to activate
.venvwhen usinguv. Commands such asuv run python,uv run pytest, anduv run doc-explainerautomatically use the project's managed environment.
If your project requires environment variables, create a .env file in the project root:
cp .env.example .env
Then configure the required values before running DocExplainer.
To install the exact dependency versions recorded in uv.lock:
uv sync
When dependencies change, update them with:
uv add <package>
and commit both:
pyproject.toml
uv.lock
to version control.
If you see:
fatal error: portaudio.h: No such file or directory
install the PortAudio development package:
sudo apt update
sudo apt install portaudio19-dev
Then run:
uv sync
uv run python --version
uv pip list
uv run python -c "import torch; print(torch.__version__)"
uv run python -c "import torch; print(torch.cuda.is_available())"

Open Document
Ctrl+OSelect Text
Choose Action
Ctrl+E) - Get detailed explanationCtrl+S) - Get concise summaryCtrl+Q) - Ask a questionInteract with Results
| Shortcut | Action |
|---|---|
Ctrl+O | Open document |
Ctrl+W | Close current tab |
Ctrl+Tab | Switch tabs |
Ctrl+E | Explain selected text |
Ctrl+S | Summarize selected text |
Ctrl+Q | Ask question |
Ctrl+F | Find in document |
Ctrl++ | Zoom in |
Ctrl+- | Zoom out |
Ctrl+0 | Reset zoom |
Ctrl+B | Toggle sidebar |
F5 | Refresh document |
F1 | Help |
Ctrl+, | Settings |
Ctrl+Q | Quit |
Enable voice input and try these commands:
User: Opens a machine learning paper
User: Selects "Transformer architecture"
System: Explains using beginner-level language, noting it requires understanding of attention
User: Clicks follow-up "What is attention?"
System: Explains attention mechanism, updates knowledge state
User: Asks "Show me an example"
System: Provides concrete example with visualization
User: Selects same text a week later
System: Recognizes user now knows attention, provides advanced explanation
User: Asks "How does this compare to RNNs?"
System: Draws comparisons based on known concepts
Create ~/.doc_explainer/config/config.json:
{
"theme": "light",
"llm_provider": "gemini",
"gemini_api_key": "YOUR_GEMINI_API_KEY",
"openai_api_key": "YOUR_OPENAI_API_KEY",
"window": {
"width": 1200,
"height": 800,
"maximized": false
},
"sidebar": {
"visible": true,
"width": 350,
"position": "right"
},
"voice": {
"enabled": true,
"input_device": "default",
"output_enabled": true,
"output_rate": 150,
"output_volume": 0.9
},
"documents": {
"default_zoom": 1.0,
"max_recent": 10,
"auto_save_interval": 5
},
"cache": {
"enabled": true,
"size_mb": 500,
"location": "~/.doc_explainer/cache"
},
"llm": {
"provider": "gemini",
"model": "gemini-1.5-flash",
"temperature": 1.0,
"max_tokens": null
},
"knowledge_graph": {
"enabled": true,
"auto_build": true
},
"memory": {
"enabled": true,
"session_tracking": true
},
"startup": {
"open_last_docs": true,
"check_updates": true,
"show_splash": true
},
"debug": {
"enabled": false,
"log_level": "INFO",
"profiling": false
}
}
Create .env file in project root:
# API Keys
GEMINI_API_KEY=your_gemini_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
# Configuration
DOC_EXPLAINER_THEME=light
DOC_EXPLAINER_DEBUG=false
DOC_EXPLAINER_LOG_LEVEL=INFO
# Paths
DOC_EXPLAINER_CACHE_DIR=~/.doc_explainer/cache
DOC_EXPLAINER_CONFIG_DIR=~/.doc_explainer/config
DOC_EXPLAINER_DATA_DIR=~/.doc_explainer/data
# LLM Settings
DOC_EXPLAINER_LLM_PROVIDER=gemini
DOC_EXPLAINER_LLM_TEMPERATURE=1.0
DOC_EXPLAINER_LLM_MAX_TOKENS=4096
# Feature Flags
DOC_EXPLAINER_ENABLE_VOICE=true
DOC_EXPLAINER_ENABLE_KG=true
DOC_EXPLAINER_ENABLE_MEMORY=true
doc-explainer --help
usage: doc-explainer [-h] [--config CONFIG] [--theme {light,dark,high_contrast,sepia}]
[--debug] [--no-splash] [--log-level {DEBUG,INFO,WARNING,ERROR}]
[--version] [--profile] [--reset-config] [--clear-cache]
[document]
Doc Explainer - Intelligent Document Explanation System
positional arguments:
document Document to open (PDF, TXT, HTML, etc.)
options:
-h, --help show this help message and exit
--config CONFIG, -c CONFIG
Configuration file path
--theme {light,dark,high_contrast,sepia}, -t {light,dark,high_contrast,sepia}
Theme to use
--debug, -d Enable debug mode
--no-splash Disable splash screen
--log-level {DEBUG,INFO,WARNING,ERROR}
Set logging level
--version, -v show program's version number and exit
--profile Enable performance profiling
--reset-config Reset configuration to defaults
--clear-cache Clear application cache
DocumentProcessorfrom src.core.document import DocumentProcessor
processor = DocumentProcessor()
doc_id = processor.load_document("path/to/file.pdf")
tree = processor.build_document_tree(doc_id)
AdaptiveExplainerfrom src.core.explanation_engine import AdaptiveExplainer
explainer = AdaptiveExplainer(style="intermediate")
explanation = explainer.explain(text, context)
summary = explainer.summarize(text, context)
answer = explainer.ask(question, context)
KnowledgeGraphfrom src.core.knowledge import KnowledgeGraph
kg = KnowledgeGraph()
kg.add_concept("attention")
kg.add_relationship("transformer", "depends_on", "attention")
prereqs = kg.get_prerequisites("transformer")
UserManagerfrom src.core.user import UserManager
user_manager = UserManager("user123")
state = user_manager.get_user_knowledge()
user_manager.update_knowledge({"concept": "attention", "correct": True})
# Register document
POST /api/documents
{"path": "/path/to/file.pdf"}
# Get explanation
POST /api/explain
{
"doc_id": "123",
"text": "selected text",
"section_id": 5
}
# Ask question
POST /api/ask
{
"doc_id": "123",
"question": "What is attention?",
"section_id": 5
}
# Get user state
GET /api/user/{user_id}/knowledge
doc-explainer/
├── src/
│ ├── core/ # Core modules
│ │ ├── document/ # Document processing
│ │ ├── memory/ # Memory management
│ │ ├── knowledge/ # Knowledge graph
│ │ ├── explanation/ # Explanation engine
│ │ ├── user/ # User modeling
│ │ └── agent/ # LLM interaction
│ ├── orchestrator/ # Pipeline coordination
│ ├── store/ # Data persistence
│ ├── ui/ # User interface
│ │ ├── gui/ # Qt GUI
│ │ └── web/ # Web interface (optional)
│ └── cli/ # Command line interface
├── tests/ # Unit tests
├── docs/ # Documentation
├── examples/ # Example notebooks
├── scripts/ # Utility scripts
├── data/ # Data directory
├── config/ # Configuration files
├── requirements.txt # Dependencies
├── setup.py # Package setup
├── README.md # This file
└── LICENSE # MIT License
# Clone repository
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install with dev dependencies
pip install -e .[dev]
# Install pre-commit hooks
pre-commit install
# Run tests
pytest tests/ -v
# Run with coverage
pytest --cov=src tests/
# Build documentation
cd docs
make html
This project follows:
# Format code
black src/
isort src/
# Type check
mypy src/
# Lint
pylint src/
# Run all tests
pytest
# Run specific test file
pytest tests/test_document.py
# Run with verbose output
pytest -v
# Run with coverage report
pytest --cov=src --cov-report=html
# Run GUI tests (headless)
pytest tests/test_gui.py --qt
# Build source and wheel distributions
python -m build
# Upload to PyPI (if publishing)
twine upload dist/*
We welcome contributions! Please see our Contributing Guide.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)Please read our Code of Conduct before contributing.
This project is licensed under the MIT License - see the LICENSE file for details.
A Context-Aware, Knowledge-Adaptive Document Tutor Using Large Language Models
HTML
0
37 commits
updated Sep 23, 2026
Doc Explainer is an AI-augmented, document-centric intelligent tutoring system designed to deliver personalized, dependency-aware explanations of technical and educational content. Unlike generic AI assistants, Doc Explainer:
The system combines scalable document retrieval, structured concept modeling, and multimodal interaction to create a truly personalized tutoring experience.
| Feature | Description |
|---|---|
| Hierarchical Parsing | Processes documents into chapters, sections, paragraphs, and sentences |
| Multi-format Support | PDF, TXT, HTML, Markdown, DOCX, PPTX |
| Concept Extraction | Automatically identifies and extracts key concepts using LLM + NER |
| Knowledge Graph | Builds a dependency graph of concepts within the document |
| Semantic Search | Vector-based retrieval of relevant sections |
| Feature | Description |
|---|---|
| User Knowledge Model | Tracks which concepts the user knows and confidence levels |
| Bayesian Knowledge Tracing | Updates knowledge state based on interactions |
| Adaptive Explanations | Adjusts depth and complexity based on user expertise |
| Prerequisite Detection | Identifies and recommends prerequisite concepts |
| Learning Path Generation | Creates personalized curriculum based on knowledge gaps |
| Mode | Description |
|---|---|
| Text Selection | Select any text to get instant explanation |
| Question Answering | Ask questions about the document |
| Voice Input | Speak your questions naturally |
| Voice Output | Listen to explanations hands-free |
| Follow-up Questions | Suggested questions based on context |
┌─────────────────────────────────────────────────────────────┐
│ UI Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Main UI │ │ Voice │ │ Document Viewer │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────────┐
│ Orchestrator Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Pipeline │ │ Context │ │ Services │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────────┐
│ Core Modules │
├─────────────┬─────────────┬─────────────┬───────────────────┤
│ Document │ Memory │ Knowledge │ Explanation │
│ Processor │ Manager │ Graph │ Engine │
├─────────────┼─────────────┼─────────────┼───────────────────┤
│ Parser │ Long-term │ Concept │ Adaptive │
│ Builder │ Session │ Extraction │ Explainer │
│ Cacher │ Context │ Relations │ Recommender │
└─────────────┴─────────────┴─────────────┴───────────────────┘
│
┌─────────────────────────────────────────────────────────────┐
│ Storage Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Document │ │ User │ │ Knowledge Graph │ │
│ │ Store │ │ Store │ │ Store │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
| Module | Responsibility | Key Classes |
|---|---|---|
| Document | Document processing and management | DocumentParser, DocumentTree, DocumentEngine |
| Memory | User and session memory management | LongTermMemory, SessionManager, Context |
| Knowledge | Concept extraction and graph management | ConceptExtractor, KnowledgeGraph, PrerequisiteAnalyzer |
| Explanation | Adaptive explanation generation | AdaptiveExplainer, ResourceRecommender |
| Agent | LLM interaction and prompt management | LLMWrapper, PromptTemplates, OutputParsers |
| Orchestrator | Pipeline coordination | DocExplainerOrchestrator, Pipelines |
| UI | Graphical user interface | MainWindow, Sidebar, Viewers |
Raw Document → Parser → Document Tree → Chunking → Embeddings → Vector Store
↓
Knowledge Graph ← Concept Extraction
User Selects Text → Context Resolution → Section ID → Document Context
↓
User Knowledge State
↓
Adaptive Explanation Generation
↓
Follow-up Questions + Resource Recommendations
Initial State → Interaction → Bayesian Update → New Knowledge State
↑ ↓
User Feedback Confidence Score
Selected Text + Document Context + User Knowledge → Prompt Engineering
↓
LLM Generation
↓
Explanation + Follow-up Questions
↓
Resource Enrichment (Videos/Articles)
# Install uv
sudo snap install astral-uv --classic
# Install system dependencies
sudo apt update
sudo apt install -y portaudio19-dev python3.12-dev
# Clone the repository
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
# Install project dependencies and create the virtual environment
uv sync
# Activate the virtual environment (optional)
source .venv/bin/activate
Note:
uv syncautomatically creates the.venvvirtual environment and installs all dependencies defined inpyproject.toml. You do not need to manually create a virtual environment or runpip install -e ..
sudo apt-get update
sudo apt-get install -y \
python3-dev \
build-essential \
libssl-dev \
libffi-dev \
libxml2-dev \
libxslt1-dev \
poppler-utils \
tesseract-ocr \
portaudio19-dev \
libportaudio2 \
libsqlite3-dev \
libbz2-dev \
libreadline-dev
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
uv sync
uv run python -m spacy download en_core_web_sm
uv run doc-explainer
If Homebrew is not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install \
poppler \
tesseract \
portaudio \
libxml2 \
libxslt \
[email protected]
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
uv sync
uv run python -m spacy download en_core_web_sm
uv run doc-explainer
Apple Silicon: If MLX support is configured as an optional dependency in
pyproject.toml, install the corresponding extra with:uv sync --extra mlx
Install the required Microsoft C++ Build Tools if they are not already available:
https://visualstudio.microsoft.com/visual-cpp-build-tools/
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
uv sync
uv run python -m spacy download en_core_web_sm
uv run doc-explainer
Note:
uvautomatically manages the project virtual environment and dependencies. You do not need to usepipwinor manually install PyAudio wheels unless your platform requires a specific workaround.
docker build -t doc-explainer .
docker run -v /path/to/documents:/documents \
doc-explainer \
/documents/paper.pdf
Note: Docker manages its own Python environment. The host
uvenvironment is not used inside the container.
uv also manages development dependencies.
If development dependencies are defined in pyproject.toml:
uv sync --dev
If development dependencies are defined as an optional dependency group/extra:
uv sync --extra dev
uv run pre-commit install
uv run pytest tests/
uv run ruff check .
uv run ruff format .
After installing the project with uv sync, commands can be executed using uv run.
uv run doc-explainer
uv run python -m spacy download en_core_web_sm
uv run doc-explainer \
--uiconfig config/ui.yaml \
--llmconfig config/llm.yaml \
--backendconfig config/backend.yaml
uv run doc-explainer /path/to/document.pdf
uv run doc-explainer \
--theme dark \
document.pdf
uv run doc-explainer \
--config ~/.doc_explainer/config.json \
document.pdf
uv run doc-explainer \
--debug \
document.pdf
uv run doc-explainer \
--no-splash \
document.pdf
uv run doc-explainer \
--log-level DEBUG \
document.pdf
uv run doc-explainer \
--profile \
document.pdf
Use uv instead of pip for managing project dependencies.
uv add <package>
For example:
uv add requests
uv add --dev pytest
uv remove <package>
uv sync
uv lock --upgrade
uv sync
uv run python script.py
uv run doc-explainer
uv run pytest
Tip: You generally don't need to activate
.venvwhen usinguv. Commands such asuv run python,uv run pytest, anduv run doc-explainerautomatically use the project's managed environment.
If your project requires environment variables, create a .env file in the project root:
cp .env.example .env
Then configure the required values before running DocExplainer.
To install the exact dependency versions recorded in uv.lock:
uv sync
When dependencies change, update them with:
uv add <package>
and commit both:
pyproject.toml
uv.lock
to version control.
If you see:
fatal error: portaudio.h: No such file or directory
install the PortAudio development package:
sudo apt update
sudo apt install portaudio19-dev
Then run:
uv sync
uv run python --version
uv pip list
uv run python -c "import torch; print(torch.__version__)"
uv run python -c "import torch; print(torch.cuda.is_available())"

Open Document
Ctrl+OSelect Text
Choose Action
Ctrl+E) - Get detailed explanationCtrl+S) - Get concise summaryCtrl+Q) - Ask a questionInteract with Results
| Shortcut | Action |
|---|---|
Ctrl+O | Open document |
Ctrl+W | Close current tab |
Ctrl+Tab | Switch tabs |
Ctrl+E | Explain selected text |
Ctrl+S | Summarize selected text |
Ctrl+Q | Ask question |
Ctrl+F | Find in document |
Ctrl++ | Zoom in |
Ctrl+- | Zoom out |
Ctrl+0 | Reset zoom |
Ctrl+B | Toggle sidebar |
F5 | Refresh document |
F1 | Help |
Ctrl+, | Settings |
Ctrl+Q | Quit |
Enable voice input and try these commands:
User: Opens a machine learning paper
User: Selects "Transformer architecture"
System: Explains using beginner-level language, noting it requires understanding of attention
User: Clicks follow-up "What is attention?"
System: Explains attention mechanism, updates knowledge state
User: Asks "Show me an example"
System: Provides concrete example with visualization
User: Selects same text a week later
System: Recognizes user now knows attention, provides advanced explanation
User: Asks "How does this compare to RNNs?"
System: Draws comparisons based on known concepts
Create ~/.doc_explainer/config/config.json:
{
"theme": "light",
"llm_provider": "gemini",
"gemini_api_key": "YOUR_GEMINI_API_KEY",
"openai_api_key": "YOUR_OPENAI_API_KEY",
"window": {
"width": 1200,
"height": 800,
"maximized": false
},
"sidebar": {
"visible": true,
"width": 350,
"position": "right"
},
"voice": {
"enabled": true,
"input_device": "default",
"output_enabled": true,
"output_rate": 150,
"output_volume": 0.9
},
"documents": {
"default_zoom": 1.0,
"max_recent": 10,
"auto_save_interval": 5
},
"cache": {
"enabled": true,
"size_mb": 500,
"location": "~/.doc_explainer/cache"
},
"llm": {
"provider": "gemini",
"model": "gemini-1.5-flash",
"temperature": 1.0,
"max_tokens": null
},
"knowledge_graph": {
"enabled": true,
"auto_build": true
},
"memory": {
"enabled": true,
"session_tracking": true
},
"startup": {
"open_last_docs": true,
"check_updates": true,
"show_splash": true
},
"debug": {
"enabled": false,
"log_level": "INFO",
"profiling": false
}
}
Create .env file in project root:
# API Keys
GEMINI_API_KEY=your_gemini_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
# Configuration
DOC_EXPLAINER_THEME=light
DOC_EXPLAINER_DEBUG=false
DOC_EXPLAINER_LOG_LEVEL=INFO
# Paths
DOC_EXPLAINER_CACHE_DIR=~/.doc_explainer/cache
DOC_EXPLAINER_CONFIG_DIR=~/.doc_explainer/config
DOC_EXPLAINER_DATA_DIR=~/.doc_explainer/data
# LLM Settings
DOC_EXPLAINER_LLM_PROVIDER=gemini
DOC_EXPLAINER_LLM_TEMPERATURE=1.0
DOC_EXPLAINER_LLM_MAX_TOKENS=4096
# Feature Flags
DOC_EXPLAINER_ENABLE_VOICE=true
DOC_EXPLAINER_ENABLE_KG=true
DOC_EXPLAINER_ENABLE_MEMORY=true
doc-explainer --help
usage: doc-explainer [-h] [--config CONFIG] [--theme {light,dark,high_contrast,sepia}]
[--debug] [--no-splash] [--log-level {DEBUG,INFO,WARNING,ERROR}]
[--version] [--profile] [--reset-config] [--clear-cache]
[document]
Doc Explainer - Intelligent Document Explanation System
positional arguments:
document Document to open (PDF, TXT, HTML, etc.)
options:
-h, --help show this help message and exit
--config CONFIG, -c CONFIG
Configuration file path
--theme {light,dark,high_contrast,sepia}, -t {light,dark,high_contrast,sepia}
Theme to use
--debug, -d Enable debug mode
--no-splash Disable splash screen
--log-level {DEBUG,INFO,WARNING,ERROR}
Set logging level
--version, -v show program's version number and exit
--profile Enable performance profiling
--reset-config Reset configuration to defaults
--clear-cache Clear application cache
DocumentProcessorfrom src.core.document import DocumentProcessor
processor = DocumentProcessor()
doc_id = processor.load_document("path/to/file.pdf")
tree = processor.build_document_tree(doc_id)
AdaptiveExplainerfrom src.core.explanation_engine import AdaptiveExplainer
explainer = AdaptiveExplainer(style="intermediate")
explanation = explainer.explain(text, context)
summary = explainer.summarize(text, context)
answer = explainer.ask(question, context)
KnowledgeGraphfrom src.core.knowledge import KnowledgeGraph
kg = KnowledgeGraph()
kg.add_concept("attention")
kg.add_relationship("transformer", "depends_on", "attention")
prereqs = kg.get_prerequisites("transformer")
UserManagerfrom src.core.user import UserManager
user_manager = UserManager("user123")
state = user_manager.get_user_knowledge()
user_manager.update_knowledge({"concept": "attention", "correct": True})
# Register document
POST /api/documents
{"path": "/path/to/file.pdf"}
# Get explanation
POST /api/explain
{
"doc_id": "123",
"text": "selected text",
"section_id": 5
}
# Ask question
POST /api/ask
{
"doc_id": "123",
"question": "What is attention?",
"section_id": 5
}
# Get user state
GET /api/user/{user_id}/knowledge
doc-explainer/
├── src/
│ ├── core/ # Core modules
│ │ ├── document/ # Document processing
│ │ ├── memory/ # Memory management
│ │ ├── knowledge/ # Knowledge graph
│ │ ├── explanation/ # Explanation engine
│ │ ├── user/ # User modeling
│ │ └── agent/ # LLM interaction
│ ├── orchestrator/ # Pipeline coordination
│ ├── store/ # Data persistence
│ ├── ui/ # User interface
│ │ ├── gui/ # Qt GUI
│ │ └── web/ # Web interface (optional)
│ └── cli/ # Command line interface
├── tests/ # Unit tests
├── docs/ # Documentation
├── examples/ # Example notebooks
├── scripts/ # Utility scripts
├── data/ # Data directory
├── config/ # Configuration files
├── requirements.txt # Dependencies
├── setup.py # Package setup
├── README.md # This file
└── LICENSE # MIT License
# Clone repository
git clone https://github.com/yourusername/doc-explainer.git
cd doc-explainer
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install with dev dependencies
pip install -e .[dev]
# Install pre-commit hooks
pre-commit install
# Run tests
pytest tests/ -v
# Run with coverage
pytest --cov=src tests/
# Build documentation
cd docs
make html
This project follows:
# Format code
black src/
isort src/
# Type check
mypy src/
# Lint
pylint src/
# Run all tests
pytest
# Run specific test file
pytest tests/test_document.py
# Run with verbose output
pytest -v
# Run with coverage report
pytest --cov=src --cov-report=html
# Run GUI tests (headless)
pytest tests/test_gui.py --qt
# Build source and wheel distributions
python -m build
# Upload to PyPI (if publishing)
twine upload dist/*
We welcome contributions! Please see our Contributing Guide.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)Please read our Code of Conduct before contributing.
This project is licensed under the MIT License - see the LICENSE file for details.