Package com.swabunga.spell.event

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


   * @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

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

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

  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

   * @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

  }

  @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

    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

  }

  @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

    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

  }

  @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

TOP

Related Classes of com.swabunga.spell.event.SpellChecker

Copyright © 2018 www.massapicom. 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.