public TreeSet<String> getNearStringFromByLevenStein(String query, int th)
     throws UnsupportedEncodingException {
   TreeSet<String> ret = new TreeSet<String>();
   TreeSet<String> cands = index.getCandidateStrings(query, th, true);
   for (String cand : cands) {
     // System.out.println(cand + " ");
     int d = LevenshteinDistance.calc(query, cand);
     System.out.print(cand + "<->" + query + ":" + d);
     if (d <= th) {
       ret.add(cand);
       System.out.println(" <<<FOUND!!");
     }
     System.out.println();
   }
   System.out.println(cands.size() + " words scanned.");
   return ret;
 }
 public TreeSet<String> getNearStringFromByJaroWinkler(String query, double th)
     throws UnsupportedEncodingException {
   TreeSet<String> ret = new TreeSet<String>();
   TreeSet<String> cands = index.getCandidateStrings(query, -1, false);
   System.out.println("scanned words:");
   for (String cand : cands) {
     // System.out.print(cand + " ");
     double d = JaroWinklerDistance.JARO_WINKLER_DISTANCE.distance(query, cand);
     System.out.print(cand + "<->" + query + ":" + d);
     if (d <= th) {
       ret.add(cand);
       System.out.print(" <<<FOUND!!");
     }
     System.out.println();
   }
   System.out.println("\n" + cands.size() + " words scanned.");
   return ret;
 }
 public void register(String s) {
   index.putWord(s);
 }