MCPcopy
hub / github.com/tickmao/Novel / clean_spaces

Function clean_spaces

scripts/clean.py:154–162  ·  view source on GitHub ↗

清理空格

(text: str)

Source from the content-addressed store, hash-verified

152
153
154def clean_spaces(text: str) -> str:
155 """清理空格"""
156 if not text:
157 return ""
158 # 去除首尾空格
159 text = text.strip()
160 # 多个空格合并为一个
161 text = re.sub(r'\s+', ' ', text)
162 return text
163
164
165def is_usable_name(text: str) -> bool:

Callers 5

is_usable_nameFunction · 0.85
apply_if_usableFunction · 0.85
strip_decorationsFunction · 0.85
normalize_source_nameFunction · 0.85
normalize_groupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected