Examples of SpellChecker


Examples of com.dotcms.repackage.com.swabunga.spell.event.SpellChecker

      Logger.error(this,ioe.getMessage(),ioe);
    }
  }

  private List _checkSpelling(String text) {
    SpellChecker checker = new SpellChecker(_spellDictionary);

    BasicSpellCheckListener listener = new BasicSpellCheckListener(text);

    checker.addSpellCheckListener(listener);

    checker.checkSpelling(
      new StringWordTokenizer(new DefaultWordFinder(text)));

    return listener.getInvalidWords();
  }
View Full Code Here

Examples of com.dotcms.repackage.org.dts.spell.SpellChecker

    protected void preloadLanguageChecker(String preloadedLanguage) throws SpellCheckException {
        getChecker(preloadedLanguage);
    }

    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;
View Full Code Here

Examples of com.flaptor.hounder.searcher.spell.SpellChecker

     * @param dictionaryDir
     *          A directory that contains an N-Gram index, for
     *          the underlying SpellChecker
     */
    public WordQuerySuggestor(File dictionaryDir) throws IOException{
        super(new SpellChecker(FSDirectory.getDirectory(dictionaryDir)));
    }
View Full Code Here

Examples of com.swabunga.spell.event.SpellChecker

      {
        Collection<Spelling> spellingErrors = new TreeSet<Spelling>();
       
        CheckSpelling(ServerInterface serverInterface) throws IOException
          {
            SpellChecker spellChecker = new SpellChecker(AppUtils.getSpeller(),100);

            spellChecker.addSpellCheckListener(this);
            spellChecker.checkSpelling(new StringWordTokenizer(getText(serverInterface)));
          }
View Full Code Here

Examples of com.swabunga.spell.event.SpellChecker

   * @see com.hp.hpl.jena.eyeball.repairtools.GenericWordChecker#setDictionary(java.lang.String)
  */
  public void setDictionary(String wordList)
        {
    SpellDictionary dictionary = getDictionary( wordList );
    spellCheck = new SpellChecker( dictionary );                // No nasty capitalisation, please!
    spellCheck.addSpellCheckListener( this );
    }
View Full Code Here

Examples of com.swabunga.spell.event.SpellChecker

  transient private JTextComponent textComponent = null;
// private ResourceBundle messages;

  // Constructor
  public JTextComponentSpellChecker(SpellDictionary dict) {
     spellCheck = new SpellChecker(dict);
     spellCheck.addSpellCheckListener(this);
  }
View Full Code Here

Examples of com.swabunga.spell.event.SpellChecker

  private void setupDictionary() {
    File wordList = new File(Global.getFileManager().getSpellDirPath()+Locale.getDefault()+".dic");
    try {
      dictionary = new SpellDictionaryHashMap(wordList);
      spellChecker = new SpellChecker(dictionary);
     
      File userWordList;
      userWordList = new File(Global.getFileManager().getSpellDirPathUser()+"user.dic");
     
      // Get the local user spell dictionary
View Full Code Here

Examples of com.swabunga.spell.event.SpellChecker

   * @throws IOException
   * @throws FileNotFoundException
   */
  public static void main(String[] args) throws FileNotFoundException, IOException {
    File dict = new File("test_data/dictionary/english.0");
    SpellChecker checker = new SpellChecker(new SpellDictionaryHashMap(dict));
    int THRESHOLD = 10; // computational cost threshold
    System.out.println(checker.getSuggestions("runnng", THRESHOLD));
    System.out.println(checker.getSuggestions("season", THRESHOLD));
    System.out.println(checker.getSuggestions("advantagius", THRESHOLD));
  }
View Full Code Here

Examples of com.swabunga.spell.event.SpellChecker

  }

  @SuppressWarnings("unchecked")
  private void doSuggest(final String cmd, final String id, final JSONArray paramArray)
  {
    final SpellChecker checker = new SpellChecker(dict);
    String word = paramArray.optString(1);
    List<String> suggestions = checker.getSuggestions(word, 2);

    respond(suggestions.iterator(), cmd, id);
  }
View Full Code Here

Examples of com.swabunga.spell.event.SpellChecker

    respond(suggestions.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);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.