Skip to content

Commit 2ffaf6f

Browse files
authored
fix: type for serialized TableChunks (#4056)
#### To test, simply serialize a TableChunk element with and without the changes in the PR ____ **Without the changes:** ``` In [1]: from unstructured.documents.elements import TableChunk In [2]: TableChunk("hi") Out[2]: <unstructured.documents.elements.TableChunk at 0x110113410> In [3]: TableChunk("hi").to_dict() Out[3]: {'type': 'Table', 'element_id': '6267e99a-46d8-4f2d-a206-51c691469c72', 'text': 'hi', 'metadata': {}} ``` ____ **With the changes:** ``` In [1]: from unstructured.documents.elements import TableChunk In [2]: TableChunk("hi") Out[2]: <unstructured.documents.elements.TableChunk at 0x10367f050> In [3]: TableChunk("hi").to_dict() Out[3]: {'type': 'TableChunk', 'element_id': 'f91af3ac-0dea-4dc4-8a6a-69c28cfcca3b', 'text': 'hi', 'metadata': {}} ``` ____
1 parent 37800c3 commit 2ffaf6f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
## 0.18.6-dev0
1+
## 0.18.6
22

33
### Enhancements
44

55
### Features
66

77
### Fixes
88
- **Improved epub partition errors** EPUB partition will now produce new type of error on unprocessable files.
9+
- **Fix type for serialized TableChunks** Use `TableChunk` for the string value of the field `type` when serializing elements of type `TableChunk`, rather than using the value `Table`.
910

1011
## 0.18.5
1112

unstructured/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.18.6-dev0" # pragma: no cover
1+
__version__ = "0.18.6" # pragma: no cover

unstructured/documents/elements.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ class Table(Text):
943943
class TableChunk(Table):
944944
"""An element for capturing chunks of tables."""
945945

946-
category = "Table"
946+
category = "TableChunk"
947947

948948

949949
class Header(Text):

0 commit comments

Comments
 (0)