Skip to content

Commit 767beab

Browse files
committed
Add .layouts() to Document entity
1 parent 5fe63b5 commit 767beab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

textractor/entities/document.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from textractor.entities.table import Table
2222
from textractor.entities.query import Query
2323
from textractor.entities.signature import Signature
24+
from textractor.entities.layout import Layout
2425
from textractor.exceptions import InputError
2526
from textractor.entities.key_value import KeyValue
2627
from textractor.entities.bbox import SpatialObject
@@ -192,6 +193,16 @@ def signatures(self) -> EntityList[Signature]:
192193
"""
193194
return EntityList(sum([page.signatures for page in self.pages], []))
194195

196+
@property
197+
def layouts(self) -> EntityList[Layout]:
198+
"""
199+
Returns all the :class:`Layout` objects present in the Document
200+
201+
:return: List of Layout objects
202+
:rtype: EntityList[Layout]
203+
"""
204+
return EntityList(sum([page.layouts for page in self.pages], []))
205+
195206
@property
196207
def identity_document(self) -> EntityList[IdentityDocument]:
197208
"""

0 commit comments

Comments
 (0)