Package com.sun.speech.freetts.util

Examples of com.sun.speech.freetts.util.BulkTimer


        String srcPath = ".";
        String destPath = ".";
       
  try {
      if (args.length > 0) {
    BulkTimer timer = BulkTimer.LOAD;
    timer.start();
    for (int i = 0 ; i < args.length; i++) {
                    if (args[i].equals("-src")) {
                        srcPath = args[++i];
                    } else if (args[i].equals("-dest")) {
                        destPath = args[++i];
                    } else if (args[i].equals("-generate_binary")) {
       String name = "diphone_units.txt";
       if (i + 1 < args.length) {
                             String nameArg = args[++i];
                             if (!nameArg.startsWith("-")) {
                                 name = nameArg;
                             }
       }

       int suffixPos = name.lastIndexOf(".txt");

       String binaryName = "diphone_units.bin";
       if (suffixPos != -1) {
           binaryName = name.substring(0, suffixPos) + ".bin";
       }

       String indexName = "diphone_units.idx";

       if (suffixPos != -1) {
           indexName = name.substring(0, suffixPos) + ".idx";
       }

       System.out.println("Loading " + name);
       timer.start("load_text");
       DiphoneUnitDatabase udb = new DiphoneUnitDatabase(
        new URL("file:"
                                        + srcPath + "/" + name), false);
       timer.stop("load_text");

       System.out.println("Dumping " + binaryName);
       timer.start("dump_binary");
           udb.dumpBinary(destPath + "/" + binaryName);
       timer.stop("dump_binary");

       timer.start("load_binary");
       DiphoneUnitDatabase budb =
          new DiphoneUnitDatabase(
            new URL("file:"
                                            + destPath + "/" + binaryName),
                                    true);
       timer.stop("load_binary");

       System.out.println("Dumping " + indexName);
       timer.start("dump index");
           budb.dumpBinaryIndex(destPath + "/" + indexName);
       timer.stop("dump index");
        } else if (args[i].equals("-compare")) {

      timer.start("load_text");
       DiphoneUnitDatabase udb = new DiphoneUnitDatabase(
        new URL("file:./diphone_units.txt"), false);
      timer.stop("load_text");

      timer.start("load_binary");
      DiphoneUnitDatabase budb =
          new DiphoneUnitDatabase(
            new URL("file:./diphone_units.bin"), true);
      timer.stop("load_binary");

      timer.start("compare");
      if (udb.compare(budb)) {
          System.out.println("other compare ok");
      } else {
          System.out.println("other compare different");
      }
      timer.stop("compare");
        } else if (args[i].equals("-showtimes")) {
      showTimes = true;
        } else {
      System.out.println("Unknown option " + args[i]);
        }
    }
    timer.stop();
    if (showTimes) {
        timer.show("DiphoneUnitDatabase");
    }
      } else {
    System.out.println("Options: ");
    System.out.println("    -src path");
    System.out.println("    -dest path");
View Full Code Here


        String destPath = ".";
  String name = "cmulex_lts";

  try {
      if (args.length > 0) {
    BulkTimer timer = new BulkTimer();
    timer.start();
    for (int i = 0 ; i < args.length; i++) {
                    if (args[i].equals("-src")) {
                        srcPath = args[++i];
                    } else if (args[i].equals("-dest")) {
                        destPath = args[++i];
        } else if (args[i].equals("-name")
                               && i < args.length -1) {
      name = args[++i];
        } else if (args[i].equals("-generate_binary")) {

       System.out.println("Loading " + name);
       timer.start("load_text");
       LetterToSoundImpl text = new LetterToSoundImpl(
        new URL("file:" + srcPath + "/"
                                        + name + ".txt"),
                                false);
       timer.stop("load_text");

       System.out.println("Dumping " + name);
       timer.start("dump_binary");
       text.dumpBinary(destPath + "/" + name + ".bin");
       timer.stop("dump_binary");

        } else if (args[i].equals("-compare")) {

      timer.start("load_text");
       LetterToSoundImpl text = new LetterToSoundImpl(
        new URL("file:./" + name + ".txt")false);
      timer.stop("load_text");

      timer.start("load_binary");
      LetterToSoundImpl binary = new LetterToSoundImpl(
        new URL("file:./" + name + ".bin")true);
      timer.stop("load_binary");

      timer.start("compare");
      if (!text.compare(binary)) {
          System.out.println("NOT EQUIVALENT");
      } else {
          System.out.println("ok");
      }
      timer.stop("compare");
        } else if (args[i].equals("-showtimes")) {
      showTimes = true;
        } else {
      System.out.println("Unknown option " + args[i]);
        }
    }
    timer.stop();
    if (showTimes) {
        timer.show("LTS loading and dumping");
    }
      } else {
    System.out.println("Options: ");
    System.out.println("    -src path");
    System.out.println("    -dest path");
View Full Code Here

        String srcPath = ".";
        String destPath = ".";

  try {
      if (args.length > 0) {
    BulkTimer timer = new BulkTimer();
    timer.start();
    for (int i = 0 ; i < args.length; i++) {
                    if (args[i].equals("-src")) {
                        srcPath = args[++i];
                    } else if (args[i].equals("-dest")) {
                        destPath = args[++i];
                    } else if (args[i].equals("-generate_binary")) {
                         String name = "clunits.txt";
                         if (i + 1 < args.length) {
                             String nameArg = args[++i];
                             if (!nameArg.startsWith("-")) {
                                 name = nameArg;
                             }
       }

                         int suffixPos = name.lastIndexOf(".txt");

                         String binaryName = "clunits.bin";
                         if (suffixPos != -1) {
                             binaryName = name.substring(0, suffixPos) + ".bin";
                         }

       System.out.println("Loading " + name);
       timer.start("load_text");
       ClusterUnitDatabase udb = new
           ClusterUnitDatabase(
        new URL("file:" + srcPath + "/" + name),
                                false);
       timer.stop("load_text");

       System.out.println("Dumping " + binaryName);
       timer.start("dump_binary");
           udb.dumpBinary(destPath + "/" + binaryName);
       timer.stop("dump_binary");

        } else if (args[i].equals("-compare")) {

      timer.start("load_text");
       ClusterUnitDatabase udb = new
           ClusterUnitDatabase(
        new URL("file:./cmu_time_awb.txt"), false);
      timer.stop("load_text");

      timer.start("load_binary");
      ClusterUnitDatabase budb =
          new ClusterUnitDatabase(
            new URL("file:./cmu_time_awb.bin"), true);
      timer.stop("load_binary");

      timer.start("compare");
      if (udb.compare(budb)) {
          System.out.println("other compare ok");
      } else {
          System.out.println("other compare different");
      }
      timer.stop("compare");
        } else if (args[i].equals("-showtimes")) {
      showTimes = true;
        } else {
      System.out.println("Unknown option " + args[i]);
        }
    }
    timer.stop();
    if (showTimes) {
        timer.show("ClusterUnitDatabase");
    }
      } else {
    System.out.println("Options: ");
    System.out.println("    -src path");
    System.out.println("    -dest path");
View Full Code Here

TOP

Related Classes of com.sun.speech.freetts.util.BulkTimer

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.