title: Trying to implement Google's "did you mean" feature in java
body: <p>I am trying to implement google's "did you mean" feature in java.
  I found some code on internet saying it works properly, it gets me an error though when trying to run it. I think it has to do with the directory creation, which is the only part of the code I do not exactly understand.</p>
  
  <p>Here is the code, could you give me some help on what's wrong?
  Thanks in advance!</p>
  
  <pre><code>             public static void main(String[] args) throws Exception {
               File dir = new File("C:/Users/Lala");
               Directory directory = FSDirectory.open(dir);
  
               SpellChecker spellChecker = new SpellChecker(directory);
  
               spellChecker.indexDictionary(
               new PlainTextDictionary(new File("fulldictionary00.txt")));
               String wordForSuggestions = "hwllo";
               int suggestionsNumber = 5;
               String[] suggestions = spellChecker.
                   suggestSimilar(wordForSuggestions, suggestionsNumber);
               if (suggestions!=null &amp;&amp; suggestions.length&gt;0) {
                   for (String word : suggestions) {
                       System.out.println("Did you mean:" + word);
                   }
               }
               else {
                   System.out.println("No suggestions found for word:"+wordForSuggestions);
               }
  
           }
  </code></pre>
  
  <p>The file <code>fulldictionary00.txt</code> is a plain text file in the right format.</p>
  
  <p>The error I get though is at line 18:</p>
  
  <pre><code>SpellChecker spellChecker = new SpellChecker(directory);
  </code></pre>
  
  <p>so it has to do with the directory creation.. I am pasting the error I get just in case any idea accures when you see it. </p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/document/Fieldable at did_you_mean.main(did_you_mean.java:18) Caused by:     
   java.lang.ClassNotFoundException: org.apache.lucene.document.Fieldable 
  </code></pre>