@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.speech.v1.StreamingRecognitionResult)) { return super.equals(obj); } com.google.cloud.speech.v1.StreamingRecognitionResult other = (com.google.cloud.speech.v1.StreamingRecognitionResult) obj; boolean result = true; result = result && getAlternativesList().equals(other.getAlternativesList()); result = result && (getIsFinal() == other.getIsFinal()); result = result && (java.lang.Float.floatToIntBits(getStability()) == java.lang.Float.floatToIntBits(other.getStability())); result = result && (getChannelTag() == other.getChannelTag()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getAlternativesCount() > 0) { hash = (37 * hash) + ALTERNATIVES_FIELD_NUMBER; hash = (53 * hash) + getAlternativesList().hashCode(); } hash = (37 * hash) + IS_FINAL_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getIsFinal()); hash = (37 * hash) + STABILITY_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits(getStability()); hash = (37 * hash) + CHANNEL_TAG_FIELD_NUMBER; hash = (53 * hash) + getChannelTag(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public void onComplete() { for (StreamingRecognizeResponse response : responses) { StreamingRecognitionResult result = response.getResultsList().get(0); SpeechRecognitionAlternative alternative = result.getAlternativesList().get(0); System.out.printf("Transcript : %s\n", alternative.getTranscript()); } }
public void onResponse(StreamingRecognizeResponse response) { responses.add(response); StreamingRecognitionResult result = response.getResultsList().get(0); // There can be several alternative transcripts for a given chunk of speech. Just // use the first (most likely) one here. SpeechRecognitionAlternative alternative = result.getAlternativesList().get(0); System.out.printf("Transcript : %s\n", alternative.getTranscript()); }
SpeechRecognitionAlternative alternative = result.getAlternativesList().get(0); System.out.printf("Transcript : %s\n", alternative.getTranscript());
SpeechRecognitionAlternative alternative = result.getAlternativesList().get(0); System.out.printf("Transcript : %s\n", alternative.getTranscript());
/** * Handle a single {@link StreamingRecognitionResult} by creating * a {@link TranscriptionResult} based on the result and notifying all * all registered {@link TranscriptionListener}s * * @param result the result to handle */ private void handleResult(StreamingRecognitionResult result) { List<SpeechRecognitionAlternative> alternatives = result.getAlternativesList(); if(alternatives.isEmpty()) { return; } TranscriptionResult transcriptionResult = new TranscriptionResult( null, this.messageID, !result.getIsFinal(), this.languageTag, result.getStability()); for(SpeechRecognitionAlternative alternative : alternatives) { transcriptionResult.addAlternative( new TranscriptionAlternative( alternative.getTranscript(), alternative.getConfidence())); } sent(transcriptionResult); }
= finalResult.getAlternativesList();