Skip to content

Commit

Permalink
AISDK-140: Add support of custom_vocabulary_id (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Weng authored Feb 1, 2022
1 parent 4c7f404 commit 16a2840
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ streamingClient.sendAudioData(ByteString);

The streaming connection will close when you call the method `streamingClient.close()` or if you go 15 seconds without sending any audio data.

## Custom Vocabulary (for streaming)
## Custom Vocabulary

You can submit any custom vocabularies independently through the CustomVocabulariesClient. Once the custom vocabulary has been submitted and processed, it is ready to be used in any streaming job.
You can submit any custom vocabularies independently through the CustomVocabulariesClient. Once the custom vocabulary has been submitted and processed, it is ready to be used in any async or streaming job.

Below you can see an example of how to create, submit, delete, check on the status and view the other associated information of your custom vocabulary.

```
// Initialize your client with your rev.ai access token
// Initialize your client with your Rev.ai access token
String accessToken = "Your Access Token";
CustomVocabulariesClient customVocabulariesClient = new CustomVocabulariesClient(accessToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public class RevAiJobOptions {
@SerializedName("speaker_channels_count")
private Integer speakerChannelsCount;

/** Optional parameter for the id of a pre-computed custom vocabulary to be used */
@SerializedName("custom_vocabulary_id")
private String customVocabularyId;

/** Optional array of {@link CustomVocabulary} objects. */
@SerializedName("custom_vocabularies")
private List<CustomVocabulary> customVocabularies;
Expand Down Expand Up @@ -200,6 +204,25 @@ public void setSpeakerChannelsCount(Integer speakerChannelsCount) {
this.speakerChannelsCount = speakerChannelsCount;
}

/**
* Returns the custom vocabulary ID.
*
* @return The custom vocabulary ID.
*/
public String getCustomVocabularyId() {
return customVocabularyId;
}

/**
* Specifies the ID of the custom vocabulary the speech engine should use while processing audio
* samples. Custom vocabularies are submitted prior to usage in the stream and assigned an Id.
*
* @param customVocabularyId The ID of the custom vocabulary.
*/
public void setCustomVocabularyId(String customVocabularyId) {
this.customVocabularyId = customVocabularyId;
}

/**
* Returns a list of {@link CustomVocabulary} objects.
*
Expand Down

0 comments on commit 16a2840

Please sign in to comment.