Skip to content

Conversation

@wangfu91
Copy link
Contributor

This pull request introduces support for phrase list in the speech recognizer module.

The main changes include the addition of the PhraseListGrammar type, 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

A phrase list is a list of words or phrases provided ahead of time to help improve their recognition. Adding a phrase to a phrase list increases its importance, thus making it more likely to be recognized.

Also see the go library's PR here: microsoft/cognitive-services-speech-sdk-go#64

Copilot AI review requested due to automatic review settings August 22, 2025 10:25
Copy link

Copilot AI left a 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 PhraseListGrammar struct with add_phrase() and clear() 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.

@adambezecny
Copy link
Contributor

hi,

looking into it. give me some time to review.

regards

Adam

@wangfu91 wangfu91 mentioned this pull request Aug 26, 2025
4 tasks
/// SpeechRecognizer struct holds functionality for speech-to-text recognition.
pub struct SpeechRecognizer {
handle: SmartHandle<SPXRECOHANDLE>,
pub(crate) handle: SmartHandle<SPXRECOHANDLE>,
Copy link
Contributor

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

Copy link
Contributor Author

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.
Copy link
Contributor

@adambezecny adambezecny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@adambezecny adambezecny merged commit 2efdedd into jabber-tools:main Aug 27, 2025
8 of 10 checks passed
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

Successfully merging this pull request may close these issues.

2 participants