0

Does anyone know if it’s possible to transition to a different page solely off of a sentiment analysis score ($request.sentiment.score) of the end-user’s response?

I basically want the agent to ask the end-user a question and then have the agent route the user to a page strictly using the sentiment analysis score of the user’s response and nothing more


What I tried so far:

Through the Dialogflow-CX simulator, I am trying to transition to a different page using the conditional statement $request.sentiment.score <= 0 in the route, however the agent does not transition to the next page and cannot match my input to the strictly conditional route (it just jumps to the sys.no-match-default event handler)

Here is a screenshot of the route I have set up:

enter image description here

As you can see, the route has no intents other than a conditional trigger that has $request.sentiment.score <= 0 as the parameter.

I simply want the agent to direct the end-user to the next page whenever it detects a message with a negative sentiment score. The next screenshot shows that the agent detects that the sentiment score is negative, however the agent does not transition to the next page.

enter image description here

Does anyone know what I seem to be doing wrong?

Nate
  • 314
  • 1
  • 2
  • 11

2 Answers2

0

In your project, it seems you have not selected intent that's why unable to go to the next page.You can follow the below steps in Dialogflow CX Console for your requirement :

1 If you need to go to the bad_service page, then we need to give some negative words as you can see in the image below. enter image description here

2 In this, if $request.sentiment.score is less than zero then only the condition will satisfy. For example , if we give some negative words like bad service then $request.sentiment.score score is less than zero then will go to bad_service page. enter image description here

3 Now select the page.

enter image description here

Example of working:

1 Positive Query Score:

enter image description here

Here the Query Score is 0.8 greater than zero,so the condition is not satisfied.

2 Negative Query Score:

enter image description here

Here the Query Score is -0.9 so we reached the bad_services page.

EDIT #1

You can transition to the page using the sentiment analysis score:

Step1: Add new sys.no-match-default event handler by clicking the + symbol near to Event handlers:

enter image description here

Step2: Select sys.no-match-default from the drop down button under Event and apply the condition to trigger in your case ( $request.sentiment.score <= 0).

enter image description here

Step3: Select the page you want , in your case the Negative Sentiment page.

enter image description here

Step 4: Add another sys.no-match-default event handler and select that.

enter image description here

Step 5: Apply the condition ( $request.sentiment.score >= 0) to trigger the positive not trained phrases .

enter image description here

Example:

enter image description here

Here I added two no-match-default event handlers,if the world is negative then we will come to a negative sentiment page from any page and the same for positive words.

Negative sentiment score:

enter image description here

kiran mathew
  • 1,882
  • 1
  • 3
  • 10
  • Thanks for your answer. The reason why I did not include an intent is because I do not want to provide any training phrases for the agent to use. I simply want the bot to go solely off of Google's Sentiment Analysis score. I did try to implement your answer, however if I enter a phrase that cannot be matched, even if the sentiment analysis score is < 0 or > 0, the agent is stuck and cannot move to any of the pages – Nate Sep 19 '22 at 08:25
  • Do you know if it's possible to go off of Google's excellent Sentiment Analysis alone? Or would I be forced to have to use some positive/negative training words in the intents I develop? I have no issues adding positive/negative words, but it seems as though the sentiment analysis scores aren't actually being used and the words are only being used for matching and routing – Nate Sep 19 '22 at 08:33
  • If you do not want to use intent then you can try to use event handler. You can use the event handler to go to another page based on sentiment analysis score. You can use the `No-match default` event and condition to trigger. You will need to create two event handlers one for positive sentiment and one for negative sentiment and add respective conditions for those events.Let me know if this helps you or not. – kiran mathew Sep 22 '22 at 08:27
  • I tried your suggestion, unfortunately I don't think it's possible to do what you're recommending. My first issue is that you cannot have two event handlers with the same event. It will give you the error "Event Handlers must be unique". My second issue is that event handlers do not have any conditions. So I cannot provide a condition based on the sentiment analysis score – Nate Sep 22 '22 at 10:39
  • Based on this [document](https://cloud.google.com/dialogflow/cx/docs/concept/intent#tp) If you use the intent you don't have to define every possible phrases, because Dialogflow's built-in machine learning expands on your list with other, similar phrases. You should create at least 10-20 (depending on complexity of intent) training phrases, so your agent can recognize a variety of end-user inputs. – kiran mathew Sep 23 '22 at 07:36
  • Thanks for sending that. Seems like there's no way to go off of Google's sentiment analysis alone (unless there's other information we don't know about yet). I am planning to purchase a Google support plan and get help from their engineers directly. I'll keep you updated if you'd like – Nate Sep 23 '22 at 09:34
  • You can raise a ticket in [Google’s Public Issue Tracker](https://issuetracker.google.com/). – kiran mathew Sep 23 '22 at 10:41
0

It is not possible to transition to a different page using Google DialogFlow's built-in sentiment analysis functionality. The closest you can get to is using pre-trained statements

Nate
  • 314
  • 1
  • 2
  • 11