Creating entity extraction model using Ruta script
6 Tasks
20 mins
Scenario
U+ Air uses a chatbot to serve its customers. Currently, the chatbot recognizes when a customer wants to cancel a ticket, and the system automatically creates a new case and routes it to the correct work queue.
U+ Air wants to improve its chatbot further to detect airline ticket numbers in customer messages automatically. The airline ticket numbers follow a strict pattern of two letters that are followed by three digits.
U+ Air determines that using an Apache UMIA RUTA script is the best choice to detect the strict ticket number pattern. As a data scientist, create an entity extraction model that contains a RUTA based entity to implement this business requirement.
Use the following credentials to log in to the exercise system:
Role | User name | Password |
---|---|---|
Data Scientist | DataScientist | rules |
Application Developer | ApplicationDeveloper | rules |
Caution: To reuse the exercise system from a previous challenge, first complete the Creating a chatbot channel challenge. Otherwise, click Initialize Pega or Reset Instance in this challenge.
Your assignment consists of the following tasks:
Task 1: Test the chatbot
As an application developer, test the chatbot for the following message: I want to cancel my ticket number AA562, and note that the chatbot does not detect the ticket number.
Task 2: Create a new entity model
As a data scientist, create a new entity model.
Task 3: Configure a RUTA based entity
Create a new RUTA based entity extraction model in the text prediction to meet the business requirement. The structure of the ticket number is strict: two letters that are followed by three digits.
Task 4: Test the entity extraction in the Airline prediction
Test the entity extraction in the Airline prediction and observe the results.
Task 5: Map entities in a case command
As an application developer, map the entities to a case command so that the chatbot includes the ticket number in the ticket cancellation case.
Task 6: Test the chatbot and examine the case created in the Customer Service portal
Confirm that a ticket cancellation request is correctly routed to the Inbound correspondence department and that the ticket number is correctly extracted from the message.
Challenge Walkthrough
Detailed Tasks
1 Test the chatbot
- On the exercise system landing page, click Pega CRM suite to log in to App Studio.
- Log in as an application developer with User name ApplicationDeveloper and Password rules.
- In the navigation pane of App Studio, click Channels to view the list of current channels.
- In the Current channel interfaces section, click the icon that represents your existing Airline Digital Messaging channel.
- In the Preview console on the right, in the Type your message here text box, enter I want to cancel my ticket number AA562 to test the chatbot.
- Turn on the Show analysis switch to see the details.
- Click Yes.
- Confirm that the chatbot detects the cancel ticket topic with 87% confidence and runs a preconfigured Cancel a ticket case type but does not detect the ticket number as an entity even though it is provided in the first message.
- In the lower-left corner, click the user icon, and then select Log off to log out of App Studio.
2 Create a new entity extraction model
- Log in to Prediction Studio as a data scientist with User name DataScientist and password rules.
- On the Predictions landing page, click Airline to open the prediction workspace.
- Click the Models tab.
- In the Entity section, click pySystemEntities to inspect it.
Note: pySystemEntites is an out-of-the-box entity extraction model that contains basic entities; you cannot modify it. New entity extraction model is required to add a new entity type.
- In the upper-left corner of the entity model details, click Back to return to the Models tab.
- In the Entity section, click Add model to begin creating the entity extraction model.
- In the Add model dialog box, select Create a new model.
- In the Model name field, enter Airline_entities.
- Click Create.
- In the upper-right corner of the Airline prediction workspace, click Save to save the entity extraction model.
3 Create a RUTA based entity
- Navigate to Outcomes tab.
- In the Outcomes section, click the Entities tab.
- In the top right of the entities list, click Create entity.
- In the New entity dialog box, in the Entity name text box, type ticket_number
Note: Notice that previously created Airline_entities entity model is selected by default with no possibility to change, because it is the only editable entity model configured in the prediction.
- Click Create.
- Go to RUTA tab.
- Check Enable RUTA.
- In the Rulescript editor, type CAP{REGEXP("..")}NUM{REGEXP("...") -> MARK(EntityType,1,3)};
Note: CAP{REGEXP("..")} detects capital letters with two characters. NUM{REGEXP("...") detects three-digit numbers that are followed by the previously detected letters. MARK(EntityType,1,3) means that annotations 1 through 3 are marked as the entity type. To learn more about RUTA script, go to Pega documentation page.
- Click Save.
- In the New entity dialog box, in the Entity name text box, type ticket_number
4 Test the entity extraction in the Airline Prediction
- In the upper-right corner of the Airline prediction workspace, click Test.
- In the Test prediction dialog box, in the text box, enter: I want to cancel my ticket number AA562, and then click Test to view the run result.
- Click the Entity tab.
- Confirm that in the Value column, the test detects AA562 as a ticket_number entity.
- Close the Test prediction dialog box.
- In the lower-left corner, click the user icon, and then select Log off to log out of Prediction Studio.
5 Map entities in a case command
- Log in as an application developer with User name ApplicationDeveloper and password rules.
- In the navigation pane of App Studio, click Channels to view the list of current channels.
- In the Current channel interfaces section, click the icon that represents your existing Airline Digital Messaging channel.
- In the Content section, in the cancel ticket row, click the Gear icon.
- In the Response configuration dialog box, click the Entities extraction tab.
- Click Add mapping to enable the chatbot to export the extracted entity in the created case.
- In the Select entity list, select ticket_number.
Note: This entity is the ticket_number entity that the Data Scientist creates.
- In the Select property list, select ticket_number.
Note: A System Architect already created the ticket_number case property.
- Click Submit.
- In the upper-right corner of App Studio, click Save to save the configuration.
6 Test the chatbot and examine case created in Customer Service portal
- In the Preview console on the right, in the Type your message here text box, , enter I want to cancel my ticket number AA562 to test the chatbot.
- Turn on the Show analysis switch to see the details.
Note: The chatbot extracts the ticket_number entity and detects cancel ticket topic. The chatbot runs a pre-configured cancel a ticket case. The conversation flow is designed to ask the customer for confirmation.
- Click Yes.
Note: If the customer does not provide the ticket number in the first message of the conversation flow, the chatbot requests the ticket number before proceeding. If the entity etraction model already detects the ticket number, this question is skipped.
- Verify that the chatbot confirms the case routing.
- In the upper-right corner of App Studio, click Save to save the results of the interaction.
- In the header of App Studio, click Preview to access the Pega Customer Service™ portal.
- In the My Work area, click the My workbaskets tab.
- In the View queue for list, select Inbound correspondence.
- Click CA-3 to access the new case.
- In the new case, confirm that the application has automatically extracted and included the ticket number entity in the case properties.
This Challenge is to practice what you learned in the following Module:
Available in the following mission:
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?