Record Class TranslationRecognitionResult
java.lang.Object
java.lang.Record
com.alibaba.cloud.ai.dashscope.audio.transcription.TranslationRecognitionResult
public record TranslationRecognitionResult(TranslationRecognitionResult.Transcription transcription, List<TranslationRecognitionResult.Translation> translations, TranslationRecognitionResult.Usage usage)
extends Record
Rich result type for Gummy translation-recognition models (long-speech and chat) via WebSocket.
Maps to the payload.output section of the DashScope WebSocket response.
Corresponds to the SDK's TranslationRecognizerResult with full field coverage,
including both source-language transcription and multi-language translations.
- Since:
- 1.1.0.0
- Author:
- spring-ai-alibaba
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordIntermediate (not yet finalized) result, available before sentenceEnd.static final recordSource-language transcription result.static final recordA single target-language translation result.static final recordUsage information (e.g., audio duration in milliseconds).static final recordA single word with timestamps and punctuation. -
Constructor Summary
ConstructorsConstructorDescriptionTranslationRecognitionResult(TranslationRecognitionResult.Transcription transcription, List<TranslationRecognitionResult.Translation> translations, TranslationRecognitionResult.Usage usage) Creates an instance of aTranslationRecognitionResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Convenience: get the source-language transcription text.getTranslationText(String language) Convenience: get translation text for a specific target language.final inthashCode()Returns a hash code value for this object.booleanWhether a sentence-end has been reached (in either transcription or translation).final StringtoString()Returns a string representation of this record class.Returns the value of thetranscriptionrecord component.Returns the value of thetranslationsrecord component.usage()Returns the value of theusagerecord component.
-
Constructor Details
-
TranslationRecognitionResult
public TranslationRecognitionResult(TranslationRecognitionResult.Transcription transcription, List<TranslationRecognitionResult.Translation> translations, TranslationRecognitionResult.Usage usage) Creates an instance of aTranslationRecognitionResultrecord class.- Parameters:
transcription- the value for thetranscriptionrecord componenttranslations- the value for thetranslationsrecord componentusage- the value for theusagerecord component
-
-
Method Details
-
isSentenceEnd
public boolean isSentenceEnd()Whether a sentence-end has been reached (in either transcription or translation). -
getTranscriptionText
Convenience: get the source-language transcription text. -
getTranslationText
Convenience: get translation text for a specific target language. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
transcription
Returns the value of thetranscriptionrecord component.- Returns:
- the value of the
transcriptionrecord component
-
translations
Returns the value of thetranslationsrecord component.- Returns:
- the value of the
translationsrecord component
-
usage
Returns the value of theusagerecord component.- Returns:
- the value of the
usagerecord component
-