java.lang.Object
com.google.genai.gaos.models.interactions.WordInfo
All Implemented Interfaces:
Annotation

public class WordInfo extends Object implements Annotation
WordInfo

Word-level ASR annotation for transcription output. Carries the word text, optional timing, and optional speaker attribution.

  • Constructor Details

    • WordInfo

      public WordInfo(@Nullable Integer endIndex, @Nullable String endOffset, @Nullable String speaker, @Nullable Integer startIndex, @Nullable String startOffset, @Nullable String text)
    • WordInfo

      public WordInfo()
  • Method Details

    • endIndex

      public Optional<Integer> endIndex()
      End of the attributed segment, exclusive.
    • endOffset

      public Optional<String> endOffset()
      End offset in time of the word relative to the start of the audio. Present when timestamp_granularities contains "word".
    • speaker

      public Optional<String> speaker()
      Optional. Speaker label for this word (e.g. "spk_1", "spk_2"). Present when diarization_mode is set in TranscriptionConfig.
    • startIndex

      public Optional<Integer> startIndex()
      Start of segment of the response that is attributed to this source.

      Index indicates the start of the segment, measured in bytes.

    • startOffset

      public Optional<String> startOffset()
      Start offset in time of the word relative to the start of the audio. Present when timestamp_granularities contains "word".
    • text

      public Optional<String> text()
      The transcribed word.
    • type

      public String type()
      Specified by:
      type in interface Annotation
    • builder

      public static WordInfo.Builder builder()
    • withEndIndex

      public WordInfo withEndIndex(@Nullable Integer endIndex)
      End of the attributed segment, exclusive.
    • withEndOffset

      public WordInfo withEndOffset(@Nullable String endOffset)
      End offset in time of the word relative to the start of the audio. Present when timestamp_granularities contains "word".
    • withSpeaker

      public WordInfo withSpeaker(@Nullable String speaker)
      Optional. Speaker label for this word (e.g. "spk_1", "spk_2"). Present when diarization_mode is set in TranscriptionConfig.
    • withStartIndex

      public WordInfo withStartIndex(@Nullable Integer startIndex)
      Start of segment of the response that is attributed to this source.

      Index indicates the start of the segment, measured in bytes.

    • withStartOffset

      public WordInfo withStartOffset(@Nullable String startOffset)
      Start offset in time of the word relative to the start of the audio. Present when timestamp_granularities contains "word".
    • withText

      public WordInfo withText(@Nullable String text)
      The transcribed word.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object