continue; if (!dict.isCorrect(tokenText)) { SpellingAnomaly anomaly = new SpellingAnomaly(jcas, t.getBegin(), t.getEnd()); List<Word> suggestions = dict.getSuggestions(tokenText, scoreThreshold);
/** * Verifies if the word to analyze is contained in dictionaries. The order * of dictionary lookup is: * <ul> * <li>The default user dictionary or the one set through * {@link SpellChecker#setUserDictionary}</li> * <li>The dictionary specified at construction time, if any.</li> * <li>Any dictionary in the order they were added through * {@link SpellChecker#addDictionary}</li> * </ul> * * @param word The word to verify that it's spelling is known. * @return true if the word is in a dictionary. */ public boolean isCorrect(String word) { if (userdictionary.isCorrect(word)) return true; for (Enumeration e = dictionaries.elements(); e.hasMoreElements();) { SpellDictionary dictionary = (SpellDictionary) e.nextElement(); if (dictionary.isCorrect(word)) return true; } return false; }
VectorUtility.addAll(suggestions, dictionary.getSuggestions(word, threshold), false); VectorUtility.addAll(suggestions, userdictionary.getSuggestions(word, threshold), false); suggestions.trimToSize();
if (!addWord.equals(word)) tokenizer.replaceWord(addWord); userdictionary.addWord(addWord); break; case SpellCheckEvent.CANCEL:
continue; if (!dict.isCorrect(tokenText)) { SpellingAnomaly anomaly = new SpellingAnomaly(jcas, t.getBegin(), t.getEnd()); List<Word> suggestions = dict.getSuggestions(tokenText, scoreThreshold);