Package com.swabunga.spell.engine

Examples of com.swabunga.spell.engine.SpellDictionaryHashMap


  /**
   * Constructs the SpellChecker.
   */
  public SpellChecker() {
    try {
      userdictionary = new SpellDictionaryHashMap();
    } catch (IOException e) {
      throw new RuntimeException("this exception should never happen because we are using null phonetic file");
    }
  }
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
      try {
        userDictionary = new SpellDictionaryHashMap(userWordList);
      } catch (FileNotFoundException e) {
        userWordList.createNewFile();
        userDictionary = new SpellDictionaryHashMap(userWordList);
      } catch (IOException e) {
        userWordList.createNewFile();
        userDictionary = new SpellDictionaryHashMap(userWordList);
      }
     
      spellListener = new SuggestionListener(this, spellChecker);
     
      // Add the user 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

    // todo load dict file from jazzy.jar archive.
    InputStream inputStream = getClass().getClassLoader().getResourceAsStream(dictFile);
    InputStreamReader reader = new InputStreamReader(inputStream);
    try
    {
      dict = new SpellDictionaryHashMap(reader);
    }
    catch (IOException e)
    {
      throw new RuntimeException(e);
    }
View Full Code Here

  public JazzySpellChecker() {
    // todo load dict file from jazzy.jar archive.
    InputStream inputStream = getClass().getClassLoader().getResourceAsStream(dictFile);
    InputStreamReader reader = new InputStreamReader(inputStream);
    try {
      dict = new SpellDictionaryHashMap(reader);
    } catch (IOException e) {
      throw new RuntimeException(e);
    } finally {
      try {
        reader.close();
View Full Code Here

    // todo load dict file from jazzy.jar archive.
    InputStream inputStream = getClass().getClassLoader().getResourceAsStream(dictFile);
    InputStreamReader reader = new InputStreamReader(inputStream);
    try
    {
      dict = new SpellDictionaryHashMap(reader);
    }
    catch (IOException e)
    {
      throw new RuntimeException(e);
    }
View Full Code Here

TOP

Related Classes of com.swabunga.spell.engine.SpellDictionaryHashMap

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.