Skip to content
Back to skills

897 Feature Text Canonicalizer 3b760055

ASecurity

Technical design for the text normalization module.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
developmentapiperformance

Works with

  • api

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 897-feature-text-canonicalizer_3b760055 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 897 Feature Text Canonicalizer 3b760055?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 897 Feature Text Canonicalizer 3b760055
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-897-feature-text-canonicalizer-3b760055/badge)](https://www.skillsdirectory.com/skills/tools-only-897-feature-text-canonicalizer-3b760055)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
phase: design
title: System Design - Text Canonicalizer
description: Technical design for the text normalization module.
---

# System Design & Architecture

## Architecture Overview
**What is the high-level system structure?**

The `text_canonicalizer` is a utility in the `validation` namespace. It is used by both PDF and EPUB extractors before passing text to the validator.

```mermaid
graph TD
    PDF[PDF Text] --> Canonicalizer[text_canonicalizer.py]
    EPUB[EPUB Text] --> Canonicalizer
    Canonicalizer --> Segmenter[text_segmenter.py]
    Segmenter --> Checker[Completeness/Order Checker]
```

## Data Models
**What data do we need to manage?**

- **Ligature Map:** A dictionary of Unicode ligatures and their multi-character expansions.
- **CanonicalizationConfig:** Toggle for conservative/aggressive modes.

## API Design
**How do components communicate?**

### Primary Interface
- `canonicalize(text: str, aggressive: bool = False) -> str`
- `resolve_ligatures(text: str) -> str`
- `remove_hyphenation(text: str) -> str`

## Component Breakdown
**What are the major building blocks?**

- **Unicode Normalizer:** Uses `unicodedata.normalize('NFKC', text)`.
- **Ligature Resolver:** Regex-based replacement of common ligatures.
- **Hyphenation Cleaner:** Logic to detect and remove end-of-line hyphens (e.g. `-\s*\n`).

## Design Decisions
**Why did we choose this approach?**

- **NFKC:** We chose Compatibility Decomposition followed by Canonical Composition (NFKC) because it handles many formatting differences (like super/subscripts or precomposed characters) that might differ between PDF and EPUB.
- **Regex for hyphens:** More robust than simple string replacement for handling whitespace around hyphens.

## Non-Functional Requirements
**How should the system perform?**

- **Correctness:** Must not introduce new words or change word order.
- **Performance:** Stream-friendly or efficient string builders.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.