Class: Lara::Models::AudioTextResult

Inherits:
Base
  • Object
show all
Defined in:
lib/lara/models/audio.rb

Overview

Audio text result for transcript translation

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

parse_time

Constructor Details

#initialize(id: nil, source: nil, target: nil, filename: nil, duration: nil, text: nil, translation: nil, segments: nil, **_kwargs) ⇒ AudioTextResult

Returns a new instance of AudioTextResult.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/lara/models/audio.rb', line 77

def initialize(id: nil, source: nil, target: nil, filename: nil, duration: nil, text: nil,
               translation: nil, segments: nil, **_kwargs)
  super()
  @id = id
  @source = source
  @target = target
  @filename = filename
  @duration = duration
  @text = text
  @translation = translation
  @segments = Array(segments).map do |seg|
    if seg.is_a?(Hash)
      AudioTextSegment.new(
        id: seg["id"] || seg[:id],
        start: seg["start"] || seg[:start],
        end_time: seg["end"] || seg[:end],
        text: seg["text"] || seg[:text],
        translation: seg["translation"] || seg[:translation]
      )
    else
      seg
    end
  end
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



75
76
77
# File 'lib/lara/models/audio.rb', line 75

def duration
  @duration
end

#filenameObject (readonly)

Returns the value of attribute filename.



75
76
77
# File 'lib/lara/models/audio.rb', line 75

def filename
  @filename
end

#idObject (readonly)

Returns the value of attribute id.



75
76
77
# File 'lib/lara/models/audio.rb', line 75

def id
  @id
end

#segmentsObject (readonly)

Returns the value of attribute segments.



75
76
77
# File 'lib/lara/models/audio.rb', line 75

def segments
  @segments
end

#sourceObject (readonly)

Returns the value of attribute source.



75
76
77
# File 'lib/lara/models/audio.rb', line 75

def source
  @source
end

#targetObject (readonly)

Returns the value of attribute target.



75
76
77
# File 'lib/lara/models/audio.rb', line 75

def target
  @target
end

#textObject (readonly)

Returns the value of attribute text.



75
76
77
# File 'lib/lara/models/audio.rb', line 75

def text
  @text
end

#translationObject (readonly)

Returns the value of attribute translation.



75
76
77
# File 'lib/lara/models/audio.rb', line 75

def translation
  @translation
end