Ich arbeite an Sphinx 4, TranscriberDemo.java Programm. Ich habe die Alpha-Version von https://sourceforge.net/projects/cmusphinx/files/sphinx4/5prealpha/ und die folgenden JAR-Dateien heruntergeladenWas wird die Ausgabe von TranscriberDemo.java in Sphinx 4 sein?
sphinx4-data-5prealpha-20160531.163451-9.jar
sphinx4-Core-5prealpha-20160531.163425-9.jar
Aus der Link: https://oss.sonatype.org/#nexus-search;quick~sphinx4
mein Code:
package transcriber;
import java.io.InputStream;
import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.SpeechResult;
import edu.cmu.sphinx.api.StreamSpeechRecognizer;
import edu.cmu.sphinx.decoder.adaptation.Stats;
import edu.cmu.sphinx.decoder.adaptation.Transform;
import edu.cmu.sphinx.result.WordResult;
/**
* A simple example that shows how to transcribe a continuous audio file that
* has multiple utterances in it.
*/
public class TranscriberDemo {
public static void main(String[] args) throws Exception {
System.out.println("Loading models...");
Configuration configuration = new Configuration();
// Load model from the jar
configuration
.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
// You can also load model from folder
// configuration.setAcousticModelPath("file:en-us");
configuration
.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
configuration
.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.bin");
StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(
configuration);
InputStream stream = TranscriberDemo.class
.getResourceAsStream("/edu/cmu/sphinx/demo/aligner/10001-90210-01803.wav");
stream.skip(44);
// Simple recognition with generic model
recognizer.startRecognition(stream);
SpeechResult result;
while ((result = recognizer.getResult()) != null) {
System.out.format("Hypothesis: %s\n", result.getHypothesis());
System.out.println("List of recognized words and their times:");
for (WordResult r : result.getWords()) {
System.out.println(r);
}
System.out.println("Best 3 hypothesis:");
for (String s : result.getNbest(3))
System.out.println(s);
}
recognizer.stopRecognition();
// Live adaptation to speaker with speaker profiles
stream = TranscriberDemo.class
.getResourceAsStream("/edu/cmu/sphinx/demo/aligner/10001-90210-01803.wav");
stream.skip(44);
// Stats class is used to collect speaker-specific data
Stats stats = recognizer.createStats(1);
recognizer.startRecognition(stream);
while ((result = recognizer.getResult()) != null) {
stats.collect(result);
}
recognizer.stopRecognition();
// Transform represents the speech profile
Transform transform = stats.createTransform();
recognizer.setTransform(transform);
// Decode again with updated transform
stream = TranscriberDemo.class
.getResourceAsStream("/edu/cmu/sphinx/demo/aligner/10001-90210-01803.wav");
stream.skip(44);
recognizer.startRecognition(stream);
while ((result = recognizer.getResult()) != null) {
System.out.format("Hypothesis: %s\n", result.getHypothesis());
}
recognizer.stopRecognition();
}
}
und der Ausgang ist:
Loading models...
13:36:22.338 INFO unitManager CI Unit: *+NSN+
13:36:22.338 INFO unitManager CI Unit: *+SPN+
13:36:22.348 INFO unitManager CI Unit: AA
13:36:22.348 INFO unitManager CI Unit: AE
13:36:22.348 INFO unitManager CI Unit: AH
13:36:22.348 INFO unitManager CI Unit: AO
13:36:22.348 INFO unitManager CI Unit: AW
13:36:22.348 INFO unitManager CI Unit: AY
13:36:22.348 INFO unitManager CI Unit: B
13:36:22.348 INFO unitManager CI Unit: CH
13:36:22.348 INFO unitManager CI Unit: D
13:36:22.348 INFO unitManager CI Unit: DH
13:36:22.348 INFO unitManager CI Unit: EH
13:36:22.348 INFO unitManager CI Unit: ER
13:36:22.348 INFO unitManager CI Unit: EY
13:36:22.348 INFO unitManager CI Unit: F
13:36:22.348 INFO unitManager CI Unit: G
13:36:22.348 INFO unitManager CI Unit: HH
13:36:22.348 INFO unitManager CI Unit: IH
13:36:22.348 INFO unitManager CI Unit: IY
13:36:22.348 INFO unitManager CI Unit: JH
13:36:22.348 INFO unitManager CI Unit: K
13:36:22.358 INFO unitManager CI Unit: L
13:36:22.358 INFO unitManager CI Unit: M
13:36:22.358 INFO unitManager CI Unit: N
13:36:22.358 INFO unitManager CI Unit: NG
13:36:22.358 INFO unitManager CI Unit: OW
13:36:22.358 INFO unitManager CI Unit: OY
13:36:22.358 INFO unitManager CI Unit: P
13:36:22.358 INFO unitManager CI Unit: R
13:36:22.358 INFO unitManager CI Unit: S
13:36:22.358 INFO unitManager CI Unit: SH
13:36:22.358 INFO unitManager CI Unit: T
13:36:22.358 INFO unitManager CI Unit: TH
13:36:22.368 INFO unitManager CI Unit: UH
13:36:22.368 INFO unitManager CI Unit: UW
13:36:22.368 INFO unitManager CI Unit: V
13:36:22.368 INFO unitManager CI Unit: W
13:36:22.368 INFO unitManager CI Unit: Y
13:36:22.368 INFO unitManager CI Unit: Z
13:36:22.368 INFO unitManager CI Unit: ZH
13:36:24.507 INFO autoCepstrum Cepstrum component auto-configured as follows: autoCepstrum {MelFrequencyFilterBank, Denoise, DiscreteCosineTransform2, Lifter}
Exception in thread "main" java.lang.NullPointerException
at transcriber.TranscriberDemo.main(TranscriberDemo.java:50)
Java Result: 1
BUILD SUCCESSFUL (total time: 7 seconds)
ich etwas Hilfe brauchen, um richtig, dieses Programm auszuführen. Vielen Dank im Voraus.
Geben Sie mir eine Rückmeldung – ziLk