Skip to content

Commit 16a2840

Browse files
author
Kevin Weng
authored
AISDK-140: Add support of custom_vocabulary_id (#33)
1 parent 4c7f404 commit 16a2840

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ streamingClient.sendAudioData(ByteString);
241241

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

244-
## Custom Vocabulary (for streaming)
244+
## Custom Vocabulary
245245

246-
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.
246+
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.
247247

248248
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.
249249

250250
```
251-
// Initialize your client with your rev.ai access token
251+
// Initialize your client with your Rev.ai access token
252252
String accessToken = "Your Access Token";
253253
CustomVocabulariesClient customVocabulariesClient = new CustomVocabulariesClient(accessToken);
254254

src/main/java/ai/rev/speechtotext/models/asynchronous/RevAiJobOptions.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public class RevAiJobOptions {
3636
@SerializedName("speaker_channels_count")
3737
private Integer speakerChannelsCount;
3838

39+
/** Optional parameter for the id of a pre-computed custom vocabulary to be used */
40+
@SerializedName("custom_vocabulary_id")
41+
private String customVocabularyId;
42+
3943
/** Optional array of {@link CustomVocabulary} objects. */
4044
@SerializedName("custom_vocabularies")
4145
private List<CustomVocabulary> customVocabularies;
@@ -200,6 +204,25 @@ public void setSpeakerChannelsCount(Integer speakerChannelsCount) {
200204
this.speakerChannelsCount = speakerChannelsCount;
201205
}
202206

207+
/**
208+
* Returns the custom vocabulary ID.
209+
*
210+
* @return The custom vocabulary ID.
211+
*/
212+
public String getCustomVocabularyId() {
213+
return customVocabularyId;
214+
}
215+
216+
/**
217+
* Specifies the ID of the custom vocabulary the speech engine should use while processing audio
218+
* samples. Custom vocabularies are submitted prior to usage in the stream and assigned an Id.
219+
*
220+
* @param customVocabularyId The ID of the custom vocabulary.
221+
*/
222+
public void setCustomVocabularyId(String customVocabularyId) {
223+
this.customVocabularyId = customVocabularyId;
224+
}
225+
203226
/**
204227
* Returns a list of {@link CustomVocabulary} objects.
205228
*

0 commit comments

Comments
 (0)