Package com.vivoka.vsdk.tts.utils
Class WordMarker
java.lang.Object
com.vivoka.vsdk.tts.utils.WordMarker
Represents a word marker in the TTS event.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionWordMarker(int index, String text, String word, int startPosInAudio, int endPosInAudio, int startPosInText, int endPosInText) -
Method Summary
Modifier and TypeMethodDescriptionstatic WordMarkerCreates a word marker from a JSON object.intintintgetIndex()intintgetText()getWord()org.json.JSONObjecttoJson()Converts the word marker to a JSON object.
-
Constructor Details
-
WordMarker
-
-
Method Details
-
toJson
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
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
- Returns:
- the text of the word marker.
-
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.
-