Skip to content

Commit 7611dd2

Browse files
committed
fix(Speech to Text): Add back support for interimResults with recognizeUsingWebSocket
1 parent 63761a5 commit 7611dd2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

speech-to-text/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/model/RecognizeOptions.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public interface Model {
117117
private Boolean profanityFilter;
118118
private Boolean smartFormatting;
119119
private Boolean speakerLabels;
120+
private Boolean interimResults;
120121

121122
/**
122123
* Builder.
@@ -139,6 +140,7 @@ public static class Builder {
139140
private Boolean profanityFilter;
140141
private Boolean smartFormatting;
141142
private Boolean speakerLabels;
143+
private Boolean interimResults;
142144

143145
private Builder(RecognizeOptions recognizeOptions) {
144146
audio = recognizeOptions.audio;
@@ -158,6 +160,7 @@ private Builder(RecognizeOptions recognizeOptions) {
158160
profanityFilter = recognizeOptions.profanityFilter;
159161
smartFormatting = recognizeOptions.smartFormatting;
160162
speakerLabels = recognizeOptions.speakerLabels;
163+
interimResults = recognizeOptions.interimResults;
161164
}
162165

163166
/**
@@ -378,6 +381,19 @@ public Builder speakerLabels(Boolean speakerLabels) {
378381
return this;
379382
}
380383

384+
/**
385+
* Set the interimResults.
386+
*
387+
* NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
388+
*
389+
* @param interimResults the interimResults
390+
* @return the interimResults
391+
*/
392+
public Builder interimResults(Boolean interimResults) {
393+
this.interimResults = interimResults;
394+
return this;
395+
}
396+
381397
/**
382398
* Set the audio.
383399
*
@@ -411,6 +427,7 @@ private RecognizeOptions(Builder builder) {
411427
profanityFilter = builder.profanityFilter;
412428
smartFormatting = builder.smartFormatting;
413429
speakerLabels = builder.speakerLabels;
430+
interimResults = builder.interimResults;
414431
}
415432

416433
/**
@@ -650,4 +667,18 @@ public Boolean smartFormatting() {
650667
public Boolean speakerLabels() {
651668
return speakerLabels;
652669
}
670+
671+
/**
672+
* Gets the interimResults.
673+
*
674+
* If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` objects. By default,
675+
* the service returns a single `SpeechRecognitionResults` object with final results only.
676+
*
677+
* NOTE: This parameter only works for the `recognizeUsingWebSocket` method.
678+
*
679+
* @return the interimResults
680+
*/
681+
public Boolean interimResults() {
682+
return interimResults;
683+
}
653684
}

0 commit comments

Comments
 (0)