refactor(parser): extract text normalizer #90

Closed
opened 2026-07-07 09:26:14 +01:00 by TimCane · 0 comments
TimCane commented 2026-07-07 09:26:14 +01:00 (Migrated from github.com)

Parent: #77 (Phase A, step 2). Invariants live in the epic.

Extract line-level text normalization behind an interface, behaviour identical.

Anchors

  • ReceiptParser.cs:87 - per-line Trim() in the candidate loop.
  • ReceiptParser.cs:76 - Whitespace() collapse regex.
  • ReceiptParser.cs:237-243 - CleanName (note: also strips #code and
    @unit - those are item-name concerns, leave them for #92, keep A2 to generic
    line normalization).

Steps

  1. Add ITextNormalizer in Parsing/Normalization + a BasicNormalizer
    implementation doing trim + whitespace collapse only.
  2. Engine normalizes each line's text through it instead of the inline Trim().

Done

  • Corpus 100% green, byte-identical output.
  • No character-misread fixing here (that is #96).
Parent: #77 (Phase A, step 2). Invariants live in the epic. Extract line-level text normalization behind an interface, behaviour identical. ## Anchors - `ReceiptParser.cs:87` - per-line `Trim()` in the candidate loop. - `ReceiptParser.cs:76` - `Whitespace()` collapse regex. - `ReceiptParser.cs:237-243` - `CleanName` (note: also strips `#code` and `@unit` - those are item-name concerns, leave them for #92, keep A2 to generic line normalization). ## Steps 1. Add `ITextNormalizer` in `Parsing/Normalization` + a `BasicNormalizer` implementation doing trim + whitespace collapse only. 2. Engine normalizes each line's text through it instead of the inline `Trim()`. ## Done - [ ] Corpus 100% green, byte-identical output. - [ ] No character-misread fixing here (that is #96).
Sign in to join this conversation.
No description provided.