# Document Comparison for Corporate Legal Issues

Silk Data’s cooperation with a renowned engineering company led to the development of an advanced NLP-based solution allowing to automatically compare PDF documents versions. The tool provides significant aid in financial, legal, services promotion and products positioning decision-making practices allowing specialists to spend mere minutes on dealing with hundred-page documents.

Source: AI-generated image

## Challenge

Our client must deal with numerous legal, service and internal operations documents every single day, which implies a significant workload for their specialists. The main problem, however, was not for the specialists to deal with all the files, but to check and verify document differences after regulation, service or partnership conditions changes.

They requested a solution that will compare PDF documents and automatically check these documents for content and structure changes.

## About the Project

Our client is an international engineering, manufacturing and retail company with its roots lying in Germany. The corporation has been operating since the end of the 19th century and has more than 400 thousand employees in Western Europe, North and South America and in South Asia.

Region

Germany

Time

2 months

Team

4 specialists

## Our Document Comparison Tool

The dedicated development team guided by our Head of AI built software able to compare PDF documents of any size and present thorough and detailed reports about the document's differences.

The solution allowed to **avoid manual comparison**, which both increases its accuracy and allows company specialists to focus on more important legal tasks.

In addition, one of the main strong points of the developed software became the ability to **receive detailed text and HTML reports** that can be downloaded and shared through corporate internal communication resources.

### What are the Technologies Lying behind Documents Compare?

There were two key technological solutions chosen for the project that would allow our tool to efficiently perform automated documents’ comparison.

- ### Vector embedding

  This is the core technology of our document comparison software which represents the way machines can read human texts.

  > **Vectors** are lists of numbers that represent various data, primarily texts. These lists are digital entities that are further perceived by computers.

  However, it’s not only about the capability of perceiving human text, but also about the ability to process and analyze it. Any NLP-based tool uses vector system as the main source for semantic analysis of the text.

  It is possible because vectors aren’t fully random and have certain patterns in the sequences of numbers’ lists. Those vectors that are ‘close’ to each other represent semantically similar concepts, while antonyms’ vectors are typically the most distant. For example, synonyms or words of the same class will be located near each other in a high-dimensional space of vectors.

  Vector embeddings are typically generated by neural networks. These networks are trained on large amounts of data which allows them to track and understand the patterns between sentences of the text, words in a particular sentence or between the image elements.

- ### Similarity matrix

  Building a vector embedding is a reliable approach in dealing with natural language processing. However, as the main client request was to create a tool that would compare documents versions and automatically check changes, we decided to reinforce general embedding. So, we applied **similarity matrix** – a method that provides greater efficiency in dealing with texts similarity checking tasks.

  The matrix provides the cluster of numbers presented as squares, where each square represents the sentence or any other semantic fragment of the text. Two neighboring squares in neighboring diagonals represent the level of similarity between sentences.

  After that, each row is calculated, and the vector representation of each sentence’s similarity to the closest ones in the text is created.

  Such an approach allows not only to calculate similarity rate between sentences (abstracts, phrases or other semantic and contextual text fragments), but also make these calculations more precise, increasing the efficiency of document comparison. Through that, we used the above-mentioned method in **AI-based fragmentation** way of our software comparing documents.

### What are the Key Traits of the Silk Data’s Solution?

The overall process of our tool’s work is demonstrated on the following simplified scheme:

There are several features implemented in our software and each of them aligns with the initial client requirements and needs.

**Various processing types**

There are four options of documents processing available:

- ### Whole documents processing

  In this option the system checks whole PDF files without any intelligent semantic analysis, i.e. without dividing it into any meaningful contextual blocks. It is the fastest but least efficient way.

- ### ToC-based processing

  This is the method that focuses on the table of contents that PDF documents may contain. These ToCs (as well as outlines and bookmarks) are machine-readable, which allows the system to divide and analyze documents according to them. **The method also allows to see if the document’s sections were moved or fully deleted.**

- ### AI-based fragments processing

  The most contemporary and efficient way that implies AI-based semantic analysis of the uploaded documents. The PDF files are divided into contextually self-contained fragments, and the system analyses each fragment finding differences between two versions.

- ### Manual selection

  This special option implies that the user can manually select any part of the initial document and any part of the modified document.

Such a variety provides great flexibility in both checking complexity and time.

**Classification of changes**

Next feature is that all the detected changes are classified, and this classification is visually represented on the tools’ UI. There are two levels of changes: **word-level** and **section-level**.

At the word level the tracked changes are the following:

