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 RecognitionResult class.

This functionality supports the following languages:

Value Language
SpellCheckLanguage.Cze Czech
SpellCheckLanguage.Dan Danish
SpellCheckLanguage.Deu German
SpellCheckLanguage.Dum Dutch
SpellCheckLanguage.Eng English
SpellCheckLanguage.Est Estonian
SpellCheckLanguage.Fin Finnish
SpellCheckLanguage.Fra French
SpellCheckLanguage.Ita Italian
SpellCheckLanguage.Lav Latvian
SpellCheckLanguage.Lit Lithuanian
SpellCheckLanguage.Pol Polish
SpellCheckLanguage.Por Portuguese
SpellCheckLanguage.Rum Romanian
SpellCheckLanguage.Slk Slovak
SpellCheckLanguage.Slv Slovene
SpellCheckLanguage.Spa Spanish
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.

AsposeOCR api = new AsposeOCR();
// Add an image to OcrInput object
OcrInput input = new OcrInput(InputType.SingleImage);
input.Add("source.png");
// Recognize image
ArrayList<RecognitionResult> results = api.Recognize(input);
// Spelling suggestions
results[0].getSpellCheckErrorList(SpellCheckLanguage.Eng).forEach((correction) -> {
	System.out.println("Found misspelled word \"" + correction.word + "\" at position " + correction.startPosition);
	if(correction.suggestedWords.size() > 0) System.out.println("Most likely replacement: " + correction.get(0).word);
});