/** * 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; }
/** * Adds a word to the user dictionary * @param word The text of the word to add * @return Whether the word was successfully added */ public boolean addToDictionary(String word) { if (!userdictionary.isCorrect(word)) { return userdictionary.addWord(word); } return false; }
continue; if (!dict.isCorrect(tokenText)) { SpellingAnomaly anomaly = new SpellingAnomaly(jcas, t.getBegin(), t.getEnd());
continue; if (!dict.isCorrect(tokenText)) { SpellingAnomaly anomaly = new SpellingAnomaly(jcas, t.getBegin(), t.getEnd());