我刚刚从一个短文本文件创建了一个语言模型。我对英语和荷兰语都这样做了,主要是为了通过减少可能性来减少识别时间。 我都使用 Sphinx 工具包和 basesphinx lm 到二进制转换器创建它们。 荷兰语语言模型可以在这里找到:http://pastebin.com/txkxiAc6 英文版可以在这里找到:http://pastebin.com/fr3Epj5b 它们都很小,但英国人能识别它需要识别的一切。
荷兰人使用荷兰语 Voxforge 包和字典。英语版本使用 cmusphinx-en-us-8khz-5.2.tar.gz 和 pocketsphinx 中的默认字典。
代码是这样的:
Public static main(){
configuration = new Configuration();
configuration.setAcousticModelPath("src/main/resources/"+language+"/model");
configuration.setDictionaryPath("src/main/resources/"+language+"/dict.dict");
configuration.setLanguageModelPath("src/main/resources/"+language+"/model.lm.bin");
context = new Context(configuration);
recognizer = context.getInstance(Recognizer.class);
recognizer.allocate();
----------GET INPUT STREAM AND SEND TO METHOD-------------
RecognizeText(inputstream,outputstream)
}
private static String RecognizeText(InputStream stream, OutputStream os) throws Exception {
context.setSpeechSource(stream, TimeFrame.INFINITE);
Result result;
while ((result = recognizer.recognize()) != null) {
SpeechResult speechResult = new SpeechResult(result);
return speechResult.getHypothesis();
}
return "";
}
“语言”变量可以设置为荷兰语或英语以获得正确的语言。英语可以,但荷兰语不行。 我的错误在哪里?我好像找不到啊
Dutch Acoustic Model 文件夹包含以下内容:
feat.params
mdef
means
mixture_weights
noisedict
transition_matrices
variances
最佳答案
荷兰模型非常老旧,已经5年没有更新了。我刚刚在 cmusphinx 网站上上传了一个新模型。
https://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/Dutch/
它应该更准确,但仍然只用 13 小时的数据进行训练。英国模型训练时间超过1000小时。我们需要更多转录的荷兰语数据。
关于java - Sphinx4 荷兰语语言模型不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40135581/