@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.speech.v1.SpeechRecognitionAlternative)) { return super.equals(obj); } com.google.cloud.speech.v1.SpeechRecognitionAlternative other = (com.google.cloud.speech.v1.SpeechRecognitionAlternative) obj; boolean result = true; result = result && getTranscript().equals(other.getTranscript()); result = result && (java.lang.Float.floatToIntBits(getConfidence()) == java.lang.Float.floatToIntBits(other.getConfidence())); result = result && getWordsList().equals(other.getWordsList()); 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(); hash = (37 * hash) + TRANSCRIPT_FIELD_NUMBER; hash = (53 * hash) + getTranscript().hashCode(); hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidence()); if (getWordsCount() > 0) { hash = (37 * hash) + WORDS_FIELD_NUMBER; hash = (53 * hash) + getWordsList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
onChanged(); if (other.getConfidence() != 0F) { setConfidence(other.getConfidence());
session.putAttribute(ff, "google.speech.confidence", String.valueOf(alternative.getConfidence())); session.putAttribute(ff, "google.speech.serialized.size", String.valueOf(alternative.getSerializedSize())); session.putAttribute(ff, "google.speech.words.count", String.valueOf(alternative.getWordsCount()));
/** * 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); }