MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / strip_pdf_url

Function strip_pdf_url

agents/master-coordinator/main.py:1101–1115  ·  view source on GitHub ↗

Remove the first PDF URL and lightweight reading command text.

(text: Any)

Source from the content-addressed store, hash-verified

1099
1100
1101def strip_pdf_url(text: Any) -> str:
1102 """Remove the first PDF URL and lightweight reading command text."""
1103 raw_text = str(text or "")
1104 stripped = raw_text
1105 for match in GENERIC_HTTP_URL_RE.finditer(raw_text):
1106 raw_url = str(match.group("url") or "").strip().rstrip(".,);]\u3002\uff0c\uff1b")
1107 if not raw_url:
1108 continue
1109 normalized_url = raw_url if "://" in raw_url else f"https://{raw_url.lstrip('/')}"
1110 if looks_like_pdf_http_url(normalized_url):
1111 stripped = f"{raw_text[:match.start()]} {raw_text[match.end():]}"
1112 break
1113 stripped = re.sub(r"(?i)\b(read this|deep read)\b", " ", stripped)
1114 stripped = re.sub(r"精读", " ", stripped)
1115 return first_meaningful_line(re.sub(r"\s+", " ", stripped)).strip(" \t\r\n::-")
1116
1117
1118def normalize_direct_pdf_title_hint(text: Any) -> str:

Callers 1

Calls 3

looks_like_pdf_http_urlFunction · 0.85
first_meaningful_lineFunction · 0.85
startMethod · 0.80

Tested by

no test coverage detected