OCR Result
Reference documentation on processing an OCR result using the Mindee SDKs.
You'll need to have a response object as described in the Response Processing section.
Accessing the Page OCR
An OCRPage describes the text and words of a single page in the document.
OCRPage Attributes
Content
Full text content extracted from the document page.
Words
List of all words found on the page.
Each word has the following properties:
Content: Text content of the word.
Polygon: Coordinates of the detected word.
Sample Code
from mindee import OCRResponse
def handle_response(response: OCRResponse) -> None:
pages = response.inference.result.pages
for page in pages:
# Page-level properties
page_content = page.content
words = page.words
# Access the full text content extracted from this page.
print(f"Page content: {page_content}")
# Access all words detected on this page.
for word in words:
word_content = word.content
word_polygon = word.polygon
print(f"Word: {word_content}")
print(f"Polygon: {word_polygon}")handleResponse(response) {
const pages = response.inference.result.pages;
for (const page of pages) {
// Full text content extracted from this page.
const pageContent = page.content;
console.log(`Page content: ${pageContent}`);
// All words detected on this page.
for (const word of page.words) {
const wordContent = word.content;
const wordPolygon = word.polygon;
console.log(`Word: ${wordContent}`);
console.log(`Polygon: ${wordPolygon.toString()}`);
}
}
}Last updated
Was this helpful?

