Class: Typecast::Models::AlignmentSegmentWord

Inherits:
Object
  • Object
show all
Defined in:
lib/typecast/timestamps.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(word:, start_time:, end_time:) ⇒ AlignmentSegmentWord

Returns a new instance of AlignmentSegmentWord.



12
13
14
15
16
# File 'lib/typecast/timestamps.rb', line 12

def initialize(word:, start_time:, end_time:)
  @word = word
  @start_time = start_time
  @end_time = end_time
end

Instance Attribute Details

#end_timeObject (readonly)

Returns the value of attribute end_time.



6
7
8
# File 'lib/typecast/timestamps.rb', line 6

def end_time
  @end_time
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



6
7
8
# File 'lib/typecast/timestamps.rb', line 6

def start_time
  @start_time
end

#wordObject (readonly)

Returns the value of attribute word.



6
7
8
# File 'lib/typecast/timestamps.rb', line 6

def word
  @word
end

Class Method Details

.from_h(hash) ⇒ Object



8
9
10
# File 'lib/typecast/timestamps.rb', line 8

def self.from_h(hash)
  new(word: hash.fetch("word", ""), start_time: hash.fetch("start_time", 0).to_f, end_time: hash.fetch("end_time", 0).to_f)
end