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

Feature Request: Final Transcription Indicator #8

Open
Hbilalkhan22 opened this issue Jul 31, 2024 · 0 comments
Open

Feature Request: Final Transcription Indicator #8

Hbilalkhan22 opened this issue Jul 31, 2024 · 0 comments

Comments

@Hbilalkhan22
Copy link

Description:
Currently, the livespeechtotext package provides recognized speech segments via the success event listener, but there is no built-in mechanism to distinguish between interim and final transcriptions. This makes it challenging to determine when the transcription process is complete, especially for integrating with text input fields where precise control over text updates is crucial.

Proposed Solution:
Introduce a "final text" indicator within the success event or a separate event to signify that the transcription is complete. This could be an additional property in the event payload that developers can check to know when the final recognized text is provided.

Example:
_livespeechtotextPlugin.addEventListener("success", (value) {
if (value.runtimeType != Map<String, dynamic>) return;
if ((value as Map<String, dynamic>).isEmpty) return;

bool isFinal = value['isFinal'] ?? false;
String transcribedText = value['text'] ?? '';

if (transcribedText.isNotEmpty) {
if (isFinal) {
// Handle final recognized text
widget.onFinalTextRecognized(transcribedText);
} else {
// Handle interim text updates
widget.onInterimTextRecognized(transcribedText);
}
}
});

Benefits:

Clear differentiation between interim and final transcriptions.
Improved control over text input updates, reducing potential issues with text insertion.
Enhanced developer experience with more granular control over speech-to-text integration.
Use Case:
This feature is especially useful for applications that need to insert speech-to-text input at specific cursor positions within text fields, ensuring that only the final recognized text is inserted, avoiding redundant or partial updates.

Thank you for considering this feature request. It would greatly enhance the usability and functionality of the livespeechtotext package.

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