From 32035d77bf668fd9088dcf03b3b9029e22bbf45d Mon Sep 17 00:00:00 2001 From: s0wa48 Date: Tue, 24 Feb 2026 16:59:23 +0100 Subject: [PATCH] fix: handle list output from group_bullet_paragraph in Element.apply() --- unstructured/documents/elements.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unstructured/documents/elements.py b/unstructured/documents/elements.py index dbf4c4d3ef..2604c77320 100644 --- a/unstructured/documents/elements.py +++ b/unstructured/documents/elements.py @@ -854,6 +854,8 @@ def apply(self, *cleaners: Callable[[str], str]): for cleaner in cleaners: cleaned_text = cleaner(cleaned_text) + if isinstance(cleaned_text, list): + cleaned_text = " ".join(cleaned_text) if not isinstance(cleaned_text, str): # pyright: ignore[reportUnnecessaryIsInstance] raise ValueError("Cleaner produced a non-string output.")