18
daily/news/sanitize.py
Normal file
18
daily/news/sanitize.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""新闻文案清洗:剥离「放宽窗口」类凑数前缀。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
_RELAX_PREFIX = re.compile(
|
||||
r"^(?:放宽窗口|放宽至[^::]*)\s*[::]\s*",
|
||||
re.UNICODE,
|
||||
)
|
||||
|
||||
|
||||
def strip_relax_window_prefix(text: str) -> str:
|
||||
"""去掉开头的「放宽窗口:」/「放宽至…:」前缀。"""
|
||||
raw = (text or "").strip()
|
||||
if not raw:
|
||||
return ""
|
||||
return _RELAX_PREFIX.sub("", raw, count=1).strip()
|
||||
Reference in New Issue
Block a user