Expand my Community achievements bar.

SOLVED

How to Check wrong spelled words using SpellChecker programatically?

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@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.