How to Check wrong spelled words using SpellChecker programatically?

himasreep445197

21-04-2020

Hi,

My requirement is to get all the wrong spelled words from the text component of a  page programmatically. For this I have used SpellCheckerProvider.createSpellChecker(language, dictionarypaths[], resourceResolver);  to get SpellChecker, but I am not understanding what to give in the parameters i.e language and dictionary paths. Please help me in this. If you provide me any example of SpellCheckerProvider class, it would be more helpful.

 

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

BrianKasingli

MVP

10-08-2020

@himasreep445197.

 

You can utilise the OSGI SpellCheckService, which can be easily understood is used.

@Reference
private SpellCheckService spellchecker;

WordCheckResult wordResult = spellchecker.checkText("hello world","eb-gb", false, null);
boolean isCorrect = wordResult.isCorrect();

Documentation: https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/reference-materials/javadoc/co...

I hope this helps,

Brian.

Answers (0)