Class WordMarker

java.lang.Object
com.vivoka.vsdk.tts.utils.WordMarker

public class WordMarker extends Object
Represents a word marker in the TTS event.
See Also:
  • Constructor Details

    • WordMarker

      public WordMarker(int index, String text, String word, int startPosInAudio, int endPosInAudio, int startPosInText, int endPosInText)
  • Method Details

    • toJson

      public org.json.JSONObject toJson() throws Exception
      Converts the word marker to a JSON object.
      Returns:
      JSONObject representation of the word marker
      Throws:
      Exception - If failed to convert the word marker to a JSON object.
    • fromJson

      public static WordMarker fromJson(String json) throws Exception
      Creates a word marker from a JSON object.
      Parameters:
      json - json string
      Returns:
      WordMarker
      Throws:
      Exception - If failed to create the word marker from the JSON string.
    • getIndex

      public int getIndex()
      Returns:
      The index of the word marker. This index is zero-based, meaning 0 corresponds to the first word.
    • getText

      public String getText()
      Returns:
      the text of the word marker.
    • getWord

      public String getWord()
      Returns:
      the current word of the word marker.
    • getStartPosInText

      public int getStartPosInText()
      Returns:
      the start position of the word marker in the text.
    • getStartPosInAudio

      public int getStartPosInAudio()
      Returns:
      the start position of the word marker in the audio.
    • getEndPosInText

      public int getEndPosInText()
      Returns:
      the end position of the word marker in the text.
    • getEndPosInAudio

      public int getEndPosInAudio()
      Returns:
      the end position of the word marker in the audio.