MCPcopy Create free account
hub / github.com/CaraJ7/MMSearch / clean_text

Function clean_text

utils/web_content_utils.py:4–9  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

2from bs4 import BeautifulSoup
3
4def clean_text(text):
5 # Remove excess whitespace characters
6 text = re.sub(r'\s+', ' ', text).strip()
7 # Remove excess newline characters
8 text = re.sub(r'\n+', '\n', text)
9 return text
10
11def extract_main_content(html):
12 soup = BeautifulSoup(html, 'html.parser')

Callers 1

extract_main_contentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected