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
@@ -18,19 +18,34 @@ module AssemblyAI
|
|
18
18
|
class TranscriptOptionalParams
|
19
19
|
# @return [AssemblyAI::Transcripts::TranscriptLanguageCode]
|
20
20
|
attr_reader :language_code
|
21
|
+
# @return [Boolean] Enable [Automatic language
|
22
|
+
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
23
|
+
# either true or false.
|
24
|
+
attr_reader :language_detection
|
25
|
+
# @return [Float] The confidence threshold for the automatically detected language.
|
26
|
+
# An error will be returned if the language confidence is below this threshold.
|
27
|
+
# Defaults to 0.
|
28
|
+
attr_reader :language_confidence_threshold
|
29
|
+
# @return [AssemblyAI::Transcripts::SpeechModel]
|
30
|
+
attr_reader :speech_model
|
21
31
|
# @return [Boolean] Enable Automatic Punctuation, can be true or false
|
22
32
|
attr_reader :punctuate
|
23
33
|
# @return [Boolean] Enable Text Formatting, can be true or false
|
24
34
|
attr_reader :format_text
|
35
|
+
# @return [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
36
|
+
attr_reader :disfluencies
|
37
|
+
# @return [Boolean] Enable
|
38
|
+
# ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription)
|
39
|
+
# transcription, can be true or false.
|
40
|
+
attr_reader :multichannel
|
25
41
|
# @return [Boolean] Enable [Dual
|
26
42
|
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
27
43
|
# transcription, can be true or false.
|
28
44
|
attr_reader :dual_channel
|
29
|
-
# @return [
|
30
|
-
|
31
|
-
#
|
32
|
-
#
|
33
|
-
# request when the redacted audio is ready if redact_pii_audio is enabled.
|
45
|
+
# @return [String] The URL to which we send webhook requests.
|
46
|
+
# We sends two different types of webhook requests.
|
47
|
+
# One request when a transcript is completed or failed, and one request when the
|
48
|
+
# redacted audio is ready if redact_pii_audio is enabled.
|
34
49
|
attr_reader :webhook_url
|
35
50
|
# @return [String] The header name to be sent with the transcript completed or failed webhook
|
36
51
|
# requests
|
@@ -46,7 +61,7 @@ module AssemblyAI
|
|
46
61
|
attr_reader :audio_end_at
|
47
62
|
# @return [Array<String>] The list of custom vocabulary to boost transcription probability for
|
48
63
|
attr_reader :word_boost
|
49
|
-
# @return [AssemblyAI::Transcripts::TranscriptBoostParam]
|
64
|
+
# @return [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words
|
50
65
|
attr_reader :boost_param
|
51
66
|
# @return [Boolean] Filter profanity from the transcribed text, can be true or false
|
52
67
|
attr_reader :filter_profanity
|
@@ -89,14 +104,8 @@ module AssemblyAI
|
|
89
104
|
# Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true
|
90
105
|
# or false
|
91
106
|
attr_reader :iab_categories
|
92
|
-
# @return [Boolean] Enable [Automatic language
|
93
|
-
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
94
|
-
# either true or false.
|
95
|
-
attr_reader :language_detection
|
96
107
|
# @return [Array<AssemblyAI::Transcripts::TranscriptCustomSpelling>] Customize how words are spelled and formatted using to and from values
|
97
108
|
attr_reader :custom_spelling
|
98
|
-
# @return [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
99
|
-
attr_reader :disfluencies
|
100
109
|
# @return [Boolean] Enable [Sentiment
|
101
110
|
# Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be
|
102
111
|
# true or false
|
@@ -131,15 +140,26 @@ module AssemblyAI
|
|
131
140
|
OMIT = Object.new
|
132
141
|
|
133
142
|
# @param language_code [AssemblyAI::Transcripts::TranscriptLanguageCode]
|
143
|
+
# @param language_detection [Boolean] Enable [Automatic language
|
144
|
+
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
145
|
+
# either true or false.
|
146
|
+
# @param language_confidence_threshold [Float] The confidence threshold for the automatically detected language.
|
147
|
+
# An error will be returned if the language confidence is below this threshold.
|
148
|
+
# Defaults to 0.
|
149
|
+
# @param speech_model [AssemblyAI::Transcripts::SpeechModel]
|
134
150
|
# @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
|
135
151
|
# @param format_text [Boolean] Enable Text Formatting, can be true or false
|
152
|
+
# @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
153
|
+
# @param multichannel [Boolean] Enable
|
154
|
+
# ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription)
|
155
|
+
# transcription, can be true or false.
|
136
156
|
# @param dual_channel [Boolean] Enable [Dual
|
137
157
|
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
138
158
|
# transcription, can be true or false.
|
139
|
-
# @param
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
159
|
+
# @param webhook_url [String] The URL to which we send webhook requests.
|
160
|
+
# We sends two different types of webhook requests.
|
161
|
+
# One request when a transcript is completed or failed, and one request when the
|
162
|
+
# redacted audio is ready if redact_pii_audio is enabled.
|
143
163
|
# @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook
|
144
164
|
# requests
|
145
165
|
# @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook
|
@@ -148,7 +168,7 @@ module AssemblyAI
|
|
148
168
|
# @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
|
149
169
|
# @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
|
150
170
|
# @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
|
151
|
-
# @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam]
|
171
|
+
# @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words
|
152
172
|
# @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
|
153
173
|
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
154
174
|
# false
|
@@ -179,11 +199,7 @@ module AssemblyAI
|
|
179
199
|
# @param iab_categories [Boolean] Enable [Topic
|
180
200
|
# Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true
|
181
201
|
# or false
|
182
|
-
# @param language_detection [Boolean] Enable [Automatic language
|
183
|
-
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
184
|
-
# either true or false.
|
185
202
|
# @param custom_spelling [Array<AssemblyAI::Transcripts::TranscriptCustomSpelling>] Customize how words are spelled and formatted using to and from values
|
186
|
-
# @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
187
203
|
# @param sentiment_analysis [Boolean] Enable [Sentiment
|
188
204
|
# Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be
|
189
205
|
# true or false
|
@@ -202,13 +218,17 @@ module AssemblyAI
|
|
202
218
|
# @param topics [Array<String>] The list of custom topics
|
203
219
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
204
220
|
# @return [AssemblyAI::Transcripts::TranscriptOptionalParams]
|
205
|
-
def initialize(language_code: OMIT,
|
206
|
-
webhook_url: OMIT, webhook_auth_header_name: OMIT, webhook_auth_header_value: OMIT, auto_highlights: OMIT, audio_start_from: OMIT, audio_end_at: OMIT, word_boost: OMIT, boost_param: OMIT, filter_profanity: OMIT, redact_pii: OMIT, redact_pii_audio: OMIT, redact_pii_audio_quality: OMIT, redact_pii_policies: OMIT, redact_pii_sub: OMIT, speaker_labels: OMIT, speakers_expected: OMIT, content_safety: OMIT, content_safety_confidence: OMIT, iab_categories: OMIT,
|
221
|
+
def initialize(language_code: OMIT, language_detection: OMIT, language_confidence_threshold: OMIT,
|
222
|
+
speech_model: OMIT, punctuate: OMIT, format_text: OMIT, disfluencies: OMIT, multichannel: OMIT, dual_channel: OMIT, webhook_url: OMIT, webhook_auth_header_name: OMIT, webhook_auth_header_value: OMIT, auto_highlights: OMIT, audio_start_from: OMIT, audio_end_at: OMIT, word_boost: OMIT, boost_param: OMIT, filter_profanity: OMIT, redact_pii: OMIT, redact_pii_audio: OMIT, redact_pii_audio_quality: OMIT, redact_pii_policies: OMIT, redact_pii_sub: OMIT, speaker_labels: OMIT, speakers_expected: OMIT, content_safety: OMIT, content_safety_confidence: OMIT, iab_categories: OMIT, custom_spelling: OMIT, sentiment_analysis: OMIT, auto_chapters: OMIT, entity_detection: OMIT, speech_threshold: OMIT, summarization: OMIT, summary_model: OMIT, summary_type: OMIT, custom_topics: OMIT, topics: OMIT, additional_properties: nil)
|
207
223
|
@language_code = language_code if language_code != OMIT
|
224
|
+
@language_detection = language_detection if language_detection != OMIT
|
225
|
+
@language_confidence_threshold = language_confidence_threshold if language_confidence_threshold != OMIT
|
226
|
+
@speech_model = speech_model if speech_model != OMIT
|
208
227
|
@punctuate = punctuate if punctuate != OMIT
|
209
228
|
@format_text = format_text if format_text != OMIT
|
229
|
+
@disfluencies = disfluencies if disfluencies != OMIT
|
230
|
+
@multichannel = multichannel if multichannel != OMIT
|
210
231
|
@dual_channel = dual_channel if dual_channel != OMIT
|
211
|
-
@speech_model = speech_model if speech_model != OMIT
|
212
232
|
@webhook_url = webhook_url if webhook_url != OMIT
|
213
233
|
@webhook_auth_header_name = webhook_auth_header_name if webhook_auth_header_name != OMIT
|
214
234
|
@webhook_auth_header_value = webhook_auth_header_value if webhook_auth_header_value != OMIT
|
@@ -228,9 +248,7 @@ module AssemblyAI
|
|
228
248
|
@content_safety = content_safety if content_safety != OMIT
|
229
249
|
@content_safety_confidence = content_safety_confidence if content_safety_confidence != OMIT
|
230
250
|
@iab_categories = iab_categories if iab_categories != OMIT
|
231
|
-
@language_detection = language_detection if language_detection != OMIT
|
232
251
|
@custom_spelling = custom_spelling if custom_spelling != OMIT
|
233
|
-
@disfluencies = disfluencies if disfluencies != OMIT
|
234
252
|
@sentiment_analysis = sentiment_analysis if sentiment_analysis != OMIT
|
235
253
|
@auto_chapters = auto_chapters if auto_chapters != OMIT
|
236
254
|
@entity_detection = entity_detection if entity_detection != OMIT
|
@@ -243,10 +261,14 @@ module AssemblyAI
|
|
243
261
|
@additional_properties = additional_properties
|
244
262
|
@_field_set = {
|
245
263
|
"language_code": language_code,
|
264
|
+
"language_detection": language_detection,
|
265
|
+
"language_confidence_threshold": language_confidence_threshold,
|
266
|
+
"speech_model": speech_model,
|
246
267
|
"punctuate": punctuate,
|
247
268
|
"format_text": format_text,
|
269
|
+
"disfluencies": disfluencies,
|
270
|
+
"multichannel": multichannel,
|
248
271
|
"dual_channel": dual_channel,
|
249
|
-
"speech_model": speech_model,
|
250
272
|
"webhook_url": webhook_url,
|
251
273
|
"webhook_auth_header_name": webhook_auth_header_name,
|
252
274
|
"webhook_auth_header_value": webhook_auth_header_value,
|
@@ -266,9 +288,7 @@ module AssemblyAI
|
|
266
288
|
"content_safety": content_safety,
|
267
289
|
"content_safety_confidence": content_safety_confidence,
|
268
290
|
"iab_categories": iab_categories,
|
269
|
-
"language_detection": language_detection,
|
270
291
|
"custom_spelling": custom_spelling,
|
271
|
-
"disfluencies": disfluencies,
|
272
292
|
"sentiment_analysis": sentiment_analysis,
|
273
293
|
"auto_chapters": auto_chapters,
|
274
294
|
"entity_detection": entity_detection,
|
@@ -291,10 +311,14 @@ module AssemblyAI
|
|
291
311
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
292
312
|
parsed_json = JSON.parse(json_object)
|
293
313
|
language_code = struct["language_code"]
|
314
|
+
language_detection = struct["language_detection"]
|
315
|
+
language_confidence_threshold = struct["language_confidence_threshold"]
|
316
|
+
speech_model = struct["speech_model"]
|
294
317
|
punctuate = struct["punctuate"]
|
295
318
|
format_text = struct["format_text"]
|
319
|
+
disfluencies = struct["disfluencies"]
|
320
|
+
multichannel = struct["multichannel"]
|
296
321
|
dual_channel = struct["dual_channel"]
|
297
|
-
speech_model = struct["speech_model"]
|
298
322
|
webhook_url = struct["webhook_url"]
|
299
323
|
webhook_auth_header_name = struct["webhook_auth_header_name"]
|
300
324
|
webhook_auth_header_value = struct["webhook_auth_header_value"]
|
@@ -314,12 +338,10 @@ module AssemblyAI
|
|
314
338
|
content_safety = struct["content_safety"]
|
315
339
|
content_safety_confidence = struct["content_safety_confidence"]
|
316
340
|
iab_categories = struct["iab_categories"]
|
317
|
-
language_detection = struct["language_detection"]
|
318
341
|
custom_spelling = parsed_json["custom_spelling"]&.map do |v|
|
319
342
|
v = v.to_json
|
320
343
|
AssemblyAI::Transcripts::TranscriptCustomSpelling.from_json(json_object: v)
|
321
344
|
end
|
322
|
-
disfluencies = struct["disfluencies"]
|
323
345
|
sentiment_analysis = struct["sentiment_analysis"]
|
324
346
|
auto_chapters = struct["auto_chapters"]
|
325
347
|
entity_detection = struct["entity_detection"]
|
@@ -331,10 +353,14 @@ module AssemblyAI
|
|
331
353
|
topics = struct["topics"]
|
332
354
|
new(
|
333
355
|
language_code: language_code,
|
356
|
+
language_detection: language_detection,
|
357
|
+
language_confidence_threshold: language_confidence_threshold,
|
358
|
+
speech_model: speech_model,
|
334
359
|
punctuate: punctuate,
|
335
360
|
format_text: format_text,
|
361
|
+
disfluencies: disfluencies,
|
362
|
+
multichannel: multichannel,
|
336
363
|
dual_channel: dual_channel,
|
337
|
-
speech_model: speech_model,
|
338
364
|
webhook_url: webhook_url,
|
339
365
|
webhook_auth_header_name: webhook_auth_header_name,
|
340
366
|
webhook_auth_header_value: webhook_auth_header_value,
|
@@ -354,9 +380,7 @@ module AssemblyAI
|
|
354
380
|
content_safety: content_safety,
|
355
381
|
content_safety_confidence: content_safety_confidence,
|
356
382
|
iab_categories: iab_categories,
|
357
|
-
language_detection: language_detection,
|
358
383
|
custom_spelling: custom_spelling,
|
359
|
-
disfluencies: disfluencies,
|
360
384
|
sentiment_analysis: sentiment_analysis,
|
361
385
|
auto_chapters: auto_chapters,
|
362
386
|
entity_detection: entity_detection,
|
@@ -385,10 +409,14 @@ module AssemblyAI
|
|
385
409
|
# @return [Void]
|
386
410
|
def self.validate_raw(obj:)
|
387
411
|
obj.language_code&.is_a?(AssemblyAI::Transcripts::TranscriptLanguageCode) != false || raise("Passed value for field obj.language_code is not the expected type, validation failed.")
|
412
|
+
obj.language_detection&.is_a?(Boolean) != false || raise("Passed value for field obj.language_detection is not the expected type, validation failed.")
|
413
|
+
obj.language_confidence_threshold&.is_a?(Float) != false || raise("Passed value for field obj.language_confidence_threshold is not the expected type, validation failed.")
|
414
|
+
obj.speech_model&.is_a?(AssemblyAI::Transcripts::SpeechModel) != false || raise("Passed value for field obj.speech_model is not the expected type, validation failed.")
|
388
415
|
obj.punctuate&.is_a?(Boolean) != false || raise("Passed value for field obj.punctuate is not the expected type, validation failed.")
|
389
416
|
obj.format_text&.is_a?(Boolean) != false || raise("Passed value for field obj.format_text is not the expected type, validation failed.")
|
417
|
+
obj.disfluencies&.is_a?(Boolean) != false || raise("Passed value for field obj.disfluencies is not the expected type, validation failed.")
|
418
|
+
obj.multichannel&.is_a?(Boolean) != false || raise("Passed value for field obj.multichannel is not the expected type, validation failed.")
|
390
419
|
obj.dual_channel&.is_a?(Boolean) != false || raise("Passed value for field obj.dual_channel is not the expected type, validation failed.")
|
391
|
-
obj.speech_model&.is_a?(AssemblyAI::Transcripts::SpeechModel) != false || raise("Passed value for field obj.speech_model is not the expected type, validation failed.")
|
392
420
|
obj.webhook_url&.is_a?(String) != false || raise("Passed value for field obj.webhook_url is not the expected type, validation failed.")
|
393
421
|
obj.webhook_auth_header_name&.is_a?(String) != false || raise("Passed value for field obj.webhook_auth_header_name is not the expected type, validation failed.")
|
394
422
|
obj.webhook_auth_header_value&.is_a?(String) != false || raise("Passed value for field obj.webhook_auth_header_value is not the expected type, validation failed.")
|
@@ -408,9 +436,7 @@ module AssemblyAI
|
|
408
436
|
obj.content_safety&.is_a?(Boolean) != false || raise("Passed value for field obj.content_safety is not the expected type, validation failed.")
|
409
437
|
obj.content_safety_confidence&.is_a?(Integer) != false || raise("Passed value for field obj.content_safety_confidence is not the expected type, validation failed.")
|
410
438
|
obj.iab_categories&.is_a?(Boolean) != false || raise("Passed value for field obj.iab_categories is not the expected type, validation failed.")
|
411
|
-
obj.language_detection&.is_a?(Boolean) != false || raise("Passed value for field obj.language_detection is not the expected type, validation failed.")
|
412
439
|
obj.custom_spelling&.is_a?(Array) != false || raise("Passed value for field obj.custom_spelling is not the expected type, validation failed.")
|
413
|
-
obj.disfluencies&.is_a?(Boolean) != false || raise("Passed value for field obj.disfluencies is not the expected type, validation failed.")
|
414
440
|
obj.sentiment_analysis&.is_a?(Boolean) != false || raise("Passed value for field obj.sentiment_analysis is not the expected type, validation failed.")
|
415
441
|
obj.auto_chapters&.is_a?(Boolean) != false || raise("Passed value for field obj.auto_chapters is not the expected type, validation failed.")
|
416
442
|
obj.entity_detection&.is_a?(Boolean) != false || raise("Passed value for field obj.entity_detection is not the expected type, validation failed.")
|
@@ -7,20 +7,16 @@ require "json"
|
|
7
7
|
module AssemblyAI
|
8
8
|
class Transcripts
|
9
9
|
class TranscriptParagraph
|
10
|
-
# @return [String]
|
10
|
+
# @return [String] The transcript of the paragraph
|
11
11
|
attr_reader :text
|
12
|
-
# @return [Integer]
|
12
|
+
# @return [Integer] The starting time, in milliseconds, of the paragraph
|
13
13
|
attr_reader :start
|
14
|
-
# @return [Integer]
|
14
|
+
# @return [Integer] The ending time, in milliseconds, of the paragraph
|
15
15
|
attr_reader :end_
|
16
|
-
# @return [Float]
|
16
|
+
# @return [Float] The confidence score for the transcript of this paragraph
|
17
17
|
attr_reader :confidence
|
18
|
-
# @return [Array<AssemblyAI::Transcripts::TranscriptWord>]
|
18
|
+
# @return [Array<AssemblyAI::Transcripts::TranscriptWord>] An array of words in the paragraph
|
19
19
|
attr_reader :words
|
20
|
-
# @return [String] The speaker of the sentence if [Speaker
|
21
|
-
# Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is
|
22
|
-
# enabled, else null
|
23
|
-
attr_reader :speaker
|
24
20
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
25
21
|
attr_reader :additional_properties
|
26
22
|
# @return [Object]
|
@@ -29,34 +25,21 @@ module AssemblyAI
|
|
29
25
|
|
30
26
|
OMIT = Object.new
|
31
27
|
|
32
|
-
# @param text [String]
|
33
|
-
# @param start [Integer]
|
34
|
-
# @param end_ [Integer]
|
35
|
-
# @param confidence [Float]
|
36
|
-
# @param words [Array<AssemblyAI::Transcripts::TranscriptWord>]
|
37
|
-
# @param speaker [String] The speaker of the sentence if [Speaker
|
38
|
-
# Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is
|
39
|
-
# enabled, else null
|
28
|
+
# @param text [String] The transcript of the paragraph
|
29
|
+
# @param start [Integer] The starting time, in milliseconds, of the paragraph
|
30
|
+
# @param end_ [Integer] The ending time, in milliseconds, of the paragraph
|
31
|
+
# @param confidence [Float] The confidence score for the transcript of this paragraph
|
32
|
+
# @param words [Array<AssemblyAI::Transcripts::TranscriptWord>] An array of words in the paragraph
|
40
33
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
41
34
|
# @return [AssemblyAI::Transcripts::TranscriptParagraph]
|
42
|
-
def initialize(text:, start:, end_:, confidence:, words:,
|
35
|
+
def initialize(text:, start:, end_:, confidence:, words:, additional_properties: nil)
|
43
36
|
@text = text
|
44
37
|
@start = start
|
45
38
|
@end_ = end_
|
46
39
|
@confidence = confidence
|
47
40
|
@words = words
|
48
|
-
@speaker = speaker if speaker != OMIT
|
49
41
|
@additional_properties = additional_properties
|
50
|
-
@_field_set = {
|
51
|
-
"text": text,
|
52
|
-
"start": start,
|
53
|
-
"end": end_,
|
54
|
-
"confidence": confidence,
|
55
|
-
"words": words,
|
56
|
-
"speaker": speaker
|
57
|
-
}.reject do |_k, v|
|
58
|
-
v == OMIT
|
59
|
-
end
|
42
|
+
@_field_set = { "text": text, "start": start, "end": end_, "confidence": confidence, "words": words }
|
60
43
|
end
|
61
44
|
|
62
45
|
# Deserialize a JSON object to an instance of TranscriptParagraph
|
@@ -74,14 +57,12 @@ module AssemblyAI
|
|
74
57
|
v = v.to_json
|
75
58
|
AssemblyAI::Transcripts::TranscriptWord.from_json(json_object: v)
|
76
59
|
end
|
77
|
-
speaker = struct["speaker"]
|
78
60
|
new(
|
79
61
|
text: text,
|
80
62
|
start: start,
|
81
63
|
end_: end_,
|
82
64
|
confidence: confidence,
|
83
65
|
words: words,
|
84
|
-
speaker: speaker,
|
85
66
|
additional_properties: struct
|
86
67
|
)
|
87
68
|
end
|
@@ -105,7 +86,6 @@ module AssemblyAI
|
|
105
86
|
obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
106
87
|
obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
|
107
88
|
obj.words.is_a?(Array) != false || raise("Passed value for field obj.words is not the expected type, validation failed.")
|
108
|
-
obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.")
|
109
89
|
end
|
110
90
|
end
|
111
91
|
end
|
@@ -7,16 +7,19 @@ require "json"
|
|
7
7
|
module AssemblyAI
|
8
8
|
class Transcripts
|
9
9
|
class TranscriptSentence
|
10
|
-
# @return [String]
|
10
|
+
# @return [String] The transcript of the sentence
|
11
11
|
attr_reader :text
|
12
|
-
# @return [Integer]
|
12
|
+
# @return [Integer] The starting time, in milliseconds, for the sentence
|
13
13
|
attr_reader :start
|
14
|
-
# @return [Integer]
|
14
|
+
# @return [Integer] The ending time, in milliseconds, for the sentence
|
15
15
|
attr_reader :end_
|
16
|
-
# @return [Float]
|
16
|
+
# @return [Float] The confidence score for the transcript of this sentence
|
17
17
|
attr_reader :confidence
|
18
|
-
# @return [Array<AssemblyAI::Transcripts::TranscriptWord>]
|
18
|
+
# @return [Array<AssemblyAI::Transcripts::TranscriptWord>] An array of words in the sentence
|
19
19
|
attr_reader :words
|
20
|
+
# @return [String] The channel of the sentence. The left and right channels are channels 1 and 2.
|
21
|
+
# Additional channels increment the channel number sequentially.
|
22
|
+
attr_reader :channel
|
20
23
|
# @return [String] The speaker of the sentence if [Speaker
|
21
24
|
# Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is
|
22
25
|
# enabled, else null
|
@@ -29,22 +32,26 @@ module AssemblyAI
|
|
29
32
|
|
30
33
|
OMIT = Object.new
|
31
34
|
|
32
|
-
# @param text [String]
|
33
|
-
# @param start [Integer]
|
34
|
-
# @param end_ [Integer]
|
35
|
-
# @param confidence [Float]
|
36
|
-
# @param words [Array<AssemblyAI::Transcripts::TranscriptWord>]
|
35
|
+
# @param text [String] The transcript of the sentence
|
36
|
+
# @param start [Integer] The starting time, in milliseconds, for the sentence
|
37
|
+
# @param end_ [Integer] The ending time, in milliseconds, for the sentence
|
38
|
+
# @param confidence [Float] The confidence score for the transcript of this sentence
|
39
|
+
# @param words [Array<AssemblyAI::Transcripts::TranscriptWord>] An array of words in the sentence
|
40
|
+
# @param channel [String] The channel of the sentence. The left and right channels are channels 1 and 2.
|
41
|
+
# Additional channels increment the channel number sequentially.
|
37
42
|
# @param speaker [String] The speaker of the sentence if [Speaker
|
38
43
|
# Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is
|
39
44
|
# enabled, else null
|
40
45
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
41
46
|
# @return [AssemblyAI::Transcripts::TranscriptSentence]
|
42
|
-
def initialize(text:, start:, end_:, confidence:, words:,
|
47
|
+
def initialize(text:, start:, end_:, confidence:, words:, channel: OMIT, speaker: OMIT,
|
48
|
+
additional_properties: nil)
|
43
49
|
@text = text
|
44
50
|
@start = start
|
45
51
|
@end_ = end_
|
46
52
|
@confidence = confidence
|
47
53
|
@words = words
|
54
|
+
@channel = channel if channel != OMIT
|
48
55
|
@speaker = speaker if speaker != OMIT
|
49
56
|
@additional_properties = additional_properties
|
50
57
|
@_field_set = {
|
@@ -53,6 +60,7 @@ module AssemblyAI
|
|
53
60
|
"end": end_,
|
54
61
|
"confidence": confidence,
|
55
62
|
"words": words,
|
63
|
+
"channel": channel,
|
56
64
|
"speaker": speaker
|
57
65
|
}.reject do |_k, v|
|
58
66
|
v == OMIT
|
@@ -74,6 +82,7 @@ module AssemblyAI
|
|
74
82
|
v = v.to_json
|
75
83
|
AssemblyAI::Transcripts::TranscriptWord.from_json(json_object: v)
|
76
84
|
end
|
85
|
+
channel = struct["channel"]
|
77
86
|
speaker = struct["speaker"]
|
78
87
|
new(
|
79
88
|
text: text,
|
@@ -81,6 +90,7 @@ module AssemblyAI
|
|
81
90
|
end_: end_,
|
82
91
|
confidence: confidence,
|
83
92
|
words: words,
|
93
|
+
channel: channel,
|
84
94
|
speaker: speaker,
|
85
95
|
additional_properties: struct
|
86
96
|
)
|
@@ -105,6 +115,7 @@ module AssemblyAI
|
|
105
115
|
obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
106
116
|
obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
|
107
117
|
obj.words.is_a?(Array) != false || raise("Passed value for field obj.words is not the expected type, validation failed.")
|
118
|
+
obj.channel&.is_a?(String) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.")
|
108
119
|
obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.")
|
109
120
|
end
|
110
121
|
end
|
@@ -17,6 +17,9 @@ module AssemblyAI
|
|
17
17
|
attr_reader :text
|
18
18
|
# @return [Array<AssemblyAI::Transcripts::TranscriptWord>] The words in the utterance.
|
19
19
|
attr_reader :words
|
20
|
+
# @return [String] The channel of this utterance. The left and right channels are channels 1 and 2.
|
21
|
+
# Additional channels increment the channel number sequentially.
|
22
|
+
attr_reader :channel
|
20
23
|
# @return [String] The speaker of this utterance, where each speaker is assigned a sequential
|
21
24
|
# capital letter - e.g. "A" for Speaker A, "B" for Speaker B, etc.
|
22
25
|
attr_reader :speaker
|
@@ -33,16 +36,19 @@ module AssemblyAI
|
|
33
36
|
# @param end_ [Integer] The ending time, in milliseconds, of the utterance in the audio file
|
34
37
|
# @param text [String] The text for this utterance
|
35
38
|
# @param words [Array<AssemblyAI::Transcripts::TranscriptWord>] The words in the utterance.
|
39
|
+
# @param channel [String] The channel of this utterance. The left and right channels are channels 1 and 2.
|
40
|
+
# Additional channels increment the channel number sequentially.
|
36
41
|
# @param speaker [String] The speaker of this utterance, where each speaker is assigned a sequential
|
37
42
|
# capital letter - e.g. "A" for Speaker A, "B" for Speaker B, etc.
|
38
43
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
39
44
|
# @return [AssemblyAI::Transcripts::TranscriptUtterance]
|
40
|
-
def initialize(confidence:, start:, end_:, text:, words:, speaker:, additional_properties: nil)
|
45
|
+
def initialize(confidence:, start:, end_:, text:, words:, speaker:, channel: OMIT, additional_properties: nil)
|
41
46
|
@confidence = confidence
|
42
47
|
@start = start
|
43
48
|
@end_ = end_
|
44
49
|
@text = text
|
45
50
|
@words = words
|
51
|
+
@channel = channel if channel != OMIT
|
46
52
|
@speaker = speaker
|
47
53
|
@additional_properties = additional_properties
|
48
54
|
@_field_set = {
|
@@ -51,8 +57,11 @@ module AssemblyAI
|
|
51
57
|
"end": end_,
|
52
58
|
"text": text,
|
53
59
|
"words": words,
|
60
|
+
"channel": channel,
|
54
61
|
"speaker": speaker
|
55
|
-
}
|
62
|
+
}.reject do |_k, v|
|
63
|
+
v == OMIT
|
64
|
+
end
|
56
65
|
end
|
57
66
|
|
58
67
|
# Deserialize a JSON object to an instance of TranscriptUtterance
|
@@ -70,6 +79,7 @@ module AssemblyAI
|
|
70
79
|
v = v.to_json
|
71
80
|
AssemblyAI::Transcripts::TranscriptWord.from_json(json_object: v)
|
72
81
|
end
|
82
|
+
channel = struct["channel"]
|
73
83
|
speaker = struct["speaker"]
|
74
84
|
new(
|
75
85
|
confidence: confidence,
|
@@ -77,6 +87,7 @@ module AssemblyAI
|
|
77
87
|
end_: end_,
|
78
88
|
text: text,
|
79
89
|
words: words,
|
90
|
+
channel: channel,
|
80
91
|
speaker: speaker,
|
81
92
|
additional_properties: struct
|
82
93
|
)
|
@@ -101,6 +112,7 @@ module AssemblyAI
|
|
101
112
|
obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
102
113
|
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
103
114
|
obj.words.is_a?(Array) != false || raise("Passed value for field obj.words is not the expected type, validation failed.")
|
115
|
+
obj.channel&.is_a?(String) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.")
|
104
116
|
obj.speaker.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.")
|
105
117
|
end
|
106
118
|
end
|
@@ -6,15 +6,18 @@ require "json"
|
|
6
6
|
module AssemblyAI
|
7
7
|
class Transcripts
|
8
8
|
class TranscriptWord
|
9
|
-
# @return [Float]
|
9
|
+
# @return [Float] The confidence score for the transcript of this word
|
10
10
|
attr_reader :confidence
|
11
|
-
# @return [Integer]
|
11
|
+
# @return [Integer] The starting time, in milliseconds, for the word
|
12
12
|
attr_reader :start
|
13
|
-
# @return [Integer]
|
13
|
+
# @return [Integer] The ending time, in milliseconds, for the word
|
14
14
|
attr_reader :end_
|
15
|
-
# @return [String]
|
15
|
+
# @return [String] The text of the word
|
16
16
|
attr_reader :text
|
17
|
-
# @return [String] The
|
17
|
+
# @return [String] The channel of the word. The left and right channels are channels 1 and 2.
|
18
|
+
# Additional channels increment the channel number sequentially.
|
19
|
+
attr_reader :channel
|
20
|
+
# @return [String] The speaker of the word if [Speaker
|
18
21
|
# Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is
|
19
22
|
# enabled, else null
|
20
23
|
attr_reader :speaker
|
@@ -26,20 +29,23 @@ module AssemblyAI
|
|
26
29
|
|
27
30
|
OMIT = Object.new
|
28
31
|
|
29
|
-
# @param confidence [Float]
|
30
|
-
# @param start [Integer]
|
31
|
-
# @param end_ [Integer]
|
32
|
-
# @param text [String]
|
33
|
-
# @param
|
32
|
+
# @param confidence [Float] The confidence score for the transcript of this word
|
33
|
+
# @param start [Integer] The starting time, in milliseconds, for the word
|
34
|
+
# @param end_ [Integer] The ending time, in milliseconds, for the word
|
35
|
+
# @param text [String] The text of the word
|
36
|
+
# @param channel [String] The channel of the word. The left and right channels are channels 1 and 2.
|
37
|
+
# Additional channels increment the channel number sequentially.
|
38
|
+
# @param speaker [String] The speaker of the word if [Speaker
|
34
39
|
# Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is
|
35
40
|
# enabled, else null
|
36
41
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
37
42
|
# @return [AssemblyAI::Transcripts::TranscriptWord]
|
38
|
-
def initialize(confidence:, start:, end_:, text:, speaker: OMIT, additional_properties: nil)
|
43
|
+
def initialize(confidence:, start:, end_:, text:, channel: OMIT, speaker: OMIT, additional_properties: nil)
|
39
44
|
@confidence = confidence
|
40
45
|
@start = start
|
41
46
|
@end_ = end_
|
42
47
|
@text = text
|
48
|
+
@channel = channel if channel != OMIT
|
43
49
|
@speaker = speaker if speaker != OMIT
|
44
50
|
@additional_properties = additional_properties
|
45
51
|
@_field_set = {
|
@@ -47,6 +53,7 @@ module AssemblyAI
|
|
47
53
|
"start": start,
|
48
54
|
"end": end_,
|
49
55
|
"text": text,
|
56
|
+
"channel": channel,
|
50
57
|
"speaker": speaker
|
51
58
|
}.reject do |_k, v|
|
52
59
|
v == OMIT
|
@@ -63,12 +70,14 @@ module AssemblyAI
|
|
63
70
|
start = struct["start"]
|
64
71
|
end_ = struct["end"]
|
65
72
|
text = struct["text"]
|
73
|
+
channel = struct["channel"]
|
66
74
|
speaker = struct["speaker"]
|
67
75
|
new(
|
68
76
|
confidence: confidence,
|
69
77
|
start: start,
|
70
78
|
end_: end_,
|
71
79
|
text: text,
|
80
|
+
channel: channel,
|
72
81
|
speaker: speaker,
|
73
82
|
additional_properties: struct
|
74
83
|
)
|
@@ -92,6 +101,7 @@ module AssemblyAI
|
|
92
101
|
obj.start.is_a?(Integer) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
93
102
|
obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
94
103
|
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
104
|
+
obj.channel&.is_a?(String) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.")
|
95
105
|
obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.")
|
96
106
|
end
|
97
107
|
end
|
data/lib/gemconfig.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assemblyai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AssemblyAI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http-faraday
|