com.basistech.rosette.apimodel.Label Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rosette-api-all Show documentation
Show all versions of rosette-api-all Show documentation
Babel Street Analytics API all modules combined
The newest version!
// Generated by delombok at Fri Nov 15 11:56:46 CST 2024
/*
* Copyright 2017 Basis Technology Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.basistech.rosette.apimodel;
import com.basistech.rosette.annotations.JacksonMixin;
/**
* Sentiment Analysis and Categorization return labels. A label is
* a category name, a confidence value,
* that contributed to the determination.
* For Sentiment, the label strings are items like 'pos' or 'neg';
* for Categorization, 'sports' or 'news'.
*/
@JacksonMixin
public final class Label {
/**
*/
private final String label;
/**
*/
private final Double confidence;
@SuppressWarnings("all")
Label(final String label, final Double confidence) {
this.label = label;
this.confidence = confidence;
}
@SuppressWarnings("all")
public static class LabelBuilder {
@SuppressWarnings("all")
private String label;
@SuppressWarnings("all")
private Double confidence;
@SuppressWarnings("all")
LabelBuilder() {
}
/**
* @return {@code this}.
*/
@SuppressWarnings("all")
public Label.LabelBuilder label(final String label) {
this.label = label;
return this;
}
/**
* @return {@code this}.
*/
@SuppressWarnings("all")
public Label.LabelBuilder confidence(final Double confidence) {
this.confidence = confidence;
return this;
}
@SuppressWarnings("all")
public Label build() {
return new Label(this.label, this.confidence);
}
@Override
@SuppressWarnings("all")
public String toString() {
return "Label.LabelBuilder(label=" + this.label + ", confidence=" + this.confidence + ")";
}
}
@SuppressWarnings("all")
public static Label.LabelBuilder builder() {
return new Label.LabelBuilder();
}
/**
* @return the label.
*/
@SuppressWarnings("all")
public String getLabel() {
return this.label;
}
/**
* @return the confidence score (0.0-1.0)
*/
@SuppressWarnings("all")
public Double getConfidence() {
return this.confidence;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof Label)) return false;
final Label other = (Label) o;
final Object this$confidence = this.getConfidence();
final Object other$confidence = other.getConfidence();
if (this$confidence == null ? other$confidence != null : !this$confidence.equals(other$confidence)) return false;
final Object this$label = this.getLabel();
final Object other$label = other.getLabel();
if (this$label == null ? other$label != null : !this$label.equals(other$label)) return false;
return true;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $confidence = this.getConfidence();
result = result * PRIME + ($confidence == null ? 43 : $confidence.hashCode());
final Object $label = this.getLabel();
result = result * PRIME + ($label == null ? 43 : $label.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "Label(label=" + this.getLabel() + ", confidence=" + this.getConfidence() + ")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy