How Key-Value Pair Extraction Works

PSPDFKit’s key-value pair (KVP) extraction engine enables you to recognize related data items in a document and export them to an external destination like a spreadsheet.

Key-Value Pair Extraction

Key-value pairs are two related data items: a key and a value. Depending on the type of document, the key-value pairs are different. For example, key-value pairs on invoices can be the following:

KeyValue
Invoice NumberNo 00162
Billing Date20/09/2022
Total1,165.10€

Key-value pair fields on government forms can be the following:

KeyValue
Company NameNutrient GmbH
Registration NumberFN 548939p
Date of Incorporation04/10/2013

It’s easy to get key-value pairs from structured documents like Excel files because the values are all named. However, 90 percent of all documents have unstructured data. For these documents, you need a KVP extraction tool to retrieve the information. Intelligent document processing (IDP) extracts data from unstructured and semi-structured documents using OCR and artificial intelligence (AI) technologies.

By automatically recognizing the document type, PSPDFKit adapts to the context and determines the extraction approach that makes the best use of available resources. PSPDFKit recognizes the document type based on adaptive layout understanding and natural language processing (NLP) technologies. This hybrid approach includes heuristics, mathematics, and machine learning (ML) capabilities that address the usual weaknesses of traditional OCR and pure ML engines.

How to Use Key-Value Pair Extraction

This example retrieves key-value pairs, such as the invoice number and billing date, from the scanned invoice below.

Sample invoice

Format the data extraction result to obtain the following table:

KeyValueDocument TypeConfidence Level
Billing date20/09/2022DateTime100%
Order date20/09/2022DateTime100%
Republic of PDF+100 847 738 227PhoneNumber77.2%
IBANAT13 2060 4236 6111 5994IBAN100%
CustomerVandelay Industries Around the Corner 13 NBC CityString69.8%
Delivery addressVandelay Industries Around the Corner 13 NBC CityString69.9%
Invoice numberNo 00162String70.9%
Ref. number34751Number92.9%
No00162Number100%
ReferenceP00201UID100%
Quantity Total (excl. VAT)320.00€Currency59%
Subtotal1,220.00€Currency100%
Discount (10%)-122.00€Currency90.6%
VAT (5.5%)+6710€Currency66.9%
Shipping cost0.00€Currency75%
TOTAL1,165.10€Currency100%
DescriptionLake MirrorString99.6%
VAT5.5%Percentage66.6%
Price per unit (excl. VAT)320.00€Currency80%
Tax No.AT98765321UID73.8%
#[email protected]EmailAddress65.6%
#www.bruuuk.comURL65.6%

This table also contains information about the data type and the confidence level for each key-value pair:

  • The data type describes the nature of the content. In this example, the engine recognizes the value [email protected] as an email and the value +100 847 738 227 as a phone number.
  • The confidence level describes how confident the KVP engine is in the accuracy of the data extraction.

In this example, the KVP engine automatically detected all key-value pairs in the document with minimal code and without any preconfiguration. The engine supports many formats and languages, and it has no dependencies to external models, resources, and databases.

Next Steps