public String spellCorrect(String text) { StringWordTokenizer swt = new StringWordTokenizer(text); spellChecker.checkSpelling(swt); return swt.getContext(); }
/** * Checks the text string. * <p> * Returns the corrected string. * * @param text The text that need to be spelled checked * @return The text after spell checking * @deprecated use checkSpelling(WordTokenizer) */ public String checkString(String text) { StringWordTokenizer tokens = new StringWordTokenizer(text); checkSpelling(tokens); return tokens.getContext(); }
private void doSpell(final String cmd, final String id, final JSONArray paramArray) { final SpellChecker checker = new SpellChecker(dict); final Set<String> errors = new HashSet<String>(); checker.addSpellCheckListener(new SpellCheckListener() { public void spellingError(SpellCheckEvent event) { errors.add(event.getInvalidWord()); } }); JSONArray words = paramArray.optJSONArray(1); checker.checkSpelling(new StringWordTokenizer(words.toString())); respond(errors.iterator(), cmd, id); }
private void doSpell(final String cmd, final String id, final JSONArray paramArray) { final SpellChecker checker = new SpellChecker(dict); final Set<String> errors = new HashSet<String>(); checker.addSpellCheckListener(new SpellCheckListener() { public void spellingError(SpellCheckEvent event) { errors.add(event.getInvalidWord()); } }); JSONArray words = paramArray.optJSONArray(1); checker.checkSpelling(new StringWordTokenizer(words.toString())); respond(errors.iterator(), cmd, id); }
private void doSpell(final String cmd, final String id, final JSONArray paramArray) { final SpellChecker checker = new SpellChecker(dict); final Set<String> errors = new HashSet<String>(); checker.addSpellCheckListener(new SpellCheckListener() { public void spellingError(SpellCheckEvent event) { errors.add(event.getInvalidWord()); } }); JSONArray words = paramArray.optJSONArray(1); checker.checkSpelling(new StringWordTokenizer(words.toString())); respond(errors.iterator(), cmd, id); }
public void spellCheck(final JTextComponent jta) { final DefaultHighlighter dh = (DefaultHighlighter)jta.getHighlighter(); dh.removeAllHighlights(); com.swabunga.spell.event.SpellChecker sc = new com.swabunga.spell.event.SpellChecker(dictionary); sc.addSpellCheckListener(new SpellCheckListener() { @Override public void spellingError(SpellCheckEvent arg0) { int pos = arg0.getWordContextPosition(); try { dh.addHighlight(pos,pos+arg0.getInvalidWord().length(),underline); } catch (BadLocationException e1) { e1.printStackTrace(); } } }); try { sc.checkSpelling(new StringWordTokenizer(jta.getText(0,jta.getDocument().getLength()))); } catch (BadLocationException e) { e.printStackTrace(); } }
private void doSpell(final String cmd, final String id, final JSONArray paramArray) { final SpellChecker checker = new SpellChecker(dict); final Set<String> errors = new HashSet<>(); checker.addSpellCheckListener(new SpellCheckListener() { @Override public void spellingError(SpellCheckEvent event) { errors.add(event.getInvalidWord()); } }); JSONArray words = paramArray.optJSONArray(1); checker.checkSpelling(new StringWordTokenizer(words.toString())); respond(errors.iterator(), cmd, id); }