TextPostprocessor<T>

Models & Types ยท AiDotNet.Postprocessing.Document

TextPostprocessor - OCR text postprocessing utilities.

Inheritance: PostprocessorBase<T, string, string> โ†’ TextPostprocessor<T>

Implements: IDisposable

For Beginners

OCR output often contains errors and formatting issues. This tool cleans up the text:

  • Remove unwanted characters
  • Fix common OCR errors
  • Normalize whitespace
  • Correct formatting

Key features:

  • Character normalization
  • Whitespace handling
  • Common OCR error correction
  • Language-aware processing

Example usage:

How It Works

TextPostprocessor provides a comprehensive pipeline for cleaning and correcting text output from OCR systems, improving readability and accuracy.

Constructors

Constructor Summary
TextPostprocessor() Creates a new TextPostprocessor with default options.
TextPostprocessor(TextPostprocessorOptions options) Creates a new TextPostprocessor with specified options.

Properties

Property Summary
bool SupportsInverse { get; } Text postprocessor supports inverse transformation (returns original).

Methods

Method Summary
IList<string> ExtractParagraphs(string text) Extracts paragraphs from processed text.
IList<string> ExtractSentences(string text) Extracts sentences from processed text.
string FixCommonOcrErrors(string text) Fixes common OCR recognition errors.
string MergeBrokenLines(string text) Merges lines that were incorrectly broken.
string NormalizeCharacters(string text) Normalizes special characters to ASCII equivalents.
string NormalizeWhitespace(string text) Normalizes whitespace in the text.
string RemoveControlCharacters(string text) Removes control characters from text.
string RemoveDuplicateSpaces(string text) Removes duplicate consecutive spaces.
string RemoveHeadersFooters(string text, int headerLines, int footerLines) Removes headers and footers from document text.
string RemovePageNumbers(string text) Removes page numbers from text.
void Dispose()