Skip to main content

Spam Detection

Detect spam comments in your discussions.

What it detects:

  • Promotional/advertising content
  • Bot-generated text patterns
  • Link spam and SEO manipulation
  • Repeated/duplicate comments
  • Off-topic noise

Reference

See the Spam Detection API Reference for method signatures and parameters.

Response: SpamDetectionResult

By Example

Basic Usage

# With article context (more accurate)
result = client.check_spam(
"Buy cheap watches at example.com!",
article_id
)

# Without context (standalone check)
result = client.check_spam("Buy cheap watches at example.com!")

print(f"Is spam: {result.is_spam}")
print(f"Confidence: {result.confidence:.2f}")
print(f"Reasoning: {result.reasoning}")

Best Practices

  • Use article context when available for better accuracy.
  • Set confidence thresholds based on your needs:
    • High confidence (above 0.9): Consider auto-rejection or flag for review
    • Medium (0.7 to 0.9): Flag for human review
    • Low (below 0.7): Allow through
  • Log false positives to understand patterns.
  • Consider showing feedback even for spam, to help users understand why their comment was flagged.