Skip to main content

Parsing

R2R supports different parsing providers to extract text from various document formats. To configure the parsing provider:
example r2r.toml
Available providers:
  • r2r: Default offering for light installations, a simple and lightweight parser included in R2R.
  • unstructured_local: Default offering for full installations, makes use of open source Unstructured package.
  • unstructured_api: Cloud offering of Unstructured

Supported File Types

R2R supports parsing for the following file types:
  • BMP (Bitmap Image)
  • CSV (Comma-Separated Values)
  • DOC (Microsoft Word Document)
  • DOCX (Microsoft Word Document)
  • EML (Electronic Mail)
  • EPUB (Electronic Publication)
  • GIF (Graphics Interchange Format)
  • HEIC (High-Efficiency Image Format)
  • HTM (HyperText Markup)
  • HTML (HyperText Markup Language)
  • JPEG (Joint Photographic Experts Group)
  • JPG (Joint Photographic Experts Group)
  • JSON (JavaScript Object Notation)
  • MD (Markdown)
  • MSG (Microsoft Outlook Message)
  • MP3 (MPEG Audio Layer III)
  • MP4 (MPEG-4 Part 14)
  • ODT (Open Document Text)
  • ORG (Org Mode)
  • PDF (Portable Document Format)
  • P7S (PKCS#7)
  • PNG (Portable Network Graphics)
  • PPT (PowerPoint)
  • PPTX (Microsoft PowerPoint Presentation)
  • RST (reStructured Text)
  • RTF (Rich Text Format)
  • SVG (Scalable Vector Graphics)
  • TSV (Tab-Separated Values)
  • TXT (Plain Text)
  • XLS (Microsoft Excel Spreadsheet)
  • XLSX (Microsoft Excel Spreadsheet)
  • XML (Extensible Markup Language)
  • TIFF (Tagged Image File Format)
  • MP4 (MPEG-4 Part 14)
Parsing providers for an R2R system cannot be configured at runtime and are instead configured server side.
Refer to the Unstructured documentation for details about their ingestion capabilities and limitations.

Chunking

R2R uses chunking to break down parsed documents into smaller, manageable pieces for efficient processing and retrieval. Configure the chunking settings in r2r.toml:
r2r.toml
Key chunking configuration options:
  • provider: The chunking provider (defaults to “r2r”).
For R2R:
  • chunking_strategy: The chunking method (“recursive”).
  • chunk_size: The target size for each chunk.
  • chunk_overlap: The number of characters to overlap between chunks.
  • excluded_parsers: List of parsers to exclude (e.g., [“mp4”]).
For Unstructured:
  • strategy: The overall chunking strategy (“auto”, “fast”, or “hi_res”).
  • chunking_strategy: The specific chunking method (“by_title” or “basic”).
  • new_after_n_chars: Soft maximum size for a chunk.
  • max_characters: Hard maximum size for a chunk.
  • combine_under_n_chars: Minimum size for combining small sections.
  • overlap: Number of characters to overlap between chunks.

Supported Providers

This is the default full provider, using the open-source Unstructured library for local processing.

Advanced Configuration Options

When using the Unstructured chunking provider, you can specify additional parameters in the configuration file:
These options allow fine-tuning of the chunking process for specific document types or requirements. Refer to the Unstructured documentation here for more details on the available settings.

Runtime Configuration

The chunking configuration can be specified at runtime with the ingest_files endpoint, allowing dynamic adjustment of chunking parameters based on the input documents or specific use cases.

Combining Chunking with Other R2R Components

Chunking is a crucial part of the document processing pipeline in R2R. It works in conjunction with other components such as parsing, embedding, and retrieval. For example:
For more detailed information on configuring chunking and other ingestion settings, please refer to the Ingestion Configuration documentation.

Next Steps

To learn more about configuring other components of R2R, explore the following pages: