-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🆕 Added support for Customer Care API endpoint for Tone Analyzer
- Loading branch information
Shubhanjan Shekhar
committed
Apr 11, 2017
1 parent
b748977
commit 7a5fcfe
Showing
7 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...rc/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/UtteranceAnalysis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.ibm.watson.developer_cloud.tone_analyzer.v3.model; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import com.ibm.watson.developer_cloud.service.model.GenericModel; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* This object represents the results of Tone Chat analysis on an utterance. It has the utterance text from the original | ||
* input. It holds a list of scores for individual chat tones. | ||
*/ | ||
public class UtteranceAnalysis extends GenericModel { | ||
|
||
@SerializedName("id") | ||
int id; | ||
|
||
@SerializedName("text") | ||
String text; | ||
|
||
List<ToneScore> tones; | ||
|
||
/** | ||
* Gets the id. | ||
* @return the id | ||
*/ | ||
public int getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* Sets the id. | ||
* @param id the new id | ||
*/ | ||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
/** | ||
* Gets the text. | ||
* @return the text | ||
*/ | ||
public String getText() { | ||
return text; | ||
} | ||
|
||
/** | ||
* Sets the text. | ||
* @param text the new text | ||
*/ | ||
public void setText(String text) { | ||
this.text = text; | ||
} | ||
|
||
/** | ||
* Gets the chat tones. | ||
* @return the chat tones | ||
*/ | ||
public List<ToneScore> getTones() { | ||
return tones; | ||
} | ||
|
||
/** | ||
* Sets the chat tones. | ||
* @param tones the new chat tones | ||
*/ | ||
public void setTones(List<ToneScore> tones) { | ||
this.tones = tones; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...r/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/UtterancesTone.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.ibm.watson.developer_cloud.tone_analyzer.v3.model; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import com.ibm.watson.developer_cloud.service.model.GenericModel; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Main object containing the result of running the Tone Analyzer Chat Analysis on a conversation. It contains a list | ||
* of utterance-level analysis results. | ||
*/ | ||
public class UtterancesTone extends GenericModel { | ||
|
||
@SerializedName("utterancesTone") | ||
List<UtteranceAnalysis> utterancesTone = new ArrayList<>(); | ||
|
||
/** | ||
* Gets the utterances tone. | ||
* @return the utterances tone | ||
*/ | ||
public List<UtteranceAnalysis> getUtterancesTone() { | ||
return utterancesTone; | ||
} | ||
|
||
/** | ||
* Sets the utterances tone. | ||
* @param utterancesTone the new utterances tone | ||
*/ | ||
public void setUtterancesTone(List<UtteranceAnalysis> utterancesTone) { | ||
this.utterancesTone = utterancesTone; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"utterances": [ | ||
{"text": "My charger isn't working.", "user": "customer"}, | ||
{"text": "Thanks for reaching out. Can you give me some more detail about the issue?", "user": "agent"}, | ||
{"text": "I put my charger in my tablet to charge it up last night and it keeps saying it isn't charging. The charging icon comes on, but it stays on even when I take the charger out. Which is ridiculous, it's brand new.", "user": "customer"}, | ||
{"text": "I'm sorry you're having issues with charging. What kind of charger are you using?", "user": "agent"} | ||
] | ||
} |
42 changes: 42 additions & 0 deletions
42
tone-analyzer/src/test/resources/tone_analyzer/tone_chat.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"utterances_tone": [ | ||
{ | ||
"utterance_id": 0, | ||
"utterance_text": "My charger isn't working.", | ||
"tones": [ | ||
{ | ||
"score": 0.536082, | ||
"tone_id": "sad", | ||
"tone_name": "sad" | ||
} | ||
] | ||
}, | ||
{ | ||
"utterance_id": 1, | ||
"utterance_text": "Thanks for reaching out. Can you give me some more detail about the issue?", | ||
"tones": [ | ||
{ | ||
"score": 0.956453, | ||
"tone_id": "polite", | ||
"tone_name": "polite" | ||
} | ||
] | ||
}, | ||
{ | ||
"utterance_id": 2, | ||
"utterance_text": "I put my charger in my tablet to charge it up last night and it keeps saying it isn't charging. The charging icon comes on, but it stays on even when I take the charger out. Which is ridiculous, it's brand new.", | ||
"tones": [] | ||
}, | ||
{ | ||
"utterance_id": 3, | ||
"utterance_text": "I'm sorry you're having issues with charging. What kind of charger are you using?", | ||
"tones": [ | ||
{ | ||
"score": 0.856453, | ||
"tone_id": "polite", | ||
"tone_name": "polite" | ||
} | ||
] | ||
} | ||
] | ||
} |