@@ -0,0 +1,2996 @@
+/*%0A * Copyright 1999-2004 Carnegie Mellon University.%0A * Portions Copyright 2004 Sun Microsystems, Inc.%0A * Portions Copyright 2004 Mitsubishi Electric Research Laboratories.%0A * All Rights Reserved.  Use is subject to license terms.%0A *%0A * See the file %22license.terms%22 for information on usage and%0A * redistribution of this file, and for a DISCLAIMER OF ALL%0A * WARRANTIES.%0A *%0A */%0Apackage tests.result.lattice;%0A%0Aimport edu.cmu.sphinx.frontend.util.StreamDataSource;%0A%0Aimport edu.cmu.sphinx.linguist.dictionary.Dictionary;%0A%0Aimport edu.cmu.sphinx.recognizer.Recognizer;%0A%0Aimport edu.cmu.sphinx.result.ConfidenceResult;%0Aimport edu.cmu.sphinx.result.ConfidenceScorer;%0Aimport edu.cmu.sphinx.result.GDLLatticeFactory;%0Aimport edu.cmu.sphinx.result.Lattice;%0Aimport edu.cmu.sphinx.result.LatticeOptimizer;%0Aimport edu.cmu.sphinx.result.MAPConfidenceScorer;%0Aimport edu.cmu.sphinx.result.Path;%0Aimport edu.cmu.sphinx.result.Result;%0Aimport edu.cmu.sphinx.result.SausageMaker;%0Aimport edu.cmu.sphinx.result.Sausage;%0Aimport edu.cmu.sphinx.result.WordResult;%0A%0Aimport edu.cmu.sphinx.util.LogMath;%0A%0Aimport edu.cmu.sphinx.util.props.ConfigurationManager;%0Aimport edu.cmu.sphinx.util.props.PropertyException;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.net.URL;%0A%0Aimport javax.sound.sampled.AudioFormat;%0Aimport javax.sound.sampled.AudioInputStream;%0Aimport javax.sound.sampled.AudioSystem;%0Aimport javax.sound.sampled.UnsupportedAudioFileException;%0A%0Apublic class GDLLatticeTest %7B%0A%0A    /**%0A     * Main method for running the MAPConfidenceTest demo.%0A     */%0A    public static void main(String%5B%5D args) %7B%0A        try %7B       %0A            String latticeGDL;%0A%09    if (args.length %3E 0) %7B%0A                latticeGDL = args%5B0%5D;%0A            %7D else %7B%0A                latticeGDL = %22testLattice.gdl%22;%0A            %7D%0A%0A            URL configURL = new File(%22./config.xml%22).toURI().toURL();%0A            ConfigurationManager cm = new ConfigurationManager(configURL);%0A            LogMath logMath = (LogMath) cm.lookup(%22logMath%22);%0A            Dictionary dictionary = (Dictionary) cm.lookup(%22dictionary%22);%0A            dictionary.allocate();%0A%0A            Lattice lattice = %0A                GDLLatticeFactory.getLattice(latticeGDL, dictionary);%0A            lattice.setLogMath(logMath);%0A            lattice.dumpAISee(%22new.gdl%22, %22New GDL%22);%0A%0A            SausageMaker sm = new SausageMaker(lattice);%0A            Sausage s = sm.makeSausage();%0A%0A            lattice.dumpAISee(%22mapLattice.gdl%22, %22MAP Lattice%22);%0A            s.dumpAISee(%22mapSausage.gdl%22, %22MAP Sausage%22);%0A        %7D catch (IOException e) %7B%0A            System.err.println(%22Problem when loading MAPConfidenceTest: %22 + e);%0A            e.printStackTrace();%0A        %7D catch (PropertyException e) %7B%0A            System.err.println(%22Problem configuring MAPConfidenceTest: %22 + e);%0A            e.printStackTrace();%0A        %7D catch (InstantiationException e) %7B%0A            System.err.println(%22Problem creating MAPConfidenceTest: %22 + e);%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%7D%0A

Converts a text file based lattice to a sausage.