Method: AssemblyAI::Transcripts::TranscriptSentence#initialize

Defined in:
lib/assemblyai/transcripts/types/transcript_sentence.rb

#initialize(text:, start:, end_:, confidence:, words:, channel: OMIT, speaker: OMIT, additional_properties: nil) ⇒ AssemblyAI::Transcripts::TranscriptSentence

Parameters:

  • text (String)

    The transcript of the sentence

  • start (Integer)

    The starting time, in milliseconds, for the sentence

  • end_ (Integer)

    The ending time, in milliseconds, for the sentence

  • confidence (Float)

    The confidence score for the transcript of this sentence

  • words (Array<AssemblyAI::Transcripts::TranscriptWord>)

    An array of words in the sentence

  • channel (String) (defaults to: OMIT)

    The channel of the sentence. The left and right channels are channels 1 and 2. Additional channels increment the channel number sequentially.

  • speaker (String) (defaults to: OMIT)

    The speaker of the sentence if [Speaker Diarization](www.assemblyai.com/docs/models/speaker-diarization) is enabled, else null

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/assemblyai/transcripts/types/transcript_sentence.rb', line 47

def initialize(text:, start:, end_:, confidence:, words:, channel: OMIT, speaker: OMIT,
               additional_properties: nil)
  @text = text
  @start = start
  @end_ = end_
  @confidence = confidence
  @words = words
  @channel = channel if channel != OMIT
  @speaker = speaker if speaker != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "text": text,
    "start": start,
    "end": end_,
    "confidence": confidence,
    "words": words,
    "channel": channel,
    "speaker": speaker
  }.reject do |_k, v|
    v == OMIT
  end
end