Example usage for com.liferay.portal.kernel.words WordsUtil checkSpelling

List of usage examples for com.liferay.portal.kernel.words WordsUtil checkSpelling

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.words WordsUtil checkSpelling.

Prototype

public static List<InvalidWord> checkSpelling(String text) 

Source Link

Usage

From source file:com.liferay.words.service.impl.WordsServiceImpl.java

License:Open Source License

@Override
public List<String> checkSpelling(String text) throws Exception {
    List<String> invalidWords = new ArrayList<String>();

    for (InvalidWord invalidWord : WordsUtil.checkSpelling(text)) {
        invalidWords.add(invalidWord.getInvalidWord());
    }//from w  w w  .  j a v a  2s.c  om

    return invalidWords;
}

From source file:com.liferay.words.service.impl.WordsServiceImpl.java

License:Open Source License

@Override
public List<String> getSuggestions(String word) throws Exception {
    List<InvalidWord> invalidWords = WordsUtil.checkSpelling(word);

    if (invalidWords.isEmpty()) {
        return Collections.emptyList();
    }/*w w  w.j a v  a2  s.  c o  m*/

    InvalidWord invalidWord = invalidWords.get(0);

    return invalidWord.getSuggestions();
}