Scrambled result on Chinese characters
- Lenguaje dominante
- Jupyter Notebook
- Estrellas
- 15.1k
- Forks
- 1.8k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.