> ## Documentation Index
> Fetch the complete documentation index at: https://docs.myspellchecker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Multi-layer validation architecture with a 12-strategy pipeline, from deterministic syllable rules to ONNX-powered AI inference.

The core design principle is **fail fast, go deeper only when needed**. Cheap deterministic checks (syllable structure, dictionary lookups) run first and reject \~90% of errors before expensive operations (N-gram context, grammar rules, AI inference) are ever invoked. Each layer receives only the output that passed the layer below.

## Design Philosophy

Myanmar text has no spaces between words, so splitting on whitespace doesn't work. Instead, the pipeline starts from syllables and builds up:

1. **Break into syllables** (deterministic, fast)
2. **Validate syllables** (catches \~90% of errors)
3. **Assemble into words** (only with valid syllables)
4. **Check grammar and context** (only with valid words)

This "fail-fast" approach catches obvious typos immediately without wasting resources on deeper analysis.

## High-Level Architecture

```text theme={null}
  +------------------+
  |   User Input     |
  +--------+---------+
           |
           v
  +------------------+
  |    Segmenter     |
  | (Syllable/Word)  |
  +--------+---------+
           |
           +----------+----------+----------+
           |          |          |          |
           v          v          v          v
  +--------+  +------+--+  +---+----+  +--+-------+
  | Layer 1 |  | Layer 2  |  | L 2.5  |  | Layer 3  |
  |Syllable |  | Word     |  |Grammar |  | Context  |
  |Validator|  |Validator |  |Rules   |  |Validator |
  +---------+  +---------+  +--------+  +----------+
           |          |          |          |
           +----------+----------+----------+
           |
           v
  +------------------+       +------------------+
  | Dictionary       |       |    Response       |
  | Provider         | ----> | (errors,          |
  | (SQLite/Memory)  |       |  suggestions,     |
  +------------------+       |  corrected_text)  |
                              +------------------+
```

## Core Components

| Component               | Purpose                                                  |
| ----------------------- | -------------------------------------------------------- |
| **SpellChecker**        | Main coordinator that orchestrates all validation layers |
| **SpellCheckerBuilder** | Fluent interface for constructing SpellChecker instances |
| **DictionaryProvider**  | Pluggable storage backend (SQLite, Memory, JSON)         |
| **Segmenter**           | Text segmentation (syllable + word)                      |
| **SyllableValidator**   | Layer 1: syllable structure validation                   |
| **WordValidator**       | Layer 2: word lookup + SymSpell suggestions              |
| **ContextValidator**    | Layer 3: N-gram + validation strategies                  |

## Validation Strategies

The context validation layer uses a Strategy pattern for modular, priority-ordered validation:

<Tree>
  <Tree.Folder name="ValidationStrategy (interface)" defaultOpen>
    <Tree.File name="ToneValidationStrategy (10)" />

    <Tree.File name="OrthographyValidationStrategy (15)" />

    <Tree.File name="SyntacticValidationStrategy (20)" />

    <Tree.File name="StatisticalConfusableStrategy (24)" />

    <Tree.File name="BrokenCompoundStrategy (25)" />

    <Tree.File name="POSSequenceValidationStrategy (30)" />

    <Tree.File name="QuestionStructureValidationStrategy (40)" />

    <Tree.File name="HomophoneValidationStrategy (45)" />

    <Tree.File name="ConfusableCompoundClassifierStrategy (47), AI, opt-in" />

    <Tree.File name="ConfusableSemanticStrategy (48), AI, opt-in" />

    <Tree.File name="NgramContextValidationStrategy (50)" />

    <Tree.File name="SemanticValidationStrategy (70), AI, opt-in" />
  </Tree.Folder>
</Tree>

Each strategy can be enabled/disabled via configuration. See [Validation Strategies](/features/validation-strategies).

## Offline Systems

### Data Pipeline

Transforms raw corpus into optimized dictionary database:

<Steps>
  <Step title="Raw Corpus" />

  <Step title="Ingester" />

  <Step title="Segmenter" />

  <Step title="Frequency Builder" />

  <Step title="Packager" />

  <Step title="SQLite DB" />
</Steps>

### Training Pipeline

Creates AI models for semantic checking (BYOM):

<Steps>
  <Step title="Corpus" />

  <Step title="Tokenizer Training" />

  <Step title="Pre-training (MLM)" />

  <Step title="Export (ONNX)" />

  <Step title="Quantization" />
</Steps>

## Design Principles

1. **Fail Fast**: Catch errors at the earliest possible layer
2. **Layered Validation**: Each layer adds accuracy at a cost
3. **Pluggable Components**: Swap providers, segmenters, taggers
4. **Graceful Degradation**: Continue working even if optional components fail
5. **Performance First**: Optimize hot paths with Cython/OpenMP

## Architecture Documents

<CardGroup cols={2}>
  <Card title="System Design" icon="sitemap" href="/architecture/system-design">
    Detailed component architecture and class responsibilities
  </Card>

  <Card title="Validation Pipeline" icon="layer-group" href="/architecture/validation-pipeline">
    Pipeline deep-dive with execution flow
  </Card>

  <Card title="Component Diagram" icon="diagram-project" href="/architecture/component-diagram">
    Visual component relationships
  </Card>

  <Card title="Data Flow" icon="arrows-turn-right" href="/architecture/data-flow">
    Data flow through the system
  </Card>

  <Card title="Extension Points" icon="puzzle-piece" href="/architecture/extension-points">
    How to extend the system
  </Card>

  <Card title="Dependency Injection" icon="plug" href="/architecture/dependency-injection">
    DI container system
  </Card>
</CardGroup>
