MCPcopy Create free account
hub / github.com/GCWing/BitFun / normalize_html_text

Function normalize_html_text

src/apps/desktop/src/api/skill_api.rs:1339–1357  ·  view source on GitHub ↗
(raw: &str)

Source from the content-addressed store, hash-verified

1337}
1338
1339fn normalize_html_text(raw: &str) -> String {
1340 let without_tags = if let Ok(re) = Regex::new(r"<[^>]+>") {
1341 re.replace_all(raw, " ").into_owned()
1342 } else {
1343 raw.to_string()
1344 };
1345
1346 without_tags
1347 .replace("&quot;", "\"")
1348 .replace("&apos;", "'")
1349 .replace("&amp;", "&")
1350 .replace("&lt;", "<")
1351 .replace("&gt;", ">")
1352 .split_whitespace()
1353 .collect::<Vec<_>>()
1354 .join(" ")
1355 .trim()
1356 .to_string()
1357}
1358
1359fn is_meaningful_meta_description(text: &str) -> bool {
1360 let lower = text.to_lowercase();

Callers 1

Calls 3

trimMethod · 0.80
replaceMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected