# Text Extractors

Biblicus provides a plugin-based text extraction system supporting diverse document types, media formats, and processing strategies.

**Extractor Families**

- [Text & Document Processing](extractors-text-document-index.html)
- [Optical Character Recognition (OCR)](extractors-ocr-index.html)
- [Vision-Language Models (VLM) for Document Understanding](extractors-vlm-document-index.html)
- [Speech-to-Text (STT)](extractors-speech-to-text-index.html)
- [Pipeline Utilities](extractors-pipeline-utilities-index.html)

## Extractor Categories

### [Text & Document Processing](extractors-text-document-index.html)

Basic text extraction from structured documents and plain text formats.

- [**pass-through-text**](extractors-text-document-pass-through.html) - Returns existing extracted text without re-extraction
- [**metadata-text**](extractors-text-document-metadata.html) - Extracts text from item metadata (title, tags, etc.)
- [**pdf-text**](extractors-text-document-pdf.html) - Extracts text from PDF documents using pypdf
- [**markitdown**](extractors-text-document-markitdown.html) - Microsoft MarkItDown for Office documents and web content
- [**unstructured**](extractors-text-document-unstructured.html) - Unstructured.io for complex document parsing

### [Optical Character Recognition (OCR)](extractors-ocr-index.html)

Traditional OCR for extracting text from images and scanned documents.

- [**ocr-rapidocr**](extractors-ocr-rapidocr.html) - RapidOCR for fast ONNX-based text recognition
- [**ocr-paddleocr-vl**](extractors-ocr-paddleocr-vl.html) - PaddleOCR vision-language model for document understanding

### [Vision-Language Models (VLM)](extractors-vlm-document-index.html)

Advanced VLM-based document understanding with layout analysis and structured extraction.

- [**docling-smol**](extractors-vlm-document-docling-smol.html) - SmolDocling-256M for fast document processing
- [**docling-granite**](extractors-vlm-document-docling-granite.html) - Granite Docling-258M for high-accuracy extraction

### [Speech-to-Text (STT)](extractors-speech-to-text-index.html)

Audio transcription for spoken content in video and audio files.

- [**stt-openai**](extractors-speech-to-text-openai.html) - OpenAI Whisper API for audio transcription
- [**stt-deepgram**](extractors-speech-to-text-deepgram.html) - Deepgram Nova-2 for fast, accurate transcription
- [**stt-aldea**](extractors-speech-to-text-aldea.html) - Aldea Speech-to-Text API for audio transcription
- [**deepgram-transform**](extractors-speech-to-text-deepgram-transform.html) - Render structured Deepgram metadata into text

### [Pipeline Utilities](extractors-pipeline-utilities-index.html)

Meta-extractors for combining, selecting, and orchestrating extraction strategies.

- [**select-text**](extractors-pipeline-utilities-select-text.html) - Selects first successful extractor from a list
- [**select-longest-text**](extractors-pipeline-utilities-select-longest.html) - Selects longest output from multiple extractors
- [**select-override**](extractors-pipeline-utilities-select-override.html) - Overrides extraction for specific items by ID
- [**select-smart-override**](extractors-pipeline-utilities-select-smart-override.html) - Overrides extraction based on media type patterns
- [**pipeline**](extractors-pipeline-utilities-pipeline.html) - Chains multiple extractors sequentially

## Quick Start

### Installation

Most extractors require optional dependencies:

```bash
# Basic text extraction (included by default)
pip install biblicus

# OCR extractors
pip install biblicus[ocr]           # RapidOCR
pip install biblicus[paddleocr]     # PaddleOCR VL

# VLM document understanding
pip install biblicus[docling]       # Docling (Transformers backend)
pip install biblicus[docling-mlx]   # Docling (MLX backend for Apple Silicon)

# Speech-to-text
pip install biblicus[openai]        # OpenAI Whisper
pip install biblicus[deepgram]      # Deepgram Nova-2

# Document processing
pip install biblicus[markitdown]    # MarkItDown (Python 3.10+)
pip install biblicus[unstructured]  # Unstructured.io
```

### Basic Usage

#### Command Line

```bash
# Initialize corpus
biblicus init my-corpus

# Ingest documents
biblicus ingest my-corpus document.pdf

# Extract text with specific extractor
biblicus extract my-corpus --extractor pdf-text
```

#### Python API

```python
from biblicus import Corpus

# Load corpus
corpus = Corpus.from_directory("my-corpus")

# Extract text using an extractor
results = corpus.extract_text(extractor_id="pdf-text")
```

## Choosing an Extractor

### For PDF Documents

- **Simple PDFs with text layers**: Use [pdf-text](extractors-text-document-pdf.html) (fast, no dependencies)
- **Scanned PDFs or complex layouts**: Use [ocr-rapidocr](extractors-ocr-rapidocr.html) or VLM extractors
- **Tables, equations, complex structure**: Use [docling-granite](extractors-vlm-document-docling-granite.html)

### For Office Documents

- **DOCX, XLSX, PPTX**: Use [markitdown](extractors-text-document-markitdown.html) or [unstructured](extractors-text-document-unstructured.html)
- **Complex layouts or scanned documents**: Use VLM extractors

### For Images

- **Simple text recognition**: Use [ocr-rapidocr](extractors-ocr-rapidocr.html)
- **Complex documents in images**: Use [ocr-paddleocr-vl](extractors-ocr-paddleocr-vl.html) or VLM extractors

### For Audio/Video

- **High accuracy, cost-effective**: Use [stt-deepgram](extractors-speech-to-text-deepgram.html)
- **OpenAI ecosystem integration**: Use [stt-openai](extractors-speech-to-text-openai.html)

### For Multiple Strategies

- **Fallback chain**: Use [select-text](extractors-pipeline-utilities-select-text.html)
- **Best output selection**: Use [select-longest-text](extractors-pipeline-utilities-select-longest.html)
- **Per-item overrides**: Use [select-override](extractors-pipeline-utilities-select-override.html) or [select-smart-override](extractors-pipeline-utilities-select-smart-override.html)

## See Also

- [extraction.md](extraction.html) - Extraction pipeline concepts and architecture
- [API Reference](../api-reference/api.html) - Python API documentation
- Repository README - Getting started guide
