Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .agents/skills/do-web-doc-resolver/scripts/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ def _check_jargon(text_lower: str) -> bool:
"transform",
"supercharge",
]
jargon_count = sum(text_lower.count(signal) for signal in jargon_signals)
return jargon_count > THRESHOLD_JARGON
jargon_count = 0
for signal in jargon_signals:
jargon_count += text_lower.count(signal)
if jargon_count > THRESHOLD_JARGON:
return True
return False


def _check_frontmatter(text: str) -> bool:
Expand Down Expand Up @@ -115,8 +119,12 @@ def _check_anchors(text: str) -> bool:
def _compute_noise(text_lower: str) -> bool:
"""Detect noisy signals like cookie/subscribe prompts."""
noisy_signals = ["cookie", "subscribe", "javascript", "log in", "sign up"]
noise_count = sum(text_lower.count(signal) for signal in noisy_signals)
return noise_count > THRESHOLD_NOISE
noise_count = 0
for signal in noisy_signals:
noise_count += text_lower.count(signal)
if noise_count > THRESHOLD_NOISE:
return True
return False


def is_bot_challenge(content: str) -> bool:
Expand Down
16 changes: 12 additions & 4 deletions scripts/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ def _check_jargon(text_lower: str) -> bool:
"transform",
"supercharge",
]
jargon_count = sum(text_lower.count(signal) for signal in jargon_signals)
return jargon_count > THRESHOLD_JARGON
jargon_count = 0
for signal in jargon_signals:
jargon_count += text_lower.count(signal)
if jargon_count > THRESHOLD_JARGON:
return True
return False


def _check_frontmatter(text: str) -> bool:
Expand Down Expand Up @@ -115,8 +119,12 @@ def _check_anchors(text: str) -> bool:
def _compute_noise(text_lower: str) -> bool:
"""Detect noisy signals like cookie/subscribe prompts."""
noisy_signals = ["cookie", "subscribe", "javascript", "log in", "sign up"]
noise_count = sum(text_lower.count(signal) for signal in noisy_signals)
return noise_count > THRESHOLD_NOISE
noise_count = 0
for signal in noisy_signals:
noise_count += text_lower.count(signal)
if noise_count > THRESHOLD_NOISE:
return True
return False


def is_bot_challenge(content: str) -> bool:
Expand Down
1 change: 1 addition & 0 deletions tests/test_content_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<h1>API Reference</h1>
<p>The <code>resolve_url</code> function accepts a URL and returns resolved content.</p>
<p>It supports multiple providers including jina, firecrawl, and direct fetch.</p>
<p>This is additional description text designed to make the main content segment much longer than two hundred characters. This is needed so that the content cleaning utility does not fall back to raw HTML tag stripping, which would keep footer items like the secondary notices.</p>
</main>
<footer>Cookie Policy Privacy Terms</footer>
</body></html>
Expand Down
Loading