@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + MAGNITUDE_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits(getMagnitude()); hash = (37 * hash) + SCORE_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits(getScore()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public com.google.cloud.language.v1beta2.Sentiment buildPartial() { com.google.cloud.language.v1beta2.Sentiment result = new com.google.cloud.language.v1beta2.Sentiment(this); result.magnitude_ = magnitude_; result.score_ = score_; onBuilt(); return result; }
public Builder mergeFrom(com.google.cloud.language.v1beta2.Sentiment other) { if (other == com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance()) return this; if (other.getMagnitude() != 0F) { setMagnitude(other.getMagnitude()); } if (other.getScore() != 0F) { setScore(other.getScore()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1beta2.Sentiment)) { return super.equals(obj); } com.google.cloud.language.v1beta2.Sentiment other = (com.google.cloud.language.v1beta2.Sentiment) obj; boolean result = true; result = result && (java.lang.Float.floatToIntBits(getMagnitude()) == java.lang.Float.floatToIntBits(other.getMagnitude())); result = result && (java.lang.Float.floatToIntBits(getScore()) == java.lang.Float.floatToIntBits(other.getScore())); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public com.google.cloud.language.v1beta2.Sentiment getDefaultInstanceForType() { return com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance(); }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasDocumentSentiment()) { hash = (37 * hash) + DOCUMENT_SENTIMENT_FIELD_NUMBER; hash = (53 * hash) + getDocumentSentiment().hashCode(); } hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; hash = (53 * hash) + getLanguage().hashCode(); if (getSentencesCount() > 0) { hash = (37 * hash) + SENTENCES_FIELD_NUMBER; hash = (53 * hash) + getSentencesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1beta2.AnalyzeSentimentResponse)) { return super.equals(obj); } com.google.cloud.language.v1beta2.AnalyzeSentimentResponse other = (com.google.cloud.language.v1beta2.AnalyzeSentimentResponse) obj; boolean result = true; result = result && (hasDocumentSentiment() == other.hasDocumentSentiment()); if (hasDocumentSentiment()) { result = result && getDocumentSentiment().equals(other.getDocumentSentiment()); } result = result && getLanguage().equals(other.getLanguage()); result = result && getSentencesList().equals(other.getSentencesList()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public com.google.cloud.language.v1beta2.Sentiment build() { com.google.cloud.language.v1beta2.Sentiment result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
if (sentiment != null) { System.out.println("Found sentiment."); System.out.printf("\tMagnitude: %.3f\n", sentiment.getMagnitude()); System.out.printf("\tScore: %.3f\n", sentiment.getScore()); } else { System.out.println("No sentiment found");
/** * * * <pre> * The overall sentiment for the document. Populated if the user enables * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. * </pre> * * <code>.google.cloud.language.v1beta2.Sentiment document_sentiment = 4;</code> */ public com.google.cloud.language.v1beta2.Sentiment getDocumentSentiment() { return documentSentiment_ == null ? com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance() : documentSentiment_; } /**
/** * * * <pre> * The overall sentiment of the input document. * </pre> * * <code>.google.cloud.language.v1beta2.Sentiment document_sentiment = 1;</code> */ public Builder mergeDocumentSentiment(com.google.cloud.language.v1beta2.Sentiment value) { if (documentSentimentBuilder_ == null) { if (documentSentiment_ != null) { documentSentiment_ = com.google.cloud.language.v1beta2.Sentiment.newBuilder(documentSentiment_) .mergeFrom(value) .buildPartial(); } else { documentSentiment_ = value; } onChanged(); } else { documentSentimentBuilder_.mergeFrom(value); } return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasText()) { hash = (37 * hash) + TEXT_FIELD_NUMBER; hash = (53 * hash) + getText().hashCode(); } if (hasSentiment()) { hash = (37 * hash) + SENTIMENT_FIELD_NUMBER; hash = (53 * hash) + getSentiment().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1beta2.AnnotateTextResponse)) { return super.equals(obj); } com.google.cloud.language.v1beta2.AnnotateTextResponse other = (com.google.cloud.language.v1beta2.AnnotateTextResponse) obj; boolean result = true; result = result && getSentencesList().equals(other.getSentencesList()); result = result && getTokensList().equals(other.getTokensList()); result = result && getEntitiesList().equals(other.getEntitiesList()); result = result && (hasDocumentSentiment() == other.hasDocumentSentiment()); if (hasDocumentSentiment()) { result = result && getDocumentSentiment().equals(other.getDocumentSentiment()); } result = result && getLanguage().equals(other.getLanguage()); result = result && getCategoriesList().equals(other.getCategoriesList()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * The overall sentiment of the input document. * </pre> * * <code>.google.cloud.language.v1beta2.Sentiment document_sentiment = 1;</code> */ public com.google.cloud.language.v1beta2.Sentiment getDocumentSentiment() { return documentSentiment_ == null ? com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance() : documentSentiment_; } /**
/** * * * <pre> * The overall sentiment for the document. Populated if the user enables * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]. * </pre> * * <code>.google.cloud.language.v1beta2.Sentiment document_sentiment = 4;</code> */ public Builder mergeDocumentSentiment(com.google.cloud.language.v1beta2.Sentiment value) { if (documentSentimentBuilder_ == null) { if (documentSentiment_ != null) { documentSentiment_ = com.google.cloud.language.v1beta2.Sentiment.newBuilder(documentSentiment_) .mergeFrom(value) .buildPartial(); } else { documentSentiment_ = value; } onChanged(); } else { documentSentimentBuilder_.mergeFrom(value); } return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasText()) { hash = (37 * hash) + TEXT_FIELD_NUMBER; hash = (53 * hash) + getText().hashCode(); } hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + type_; if (hasSentiment()) { hash = (37 * hash) + SENTIMENT_FIELD_NUMBER; hash = (53 * hash) + getSentiment().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1beta2.Entity)) { return super.equals(obj); } com.google.cloud.language.v1beta2.Entity other = (com.google.cloud.language.v1beta2.Entity) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && type_ == other.type_; result = result && internalGetMetadata().equals(other.internalGetMetadata()); result = result && (java.lang.Float.floatToIntBits(getSalience()) == java.lang.Float.floatToIntBits(other.getSalience())); result = result && getMentionsList().equals(other.getMentionsList()); result = result && (hasSentiment() == other.hasSentiment()); if (hasSentiment()) { result = result && getSentiment().equals(other.getSentiment()); } result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * For calls to [AnalyzeEntitySentiment][] or if * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to * true, this field will contain the sentiment expressed for this mention of * the entity in the provided document. * </pre> * * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 3;</code> */ public com.google.cloud.language.v1beta2.Sentiment getSentiment() { return sentiment_ == null ? com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance() : sentiment_; } /**