File size: 554 Bytes
4b734e0
78d3c76
289370b
 
4b734e0
289370b
4b734e0
78d3c76
 
4b734e0
 
289370b
4b734e0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 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.")