Getting the list of misspelled words

Contents
[ ]

Aspose.OCR can automatically generate a list of misspelled words found in an image and their suggested replacements in descending order of suitability. This list is fetched using GetSpellCheckErrorList method of Aspose.OCR.RecognitionResult object.

This functionality supports the following languages:

Value Language
Aspose.OCR.SpellChecker.SpellCheckLanguage.Cze Czech
Aspose.OCR.SpellChecker.SpellCheckLanguage.Dan Danish
Aspose.OCR.SpellChecker.SpellCheckLanguage.Deu German
Aspose.OCR.SpellChecker.SpellCheckLanguage.Dum Dutch
Aspose.OCR.SpellChecker.SpellCheckLanguage.Eng English
Aspose.OCR.SpellChecker.SpellCheckLanguage.Est Estonian
Aspose.OCR.SpellChecker.SpellCheckLanguage.Fin Finnish
Aspose.OCR.SpellChecker.SpellCheckLanguage.Fra French
Aspose.OCR.SpellChecker.SpellCheckLanguage.Ita Italian
Aspose.OCR.SpellChecker.SpellCheckLanguage.Lav Latvian
Aspose.OCR.SpellChecker.SpellCheckLanguage.Lit Lithuanian
Aspose.OCR.SpellChecker.SpellCheckLanguage.Pol Polish
Aspose.OCR.SpellChecker.SpellCheckLanguage.Por Portuguese
Aspose.OCR.SpellChecker.SpellCheckLanguage.Rum Romanian
Aspose.OCR.SpellChecker.SpellCheckLanguage.Slk Slovak
Aspose.OCR.SpellChecker.SpellCheckLanguage.Slv Slovene
Aspose.OCR.SpellChecker.SpellCheckLanguage.Spa Spanish
Aspose.OCR.SpellChecker.SpellCheckLanguage.Swe Swedish

Found errors and suggested substitutions are provided as a list of SpellCheckError objects. The substitutions are ordered by Levenshtein distance from the misspelled word, so the most likely replacements come first.

Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add an image to OcrInput object
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.SingleImage);
input.Add("source.png");
// Recognize image
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.Recognize(input);
// Output misspelled words
foreach(var correction in results[0].GetSpellCheckErrorList(Aspose.OCR.SpellChecker.SpellCheckLanguage.Eng))
{
	Console.WriteLine($@"Found misspelled word ""{correction.Word}"" at position {correction.StartPosition}.");
	if(correction.SuggestedWords.Count>0) Console.WriteLine($@"Most likely replacement: ""{correction.SuggestedWords[0].Word}""");
}