Skip to content
Back to skills

897 Feature Text Canonicalizer F606824a

ASecurity

Define requirements for text normalization to ensure consistent comparison between PDF and EPUB.

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

Security analysis

A100/100

Scanned October 11, 2026

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

Installs into .claude/skills of the current project.

Are you the author of 897 Feature Text Canonicalizer F606824a?

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

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

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

SKILL.md
---
phase: requirements
title: Requirements - Text Canonicalizer
description: Define requirements for text normalization to ensure consistent comparison between PDF and EPUB.
---

# Requirements & Problem Understanding

## Problem Statement
**What problem are we solving?**

- PDF and EPUB files often represent the same text using different character sequences (e.g., ligatures like "fi" instead of "fi").
- Text extraction from PDF often includes soft hyphens or end-of-line hyphens ("word- \n wrap") that break word comparison.
- To perform accurate validation (completeness and order checks), we need a "canonical" version of the text that is identical regardless of the source file's quirks.

## Goals & Objectives
**What do we want to achieve?**

- **Unicode Normalization:** Use NFKC to unify character representations.
- **Ligature Resolution:** Decompose ligatures (e.g., "fl" -> "fl", "æ" -> "ae").
- **Hyphenation Cleanup:** Remove end-of-line hyphens and unify various hyphen characters.
- **Whitespace Handling:** While `text_segmenter` handles basic whitespace, the canonicalizer should ensure consistent encoding.
- **Idempotency:** Running the canonicalizer multiple times should not change the output after the first run.

## User Stories & Use Cases
**How will users interact with the solution?**

- As a developer, I want to pass "extact-from-pdf" text and get "clean-compare-ready" text.
- As a validator, I want to be sure that `canonicalize(pdf_text) == canonicalize(epub_text)` if the words are the same.
- As a system, I want two modes: `conservative` (safe) and `aggressive` (for heavy OCR/PDF artifacts).

## Success Criteria
**How will we know when we're done?**

- `pdf_to_epub/validation/text_canonicalizer.py` is implemented.
- Ligatures are correctly expanded.
- End-of-line hyphens are removed.
- 100% test coverage including complex Unicode edge cases.

## Constraints & Assumptions
**What limitations do we need to work within?**

- Must be fast enough for large texts.
- Should not remove meaningful punctuation (unless specified in aggressive mode).
- Assumption: Input is UTF-8 encoded string.

## Questions & Open Items
**What do we still need to clarify?**

- Do we need to handle specific OCR artifacts like "rn" instead of "m"? (Decision: Keep it for 'aggressive' mode only).
- Should we lowercase by default? (Decision: No, let the specific checker decide on case-sensitivity).

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.