Files
daily-robots/daily/news/sanitize.py

19 lines
469 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""新闻文案清洗:剥离「放宽窗口」类凑数前缀。"""
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()