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.")