Azure / Azure/azure-sdk-for-python

Unexpectedly Deep Section Nesting on Second Page – Bug or Expected Behavior in Azure Document Intelligence Multi-page Processing?

Open
#41,107 2 comments 0 reactions 1 assignee Claimed by @bojunehsu View on GitHub
Client customer-reported Document Intelligence needs-team-attention question Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

When processing a multi-page file (see [attachment](https://github.com/user-attachments/files/20218335/multiplepagesample.pdf)) with Azure Document Intelligence, the resulting layout shows that the section on the second page is nested much deeper than expected.

Is this simply a detection failure?

Or is this expected behavior when handling multi-page documents—meaning that post-processing is required to adjust layout consistency across pages?

I'd appreciate any clarification on whether this is a bug or something that needs to be handled on the client side.

```
$ for line in result.content.splitlines():
$ if '#' in line:
$ print(line)
# This is title
## 1. Text
## 2. Page Objects
### 2.1 Table
### 2.2. Figure
## 3. Others
## This is title
### 1. Text
### 2. Page Objects
#### 2.1 Table
#### 2.2. Figure
### 3. Others

$ for i, paragraph in enumerate(result.paragraphs):
$ if paragraph.get('role') in ['title', 'sectionHeading']:
$ print(paragraph['role'], paragraph['content'])
title This is title
sectionHeading 1. Text
sectionHeading 2. Page Objects
sectionHeading 2.1 Table
sectionHeading 2.2. Figure
sectionHeading 3. Others
title This is title
sectionHeading 1. Text
sectionHeading 2. Page Objects
sectionHeading 2.1 Table
sectionHeading 2.2. Figure
sectionHeading 3. Others
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.