Skip to main content

Dogwhistle Detection

Identify coded language that appears innocuous but carries hidden harmful meanings.

What it detects:

  • Coded language: Terms with hidden meanings to specific groups
  • Subtlety level: How hidden the messaging is
  • Harm potential: Risk level of the detected content
  • Categories: Types of dogwhistles detected

Reference

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

Response: DogwhistleResult

By Example

Basic Usage

result = client.check_dogwhistle(
"This comment to analyze for coded language",
article_id
)

print(f"Detected: {result.detection.dogwhistles_detected}")
print(f"Confidence: {result.detection.confidence:.2f}")
print(f"Reasoning: {result.detection.reasoning}")

if result.details:
print(f"Terms: {result.details.dogwhistle_terms}")
print(f"Categories: {result.details.categories}")
print(f"Subtlety: {result.details.subtlety_level:.2f}")
print(f"Harm potential: {result.details.harm_potential:.2f}")

With Custom Detection

Provide context for better detection:

result = client.check_dogwhistle(
"Comment text here",
article_id,
sensitive_topics=['topic-area-1', 'topic-area-2'],
dogwhistle_examples=['known-coded-phrase', 'another-term']
)