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

Function normalize_group

scripts/clean.py:231–245  ·  view source on GitHub ↗

规范化分组名称

(group: str)

Source from the content-addressed store, hash-verified

229
230
231def normalize_group(group: str) -> str:
232 """规范化分组名称"""
233 if not group:
234 return ""
235
236 # 先尝试直接映射
237 if group in GROUP_MAPPING:
238 return GROUP_MAPPING[group]
239
240 # 清洗后再映射
241 cleaned = clean_spaces(strip_decorations(group))
242 if cleaned in GROUP_MAPPING:
243 return GROUP_MAPPING[cleaned]
244
245 return cleaned
246
247
248def clean_source(source: dict, grade: bool = False) -> dict:

Callers 2

enrich_sourceMethod · 0.90
clean_sourceFunction · 0.85

Calls 2

clean_spacesFunction · 0.85
strip_decorationsFunction · 0.85

Tested by

no test coverage detected