Azure / Azure/azure-sdk-for-python

Words in `DocumentLine` store polygons as lists of floats instead of lists of `Point`s

Open
#39,062 2 comments 0 reactions 1 assignee Assigned to @bojunehsu View on GitHub
Client Cognitive - Form Recognizer customer-reported needs-team-attention question Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

- **Package Name**: `azure.ai.formrecognizer`
- **Package Version**: 3.3.3
- **Operating System**: MacOS
- **Python Version**: 3.12

**Describe the bug**

The words in a `DocumentLine` seem to store their polygons as a list of floats rather than as a list of `Point` objects.

```python
from typing import reveal_type

line: DocumentLine
for w in line.get_words():
for p in w.polygon:
reveal_type(p) # this reveals as `Point` but it turns out to be a `float` at runtime
```

This is in contrast to iterating over words from the `words` field in a `DocumentPage`, where the polygons are indeed sequences of `Point` objects.

**To Reproduce**
Steps to reproduce the behavior:
1. Use a `prebuilt-read` model on pdf bytes to run OCR
2. Examine the words in a document line in the result

Tangentially related to #39031

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.