Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

语音识别的结果并不是逐字的输出,而是识别完成后一起输出了 #5

Open
huangfengjing opened this issue Nov 23, 2024 · 0 comments

Comments

@huangfengjing
Copy link

huangfengjing commented Nov 23, 2024

不管是执行你的样例 DEMO还是我自己的集成。

下面的这段 onSuccess 只会被触发一次,就是整个识别结束的时候,而不是逐字,甚至不是一小段一小段的,而是完成的长语音文本:

/// 语音识别结果监听
SpeechXf.onSpeechResultListener(
onSuccess: (result, isLast) {
if (mounted) {
speechController.text = speechController.text + result;
}
if (isLast) {
showToast('结束说话...', position: ToastPosition.bottom);
}
},
onError: (error) {
showToast(error);
},
);

以下 是部分日志:

D/MSC_LOG ( 9299): JNI_IsrResultCB
D/MSC_LOG ( 9299): JNI_IsrResultCB AttachCurrentThread
D/MSC_LOG ( 9299): JNI_IsrResultCB get result chararray
D/MSC_LOG ( 9299): JNI_IsrResultCB get sessionID chararray
D/MSC_LOG ( 9299): JNI_IsrResultCB CallVoidMethod
D/MscRecognizer( 9299): rsltCb:0result:{"sn":6,"ls":false,"bg":0,"ed":0,"pgs":"rpl","rg":[1,5],"ws":[{"bg":0,"cw":[{"sc":0.0,"w":"我会"}]},{"bg":0,"cw":[{"sc":0.0,"w":"说"}]},{"bg":0,"cw":[{"sc":0.0,"w":"一"}]},{"bg":0,"cw":[{"sc":0.0,"w":"段"}]},{"bg":0,"cw":[{"sc":0.0,"w":"很长"}]},{"bg":0,"cw":[{"sc":0.0,"w":"的"}]}]}
D/MSC_LOG ( 9299): JNI_IsrResultCB DetachCurrentThread
D/MscSpeechLog( 9299): false anddjsun false
D/MscSpeechLog( 9299): msc result time:1732340577139
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"我会"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"说"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"一"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"段"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"很长"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"的"}
D/============>xf_log:( 9299): 我会说一段很长的
D/MSC_LOG ( 9299): JNI_IsrResultCB
D/MSC_LOG ( 9299): JNI_IsrResultCB AttachCurrentThread
D/MSC_LOG ( 9299): JNI_IsrResultCB get result chararray
D/MSC_LOG ( 9299): JNI_IsrResultCB get sessionID chararray
D/MSC_LOG ( 9299): JNI_IsrResultCB CallVoidMethod
D/MscRecognizer( 9299): rsltCb:0result:{"sn":7,"ls":false,"bg":0,"ed":0,"pgs":"rpl","rg":[1,6],"ws":[{"bg":0,"cw":[{"sc":0.0,"w":"我会"}]},{"bg":0,"cw":[{"sc":0.0,"w":"说"}]},{"bg":0,"cw":[{"sc":0.0,"w":"一"}]},{"bg":0,"cw":[{"sc":0.0,"w":"段"}]},{"bg":0,"cw":[{"sc":0.0,"w":"很长"}]},{"bg":0,"cw":[{"sc":0.0,"w":"的"}]},{"bg":0,"cw":[{"sc":0.0,"w":"文章"}]}]}
D/MSC_LOG ( 9299): JNI_IsrResultCB DetachCurrentThread
D/MscSpeechLog( 9299): false anddjsun false
D/MscSpeechLog( 9299): msc result time:1732340577448
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"我会"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"说"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"一"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"段"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"很长"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"的"}
D/>>>>>>>>>>>( 9299): {"sc":0,"w":"文章"}
D/============>xf_log:( 9299): 我会说一段很长的文章

Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [版本 10.0.19045.5131], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.3)
[√] Android Studio (version 2024.2)
[√] IntelliJ IDEA Ultimate Edition (version 2024.2)
[√] VS Code (version 1.95.2)
[!] Proxy Configuration
! NO_PROXY is not set
[√] Connected device (4 available)
[√] Network resources

! Doctor found issues in 1 category.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant