-
Notifications
You must be signed in to change notification settings - Fork 19
Add phrase list support for speech recognizer #31
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds phrase list support to the speech recognizer module, enabling users to improve recognition accuracy by providing specific words or phrases that are likely to be spoken. The main changes include implementing the PhraseListGrammar type with methods to add phrases and clear the list, integrating it into the public API, and adding comprehensive integration tests.
- Introduces
PhraseListGrammarstruct withadd_phrase()andclear()methods - Exposes the speech recognizer handle to enable grammar creation
- Adds integration test demonstrating phrase list functionality with audio file processing
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/speech/phrase_list_grammar.rs | New module implementing PhraseListGrammar and internal GrammarPhrase structs |
| src/speech.rs | Exports the new PhraseListGrammar type in the public API |
| src/speech/speech_recognizer.rs | Changes handle visibility to pub(crate) for grammar integration |
| tests/integration_test.rs | Adds comprehensive integration test for phrase list functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
hi, looking into it. give me some time to review. regards Adam |
| /// SpeechRecognizer struct holds functionality for speech-to-text recognition. | ||
| pub struct SpeechRecognizer { | ||
| handle: SmartHandle<SPXRECOHANDLE>, | ||
| pub(crate) handle: SmartHandle<SPXRECOHANDLE>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason for this change? please clarify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the field pub(crate) because in PhraseListGrammar::from_recognizer(), it needs to access the recognizer handle to create a PhraseListGrammar instance.
Moved the GrammarPhrase struct and its implementation from phrase_list_grammar.rs to a new grammar_phrase.rs module for better separation of concerns and code organization. Updated imports to use the new module.
adambezecny
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This pull request introduces support for
phrase listin the speech recognizer module.The main changes include the addition of the
PhraseListGrammartype, its integration into the public API, and a new integration test to verify phrase list functionality.See the doc here: Improve recognition accuracy with phrase list
Also see the go library's PR here: microsoft/cognitive-services-speech-sdk-go#64