Closed Sooloom closed 9 months ago
你好。 您使用的是大型号还是小型号? big 不支持语法。 你在日志中看到了什么?
你好,中文两种模型我都测试过,另外英文模型没有问题,英文正常,中文两种模型我都测试过,出错信息如下: 如果代码中我用 VoskRecognizer rec = new VoskRecognizer(model, 16000.0f, "[\"打开\",\"关闭\",\"运行\", \"启动\", \"[unk]\"]"); 日志中显示如下 LOG (VoskAPI:ReadDataFiles():model.cc:213) Decoding params beam=12 max-active=5000 lattice-beam=4 LOG (VoskAPI:ReadDataFiles():model.cc:216) Silence phones 1:2:3:4:5:6:7:8:9:10 LOG (VoskAPI:RemoveOrphanNodes():nnet-nnet.cc:948) Removed 0 orphan nodes. LOG (VoskAPI:RemoveOrphanComponents():nnet-nnet.cc:847) Removing 0 orphan components. LOG (VoskAPI:ReadDataFiles():model.cc:248) Loading i-vector extractor from model/ivector/final.ie LOG (VoskAPI:ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor LOG (VoskAPI:ComputeDerivedVars():ivector-extractor.cc:204) Done. LOG (VoskAPI:ReadDataFiles():model.cc:282) Loading HCL and G from model/graph/HCLr.fst model/graph/Gr.fst LOG (VoskAPI:ReadDataFiles():model.cc:303) Loading winfo model/graph/phones/word_boundary.int LOG (VoskAPI:Recognizer():recognizer.cc:63) ["打开", "关闭", "运行", "启动", "[unk]"] WARNING (VoskAPI:Recognizer():recognizer.cc:84) Ignoring word missing in vocabulary: '打开' WARNING (VoskAPI:Recognizer():recognizer.cc:84) Ignoring word missing in vocabulary: '关闭' WARNING (VoskAPI:Recognizer():recognizer.cc:84) Ignoring word missing in vocabulary: '运行' WARNING (VoskAPI:Recognizer():recognizer.cc:84) Ignoring word missing in vocabulary: '启动' LOG (VoskAPI:Estimate():language_model.cc:142) Estimating language model with ngram-order=2, discount=0.5 LOG (VoskAPI:OutputToFst():language_model.cc:209) Created language model with 2 states and 2 arcs.
如果代码用json序列化
var grammar = JsonSerializer.Serialize(new List
语法字符串必须是 utf-8 编码,而不是 \u 表示法。 在第一个示例中,编码可能是其他东西,而不是 utf-8。
尝试类似的东西:
Console.OutputEncoding = Encoding.UTF8;
JsonSerializerOptions options = new JsonSerializerOptions
{
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
};
string grammar = JsonSerializer.Serialize<Dictinory>(dictinory, options);
我已经更改了代码
Console.OutputEncoding = Encoding.UTF8;
JsonSerializerOptions options = new JsonSerializerOptions
{
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
};
List
在加载中文语音模型后,语音识别不到这些预定词语,请问如何解决?