- **Edited text.** Highlighted are red-colored font.
- **Deleted text.** Visually represented as the crossed out.
- **Inserted text.** Visually represented by standard black font.

At the section level the system demonstrates:

- **Moved ToC sections/AI-based fragments.** Represented by blueish background.
- **Empty sections.** Visually represented by light-yellow background.
- **Deleted/inserted matched sections.** Visually represented by green-grey background.

**Report and statistics generation**

- **Statistics.** Every document check is followed by a specially generated statistics that contains the number and average percentage of classes changed, deleted or inserted into the initial document.

- **HTML report.** The user can download and open specially generated HTML report that duplicates the interface of the PDF comparison processing results. The users can see the list of compared sections and AI-based fragments, choose them and see all section-level and text-level changes, as well as similarity rate of two versions.

## Our Expert

> ‘This project is another demonstration that machines can become valuable and efficient helpers for businesses in dealing with overwhelming paperwork.
>
> Our tool allows to perform an hour-long task of comparing two versions of the document in a few minutes, and Silk Data can provide even more options for smart automation in many aspects and for many industries. Our opinion is that the need for such solutions will be growing with every year passing.’

## Project Results

Our document comparison tool is used by the client company’s legal department.

The key advantage the legal specialists received is the optimization of their work and an opportunity to ‘delegate’ painstaking and time-consuming task of comparing PDF documents to a machine.

It allowed the legal department to process greater numbers of partnership and regulatory documents for the same time periods, while the department specialists were almost completely spared from the task. In addition, the tool lowered the comparison complexity, as specialists don't have to look through every page and every sentence of the PDF file.

It is predicted that the tool will be implemented by other departments, like sales and financial teams, for the same purposes.

## Frequently Asked Questions

### What is document analysis?

It is the process of manual or automated document examination, whose main purpose is to identify document type, contents and semantics through comprehending its structure, context and other semantic details.

### Is our corporate data safe while dealing with your tool?

Of course. In Silk Data we follow strict policies regarding our clients’ corporate and personal data. We contractually guarantee that all the data regarding your company will be stored in our servers only with no transfer to third parties.

### How can I order the same automatic document comparison solution?

You can contact our company via a special form and formulate your initial request. Our C-level specialists will get in touch with you as soon as possible to discuss your request in detail.

## Project Info

### Type

[Natural Language Processing](https://silkdata.tech/case-studies/nlp)

### Industry

[Retail](https://silkdata.tech/case-studies/retail)

### Technology

[Python](https://silkdata.tech/case-studies/python)

## Have a Look at Our Related Projects

[See more](https://silkdata.tech/case-studies)

[Text Summarization](https://silkdata.tech/text-summarizer)

[Machine Learning](https://silkdata.tech/case-studies/machine-learning)

[Simplifies text summarization by using an advanced ML model to process large volumes of content. It extracts key points for concise summaries, supports 20+ languages, etc.](https://silkdata.tech/text-summarizer)

[AI-Powered Text Compare Tool](https://silkdata.tech/ai-text-compare)

[Machine Learning](https://silkdata.tech/case-studies/machine-learning)

[Compare documents by analyzing their semantic similarity. It highlights identical, similar, or altered text, supports multiple languages and file formats, provides visual reports.](https://silkdata.tech/ai-text-compare)

[Contract Analysis](https://silkdata.tech/ai-contract-review)

[Machine Learning](https://silkdata.tech/case-studies/machine-learning)

[The tool uses AI to quickly identify key provisions in legal documents. Enter contract text or upload a PDF/DOCX file and get the key provisions of the document within seconds.](https://silkdata.tech/ai-contract-review)

[Plagiarix](https://plagiarix.com)

[Machine Learning](https://silkdata.tech/case-studies/machine-learning)

[AI plagiarism detection system designed for the education sector. It detects AI-generated content and internet plagiarism and supports batch processing.](https://plagiarix.com)

[Semantic Map](https://silkdata.tech/semantic-map)

[Machine Learning](https://silkdata.tech/case-studies/machine-learning)

[AI automatically creates semantic maps, visualizing connections between documents and key topics. It allows discovering patterns in data, improving information analysis](https://silkdata.tech/semantic-map)

[AI-assisted Search](https://silkdata.tech/ai-assisted-search)

[Machine Learning](https://silkdata.tech/case-studies/machine-learning)

[AI tool that improves search accuracy by understanding context. It uses AI to analyse large amounts of text, improving relevance and supporting multiple languages and formats.](https://silkdata.tech/ai-assisted-search)
