Exploring natural language processing with NLP Sample on Pega 7.4
NLP Sample provides a set of tools and example use cases for you to explore and learn about natural language processing. After you become comfortable with the default demonstration tools, you can create custom text analyzers that support your business goal. For example, you can automate the analysis of customer tweets so that only certain tweets are forwarded to a customer service representative, who reviews them and responds.
- Installing NLP Sample
- Exploring text analytics features
- Using natural language processing in the application context
- Advanced: Updating models with feedback data
- Next steps
Installing NLP Sample
Install NLP Sample by importing to your application the archive file that contains the application ruleset.
- Download the NLPSample7.4 archive file.
- Import the archive file to your application.
- Log in to Pega® Platform by entering the following credentials:
- user: admin@nlpsample
- password: rules
To access NLP Sample through your operator account, add the NLPSample:Administrators access group to your account.
- In Designer Studio, click Launch web interface > NLP Sample to open the application.
Exploring text analytics features
Become familiar with natural language processing on Pega Platform and explore the text categorization, text extraction, and language detection by applying a Text Analyzer rule to a piece of text. Before you configure custom Text Analyzers, start with the demonstrative instance of the Text Analyzer rule in NLP Sample (the Example text analyzer).
- To open NLP Sample, in Designer Studio, click Launch web interface > NLP Sample.
- In NLP Sample, click Try Text Analytics.
- Click the Feature tab.
- In the Feature field, select from the following options:
- Text categorization – Perform one of the following types of categorization tasks:
- Topic detection – Detect the talking point of a piece of text by classifying that text into one or more predefined categories. For more information, see Topic detection.
- Sentiment detection – Determine whether a piece of text carries negative, positive, or neutral meaning. For more information, see Sentiment analysis.
- Intent detection – Detect the purpose of a piece of text, for example, to discover whether it is a complaint, request for information, a threat of churn, and so on. For more information, see Intent analysis.
- Text extraction – Perform one of the following text extraction tasks:
- Entity extraction – Detect and classify named entities into predefined categories, for example, names of people, locations, organizations, and so on. Each entity type is associated with a unique icon and color when it is highlighted in the input text.
- Auto-tagging extraction – Mark the most important entities that define a piece of text.
For more information, see Text extraction.
- Text categorization – Perform one of the following types of categorization tasks:
Configure the input for analysis by expanding the Configure input list and configuring the following fields:
- Text analyzer – Select one of the following Text Analyzer rules:
- Example text analyzer – Use the default Text Analyzer rule (recommended).
- Custom text analyzer – Select a custom Text Analyzer rule by specifying that rule's applicable class and name.
- Only for topic detection: Taxonomy – Select a use case for topic detection.
A taxonomy contains a list of categories into which you can classify input text. Each taxonomy that you can select contains a unique set of categories that correspond to a specific type of use case, business type, or industry area, for example, banking or customer support. To learn about taxonomies in Pega Platform, see Requirements and best practices for creating a taxonomy for rule-based classification analysis.
- Input type – Provide a text sample to analyze. You can select the following sources of input:
- Input Text – Select one of the default text samples.
- Input URL – Load text from an external URL.
- Text analyzer – Select one of the following Text Analyzer rules:
Click Try it to analyze text.
You discovered the natural processing capabilities of Pega Platform by applying different types of analysis on various text samples.
Using natural language processing in the application context
Explore the implementation of natural language processing in Pega Platform by specifying the routing logic and case types to create when the Text Analyzer classifies text as part of a specific category, detects a sentiment type, a particular intent, and so on.
- In Designer Studio, click Launch web interface > NLP Sample to open NLP Sample.
- Click Try Text Analytics.
- Click the Application tab.
- In the Data source field, click Choose file and select an .XLS or .XLSX file that contains text input for analysis.
Click Download template to obtain sample records and view the file format that is required by NLP Sample.
- Expand the Configure text analyzer rule list.
- Perform one of the following actions:
- To select the demonstrative instance of the Text Analyzer rule, perform the following actions:
- In the Text analyzer field, select Example text analyzer.
- In the Taxonomy field, select a taxonomy to apply on the input data.
- To select a custom text analyzer, in the Text analyzer field, select Custom text analyzer and specify the applicable class and the name of that Text Analyzer.
- To select the demonstrative instance of the Text Analyzer rule, perform the following actions:
Configure the cases that are created when input text is categorized into one or more topics by performing the following actions:
Configuring case creation based on the detected categories
- In the Category field, press the Down Arrow key and select a topic (category).
- In the Case type, field, press the Down Arrow key and select a case type.
This case type is created when the Text Analyzer classifies a piece of text as belonging to the corresponding topic.
- Optional: To create more topic and case type pairings, click Add.
Configure the conditions for case creation and routing by performing the following actions:
- In the Routing logic section, click the Add icon.
- Select a group or a single operator to whom to route the case.
Configuring case assignment in NLP Sample
- Click the Expand icon to open the section for creating conditions.
- Click Add condition.
- Configure the condition logic for routing cases.
Sample case routing logic in NLP Sample
- Click Start.
You can view the results of the case creation and routing on the right in the Reports and Cases routed sections.
Case routing results
You can access the cases that you created with NLP Sample in the Case Manager portal, where you can act on each case, as shown in the following example:
An NLP Sample case in the Case Manager portal
You created an application logic in which, based on the output of natural language processing of a piece of text, you created a corresponding case that was routed to an appropriate work party to be acted on. You can now use natural language processing to derive structured business intelligence and further process it in the context of Pega Platform in accordance with the Next-Best-Action principle.
Advanced: Updating models with feedback data
You can provide feedback on any machine outcome of natural language processing by using the pxCaptureFeedback activity in NLP Sample. When a model incorrectly classifies a piece of text, you can provide a correct NLP outcome which is stored for that model. If at least 10 corrected records are gathered, you can feed these records to that model as training data, so that next time a similar record is processed, the accuracy of classification improves.
- Log on to NLP Sample as admin@nlpsample.
- In Designer Studio, click Launch web interface > Analytics Center.
- For a model that you want to test, click the More icon and select Test.
- Paste the test phrase in the Sample text box and click Test.
- View the text analytics outcome.
- Click Update to provide feedback to the model. For example, you can change the outcome of sentiment analysis, as shown in the following example:
Providing feedback on text analytics outcome
- Click Submit. You must provide at least 10 feedback items before you can update a model.
- To start the model update wizard for the model to which you provided feedback, click the More icon and select Update.
- In the Source selection step of the model update wizard, make sure that the Do you want to add feedback? checkbox is selected and click Next.
- Follow the steps of the wizard. For more information, see Text analytics.
Updating a model in Analytics Center
Next steps
- Learn more about the rules that support natural language processing. For more information, see Text Analytics in Pega 7.4 and Utilizing Text Analytics to Improve Business Performance.
- Create custom Text Analyzers and configure them to suit your business goal. You can test and experiment with custom Text Analyzer rules in NLP Sample. For more information, see About Text Analyzer rules.
- Develop machine-learning models to classify text. You can include those models in Text Analyzer rules to enhance the accuracy with which Text Analyzers detect sentiments, topics, intents, extract entities, and so on. For more information, see Managing predictive and text analytics models.
- Create a data flow for retrieving, processing, storing, and analyzing text-based customer interactions, for example, Analyzing WhatsApp content in NLP Sample in real time.