# shner-elmo/flashtext2 architecture

> Architecture diagram of the GitHub repository shner-elmo/flashtext2, 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/shner-elmo/flashtext2
- Repository: https://github.com/shner-elmo/flashtext2

## Overview

flashtext2 is a small Python-facing keyword extraction and replacement library backed by a Rust keyword processor. Users configure a processor with keywords, then extract matches (optionally with spans) or replace them; the wrapper dispatches these operations to the Rust engine. The README documents Unicode tokenization, case folding, case sensitivity, and longest-match behavior. The engine implementation is not present in the supplied tree, so its internal stages are not mapped.

Main entry points: [`src/lib.rs`](https://github.com/shner-elmo/flashtext2/blob/master/src/lib.rs) (Keyword API)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Python caller"))
node_api["Keyword API<br/>[lib.rs]"]
node_engine["Rust processor"]

node_user -->|"configures and invokes"| node_api
node_api -->|"dispatches keyword operations"| node_engine

click node_api "https://github.com/shner-elmo/flashtext2/blob/master/src/lib.rs"

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_user,node_engine toneIndigo
class node_api toneMint
```

## Components

### Other components

- **Python caller**
- [Keyword API](https://github.com/shner-elmo/flashtext2/blob/master/src/lib.rs): `src/lib.rs`
- **Rust processor**

## Connections

- Python caller → Keyword API: configures and invokes (evidence: `README.md`)
- Keyword API → Rust processor: dispatches keyword operations (evidence: `src/lib.rs`)
