Skip to content

Commit

Permalink
fix: Restore proper string serialization of DocItemLabel (#124)
Browse files Browse the repository at this point in the history
* feat: Add mapping to colors into DocItemLabel

Signed-off-by: Christoph Auer <[email protected]>

* fix: Restore DocItemLabel.__str__

Signed-off-by: Christoph Auer <[email protected]>

---------

Signed-off-by: Christoph Auer <[email protected]>
  • Loading branch information
cau-git authored Jan 8, 2025
1 parent 5c2e0de commit a52bb88
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docling_core/types/doc/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class DocItemLabel(str, Enum):
PARAGRAPH = "paragraph"
REFERENCE = "reference"

def __str__(self):
"""Get string value."""
return str(self.value)

@staticmethod
def get_color(label: "DocItemLabel") -> Tuple[int, int, int]:
"""Return the RGB color associated with a given label."""
Expand Down

0 comments on commit a52bb88

Please sign in to comment.