Skip to content

Commit 273e72b

Browse files
committed
🐛 Adds label field to NLU DocumentSentimentResult
1 parent a51b753 commit 273e72b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

natural-language-understanding/src/main/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/model/DocumentSentimentResults.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
public class DocumentSentimentResults extends GenericModel {
2121

2222
private Double score;
23+
private String label;
2324

2425
/**
2526
* Gets the score.
@@ -40,4 +41,24 @@ public Double getScore() {
4041
public void setScore(final Double score) {
4142
this.score = score;
4243
}
44+
45+
/**
46+
* Gets the label.
47+
*
48+
* Sentiment label
49+
*
50+
* @return the label
51+
*/
52+
public String getLabel() {
53+
return label;
54+
}
55+
56+
/**
57+
* Sets the label.
58+
*
59+
* @param label the new label
60+
*/
61+
public void setLabel(String label) {
62+
this.label = label;
63+
}
4364
}

natural-language-understanding/src/test/java/com/ibm/watson/developer_cloud/natural_language_understanding/v1/NaturalLanguageUnderstandingTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ public void testModelOptions1() throws InterruptedException {
257257
// DocumentSentimentResults
258258
DocumentSentimentResults documentSentimentResults = new DocumentSentimentResults();
259259
documentSentimentResults.setScore(10.10);
260+
documentSentimentResults.setLabel("neutral");
260261
assertEquals(documentSentimentResults.getScore(), 10.10, 0);
262+
assertEquals(documentSentimentResults.getLabel(), "neutral");
261263

262264
// EmotionOptions
263265
EmotionOptions emotionOptions = new EmotionOptions.Builder().document(true).targets(null).build();

0 commit comments

Comments
 (0)