Class: AssemblyAI::Transcripts::TopicDetectionModelResult
- Inherits:
-
Object
- Object
- AssemblyAI::Transcripts::TopicDetectionModelResult
- Defined in:
- lib/assemblyai/transcripts/types/topic_detection_model_result.rb
Overview
The result of the Topic Detection model, if it is enabled.
See [Topic Detection](https://www.assemblyai.com/docs/models/topic-detection)
for more information.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#results ⇒ Array<AssemblyAI::Transcripts::TopicDetectionResult>
readonly
An array of results for the Topic Detection model.
-
#status ⇒ AssemblyAI::Transcripts::AudioIntelligenceModelStatus
readonly
The status of the Topic Detection model.
-
#summary ⇒ Hash{String => Float}
readonly
The overall relevance of topic to the entire audio file.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::TopicDetectionModelResult
Deserialize a JSON object to an instance of TopicDetectionModelResult.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(status:, results:, summary:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::TopicDetectionModelResult constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TopicDetectionModelResult to a JSON object.
Constructor Details
#initialize(status:, results:, summary:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::TopicDetectionModelResult
35 36 37 38 39 40 41 |
# File 'lib/assemblyai/transcripts/types/topic_detection_model_result.rb', line 35 def initialize(status:, results:, summary:, additional_properties: nil) @status = status @results = results @summary = summary @additional_properties = additional_properties @_field_set = { "status": status, "results": results, "summary": summary } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/assemblyai/transcripts/types/topic_detection_model_result.rb', line 22 def additional_properties @additional_properties end |
#results ⇒ Array<AssemblyAI::Transcripts::TopicDetectionResult> (readonly)
Returns An array of results for the Topic Detection model.
18 19 20 |
# File 'lib/assemblyai/transcripts/types/topic_detection_model_result.rb', line 18 def results @results end |
#status ⇒ AssemblyAI::Transcripts::AudioIntelligenceModelStatus (readonly)
Returns The status of the Topic Detection model. Either success, or unavailable in the rare case that the model failed.
16 17 18 |
# File 'lib/assemblyai/transcripts/types/topic_detection_model_result.rb', line 16 def status @status end |
#summary ⇒ Hash{String => Float} (readonly)
Returns The overall relevance of topic to the entire audio file.
20 21 22 |
# File 'lib/assemblyai/transcripts/types/topic_detection_model_result.rb', line 20 def summary @summary end |
Class Method Details
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::TopicDetectionModelResult
Deserialize a JSON object to an instance of TopicDetectionModelResult
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/assemblyai/transcripts/types/topic_detection_model_result.rb', line 47 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) status = struct["status"] results = parsed_json["results"]&.map do |v| v = v.to_json AssemblyAI::Transcripts::TopicDetectionResult.from_json(json_object: v) end summary = struct["summary"] new( status: status, results: results, summary: summary, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
77 78 79 80 81 |
# File 'lib/assemblyai/transcripts/types/topic_detection_model_result.rb', line 77 def self.validate_raw(obj:) obj.status.is_a?(AssemblyAI::Transcripts::AudioIntelligenceModelStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.") obj.summary.is_a?(Hash) != false || raise("Passed value for field obj.summary is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TopicDetectionModelResult to a JSON object
67 68 69 |
# File 'lib/assemblyai/transcripts/types/topic_detection_model_result.rb', line 67 def to_json(*_args) @_field_set&.to_json end |