Last active
March 16, 2021 12:09
-
-
Save mgv99/69952e197b959e8fd509b6f387eb23c9 to your computer and use it in GitHub Desktop.
Example chatbot state definition
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
replyOpinion | |
.body(context -> { | |
PerspectiveApiScore score = | |
(PerspectiveApiScore)context.getIntent().getNlpData().get("nlp.perspectiveapi"); | |
Double toxicity = score.getToxicityScore(); | |
if (!toxicity.equals(PerspectiveApiScore.DEFAULT_SCORE) && toxicity > 0.7) { | |
reactPlatform.reply(context, "That comment was inappropriate..."); | |
} | |
else { | |
reactPlatform.reply(context, "Thank you for your opinion!"); | |
} | |
}) | |
.next() | |
.moveTo(awaitingInput); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment