Detect and Highlight Entities from Unstructured Text with Pre-trained Models
Use the Business Entity Recognition pre-trained models to get machine learning entity predictions for the text you submit to the service.
Overview
You will learn
- How to call and test Business Entity Recognition
- How to access and use the Business Entity Recognition Swagger UI (User Interface)
- How to use the Business Entity Recognition pre-trained models to extract entities from unstructured text
Prerequisites
Steps
Intro
The core functionality of Business Entity Recognition is to automatically detect and highlight any given type of named entity in unstructured text and classify it in accordance with predefined categories. When you finish this tutorial, you will get named entity predictions for the texts you submit to the service.
Business Entity Recognition is a customizable machine learning service, but you can also use the following pre-trained machine learning models:
sap_address_entitysap_email_business_entitysap_generic_entitiessap_invoice_header
See Extracted Entities by Pre-trained Model and Free Tier Option Technical Constraints.
This tutorial gives you an introduction to the service using the free tier option for Business Entity Recognition and the available pre-trained machine learning models. If you want to try out the Business Entity Recognition training endpoints to create your own model, check out the tutorial group Use Custom Machine Learning Models to Process Unstructured Text.
You will use Swagger UI, via any web browser, to call the Business Entity Recognition service APIs. Swagger UI allows developers to effortlessly interact and try out every single operation an API exposes for easy consumption. For more information, see Swagger UI.
In the service key you created for Business Entity Recognition in the previous tutorial: Create Service Instance for Business Entity Recognition, you should find (outside the uaa section of the service key) an entry called url (as highlighted in the image below).
To access the Business Entity Recognition Swagger UI, add
/api/v1to theurlvalue, paste it into any web browser and press Enter.
BER To be able to use the Swagger UI endpoints, you need to authorize yourself. In the top right corner, click Authorize.

BER Get the
access_tokenvalue created in the previous tutorial: Get OAuth Access Token for Business Entity Recognition Using Any Web Browser, then add bearer in front of it, and enter in the Value field.Codebearer <access_token>
BER Click Authorize and then click Close.

BER
Use the POST /inference/jobs endpoint to submit the text to be extracted and choose the pre-trained machine learning model you want to use to extract entities from the text.
Click the endpoint name to expand it.
Click Try it out.

BER In payload, enter the
textyou want to extract named entities from,modelName, andmodelVersion. In thissap_address_entitypre-trained model example, you can use the following:JSON{ "text":"Warehouse 02 (UK) Ltd c/o Excel Logistics Waindyke Way WF6 1TF. West Yorkshire United Kingdom.", "modelName":"sap_address_entity", "modelVersion":"3" }Click Execute.

BER Copy the
idfrom the Response body to see the result of the extraction in the next step.
BER
Use the GET /inference/jobs/{jobId} endpoint to see the text extraction results and the confidence level of the sap_address_entity model.
Click the endpoint name to expand it.
Click Try it out.

BER Enter the
jobIdobtained in the previous step and click Execute.
BER
You should receive a response like the following:

In the response, you will find the prediction for the extracted entities. The prediction is made with a probability indicated by the confidence field which represents how certain the model is about the value provided. A confidence of 1 means that the model is 100% sure about its prediction.
You have now successfully used the sap_address_entity model to get text entity predictions for the unstructured text you submitted to Business Entity Recognition.
You can also use the following payload example with the sap_address_entity model:
{
"text":"STAG GmbH Beriiner Chaussee 29, 39307 Genthin Logistik / Einkauf Tel.: 039 33/821 - 223 Fax: 039 33/ 821 - 259.",
"modelName":"sap_address_entity",
"modelVersion":"3"
}To try out the sap_address_entity model with your own unstructured text, keep in mind the model scope and supported languages, as detailed in sap_address_entity and Supported Languages.
Use the POST /inference/jobs endpoint to submit the text to be extracted and choose the pre-trained machine learning model you want to use to extract entities from the text.
Click the endpoint name to expand it.
Click Try it out.

BER In payload, enter the
textyou want to extract named entities from,modelName, andmodelVersion. In thissap_email_business_entitypre-trained model example, you can use the following:JSON{ "text":"11577210 - FAGOR EDERLAN MEXICO ยง Dear colleagues, there any way to identify which procurement division has transmitted 1339846 this payment to ABC Ltd. as there is no identification number. Are you able to help? Thank you: Doe, Jane <jane.doe@doe-company.com>: 15 May 2019 15:25 To: Doe, John <john.doe@doe-company.com>Cc: Smith, John <john.smith@doe-company.com>: /432216153 328,439.24 Thanks and best Jane. Doe, Jane. Accountant, Procurement Department, Doe Company, S. L. P.Phone+52 444 880 2300. 1114 Doe Company<doe-company.com>", "modelName":"sap_email_business_entity", "modelVersion":"2" }Click Execute.

BER Copy the
idfrom the Response body to see the result of the extraction in the next step.
BER
Use the GET /inference/jobs/{jobId} endpoint to see the text extraction results and the confidence level of the sap_email_business_entity model.
Click the endpoint name to expand it.
Click Try it out.

BER Enter the
jobIdobtained in the previous step and click Execute.
BER
You should receive a response like the following:

In the response, you will find the prediction for the extracted entities. The prediction is made with a probability indicated by the confidence field which represents how certain the model is about the value provided. A confidence of 1 means that the model is 100% sure about its prediction.
You have now successfully used the sap_email_business_entity model to get text entity predictions for the unstructured text you submitted to Business Entity Recognition.
You can also use the following payload example with the sap_email_business_entity model:
{
"text":"Von: lena nova <office@scomputercenter.bg> Gesendet: Montag, 21. Januar 2019, 19:13 Uhr An: canu, ana <ana.canu@company.com>; office@computercenter-bg.com Betreff: RE: M & B EOOD 2639710315 Sehr geehrter Kunde, ich sende Ihnen Informationen fรผr unsere Zahlung. Proforma 198305906 ist ein Teil der Rechnung 4830476570 / 11.01.2019. Rechnungsdatum Betrag in EUR 4830473772 14.12.2018 9,28 โฌ 4830474632 21.12.2018 29,16 โฌ 4830475244 28.12.2018 46,19 โฌ 4830475919 4.1.2019 9,28 โฌ 198305906 10.1.2019 9,29 โฌ 103,20 โฌ 4830476570 11.1.2019 37,13 198305906 10.1.2019 -9,29 โฌ 27,84 Einen schรถnen Tag noch! Mit freundlichen Grรผรen, lena lena nova Verkaufsleiterin M & B EOOD-Computer Center 11, Angel Kanchev Str; 1000, Sofia, Bulgarien Tel.: + 359 2 981 58 57; Mobil: + 359 889 61 13 21 E-Mail: office@scomputercenter.bg Besuchen Sie uns unter: www.computercenter.bg",
"modelName":"sap_email_business_entity",
"modelVersion":"2"
}To try out the sap_email_business_entity model with your own unstructured text, keep in mind the model scope and supported languages, as detailed in sap_email_business_entity and Supported Languages.
Use the POST /inference/jobs endpoint to submit the text to be extracted and choose the pre-trained machine learning model you want to use to extract entities from the text.
Click the endpoint name to expand it.
Click Try it out.

BER In payload, enter the
textyou want to extract named entities from,modelName, andmodelVersion. In thissap_generic_entitiespre-trained model example, you can use the following:JSON{ "text":"In 1988, 31.6% of blacks lived in poverty, compared with 10.1% for whites and 26.8% for Hispanics.", "modelName":"sap_generic_entities", "modelVersion":"1" }Click Execute.

BER Copy the
idfrom the Response body to see the result of the extraction in the next step.
BER
Use the GET /inference/jobs/{jobId} endpoint to see the text extraction results and the confidence level of the sap_generic_entities model.
Click the endpoint name to expand it.
Click Try it out.

BER Enter the
jobIdobtained in the previous step and click Execute.
BER
You should receive a response like the following:

In the response, you will find the prediction for the extracted entities. The prediction is made with a probability indicated by the confidence field which represents how certain the model is about the value provided. A confidence of 1 means that the model is 100% sure about its prediction.
You have now successfully used the sap_generic_entities model to get text entity predictions for the unstructured text you submitted to Business Entity Recognition.
You can also use the following payload example with the sap_generic_entities model:
{
"text":"Sie liegt sechs Kilometer nordรถstlich des Stadtzentrums von Pardubice und gehรถrt zum Okres Pardubice.",
"modelName":"sap_generic_entities",
"modelVersion":"1"
}To try out the sap_generic_entities model with your own unstructured text, keep in mind the model scope and supported languages, as detailed in sap_generic_entities and Supported Languages.
Use the POST /inference/jobs endpoint to submit the text to be extracted and choose the pre-trained machine learning model you want to use to extract entities from the text.
Click the endpoint name to expand it.
Click Try it out.

BER In payload, enter the
textyou want to extract named entities from,modelName, andmodelVersion. In thissap_invoice_headerpre-trained model example, you can use the following:JSON{ "text":"-----Original Message----- From: Duma Trunchi, Regina <DumaTrunchi@company.com> Sent: Thursday, December 20, 2018 4:33 PM To: Dubey, Ashish <Ashish.Dubey@company.com> Cc: Grc, Sony <grcsony@eu.company.com> Subject: CLEARING//226.530,63eur//phoxdistri Hi Ashish, Please do the clearing as per the attachment. Thank you, Duma-Trunchi Regina Accounts Receivable Finance company Pvt Ltd F&A services operated by AKAI Pvt Ltd Registered office: The Heights, 116 Glenurquhart Road, BALLAUGH, Surrey. KT27 0XW. UK Registered Company Number: 2522874", "modelName":"sap_invoice_header", "modelVersion":"1" }Click Execute.

BER Copy the
idfrom the Response body to see the result of the extraction in the next step.
BER
Use the GET /inference/jobs/{jobId} endpoint to see the text extraction results and the confidence level of the sap_invoice_header model.
Click the endpoint name to expand it.
Click Try it out.

BER Enter the
jobIdobtained in the previous step and click Execute.
BER
You should receive a response like the following:

You have now successfully used the sap_invoice_header model to get text entity predictions for the unstructured text you submitted to Business Entity Recognition.
You can also use the following payload example with the sap_invoice_header model:
{
"text":"Order number 12345678 Order type Sales Force Order abcdef Date 01/01/2001 Customer number 9876543 Customer service 123/ 456 6789 E-mail eshop@gmail.com Your Reference: Order receipt confirmation Customer address 508 W. St Margarets St. Brooklyn, NY 11228 Billing address 508 W. St Margarets St. Brooklyn, NY 11228 Ordered by Fenton Moon Shipping type: UPS 2nd Day Air PM Terms of payment: 30 Days Net due Your message: Item Material Description Qty. Price per Unit Net steel gray / Length 12 mm / 1 35.00 35.00 Gross Amount USD 35.00 Freight/ packaging USD 15.00 Tax 2 % USD 1 Tax 4 % USD 2 Total amount USD 53",
"modelName":"sap_invoice_header",
"modelVersion":"1"
}To try out the sap_invoice_header model with your own unstructured text, keep in mind the model scope and supported languages, as detailed in sap_invoice_header and Supported Languages.
Congratulations, you have completed this tutorial.
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.