MCPcopy Create free account
hub / github.com/RawdogReverend/TermNet / normalize_text

Method normalize_text

ui/webserver/web_ui_server.py:24–37  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

22 import re
23
24 def normalize_text(text: str) -> str:
25 # Simple detection: jammed datetime looks like WedSep242025,22:09:27EDT
26 compact_dt = re.findall(r"[A-Z][a-z]{2}[A-Z][a-z]{2}\d{1,2}\d{4},\d{2}:\d{2}:\d{2}[A-Z]{2,4}", text)
27 for dt in compact_dt:
28 # slice it instead of regex replace
29 day = dt[0:3] # Wed
30 month = dt[3:6] # Sep
31 date = dt[6:8] # 24
32 year = dt[8:12] # 2025
33 time = dt.split(",")[1][0:8] # 22:09:27
34 tz = dt.split(",")[1][8:] # EDT
35 fixed = f"{day} {month} {int(date)} {year}, {time} {tz}"
36 text = text.replace(dt, fixed)
37 return text
38
39
40 async def connect(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected