Spaces:
Sleeping
Sleeping
# storyverse_weaver/core/utils.py | |
import re | |
def basic_text_cleanup(text: str) -> str: | |
if not text or not isinstance(text, str): return "" | |
text = text.strip() | |
patterns = [ r"^```(?:python|text|narrative)?\s*(.*?)\s*```$", r"^```\s*(.*?)\s*```$" ] | |
for pattern in patterns: | |
match = re.match(pattern, text, re.DOTALL | re.IGNORECASE) | |
if match: return match.group(1).strip() | |
return text | |
# Could add image resizing, format conversion utilities here later | |
print("DEBUG: core.utils (for StoryVerseWeaver) - Module defined.") |