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
- Python
- PHP
- REST API
- Blocking Client
- Async Client
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}")
result = await 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}")
$client->checkDogwhistle($articleId, "This comment to analyze")
->then(function ($result) {
echo "Detected: " . ($result->detection->dogwhistlesDetected ? 'Yes' : 'No') . "\n";
echo "Confidence: " . number_format($result->detection->confidence, 2) . "\n";
echo "Reasoning: " . $result->detection->reasoning . "\n";
if ($result->details) {
echo "Terms: " . implode(', ', $result->details->dogwhistleTerms) . "\n";
echo "Categories: " . implode(', ', $result->details->categories) . "\n";
echo "Subtlety: " . $result->details->subtletyLevel . "\n";
echo "Harm potential: " . $result->details->harmPotential . "\n";
}
});
$client->run();
Try it out live →
curl -X POST https://app.respectify.ai/v0.2/dogwhistle \
-H "X-User-Email: your@email.com" \
-H "X-API-Key: your-api-key" \
-d "article_context_id=550e8400-e29b-41d4-a716-446655440000" \
-d "comment=This comment to analyze for coded language"
Response:
{
"detection": {
"reasoning": "No coded language or dogwhistles detected in this comment.",
"dogwhistles_detected": false,
"confidence": 0.92
}
}
With Custom Detection
Provide context for better detection:
- Python
- PHP
- REST API
- Blocking Client
- Async Client
result = client.check_dogwhistle(
"Comment text here",
article_id,
sensitive_topics=['topic-area-1', 'topic-area-2'],
dogwhistle_examples=['known-coded-phrase', 'another-term']
)
result = await client.check_dogwhistle(
"Comment text here",
article_id,
sensitive_topics=['topic-area-1', 'topic-area-2'],
dogwhistle_examples=['known-coded-phrase', 'another-term']
)
$client->checkDogwhistle(
$articleId,
"Comment text here",
['topic-area-1', 'topic-area-2'], // sensitive topics
['known-coded-phrase', 'another-term'] // known examples
);
Try it out live →
curl -X POST https://app.respectify.ai/v0.2/dogwhistle \
-H "X-User-Email: your@email.com" \
-H "X-API-Key: your-api-key" \
-d "article_context_id=550e8400-e29b-41d4-a716-446655440000" \
-d "comment=Comment text here" \
-d "sensitive_topics[]=topic-area-1" \
-d "sensitive_topics[]=topic-area-2" \
-d "dogwhistle_examples[]=known-coded-phrase" \
-d "dogwhistle_examples[]=another-term"