Interaction history NLP example
You can customize the Interaction API in multiple ways, the most common of which is to provide a custom strategy for interaction with users through a conversation channel.
Example: Interaction history application in natural language processing
The following example demonstrates how to customize the pyGetBestPropositions strategy to combine natural language processing with interaction history. The goal of this strategy is to make a proposition to the user, based on natural language processing outcome. By default, the strategy uses the topic of customer input to determine the best proposition to offer. The interaction history comes into play when determining customer sentiment with regards to the analyzed input record. If the negative sentiment is detected, the strategy checks previous customer inputs for negative sentiment. If three consecutive negative sentiments are detected, the sentiment analysis takes precedence over topic detection in determining the best proposition for customers.
The following strategies provide an example of how you can customize the Interaction API to combine natural language processing with interaction history to detect multiple negative sentiments and react to them by making a proposition.
Natural language processing outcomes from previous interactions
First, determine how to take advantage of previous interactions that involved natural language processing. In the following example, the InvokeIH strategy imports previous interactions for the last three days, and then groups them by the sentiment value. The results are propagated further if the sentiment value of the last two interactions was negative.
Negative sentiment detection
In the next step, the pyGetPropositionsForSent strategy checks whether customer input has been negative twice in a row and compares previous results with the currently analyzed record. If there are three consecutive negative sentiments, then a proposition is made to the customer based on the rank.
A next-best-action strategy
Finally, the top-level pyGetBestPropositions strategy combines sentiment and topic detection to provide the next best action to customers.
By default, the strategy configuration analyzes the topic of the customer input to determine the proposition to offer. However, the strategy can take the retention steps for unhappy customers by using the pyGetPropositionsForSent strategy if three negative sentiment values for customer input were detected consecutively.