SpellCorrection<T>

Models & Types ยท AiDotNet.Postprocessing.Document

SpellCorrection - Spell checking and correction for OCR output.

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

Implements: IDisposable

For Beginners

OCR systems often misread characters, resulting in misspelled words. This tool corrects them:

  • Detects misspelled words
  • Suggests corrections based on edit distance
  • Uses context for better accuracy
  • Handles domain-specific vocabulary

Key features:

  • Edit distance-based suggestions
  • Custom dictionary support
  • Context-aware correction
  • OCR-specific error patterns

Example usage:

How It Works

SpellCorrection provides spell checking and automatic correction capabilities specifically designed for OCR output, which has different error patterns than normal typing errors.

Constructors

Constructor Summary
SpellCorrection() Creates a new SpellCorrection instance with default settings.
SpellCorrection(int maxEditDistance) Creates a new SpellCorrection instance with specified max edit distance.

Properties

Property Summary
bool SupportsInverse { get; } Spell correction does not support inverse transformation.

Methods

Method Summary
IList<string> GetSuggestions(string word, int maxSuggestions) Gets correction suggestions for a misspelled word.
bool IsCorrect(string word) Checks if a word is spelled correctly.
void AddToDictionary(IEnumerable<string> words) Adds multiple words to the custom dictionary.
void AddToDictionary(string word) Adds multiple words to the custom dictionary.
void Dispose()
void LoadDictionary(IEnumerable<string> words) Loads a custom dictionary from words.