Skip to content

Commit

Permalink
Add .layouts() to Document entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Belval committed Mar 7, 2024
1 parent 5fe63b5 commit 767beab
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions textractor/entities/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from textractor.entities.table import Table
from textractor.entities.query import Query
from textractor.entities.signature import Signature
from textractor.entities.layout import Layout
from textractor.exceptions import InputError
from textractor.entities.key_value import KeyValue
from textractor.entities.bbox import SpatialObject
Expand Down Expand Up @@ -192,6 +193,16 @@ def signatures(self) -> EntityList[Signature]:
"""
return EntityList(sum([page.signatures for page in self.pages], []))

@property
def layouts(self) -> EntityList[Layout]:
"""
Returns all the :class:`Layout` objects present in the Document
:return: List of Layout objects
:rtype: EntityList[Layout]
"""
return EntityList(sum([page.layouts for page in self.pages], []))

@property
def identity_document(self) -> EntityList[IdentityDocument]:
"""
Expand Down

0 comments on commit 767beab

Please sign in to comment.