refactor(parser): extract text normalizer #103

Merged
TimCane merged 2 commits from feat/90-extract-text-normalizer into main 2026-07-07 10:33:52 +01:00
TimCane commented 2026-07-07 10:24:16 +01:00 (Migrated from github.com)

Summary

  • Add ITextNormalizer + BasicNormalizer under Parsing/Normalization, doing generic line normalization only: trim + whitespace collapse (A2 of the ADR-0006 pipeline extraction, epic #77).
  • ReceiptParseEngine normalizes each line through the normalizer instead of the inline Trim(); CleanName's #code/@unit stripping stays put (item-name concern for #92), no misread fixing (#96).
  • Behaviour-preserving: static ReceiptParser.Parse facade, OcrWorker call site, pure Domain and long minor units all unchanged.
  • Document the extracted normalizer in docs/06 (parsing) and docs/11 (testing); no wire-contract change so docs/03-05 untouched.

Test plan

  • dotnet build backend/BillSplitter.sln
  • dotnet test backend/tests/BillSplitter.Tests/BillSplitter.Tests.csproj - 85/85 green, 33-fixture corpus byte-identical.

Closes #90

## Summary - Add `ITextNormalizer` + `BasicNormalizer` under `Parsing/Normalization`, doing generic line normalization only: trim + whitespace collapse (A2 of the ADR-0006 pipeline extraction, epic #77). - `ReceiptParseEngine` normalizes each line through the normalizer instead of the inline `Trim()`; `CleanName`'s `#code`/`@unit` stripping stays put (item-name concern for #92), no misread fixing (#96). - Behaviour-preserving: static `ReceiptParser.Parse` facade, `OcrWorker` call site, pure Domain and `long` minor units all unchanged. - Document the extracted normalizer in docs/06 (parsing) and docs/11 (testing); no wire-contract change so docs/03-05 untouched. ## Test plan - `dotnet build backend/BillSplitter.sln` - `dotnet test backend/tests/BillSplitter.Tests/BillSplitter.Tests.csproj` - 85/85 green, 33-fixture corpus byte-identical. Closes #90
Sign in to join this conversation.
No description provided.