assemblyai 1.0.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assemblyai/lemur/types/lemur_model.rb +1 -0
- data/lib/assemblyai/transcripts/client.rb +349 -153
- data/lib/assemblyai/transcripts/polling_client.rb +148 -70
- data/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +2 -2
- data/lib/assemblyai/transcripts/types/paragraphs_response.rb +8 -8
- data/lib/assemblyai/transcripts/types/sentences_response.rb +8 -8
- data/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +12 -1
- data/lib/assemblyai/transcripts/types/topic_detection_result.rb +2 -2
- data/lib/assemblyai/transcripts/types/transcript.rb +98 -56
- data/lib/assemblyai/transcripts/types/transcript_boost_param.rb +1 -1
- data/lib/assemblyai/transcripts/types/transcript_list.rb +4 -4
- data/lib/assemblyai/transcripts/types/transcript_list_item.rb +15 -15
- data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +64 -38
- data/lib/assemblyai/transcripts/types/transcript_paragraph.rb +12 -32
- data/lib/assemblyai/transcripts/types/transcript_sentence.rb +22 -11
- data/lib/assemblyai/transcripts/types/transcript_utterance.rb +14 -2
- data/lib/assemblyai/transcripts/types/transcript_word.rb +21 -11
- data/lib/gemconfig.rb +1 -1
- metadata +2 -2
@@ -3,8 +3,8 @@
|
|
3
3
|
require_relative "../../requests"
|
4
4
|
require_relative "types/transcript_status"
|
5
5
|
require_relative "types/transcript_list"
|
6
|
-
require_relative "types/speech_model"
|
7
6
|
require_relative "types/transcript_language_code"
|
7
|
+
require_relative "types/speech_model"
|
8
8
|
require_relative "types/transcript_boost_param"
|
9
9
|
require_relative "types/redact_pii_audio_quality"
|
10
10
|
require_relative "types/pii_policy"
|
@@ -22,26 +22,34 @@ require "async"
|
|
22
22
|
|
23
23
|
module AssemblyAI
|
24
24
|
class TranscriptsClient
|
25
|
+
# @return [AssemblyAI::RequestClient]
|
25
26
|
attr_reader :request_client
|
26
27
|
|
27
|
-
# @param request_client [RequestClient]
|
28
|
-
# @return [TranscriptsClient]
|
28
|
+
# @param request_client [AssemblyAI::RequestClient]
|
29
|
+
# @return [AssemblyAI::TranscriptsClient]
|
29
30
|
def initialize(request_client:)
|
30
|
-
# @type [RequestClient]
|
31
31
|
@request_client = request_client
|
32
32
|
end
|
33
33
|
|
34
34
|
# Retrieve a list of transcripts you created.
|
35
|
-
#
|
35
|
+
# Transcripts are sorted from newest to oldest. The previous URL always points to
|
36
|
+
# a page with older transcripts.
|
36
37
|
#
|
37
38
|
# @param limit [Integer] Maximum amount of transcripts to retrieve
|
38
|
-
# @param status [Transcripts::TranscriptStatus] Filter by transcript status
|
39
|
+
# @param status [AssemblyAI::Transcripts::TranscriptStatus] Filter by transcript status
|
39
40
|
# @param created_on [String] Only get transcripts created on this date
|
40
41
|
# @param before_id [String] Get transcripts that were created before this transcript ID
|
41
42
|
# @param after_id [String] Get transcripts that were created after this transcript ID
|
42
43
|
# @param throttled_only [Boolean] Only get throttled transcripts, overrides the status filter
|
43
|
-
# @param request_options [RequestOptions]
|
44
|
-
# @return [Transcripts::TranscriptList]
|
44
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
45
|
+
# @return [AssemblyAI::Transcripts::TranscriptList]
|
46
|
+
# @example
|
47
|
+
# api = AssemblyAI::Client.new(
|
48
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
49
|
+
# base_url: "https://api.example.com",
|
50
|
+
# api_key: "YOUR_API_KEY"
|
51
|
+
# )
|
52
|
+
# api.transcripts.list
|
45
53
|
def list(limit: nil, status: nil, created_on: nil, before_id: nil, after_id: nil, throttled_only: nil,
|
46
54
|
request_options: nil)
|
47
55
|
response = @request_client.conn.get do |req|
|
@@ -59,66 +67,116 @@ module AssemblyAI
|
|
59
67
|
}.compact
|
60
68
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript"
|
61
69
|
end
|
62
|
-
Transcripts::TranscriptList.from_json(json_object: response.body)
|
70
|
+
AssemblyAI::Transcripts::TranscriptList.from_json(json_object: response.body)
|
63
71
|
end
|
64
72
|
|
65
|
-
# Create a transcript from
|
73
|
+
# Create a transcript from a media file that is accessible via a URL.
|
66
74
|
#
|
67
|
-
# @param
|
68
|
-
# @param
|
75
|
+
# @param language_code [AssemblyAI::Transcripts::TranscriptLanguageCode]
|
76
|
+
# @param language_detection [Boolean] Enable [Automatic language
|
77
|
+
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
78
|
+
# either true or false.
|
79
|
+
# @param language_confidence_threshold [Float] The confidence threshold for the automatically detected language.
|
80
|
+
# An error will be returned if the language confidence is below this threshold.
|
81
|
+
# Defaults to 0.
|
82
|
+
# @param speech_model [AssemblyAI::Transcripts::SpeechModel]
|
69
83
|
# @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
|
70
84
|
# @param format_text [Boolean] Enable Text Formatting, can be true or false
|
71
|
-
# @param
|
72
|
-
# @param
|
73
|
-
#
|
74
|
-
#
|
75
|
-
# @param
|
85
|
+
# @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
86
|
+
# @param multichannel [Boolean] Enable
|
87
|
+
# ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription)
|
88
|
+
# transcription, can be true or false.
|
89
|
+
# @param dual_channel [Boolean] Enable [Dual
|
90
|
+
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
91
|
+
# transcription, can be true or false.
|
92
|
+
# @param webhook_url [String] The URL to which we send webhook requests.
|
93
|
+
# We sends two different types of webhook requests.
|
94
|
+
# One request when a transcript is completed or failed, and one request when the
|
95
|
+
# redacted audio is ready if redact_pii_audio is enabled.
|
96
|
+
# @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook
|
97
|
+
# requests
|
98
|
+
# @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook
|
99
|
+
# requests for added security
|
100
|
+
# @param auto_highlights [Boolean] Enable Key Phrases, either true or false
|
76
101
|
# @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
|
77
102
|
# @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
|
78
103
|
# @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
|
79
|
-
# @param boost_param [Transcripts::TranscriptBoostParam]
|
104
|
+
# @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words
|
80
105
|
# @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
|
81
|
-
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
82
|
-
#
|
83
|
-
# @param
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
# @param
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
# @param
|
92
|
-
#
|
106
|
+
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
107
|
+
# false
|
108
|
+
# @param redact_pii_audio [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be
|
109
|
+
# true or false. See [PII
|
110
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
111
|
+
# details.
|
112
|
+
# @param redact_pii_audio_quality [AssemblyAI::Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently
|
113
|
+
# supports mp3 (default) and wav. See [PII
|
114
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
115
|
+
# details.
|
116
|
+
# @param redact_pii_policies [Array<AssemblyAI::Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII
|
117
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
118
|
+
# details.
|
119
|
+
# @param redact_pii_sub [AssemblyAI::Transcripts::SubstitutionPolicy]
|
120
|
+
# @param speaker_labels [Boolean] Enable [Speaker
|
121
|
+
# diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be
|
122
|
+
# true or false
|
123
|
+
# @param speakers_expected [Integer] Tells the speaker label model how many speakers it should attempt to identify,
|
124
|
+
# up to 10. See [Speaker
|
125
|
+
# diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for
|
126
|
+
# more details.
|
127
|
+
# @param content_safety [Boolean] Enable [Content
|
128
|
+
# Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be
|
129
|
+
# true or false
|
130
|
+
# @param content_safety_confidence [Integer] The confidence threshold for the Content Moderation model. Values must be
|
131
|
+
# between 25 and 100.
|
132
|
+
# @param iab_categories [Boolean] Enable [Topic
|
133
|
+
# Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true
|
134
|
+
# or false
|
135
|
+
# @param custom_spelling [Array<Hash>] Customize how words are spelled and formatted using to and from valuesRequest of type Array<AssemblyAI::Transcripts::TranscriptCustomSpelling>, as a Hash
|
93
136
|
# * :from (Array<String>)
|
94
137
|
# * :to (String)
|
95
|
-
# @param
|
96
|
-
#
|
97
|
-
#
|
98
|
-
# @param
|
138
|
+
# @param sentiment_analysis [Boolean] Enable [Sentiment
|
139
|
+
# Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be
|
140
|
+
# true or false
|
141
|
+
# @param auto_chapters [Boolean] Enable [Auto Chapters](https://www.assemblyai.com/docs/models/auto-chapters),
|
142
|
+
# can be true or false
|
143
|
+
# @param entity_detection [Boolean] Enable [Entity
|
144
|
+
# Detection](https://www.assemblyai.com/docs/models/entity-detection), can be true
|
145
|
+
# or false
|
99
146
|
# @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
|
100
|
-
#
|
101
|
-
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization),
|
102
|
-
#
|
103
|
-
# @param
|
104
|
-
# @param
|
105
|
-
# @param
|
106
|
-
# @param
|
147
|
+
# Valid values are in the range [0, 1] inclusive.
|
148
|
+
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization),
|
149
|
+
# can be true or false
|
150
|
+
# @param summary_model [AssemblyAI::Transcripts::SummaryModel] The model to summarize the transcript
|
151
|
+
# @param summary_type [AssemblyAI::Transcripts::SummaryType] The type of summary
|
152
|
+
# @param custom_topics [Boolean] Enable custom topics, either true or false
|
153
|
+
# @param topics [Array<String>] The list of custom topics
|
107
154
|
# @param audio_url [String] The URL of the audio or video file to transcribe.
|
108
|
-
# @param request_options [RequestOptions]
|
109
|
-
# @return [Transcripts::Transcript]
|
110
|
-
|
111
|
-
|
155
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
156
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
157
|
+
# @example
|
158
|
+
# api = AssemblyAI::Client.new(
|
159
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
160
|
+
# base_url: "https://api.example.com",
|
161
|
+
# api_key: "YOUR_API_KEY"
|
162
|
+
# )
|
163
|
+
# api.transcripts.submit(audio_url: "https://assembly.ai/wildfires.mp3")
|
164
|
+
def submit(audio_url:, language_code: nil, language_detection: nil, language_confidence_threshold: nil, speech_model: nil,
|
165
|
+
punctuate: nil, format_text: nil, disfluencies: nil, multichannel: nil, dual_channel: nil, webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, custom_spelling: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil)
|
112
166
|
response = @request_client.conn.post do |req|
|
113
167
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
114
168
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
115
169
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
116
170
|
req.body = {
|
117
171
|
**(request_options&.additional_body_parameters || {}),
|
118
|
-
speech_model: speech_model,
|
119
172
|
language_code: language_code,
|
173
|
+
language_detection: language_detection,
|
174
|
+
language_confidence_threshold: language_confidence_threshold,
|
175
|
+
speech_model: speech_model,
|
120
176
|
punctuate: punctuate,
|
121
177
|
format_text: format_text,
|
178
|
+
disfluencies: disfluencies,
|
179
|
+
multichannel: multichannel,
|
122
180
|
dual_channel: dual_channel,
|
123
181
|
webhook_url: webhook_url,
|
124
182
|
webhook_auth_header_name: webhook_auth_header_name,
|
@@ -139,9 +197,7 @@ module AssemblyAI
|
|
139
197
|
content_safety: content_safety,
|
140
198
|
content_safety_confidence: content_safety_confidence,
|
141
199
|
iab_categories: iab_categories,
|
142
|
-
language_detection: language_detection,
|
143
200
|
custom_spelling: custom_spelling,
|
144
|
-
disfluencies: disfluencies,
|
145
201
|
sentiment_analysis: sentiment_analysis,
|
146
202
|
auto_chapters: auto_chapters,
|
147
203
|
entity_detection: entity_detection,
|
@@ -151,19 +207,26 @@ module AssemblyAI
|
|
151
207
|
summary_type: summary_type,
|
152
208
|
custom_topics: custom_topics,
|
153
209
|
topics: topics,
|
154
|
-
additional_properties: additional_properties,
|
155
210
|
audio_url: audio_url
|
156
211
|
}.compact
|
157
212
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript"
|
158
213
|
end
|
159
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
214
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
160
215
|
end
|
161
216
|
|
162
|
-
# Get the transcript resource. The transcript is ready when the "status" is
|
217
|
+
# Get the transcript resource. The transcript is ready when the "status" is
|
218
|
+
# "completed".
|
163
219
|
#
|
164
220
|
# @param transcript_id [String] ID of the transcript
|
165
|
-
# @param request_options [RequestOptions]
|
166
|
-
# @return [Transcripts::Transcript]
|
221
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
222
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
223
|
+
# @example
|
224
|
+
# api = AssemblyAI::Client.new(
|
225
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
226
|
+
# base_url: "https://api.example.com",
|
227
|
+
# api_key: "YOUR_API_KEY"
|
228
|
+
# )
|
229
|
+
# api.transcripts.get(transcript_id: "transcript_id")
|
167
230
|
def get(transcript_id:, request_options: nil)
|
168
231
|
response = @request_client.conn.get do |req|
|
169
232
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -171,14 +234,21 @@ module AssemblyAI
|
|
171
234
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
172
235
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}"
|
173
236
|
end
|
174
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
237
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
175
238
|
end
|
176
239
|
|
177
|
-
#
|
240
|
+
# Remove the data from the transcript and mark it as deleted.
|
178
241
|
#
|
179
242
|
# @param transcript_id [String] ID of the transcript
|
180
|
-
# @param request_options [RequestOptions]
|
181
|
-
# @return [Transcripts::Transcript]
|
243
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
244
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
245
|
+
# @example
|
246
|
+
# api = AssemblyAI::Client.new(
|
247
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
248
|
+
# base_url: "https://api.example.com",
|
249
|
+
# api_key: "YOUR_API_KEY"
|
250
|
+
# )
|
251
|
+
# api.transcripts.delete(transcript_id: "{transcript_id}")
|
182
252
|
def delete(transcript_id:, request_options: nil)
|
183
253
|
response = @request_client.conn.delete do |req|
|
184
254
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -186,15 +256,16 @@ module AssemblyAI
|
|
186
256
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
187
257
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}"
|
188
258
|
end
|
189
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
259
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
190
260
|
end
|
191
261
|
|
192
|
-
# Export your transcript in SRT or VTT format
|
262
|
+
# Export your transcript in SRT or VTT format to use with a video player for
|
263
|
+
# subtitles and closed captions.
|
193
264
|
#
|
194
265
|
# @param transcript_id [String] ID of the transcript
|
195
|
-
# @param subtitle_format [Transcripts::SubtitleFormat] The format of the captions
|
266
|
+
# @param subtitle_format [AssemblyAI::Transcripts::SubtitleFormat] The format of the captions
|
196
267
|
# @param chars_per_caption [Integer] The maximum number of characters per caption
|
197
|
-
# @param request_options [RequestOptions]
|
268
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
198
269
|
# @return [String]
|
199
270
|
def get_subtitles(transcript_id:, subtitle_format:, chars_per_caption: nil, request_options: nil)
|
200
271
|
response = @request_client.conn.get do |req|
|
@@ -210,11 +281,20 @@ module AssemblyAI
|
|
210
281
|
response.body
|
211
282
|
end
|
212
283
|
|
213
|
-
# Get the transcript split by sentences. The API will attempt to semantically
|
284
|
+
# Get the transcript split by sentences. The API will attempt to semantically
|
285
|
+
# segment the transcript into sentences to create more reader-friendly
|
286
|
+
# transcripts.
|
214
287
|
#
|
215
288
|
# @param transcript_id [String] ID of the transcript
|
216
|
-
# @param request_options [RequestOptions]
|
217
|
-
# @return [Transcripts::SentencesResponse]
|
289
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
290
|
+
# @return [AssemblyAI::Transcripts::SentencesResponse]
|
291
|
+
# @example
|
292
|
+
# api = AssemblyAI::Client.new(
|
293
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
294
|
+
# base_url: "https://api.example.com",
|
295
|
+
# api_key: "YOUR_API_KEY"
|
296
|
+
# )
|
297
|
+
# api.transcripts.get_sentences(transcript_id: "transcript_id")
|
218
298
|
def get_sentences(transcript_id:, request_options: nil)
|
219
299
|
response = @request_client.conn.get do |req|
|
220
300
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -222,14 +302,23 @@ module AssemblyAI
|
|
222
302
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
223
303
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/sentences"
|
224
304
|
end
|
225
|
-
Transcripts::SentencesResponse.from_json(json_object: response.body)
|
305
|
+
AssemblyAI::Transcripts::SentencesResponse.from_json(json_object: response.body)
|
226
306
|
end
|
227
307
|
|
228
|
-
# Get the transcript split by paragraphs. The API will attempt to semantically
|
308
|
+
# Get the transcript split by paragraphs. The API will attempt to semantically
|
309
|
+
# segment your transcript into paragraphs to create more reader-friendly
|
310
|
+
# transcripts.
|
229
311
|
#
|
230
312
|
# @param transcript_id [String] ID of the transcript
|
231
|
-
# @param request_options [RequestOptions]
|
232
|
-
# @return [Transcripts::ParagraphsResponse]
|
313
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
314
|
+
# @return [AssemblyAI::Transcripts::ParagraphsResponse]
|
315
|
+
# @example
|
316
|
+
# api = AssemblyAI::Client.new(
|
317
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
318
|
+
# base_url: "https://api.example.com",
|
319
|
+
# api_key: "YOUR_API_KEY"
|
320
|
+
# )
|
321
|
+
# api.transcripts.get_paragraphs(transcript_id: "transcript_id")
|
233
322
|
def get_paragraphs(transcript_id:, request_options: nil)
|
234
323
|
response = @request_client.conn.get do |req|
|
235
324
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -237,15 +326,16 @@ module AssemblyAI
|
|
237
326
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
238
327
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/paragraphs"
|
239
328
|
end
|
240
|
-
Transcripts::ParagraphsResponse.from_json(json_object: response.body)
|
329
|
+
AssemblyAI::Transcripts::ParagraphsResponse.from_json(json_object: response.body)
|
241
330
|
end
|
242
331
|
|
243
|
-
# Search through the transcript for
|
332
|
+
# Search through the transcript for keywords. You can search for individual words,
|
333
|
+
# numbers, or phrases containing up to five words or numbers.
|
244
334
|
#
|
245
335
|
# @param transcript_id [String] ID of the transcript
|
246
336
|
# @param words [String] Keywords to search for
|
247
|
-
# @param request_options [RequestOptions]
|
248
|
-
# @return [Transcripts::WordSearchResponse]
|
337
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
338
|
+
# @return [AssemblyAI::Transcripts::WordSearchResponse]
|
249
339
|
def word_search(transcript_id:, words: nil, request_options: nil)
|
250
340
|
response = @request_client.conn.get do |req|
|
251
341
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -254,14 +344,22 @@ module AssemblyAI
|
|
254
344
|
req.params = { **(request_options&.additional_query_parameters || {}), "words": words }.compact
|
255
345
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/word-search"
|
256
346
|
end
|
257
|
-
Transcripts::WordSearchResponse.from_json(json_object: response.body)
|
347
|
+
AssemblyAI::Transcripts::WordSearchResponse.from_json(json_object: response.body)
|
258
348
|
end
|
259
349
|
|
260
|
-
# Retrieve the redacted audio object containing the status and URL to the redacted
|
350
|
+
# Retrieve the redacted audio object containing the status and URL to the redacted
|
351
|
+
# audio.
|
261
352
|
#
|
262
353
|
# @param transcript_id [String] ID of the transcript
|
263
|
-
# @param request_options [RequestOptions]
|
264
|
-
# @return [Transcripts::RedactedAudioResponse]
|
354
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
355
|
+
# @return [AssemblyAI::Transcripts::RedactedAudioResponse]
|
356
|
+
# @example
|
357
|
+
# api = AssemblyAI::Client.new(
|
358
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
359
|
+
# base_url: "https://api.example.com",
|
360
|
+
# api_key: "YOUR_API_KEY"
|
361
|
+
# )
|
362
|
+
# api.transcripts.get_redacted_audio(transcript_id: "transcript_id")
|
265
363
|
def get_redacted_audio(transcript_id:, request_options: nil)
|
266
364
|
response = @request_client.conn.get do |req|
|
267
365
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -269,31 +367,39 @@ module AssemblyAI
|
|
269
367
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
270
368
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/redacted-audio"
|
271
369
|
end
|
272
|
-
Transcripts::RedactedAudioResponse.from_json(json_object: response.body)
|
370
|
+
AssemblyAI::Transcripts::RedactedAudioResponse.from_json(json_object: response.body)
|
273
371
|
end
|
274
372
|
end
|
275
373
|
|
276
374
|
class AsyncTranscriptsClient
|
375
|
+
# @return [AssemblyAI::AsyncRequestClient]
|
277
376
|
attr_reader :request_client
|
278
377
|
|
279
|
-
# @param request_client [AsyncRequestClient]
|
280
|
-
# @return [AsyncTranscriptsClient]
|
378
|
+
# @param request_client [AssemblyAI::AsyncRequestClient]
|
379
|
+
# @return [AssemblyAI::AsyncTranscriptsClient]
|
281
380
|
def initialize(request_client:)
|
282
|
-
# @type [AsyncRequestClient]
|
283
381
|
@request_client = request_client
|
284
382
|
end
|
285
383
|
|
286
384
|
# Retrieve a list of transcripts you created.
|
287
|
-
#
|
385
|
+
# Transcripts are sorted from newest to oldest. The previous URL always points to
|
386
|
+
# a page with older transcripts.
|
288
387
|
#
|
289
388
|
# @param limit [Integer] Maximum amount of transcripts to retrieve
|
290
|
-
# @param status [Transcripts::TranscriptStatus] Filter by transcript status
|
389
|
+
# @param status [AssemblyAI::Transcripts::TranscriptStatus] Filter by transcript status
|
291
390
|
# @param created_on [String] Only get transcripts created on this date
|
292
391
|
# @param before_id [String] Get transcripts that were created before this transcript ID
|
293
392
|
# @param after_id [String] Get transcripts that were created after this transcript ID
|
294
393
|
# @param throttled_only [Boolean] Only get throttled transcripts, overrides the status filter
|
295
|
-
# @param request_options [RequestOptions]
|
296
|
-
# @return [Transcripts::TranscriptList]
|
394
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
395
|
+
# @return [AssemblyAI::Transcripts::TranscriptList]
|
396
|
+
# @example
|
397
|
+
# api = AssemblyAI::Client.new(
|
398
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
399
|
+
# base_url: "https://api.example.com",
|
400
|
+
# api_key: "YOUR_API_KEY"
|
401
|
+
# )
|
402
|
+
# api.transcripts.list
|
297
403
|
def list(limit: nil, status: nil, created_on: nil, before_id: nil, after_id: nil, throttled_only: nil,
|
298
404
|
request_options: nil)
|
299
405
|
Async do
|
@@ -312,57 +418,103 @@ module AssemblyAI
|
|
312
418
|
}.compact
|
313
419
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript"
|
314
420
|
end
|
315
|
-
Transcripts::TranscriptList.from_json(json_object: response.body)
|
421
|
+
AssemblyAI::Transcripts::TranscriptList.from_json(json_object: response.body)
|
316
422
|
end
|
317
423
|
end
|
318
424
|
|
319
|
-
# Create a transcript from
|
425
|
+
# Create a transcript from a media file that is accessible via a URL.
|
320
426
|
#
|
321
|
-
# @param
|
322
|
-
# @param
|
427
|
+
# @param language_code [AssemblyAI::Transcripts::TranscriptLanguageCode]
|
428
|
+
# @param language_detection [Boolean] Enable [Automatic language
|
429
|
+
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
430
|
+
# either true or false.
|
431
|
+
# @param language_confidence_threshold [Float] The confidence threshold for the automatically detected language.
|
432
|
+
# An error will be returned if the language confidence is below this threshold.
|
433
|
+
# Defaults to 0.
|
434
|
+
# @param speech_model [AssemblyAI::Transcripts::SpeechModel]
|
323
435
|
# @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
|
324
436
|
# @param format_text [Boolean] Enable Text Formatting, can be true or false
|
325
|
-
# @param
|
326
|
-
# @param
|
327
|
-
#
|
328
|
-
#
|
329
|
-
# @param
|
437
|
+
# @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
438
|
+
# @param multichannel [Boolean] Enable
|
439
|
+
# ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription)
|
440
|
+
# transcription, can be true or false.
|
441
|
+
# @param dual_channel [Boolean] Enable [Dual
|
442
|
+
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
443
|
+
# transcription, can be true or false.
|
444
|
+
# @param webhook_url [String] The URL to which we send webhook requests.
|
445
|
+
# We sends two different types of webhook requests.
|
446
|
+
# One request when a transcript is completed or failed, and one request when the
|
447
|
+
# redacted audio is ready if redact_pii_audio is enabled.
|
448
|
+
# @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook
|
449
|
+
# requests
|
450
|
+
# @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook
|
451
|
+
# requests for added security
|
452
|
+
# @param auto_highlights [Boolean] Enable Key Phrases, either true or false
|
330
453
|
# @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
|
331
454
|
# @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
|
332
455
|
# @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
|
333
|
-
# @param boost_param [Transcripts::TranscriptBoostParam]
|
456
|
+
# @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words
|
334
457
|
# @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
|
335
|
-
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
336
|
-
#
|
337
|
-
# @param
|
338
|
-
#
|
339
|
-
#
|
340
|
-
#
|
341
|
-
# @param
|
342
|
-
#
|
343
|
-
#
|
344
|
-
#
|
345
|
-
# @param
|
346
|
-
#
|
458
|
+
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
459
|
+
# false
|
460
|
+
# @param redact_pii_audio [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be
|
461
|
+
# true or false. See [PII
|
462
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
463
|
+
# details.
|
464
|
+
# @param redact_pii_audio_quality [AssemblyAI::Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently
|
465
|
+
# supports mp3 (default) and wav. See [PII
|
466
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
467
|
+
# details.
|
468
|
+
# @param redact_pii_policies [Array<AssemblyAI::Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII
|
469
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
470
|
+
# details.
|
471
|
+
# @param redact_pii_sub [AssemblyAI::Transcripts::SubstitutionPolicy]
|
472
|
+
# @param speaker_labels [Boolean] Enable [Speaker
|
473
|
+
# diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be
|
474
|
+
# true or false
|
475
|
+
# @param speakers_expected [Integer] Tells the speaker label model how many speakers it should attempt to identify,
|
476
|
+
# up to 10. See [Speaker
|
477
|
+
# diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for
|
478
|
+
# more details.
|
479
|
+
# @param content_safety [Boolean] Enable [Content
|
480
|
+
# Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be
|
481
|
+
# true or false
|
482
|
+
# @param content_safety_confidence [Integer] The confidence threshold for the Content Moderation model. Values must be
|
483
|
+
# between 25 and 100.
|
484
|
+
# @param iab_categories [Boolean] Enable [Topic
|
485
|
+
# Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true
|
486
|
+
# or false
|
487
|
+
# @param custom_spelling [Array<Hash>] Customize how words are spelled and formatted using to and from valuesRequest of type Array<AssemblyAI::Transcripts::TranscriptCustomSpelling>, as a Hash
|
347
488
|
# * :from (Array<String>)
|
348
489
|
# * :to (String)
|
349
|
-
# @param
|
350
|
-
#
|
351
|
-
#
|
352
|
-
# @param
|
490
|
+
# @param sentiment_analysis [Boolean] Enable [Sentiment
|
491
|
+
# Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be
|
492
|
+
# true or false
|
493
|
+
# @param auto_chapters [Boolean] Enable [Auto Chapters](https://www.assemblyai.com/docs/models/auto-chapters),
|
494
|
+
# can be true or false
|
495
|
+
# @param entity_detection [Boolean] Enable [Entity
|
496
|
+
# Detection](https://www.assemblyai.com/docs/models/entity-detection), can be true
|
497
|
+
# or false
|
353
498
|
# @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
|
354
|
-
#
|
355
|
-
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization),
|
356
|
-
#
|
357
|
-
# @param
|
358
|
-
# @param
|
359
|
-
# @param
|
360
|
-
# @param
|
499
|
+
# Valid values are in the range [0, 1] inclusive.
|
500
|
+
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization),
|
501
|
+
# can be true or false
|
502
|
+
# @param summary_model [AssemblyAI::Transcripts::SummaryModel] The model to summarize the transcript
|
503
|
+
# @param summary_type [AssemblyAI::Transcripts::SummaryType] The type of summary
|
504
|
+
# @param custom_topics [Boolean] Enable custom topics, either true or false
|
505
|
+
# @param topics [Array<String>] The list of custom topics
|
361
506
|
# @param audio_url [String] The URL of the audio or video file to transcribe.
|
362
|
-
# @param request_options [RequestOptions]
|
363
|
-
# @return [Transcripts::Transcript]
|
364
|
-
|
365
|
-
|
507
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
508
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
509
|
+
# @example
|
510
|
+
# api = AssemblyAI::Client.new(
|
511
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
512
|
+
# base_url: "https://api.example.com",
|
513
|
+
# api_key: "YOUR_API_KEY"
|
514
|
+
# )
|
515
|
+
# api.transcripts.submit(audio_url: "https://assembly.ai/wildfires.mp3")
|
516
|
+
def submit(audio_url:, language_code: nil, language_detection: nil, language_confidence_threshold: nil, speech_model: nil,
|
517
|
+
punctuate: nil, format_text: nil, disfluencies: nil, multichannel: nil, dual_channel: nil, webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, custom_spelling: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil)
|
366
518
|
Async do
|
367
519
|
response = @request_client.conn.post do |req|
|
368
520
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -370,10 +522,14 @@ module AssemblyAI
|
|
370
522
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
371
523
|
req.body = {
|
372
524
|
**(request_options&.additional_body_parameters || {}),
|
373
|
-
speech_model: speech_model,
|
374
525
|
language_code: language_code,
|
526
|
+
language_detection: language_detection,
|
527
|
+
language_confidence_threshold: language_confidence_threshold,
|
528
|
+
speech_model: speech_model,
|
375
529
|
punctuate: punctuate,
|
376
530
|
format_text: format_text,
|
531
|
+
disfluencies: disfluencies,
|
532
|
+
multichannel: multichannel,
|
377
533
|
dual_channel: dual_channel,
|
378
534
|
webhook_url: webhook_url,
|
379
535
|
webhook_auth_header_name: webhook_auth_header_name,
|
@@ -394,9 +550,7 @@ module AssemblyAI
|
|
394
550
|
content_safety: content_safety,
|
395
551
|
content_safety_confidence: content_safety_confidence,
|
396
552
|
iab_categories: iab_categories,
|
397
|
-
language_detection: language_detection,
|
398
553
|
custom_spelling: custom_spelling,
|
399
|
-
disfluencies: disfluencies,
|
400
554
|
sentiment_analysis: sentiment_analysis,
|
401
555
|
auto_chapters: auto_chapters,
|
402
556
|
entity_detection: entity_detection,
|
@@ -406,20 +560,27 @@ module AssemblyAI
|
|
406
560
|
summary_type: summary_type,
|
407
561
|
custom_topics: custom_topics,
|
408
562
|
topics: topics,
|
409
|
-
additional_properties: additional_properties,
|
410
563
|
audio_url: audio_url
|
411
564
|
}.compact
|
412
565
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript"
|
413
566
|
end
|
414
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
567
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
415
568
|
end
|
416
569
|
end
|
417
570
|
|
418
|
-
# Get the transcript resource. The transcript is ready when the "status" is
|
571
|
+
# Get the transcript resource. The transcript is ready when the "status" is
|
572
|
+
# "completed".
|
419
573
|
#
|
420
574
|
# @param transcript_id [String] ID of the transcript
|
421
|
-
# @param request_options [RequestOptions]
|
422
|
-
# @return [Transcripts::Transcript]
|
575
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
576
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
577
|
+
# @example
|
578
|
+
# api = AssemblyAI::Client.new(
|
579
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
580
|
+
# base_url: "https://api.example.com",
|
581
|
+
# api_key: "YOUR_API_KEY"
|
582
|
+
# )
|
583
|
+
# api.transcripts.get(transcript_id: "transcript_id")
|
423
584
|
def get(transcript_id:, request_options: nil)
|
424
585
|
Async do
|
425
586
|
response = @request_client.conn.get do |req|
|
@@ -428,15 +589,22 @@ module AssemblyAI
|
|
428
589
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
429
590
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}"
|
430
591
|
end
|
431
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
592
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
432
593
|
end
|
433
594
|
end
|
434
595
|
|
435
|
-
#
|
596
|
+
# Remove the data from the transcript and mark it as deleted.
|
436
597
|
#
|
437
598
|
# @param transcript_id [String] ID of the transcript
|
438
|
-
# @param request_options [RequestOptions]
|
439
|
-
# @return [Transcripts::Transcript]
|
599
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
600
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
601
|
+
# @example
|
602
|
+
# api = AssemblyAI::Client.new(
|
603
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
604
|
+
# base_url: "https://api.example.com",
|
605
|
+
# api_key: "YOUR_API_KEY"
|
606
|
+
# )
|
607
|
+
# api.transcripts.delete(transcript_id: "{transcript_id}")
|
440
608
|
def delete(transcript_id:, request_options: nil)
|
441
609
|
Async do
|
442
610
|
response = @request_client.conn.delete do |req|
|
@@ -445,16 +613,17 @@ module AssemblyAI
|
|
445
613
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
446
614
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}"
|
447
615
|
end
|
448
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
616
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
449
617
|
end
|
450
618
|
end
|
451
619
|
|
452
|
-
# Export your transcript in SRT or VTT format
|
620
|
+
# Export your transcript in SRT or VTT format to use with a video player for
|
621
|
+
# subtitles and closed captions.
|
453
622
|
#
|
454
623
|
# @param transcript_id [String] ID of the transcript
|
455
|
-
# @param subtitle_format [Transcripts::SubtitleFormat] The format of the captions
|
624
|
+
# @param subtitle_format [AssemblyAI::Transcripts::SubtitleFormat] The format of the captions
|
456
625
|
# @param chars_per_caption [Integer] The maximum number of characters per caption
|
457
|
-
# @param request_options [RequestOptions]
|
626
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
458
627
|
# @return [String]
|
459
628
|
def get_subtitles(transcript_id:, subtitle_format:, chars_per_caption: nil, request_options: nil)
|
460
629
|
Async do
|
@@ -472,11 +641,20 @@ module AssemblyAI
|
|
472
641
|
end
|
473
642
|
end
|
474
643
|
|
475
|
-
# Get the transcript split by sentences. The API will attempt to semantically
|
644
|
+
# Get the transcript split by sentences. The API will attempt to semantically
|
645
|
+
# segment the transcript into sentences to create more reader-friendly
|
646
|
+
# transcripts.
|
476
647
|
#
|
477
648
|
# @param transcript_id [String] ID of the transcript
|
478
|
-
# @param request_options [RequestOptions]
|
479
|
-
# @return [Transcripts::SentencesResponse]
|
649
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
650
|
+
# @return [AssemblyAI::Transcripts::SentencesResponse]
|
651
|
+
# @example
|
652
|
+
# api = AssemblyAI::Client.new(
|
653
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
654
|
+
# base_url: "https://api.example.com",
|
655
|
+
# api_key: "YOUR_API_KEY"
|
656
|
+
# )
|
657
|
+
# api.transcripts.get_sentences(transcript_id: "transcript_id")
|
480
658
|
def get_sentences(transcript_id:, request_options: nil)
|
481
659
|
Async do
|
482
660
|
response = @request_client.conn.get do |req|
|
@@ -485,15 +663,24 @@ module AssemblyAI
|
|
485
663
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
486
664
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/sentences"
|
487
665
|
end
|
488
|
-
Transcripts::SentencesResponse.from_json(json_object: response.body)
|
666
|
+
AssemblyAI::Transcripts::SentencesResponse.from_json(json_object: response.body)
|
489
667
|
end
|
490
668
|
end
|
491
669
|
|
492
|
-
# Get the transcript split by paragraphs. The API will attempt to semantically
|
670
|
+
# Get the transcript split by paragraphs. The API will attempt to semantically
|
671
|
+
# segment your transcript into paragraphs to create more reader-friendly
|
672
|
+
# transcripts.
|
493
673
|
#
|
494
674
|
# @param transcript_id [String] ID of the transcript
|
495
|
-
# @param request_options [RequestOptions]
|
496
|
-
# @return [Transcripts::ParagraphsResponse]
|
675
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
676
|
+
# @return [AssemblyAI::Transcripts::ParagraphsResponse]
|
677
|
+
# @example
|
678
|
+
# api = AssemblyAI::Client.new(
|
679
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
680
|
+
# base_url: "https://api.example.com",
|
681
|
+
# api_key: "YOUR_API_KEY"
|
682
|
+
# )
|
683
|
+
# api.transcripts.get_paragraphs(transcript_id: "transcript_id")
|
497
684
|
def get_paragraphs(transcript_id:, request_options: nil)
|
498
685
|
Async do
|
499
686
|
response = @request_client.conn.get do |req|
|
@@ -502,16 +689,17 @@ module AssemblyAI
|
|
502
689
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
503
690
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/paragraphs"
|
504
691
|
end
|
505
|
-
Transcripts::ParagraphsResponse.from_json(json_object: response.body)
|
692
|
+
AssemblyAI::Transcripts::ParagraphsResponse.from_json(json_object: response.body)
|
506
693
|
end
|
507
694
|
end
|
508
695
|
|
509
|
-
# Search through the transcript for
|
696
|
+
# Search through the transcript for keywords. You can search for individual words,
|
697
|
+
# numbers, or phrases containing up to five words or numbers.
|
510
698
|
#
|
511
699
|
# @param transcript_id [String] ID of the transcript
|
512
700
|
# @param words [String] Keywords to search for
|
513
|
-
# @param request_options [RequestOptions]
|
514
|
-
# @return [Transcripts::WordSearchResponse]
|
701
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
702
|
+
# @return [AssemblyAI::Transcripts::WordSearchResponse]
|
515
703
|
def word_search(transcript_id:, words: nil, request_options: nil)
|
516
704
|
Async do
|
517
705
|
response = @request_client.conn.get do |req|
|
@@ -521,15 +709,23 @@ module AssemblyAI
|
|
521
709
|
req.params = { **(request_options&.additional_query_parameters || {}), "words": words }.compact
|
522
710
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/word-search"
|
523
711
|
end
|
524
|
-
Transcripts::WordSearchResponse.from_json(json_object: response.body)
|
712
|
+
AssemblyAI::Transcripts::WordSearchResponse.from_json(json_object: response.body)
|
525
713
|
end
|
526
714
|
end
|
527
715
|
|
528
|
-
# Retrieve the redacted audio object containing the status and URL to the redacted
|
716
|
+
# Retrieve the redacted audio object containing the status and URL to the redacted
|
717
|
+
# audio.
|
529
718
|
#
|
530
719
|
# @param transcript_id [String] ID of the transcript
|
531
|
-
# @param request_options [RequestOptions]
|
532
|
-
# @return [Transcripts::RedactedAudioResponse]
|
720
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
721
|
+
# @return [AssemblyAI::Transcripts::RedactedAudioResponse]
|
722
|
+
# @example
|
723
|
+
# api = AssemblyAI::Client.new(
|
724
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
725
|
+
# base_url: "https://api.example.com",
|
726
|
+
# api_key: "YOUR_API_KEY"
|
727
|
+
# )
|
728
|
+
# api.transcripts.get_redacted_audio(transcript_id: "transcript_id")
|
533
729
|
def get_redacted_audio(transcript_id:, request_options: nil)
|
534
730
|
Async do
|
535
731
|
response = @request_client.conn.get do |req|
|
@@ -538,7 +734,7 @@ module AssemblyAI
|
|
538
734
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
539
735
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/redacted-audio"
|
540
736
|
end
|
541
|
-
Transcripts::RedactedAudioResponse.from_json(json_object: response.body)
|
737
|
+
AssemblyAI::Transcripts::RedactedAudioResponse.from_json(json_object: response.body)
|
542
738
|
end
|
543
739
|
end
|
544
740
|
end
|