package javakurs.uebung10;

import java.io.IOException;

/**
 * {@link LexFsaTest} is a test class for {@link LexFsa}.
 *
 * @author Joerg Steffen, DFKI
 * @version $Id$
 */
public final class LexFsaTest {

  /**
   * This creates a new instance of {@link LexFsaTest}. Not to be used.
   */
  private LexFsaTest() {

    // private, empty constructor
  }


  /**
   * This is the main method. It requires no arguments.
   *
   * @param args an array of {@link String}s with arguments; not required here
   */
  public static void main(String[] args) {

    try {
      LexFsa lexicon =
        LexFsa.buildLexiconAutomaton("data/uebung10/top1000en.txt");

      // define some test strings; tests are case sensitive
      String[] testStrings = {
        "David", "gain", "American", "abcd"
      };

      for (int i = 0; i < testStrings.length; i++) {
        System.out.print("'" + testStrings[i] + "' ");
        if (!lexicon.match(testStrings[i])) {
          System.out.print("not ");
        }
        System.out.println("found");
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}
