Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 50dcb1ff2217256694bce78e1f21a6020998eb57 @pathikrit committed Sep 27, 2011
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/js.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/sphinx4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/jsapi.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/WSJ_8gau_13dCep_8kHz_31mel_200Hz_3500Hz.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ </component>
+</module>
+
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,76 @@
+/*
+ * Copyright 1999-2004 Carnegie Mellon University.
+ * Portions Copyright 2004 Sun Microsystems, Inc.
+ * Portions Copyright 2004 Mitsubishi Electric Research Laboratories.
+ * All Rights Reserved. Use is subject to license terms.
+ *
+ * See the file "license.terms" for information on usage and
+ * redistribution of this file, and for a DISCLAIMER OF ALL
+ * WARRANTIES.
+ *
+ */
+
+package edu.cmu.sphinx.demo.hellongram;
+
+import edu.cmu.sphinx.frontend.util.Microphone;
+import edu.cmu.sphinx.recognizer.Recognizer;
+import edu.cmu.sphinx.result.Result;
+import edu.cmu.sphinx.util.props.ConfigurationManager;
+
+
+/**
+ * A simple HelloNGram demo showing a simple speech application built using Sphinx-4. This application uses the Sphinx-4
+ * endpointer, which automatically segments incoming audio into utterances and silences.
+ */
+public class HelloNGram {
+
+ public static void main(String[] args) {
+ ConfigurationManager cm;
+
+ if (args.length > 0) {
+ cm = new ConfigurationManager(args[0]);
+ } else {
+ cm = new ConfigurationManager(HelloNGram.class.getResource("hellongram.config.xml"));
+ }
+
+ // allocate the recognizer
+ System.out.println("Loading...");
+ Recognizer recognizer = (Recognizer) cm.lookup("recognizer");
+ recognizer.allocate();
+
+ // start the microphone or exit if the programm if this is not possible
+ Microphone microphone = (Microphone) cm.lookup("microphone");
+ if (!microphone.startRecording()) {
+ System.out.println("Cannot start microphone.");
+ recognizer.deallocate();
+ System.exit(1);
+ }
+
+ printInstructions();
+
+ // loop the recognition until the programm exits.
+ while (true) {
+ System.out.println("Start speaking. Press Ctrl-C to quit.\n");
+
+ Result result = recognizer.recognize();
+
+ if (result != null) {
+ String resultText = result.getBestResultNoFiller();
+ System.out.println("You said: " + resultText + '\n');
+ } else {
+ System.out.println("I can't hear what you said.\n");
+ }
+ }
+ }
+
+
+ /** Prints out what to say for this demo. */
+ private static void printInstructions() {
+ System.out.println("Sample sentences:\n" +
+ "the green one right in the middle\n" +
+ "the purple one on the lower right side\n" +
+ "the closest purple one on the far left side\n" +
+ "the only one left on the left\n\n" +
+ "Refer to the file hellongram.test for a complete list.\n");
+ }
+}
Oops, something went wrong.

0 comments on commit 50dcb1f

Please sign in to comment.