コード例 #1
0
 private void configureSpellChecker(SpellChecker checker) {
   checker.setSkipNumbers(true);
   checker.setIgnoreUpperCaseWords(true);
   // set checker.setCaseSensitive(false) to avoid checking the case of word (JMySpell require
   // first word in the sentence to be upper-cased)
   checker.setCaseSensitive(false);
 }
コード例 #2
0
  protected List<String> findMisspelledWords(Iterator<String> checkedWordsIterator, String lang)
      throws SpellCheckException {
    SpellChecker checker = (SpellChecker) getChecker(lang);

    List<String> misspelledWordsList = new ArrayList<String>();
    while (checkedWordsIterator.hasNext()) {
      String word = checkedWordsIterator.next();
      if (!word.equals("") && !checker.isCorrect(word)) {
        misspelledWordsList.add(word);
      }
    }

    return misspelledWordsList;
  }
コード例 #3
0
 protected List<String> findSuggestions(String word, String lang, int maxSuggestions)
     throws SpellCheckException {
   SpellChecker checker = (SpellChecker) getChecker(lang);
   return checker.getDictionary().getSuggestions(word, maxSuggestions);
 }