# campusx-official/langchain-text-splitters architecture

> Architecture diagram of the GitHub repository campusx-official/langchain-text-splitters, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/campusx-official/langchain-text-splitters
- Repository: https://github.com/campusx-official/langchain-text-splitters

## Overview

This repository is a set of standalone Python demonstrations of document and text chunking, not a unified application. Each script prepares sample text or loads a PDF, configures a splitting strategy, and prints a result. The examples cover length-based, general recursive, Markdown-aware, Python-aware, and embedding-driven semantic splitting. Edges reflect calls visible in the excerpts; external libraries are shown as dependencies, not as repository modules.

Main entry points: [`semantic_meaning_based.py`](https://github.com/campusx-official/langchain-text-splitters/blob/main/semantic_meaning_based.py) (Semantic split), [`length_based.py`](https://github.com/campusx-official/langchain-text-splitters/blob/main/length_based.py) (PDF length split), [`text_structure_based.py`](https://github.com/campusx-official/langchain-text-splitters/blob/main/text_structure_based.py) (Text structure split), [`markdown_splitting.py`](https://github.com/campusx-official/langchain-text-splitters/blob/main/markdown_splitting.py) (Markdown split)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_length_demo["PDF length split<br/>[length_based.py]"]
node_pdf_loader["PDF loader"]
node_character_splitter["Character splitter"]
node_text_structure_demo["Text structure split"]
node_recursive_splitter["Recursive splitter"]
node_markdown_demo["Markdown split"]
node_python_demo["Python code split"]
node_semantic_demo["Semantic split"]
node_semantic_chunker["Semantic chunker"]
node_openai_embeddings["OpenAI embeddings"]
node_dotenv["Environment loader"]

node_length_demo -->|"loads PDF"| node_pdf_loader
node_length_demo -->|"splits documents"| node_character_splitter
node_text_structure_demo -->|"splits text"| node_recursive_splitter
node_markdown_demo -->|"splits Markdown"| node_recursive_splitter
node_python_demo -->|"splits Python"| node_recursive_splitter
node_semantic_demo -->|"creates documents"| node_semantic_chunker
node_semantic_demo -->|"configures embeddings"| node_openai_embeddings
node_semantic_demo -->|"loads environment"| node_dotenv

click node_length_demo "https://github.com/campusx-official/langchain-text-splitters/blob/main/length_based.py"
click node_text_structure_demo "https://github.com/campusx-official/langchain-text-splitters/blob/main/text_structure_based.py"
click node_markdown_demo "https://github.com/campusx-official/langchain-text-splitters/blob/main/markdown_splitting.py"
click node_python_demo "https://github.com/campusx-official/langchain-text-splitters/blob/main/python_code_splitting.py"
click node_semantic_demo "https://github.com/campusx-official/langchain-text-splitters/blob/main/semantic_meaning_based.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_length_demo,node_text_structure_demo,node_markdown_demo,node_python_demo,node_semantic_demo toneTeal
class node_pdf_loader,node_character_splitter,node_recursive_splitter,node_semantic_chunker,node_openai_embeddings,node_dotenv toneIndigo
```

## Components

### Other components

- [PDF length split](https://github.com/campusx-official/langchain-text-splitters/blob/main/length_based.py): `length_based.py`
- **PDF loader**
- **Character splitter**
- [Text structure split](https://github.com/campusx-official/langchain-text-splitters/blob/main/text_structure_based.py): `text_structure_based.py`
- **Recursive splitter**
- [Markdown split](https://github.com/campusx-official/langchain-text-splitters/blob/main/markdown_splitting.py): `markdown_splitting.py`
- [Python code split](https://github.com/campusx-official/langchain-text-splitters/blob/main/python_code_splitting.py): `python_code_splitting.py`
- [Semantic split](https://github.com/campusx-official/langchain-text-splitters/blob/main/semantic_meaning_based.py): `semantic_meaning_based.py`
- **Semantic chunker**
- **OpenAI embeddings**
- **Environment loader**

## Connections

- PDF length split → PDF loader: loads PDF (evidence: `length_based.py`)
- PDF length split → Character splitter: splits documents (evidence: `length_based.py`)
- Text structure split → Recursive splitter: splits text (evidence: `text_structure_based.py`)
- Markdown split → Recursive splitter: splits Markdown (evidence: `markdown_splitting.py`)
- Python code split → Recursive splitter: splits Python (evidence: `python_code_splitting.py`)
- Semantic split → Semantic chunker: creates documents (evidence: `semantic_meaning_based.py`)
- Semantic split → OpenAI embeddings: configures embeddings (evidence: `semantic_meaning_based.py`)
- Semantic split → Environment loader: loads environment (evidence: `semantic_meaning_based.py`)
