From c0620a1fe1829402ea346be10b0a8c33a6d7dae5 Mon Sep 17 00:00:00 2001 From: eee <39297833+dongqianzhuan@users.noreply.github.com> Date: Fri, 31 Mar 2023 22:26:47 +0800 Subject: [PATCH] fix garbled console output with chinese characters (#108) --- ...ech-recognition-from-microphone-with-endpoint-detection.py | 4 ++-- python-api-examples/speech-recognition-from-microphone.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py b/python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py index 4c5bd633..d3e198cd 100755 --- a/python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py +++ b/python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py @@ -125,10 +125,10 @@ def main(): if result and (last_result != result): last_result = result - display.print(segment_id, result) - + print("\r{}:{}".format(segment_id, result), end="", flush=True) if is_endpoint: if result: + print("\r{}:{}".format(segment_id, result), flush=True) segment_id += 1 recognizer.reset(stream) diff --git a/python-api-examples/speech-recognition-from-microphone.py b/python-api-examples/speech-recognition-from-microphone.py index fe2b0167..efed81b6 100755 --- a/python-api-examples/speech-recognition-from-microphone.py +++ b/python-api-examples/speech-recognition-from-microphone.py @@ -113,7 +113,7 @@ def main(): result = recognizer.get_result(stream) if last_result != result: last_result = result - display.print(-1, result) + print("\r{}".format(result), end="", flush=True) if __name__ == "__main__":