Skip to content

Commit f330bdf

Browse files
authored
fix: update find-and-replace to accept strings or arrays of strings (#146)
1 parent 495445b commit f330bdf

2 files changed

Lines changed: 33 additions & 31 deletions

File tree

src/types/liveTranscriptionOptions.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ export type LiveTranscriptionOptions = {
2828
*/
2929
tier?: string;
3030

31-
/**
32-
* Terms or phrases to search for in the submitted audio and replace
33-
* @remarks Can send multiple instances in query string replace=this:that&replace=thisalso:thatalso. Replacing a term or phrase with nothing will remove the term or phrase from the audio transcript.
34-
* @see https://developers.deepgram.com/documentation/features/replace/
35-
*/
36-
replace?: string;
37-
3831
/**
3932
* BCP-47 language tag that hints at the primary spoken language.
4033
* @default en-US
@@ -114,13 +107,6 @@ export type LiveTranscriptionOptions = {
114107
*/
115108
numbers_spaces?: boolean;
116109

117-
/**
118-
* Terms or phrases to search for in the submitted audio. Deepgram searches
119-
* for acoustic patterns in audio rather than text patterns in transcripts
120-
* because we have noticed that acoustic pattern matching is more performant.
121-
* @see https://developers.deepgram.com/documentation/features/search/
122-
*/
123-
search?: Array<string>;
124110
/**
125111
* Callback URL to provide if you would like your submitted audio to be
126112
* processed asynchronously. When passed, Deepgram will immediately respond
@@ -131,14 +117,30 @@ export type LiveTranscriptionOptions = {
131117
* @see https://developers.deepgram.com/documentation/features/callback/
132118
*/
133119
callback?: string;
120+
121+
/**
122+
* Terms or phrases to search for in the submitted audio and replace
123+
* @remarks Can send multiple instances in query string replace=this:that&replace=thisalso:thatalso. Replacing a term or phrase with nothing will remove the term or phrase from the audio transcript.
124+
* @see https://developers.deepgram.com/documentation/features/replace/
125+
*/
126+
replace?: string[] | string;
127+
128+
/**
129+
* Terms or phrases to search for in the submitted audio. Deepgram searches
130+
* for acoustic patterns in audio rather than text patterns in transcripts
131+
* because we have noticed that acoustic pattern matching is more performant.
132+
* @see https://developers.deepgram.com/documentation/features/search/
133+
*/
134+
search?: string[] | string;
135+
134136
/**
135137
* Keywords to which the model should pay particular attention to boosting
136138
* or suppressing to help it understand context. Just like a human listener,
137139
* Deepgram can better understand mumbled, distorted, or otherwise
138140
* hard-to-decipher speech when it knows the context of the conversation.
139141
* @see https://developers.deepgram.com/documentation/features/keywords/
140142
*/
141-
keywords?: Array<string>;
143+
keywords?: string[] | string;
142144

143145
/**
144146
* Support for out-of-vocabulary (OOV) keyword boosting when processing streaming audio is

src/types/prerecordedTranscriptionOptions.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ export type PrerecordedTranscriptionOptions = {
2828
*/
2929
tier?: string;
3030

31-
/**
32-
* Terms or phrases to search for in the submitted audio and replace
33-
* @remarks Can send multiple instances in query string replace=this:that&replace=thisalso:thatalso. Replacing a term or phrase with nothing will remove the term or phrase from the audio transcript.
34-
* @see https://developers.deepgram.com/documentation/features/replace/
35-
*/
36-
replace?: string;
37-
3831
/**
3932
* BCP-47 language tag that hints at the primary spoken language.
4033
* @default en-US
@@ -119,14 +112,6 @@ export type PrerecordedTranscriptionOptions = {
119112
*/
120113
numbers_spaces?: boolean;
121114

122-
/**
123-
* Terms or phrases to search for in the submitted audio. Deepgram searches
124-
* for acoustic patterns in audio rather than text patterns in transcripts
125-
* because we have noticed that acoustic pattern matching is more performant.
126-
* @see https://developers.deepgram.com/documentation/features/search/
127-
*/
128-
search?: Array<string>;
129-
130115
/**
131116
* Callback URL to provide if you would like your submitted audio to be
132117
* processed asynchronously. When passed, Deepgram will immediately respond
@@ -138,14 +123,29 @@ export type PrerecordedTranscriptionOptions = {
138123
*/
139124
callback?: string;
140125

126+
/**
127+
* Terms or phrases to search for in the submitted audio and replace
128+
* @remarks Can send multiple instances in query string replace=this:that&replace=thisalso:thatalso. Replacing a term or phrase with nothing will remove the term or phrase from the audio transcript.
129+
* @see https://developers.deepgram.com/documentation/features/replace/
130+
*/
131+
replace?: string[] | string;
132+
133+
/**
134+
* Terms or phrases to search for in the submitted audio. Deepgram searches
135+
* for acoustic patterns in audio rather than text patterns in transcripts
136+
* because we have noticed that acoustic pattern matching is more performant.
137+
* @see https://developers.deepgram.com/documentation/features/search/
138+
*/
139+
search?: string[] | string;
140+
141141
/**
142142
* Keywords to which the model should pay particular attention to boosting
143143
* or suppressing to help it understand context. Just like a human listener,
144144
* Deepgram can better understand mumbled, distorted, or otherwise
145145
* hard-to-decipher speech when it knows the context of the conversation.
146146
* @see https://developers.deepgram.com/documentation/features/keywords/
147147
*/
148-
keywords?: Array<string>;
148+
keywords?: string[] | string;
149149

150150
/**
151151
* Support for out-of-vocabulary (OOV) keyword boosting when processing streaming audio is

0 commit comments

Comments
 (0)