alphacep / alphacep/vosk-api

SetGrammar

Offen
#1,720 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Jupyter Notebook
Sterne
15.1k
Forks
1.8k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.