java - Sphinx 4可怕的准确性

标签 java sphinx4

我正在尝试让 sphinx 4 与我的桌面应用程序一起工作,它的正确率是 0% 我还使用默认语言模型以及 sphinx4 data.jar 中的所有内容

代码:

import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.Microphone;
import edu.cmu.sphinx.api.SpeechResult;
import edu.cmu.sphinx.api.StreamSpeechRecognizer;
public class Speechy {
public static void main(String[] args) throws Exception {

    Configuration configuration = new Configuration();

    configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/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");
    Microphone micro = new Microphone(8000, 16, true, false);
    micro.startRecording();
    StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(configuration);
 // Start recognition process pruning previously cached data.
    recognizer.startRecognition(micro.getStream());
 while(true){
 SpeechResult result = recognizer.getResult();
 System.out.println(result.getHypothesis());
 }
}
}

最佳答案

Microphone micro = new Microphone(8000, 16, true, false);

默认声学模型需要16khz音频,您的配置8000是错误的。

另请参阅the tutorial

The top reasons of the bad accuracy are:

The mismatch of the sample rate/no. of channels of the incoming audio or the mismatch of the incoming audio bandwidth. It must be 16kHz (or 8kHz, depending on the training data) 16bit Mono (= single channel) Little-Endian file. You need to fix sample rate of the source with resampling (only if its rate is higher than that of the training data). You should not upsample a file and decode it with acoustic models trained on higher sampling rate audio. Audio file format (sampling rate, number of channels) can be verified using below command sox --i /path/to/audio/file. Find more information here: What is sample rate

关于java - Sphinx 4可怕的准确性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46124023/

相关文章:

java - 用java编写二维数组

java - hibernate/JPA : Get one (first) element of a OneToMany relationship

cmusphinx - 在Sphinx4中使用德语词典和语言模型

java - Sphinx4 将 wav 文件中的语音识别为输入而不是麦克风输入

java - 当有人用 JAVA 说话时尝试将静态图像发送到 'talk'

sphinx4 - 使用 eclipse 构建 sphinx4

java - jar 文件未使用 stacktrace 执行另一个应用程序中的所有功能

java - 在 Java 中发送 HTTP POST 请求时出现问题

java - 如何更正后查询的更改编码?

Java 狮身人面像 "Answers Itself"