alphacep / alphacep/vosk-api

SetGrammar

Open
#1,720 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
15.1k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

MODEL_PATH = r'D:\Desktop\vsok\vosk-model-small-cn-0.22'
model = Model(MODEL_PATH)
rec = KaldiRecognizer(model, 16000)

grammar_list = ["诺普信", "智慧农业", "悦心健康", "国新能源"]
grammar_json = json.dumps(grammar_list, ensure_ascii=False)
rec.SetGrammar(grammar_json)

LOG (VoskAPI:UpdateGrammarFst():recognizer.cc:287) ["璇烘櫘淇?, "鏅烘収鍐滀笟", "鎮﹀績鍋ュ悍", "鍥芥柊鑳芥簮"]

Report an error. That is, the log cannot display Chinese characters correctly. After using the ensure_ascii=False flag in json.dumps, it seems that what is output is Unicode, rather than UTF-8.
These Chinese words are not in the model's dictionary. I want to add some Chinese words that are not in the dictionary. Roughly speaking, how should I go about doing this? Thank you in advance!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.