Skip to content

Commit d8ea880

Browse files
committed
minor fixes to comments
1 parent 3f46b65 commit d8ea880

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

examples/conversation_tone_analyzer_integration/tone_conversation_integration.v1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# import tone detection
88
import tone_detection
99

10-
#
10+
# load the .env file containing your environment variables for the required services (conversation and tone)
1111
load_dotenv(find_dotenv())
1212

1313
# replace with your own conversation credentials or put them in a .env file in the home directory
@@ -30,7 +30,7 @@
3030
maintainToneHistoryInContext = True
3131

3232
# Payload for the Watson Conversation Service
33-
# workspace_id and user input text required.
33+
# user input text required - replace "I am happy" with user input text.
3434
payload = {
3535
'workspace_id':workspace_id,
3636
'input': {

examples/conversation_tone_analyzer_integration/tone_detection.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
SOCIAL_TONE_LABEL = 'social_tone'
3535

3636
'''
37-
* updateUserTone processes the Tone Analyzer payload to pull out the emotion, language and social
37+
* updateUserTone processes the Tone Analyzer payload to pull out the emotion, writing and social
3838
* tones, and identify the meaningful tones (i.e., those tones that meet the specified thresholds).
3939
* The conversationPayload json object is updated to include these tones.
4040
* @param conversationPayload json object returned by the Watson Conversation Service
@@ -57,7 +57,7 @@ def updateUserTone (conversationPayload, toneAnalyzerPayload, maintainHistory):
5757
# For convenience sake, define a variable for the user object
5858
user = conversationPayload['context']['user'];
5959

60-
# Extract the tones - emotion, language and social
60+
# Extract the tones - emotion, writing and social
6161
if toneAnalyzerPayload and toneAnalyzerPayload['document_tone']:
6262
for toneCategory in toneAnalyzerPayload['document_tone']['tone_categories']:
6363
if toneCategory['category_id'] == EMOTION_TONE_LABEL:
@@ -132,16 +132,16 @@ def updateEmotionTone(user, emotionTone, maintainHistory):
132132
})
133133

134134
'''
135-
updateLanguageTone updates the user with the language tones interpreted based on the specified thresholds
135+
updateWritingTone updates the user with the writing tones interpreted based on the specified thresholds
136136
@param: user a json object representing user information (tone) to be used in conversing with the Conversation Service
137-
@param: languageTone a json object containing the language tones in the payload returned by the Tone Analyzer
137+
@param: writingTone a json object containing the writing tones in the payload returned by the Tone Analyzer
138138
'''
139139
def updateWritingTone (user, writingTone, maintainHistory):
140140

141141
currentWriting = [];
142142
currentWritingObject = [];
143143

144-
# Process each language tone and determine if it is high or low
144+
# Process each writing tone and determine if it is high or low
145145
for tone in writingTone['tones']:
146146
if tone['score'] >= WRITING_HIGH_SCORE_THRESHOLD:
147147
currentWriting.append(tone['tone_name'].lower() + '_high')

0 commit comments

Comments
 (0)