com.mtnfog.idyl.ami.sdk.model.Entity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of idyl-ami-java-sdk Show documentation
Show all versions of idyl-ami-java-sdk Show documentation
Java SDK for Mountain Fog's Idyl AMI.
The newest version!
/* Copyright 2014-2015 Mountain Fog, Inc.
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.mtnfog.idyl.ami.sdk.model;
import java.io.Serializable;
import org.apache.commons.lang3.builder.HashCodeBuilder;
public class Entity implements Serializable {
private static final long serialVersionUID = 5297145844547340358L;
private String type;
private String text;
private double probability;
private int startPosition;
private int endPosition;
public Entity() {
}
public Entity(String text) {
this.text = text;
}
public Entity(String text, double probability, int startPosition, int endPosition, String type) {
this.text = text;
this.probability = probability;
this.startPosition = startPosition;
this.endPosition = endPosition;
this.type = type;
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 31).
append(text).
append(startPosition).
append(endPosition).
append(probability).
append(type).
toHashCode();
}
@Override
public boolean equals(Object obj) {
if(obj instanceof Entity) {
Entity entity = (Entity) obj;
if(this.text.equals(entity.getText())
&& this.startPosition == entity.getStartPosition()
&& this.endPosition == entity.getEndPosition()
&& this.probability == entity.getProbability()
&& this.type.equalsIgnoreCase(entity.getType())) {
return true;
}
}
return false;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Text: " + text + "; ");
sb.append("Start: " + startPosition + "; ");
sb.append("End: " + endPosition + "; ");
sb.append("Probability: " + probability + "; ");
sb.append("Type: " + type + "; ");
return sb.toString();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public double getProbability() {
return probability;
}
public void setProbability(double probability) {
this.probability = probability;
}
public int getStartPosition() {
return startPosition;
}
public void setStartPosition(int startPosition) {
this.startPosition = startPosition;
}
public int getEndPosition() {
return endPosition;
}
public void setEndPosition(int endPosition) {
this.endPosition = endPosition;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy