Skip to content

Commit

Permalink
Tej 1058 sentiment (#112)
Browse files Browse the repository at this point in the history
* [maven-release-plugin] prepare release rosette-api-java-binding-1.8.1

* [maven-release-plugin] prepare for next development iteration

* TEJ-1058: added linking confidence in EntitySentiment.
  • Loading branch information
Katsuya-Tomioka authored and Li Xu committed Oct 27, 2017
1 parent 7764259 commit 515fec5
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api-java-binding</artifactId>
<version>1.8.1-SNAPSHOT</version>
<version>1.8.2-SNAPSHOT</version>
</parent>
<artifactId>rosette-api</artifactId>
<name>rosette-api</name>
Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api-java-binding</artifactId>
<version>1.8.1-SNAPSHOT</version>
<version>1.8.2-SNAPSHOT</version>
</parent>
<artifactId>rosette-api-common</artifactId>
<name>rosette-api-common</name>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api-java-binding</artifactId>
<version>1.8.1-SNAPSHOT</version>
<version>1.8.2-SNAPSHOT</version>
</parent>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api-examples</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api-java-binding</artifactId>
<version>1.8.1-SNAPSHOT</version>
<version>1.8.2-SNAPSHOT</version>
</parent>
<artifactId>rosette-api-json</artifactId>
<name>rosette-api-json</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public EntitySentimentMixin(
@JsonProperty("count") Integer count,
@JsonProperty("entityId") String entityId,
@JsonProperty("confidence") Double confidence,
@JsonProperty("salience") Double salience,
@JsonProperty("linkingConfidence") Double linkingConfidence,
@JsonProperty("sentiment") Label sentiment) {
//
}
Expand Down
14 changes: 14 additions & 0 deletions json/src/test/data/SentimentResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"entities": [
{
"count": 17,
"mention": "Samsung",
"normalized": "Samsung",
"type": "ORGANIZATION",
"salience": 1.0,
"confidence": 1.0,
"linkingConfidence": 1.0,
"sentiment": {"label": "neutral", "confidence": 1.0}
}
]
}
2 changes: 1 addition & 1 deletion model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api-java-binding</artifactId>
<version>1.8.1-SNAPSHOT</version>
<version>1.8.2-SNAPSHOT</version>
</parent>
<artifactId>rosette-api-model</artifactId>
<name>rosette-api-model</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public final class EntitySentiment {
private final Double confidence;
private final Double salience;
private final Label sentiment;
private final Double linkingConfidence;

/**
* constructor for {@code EntitySentiment}
Expand All @@ -49,7 +50,7 @@ public EntitySentiment(String type,
String entityId,
Double confidence,
Label sentiment) {
this(type, mention, normalized, count, entityId, confidence, null, sentiment);
this(type, mention, normalized, count, entityId, confidence, null, null, sentiment);
}

/**
Expand All @@ -61,6 +62,7 @@ public EntitySentiment(String type,
* @param entityId if the entity was linked, the ID from the knowledge base.
* @param confidence entity confidence.
* @param salience entity salience.
* @param linkingConfidence linking confidence.
* @param sentiment the sentiment information.
*/
public EntitySentiment(String type,
Expand All @@ -70,6 +72,7 @@ public EntitySentiment(String type,
String entityId,
Double confidence,
Double salience,
Double linkingConfidence,
Label sentiment) {
this.type = type;
this.mention = mention;
Expand All @@ -78,6 +81,7 @@ public EntitySentiment(String type,
this.entityId = entityId;
this.confidence = confidence;
this.salience = salience;
this.linkingConfidence = linkingConfidence;
this.sentiment = sentiment;
}

Expand Down Expand Up @@ -139,6 +143,14 @@ public Double getSalience() {
return salience;
}

/**
* get the linking confidence
* @return the linking confidence
*/
public Double getLinkingConfidence() {
return linkingConfidence;
}

/**
* @return the sentiment information.
*/
Expand All @@ -162,11 +174,12 @@ public boolean equals(Object o) {
&& Objects.equals(entityId, that.entityId)
&& Objects.equals(confidence, that.confidence)
&& Objects.equals(salience, that.salience)
&& Objects.equals(linkingConfidence, that.linkingConfidence)
&& Objects.equals(sentiment, that.sentiment);
}

@Override
public int hashCode() {
return Objects.hash(type, mention, normalized, count, entityId, confidence, salience, sentiment);
return Objects.hash(type, mention, normalized, count, entityId, confidence, salience, linkingConfidence, sentiment);
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api-java-binding</artifactId>
<version>1.8.1-SNAPSHOT</version>
<version>1.8.2-SNAPSHOT</version>
<parent>
<artifactId>open-source-parent</artifactId>
<groupId>com.basistech</groupId>
Expand Down
2 changes: 1 addition & 1 deletion release/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api-java-binding</artifactId>
<version>1.8.1-SNAPSHOT</version>
<version>1.8.2-SNAPSHOT</version>
</parent>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api-release</artifactId>
Expand Down

0 comments on commit 515fec5

Please sign in to comment.