Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Interaction history NLP example

Updated on May 17, 2024

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.

Extracting previous interactions whose sentiment value was negative
The configuration of strategy components for extracting previous interactions with negative sentiment.

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.

Reacting to a history of consecutive negative sentiments
The configuration of strategy components for extracting previous interactions with negative sentiment.

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.

A strategy for offering propositions to customers based on natural language processing
The configuration of strategy components for choosing the right offers for customers.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us