alphacep / alphacep/vosk-api

Scrambled result on Chinese characters

オープン
#2,047 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Jupyter Notebook
スター
15.1k
フォーク
1.8k
PR マージ指標
30日以内にマージされた PR はありません

説明

I was testing Vosk on my Java program, but when I invoke `recognizer.getResult()` or `recognizer.getPartialResult()`, it returned some scrambled words like these:

what I said: 而且这次乱的更奇怪了
returned result: 鑰屼笖 杩欎釜 涔� 寰� 鏇� 濂囨�� 浜�

Then I tried to resolve this problem, and created a function:
```java
private static String fixVoskResult(String result) {
try {
byte[] bytes = result.getBytes(Charset.forName("GBK"));

return new String(bytes, StandardCharsets.UTF_8);
} catch (Exception e) {
LOGGER.error("Error occurred while fixing Vosk result.", e);
return result;
}
}
```
Surely it can fix some words, but there are still a lot of '�?':

�? 视觉 识别 准确�? �? 第二�?
�? �? �?�? 偷看 �?�? 偷看 �? 叔叔 �?
这个 识别 准确�? �? �? �? �? �? �?

It seems that '�' is causing problem. When Java parsing result from JNI return value (GBK parsing UTF-8 represented bytes), this character is used to represent those unparsable bytes(this is an unicode feature). So there are already broken bytes in returned result. That is why there are still some '�?' in fixed result.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。