Enabling service cases to smartly extract content from images using Pega NLP and Google Vision

From PegaWiki
How to use OCR and NLP to dramatically simplify customer experiences / This is the approved revision of this page, as well as being the most recent.
Jump to navigation Jump to search

Enabling service cases to smartly extract content from images using Pega NLP and Google Vision

Description Extract text from photos using Pega NLP and Google Vision
Version as of 8.4
Application Pega Customer Service
Capability/Industry Area Communications and Media

Pega NLP (natural language processing) along with the Google Vision OCR (optical character recognition) service can provide your service case with the artificial intelligence it requires to quickly understand an image shared or clicked by a customer, and easily derive the relevant data present within it. From a simple use case of obtaining device details present on a device, to complex use cases for getting the address details of a guest from a visiting card, all of these use cases not only make the end user's journey much easier, but also reduce the time the user spends on each journey.

Example .jpg Example.jpg


  1. Enable Google’s cloud Vision API at console.developers.google.com and generate a new API Key to use in your application.
  2. Import the Google Vision OCR component from Pega Marketplace to your application. (See Get component)
  3. In your service case, invoke the D_GetTextFromOCR data page, then provide the Google API key and the image’s base64 string as input, to get ResponseData as output containing the raw text.
  4. Invoke a text analyzer rule to extract the entities from the raw text that the OCR engine provides. .pyText has the raw text extracted from the image, and places the output at .pyNLPOutcome

Entity on the model.jpg

Input and output to text analyzer.jpg

5. Define the entities and provide the extraction model to get the data present on the raw text. The extraction model can be based on a RUTA script or a machine learning model. You can use Prediction Studio to explore the options.

6. Once the text analyzer is executed in the context of a service case (@pxExecuteAnActivity(Primary,"pxRunTextAnalyzer")) extract the values that you require from the .pyNLPOutcome property.

Clipboard result.jpg


The Guided internet service Microjourney in Pega Customer Service for Communications makes use of Pega’s artificial intelligence features, such as natural language processing and OCR, to help customers effortlessly enter their cable modem details during internet service setup.