Socratic irony detector prompt
Sarcasm and irony are where literal sentiment analysis falls apart: the words say one thing and mean the opposite. “Best day ever” after a three-hour queue is mockery, not praise. The Socratic irony detector prompt builds a few-shot prompt that teaches a model to read the contextual cues — contradiction, exaggeration, scare quotes, emoji — that reveal non-literal intent, tuned to the domain you’re working in.
How it works
You pick a domain (social media, product reviews, or literature), which loads labeled examples matched to that style of irony along with an explanation of the cue each one relies on. You set the output format and a confidence threshold below which the model defaults to “sincere” rather than guessing. The tool assembles a prompt listing the contextual cues to weigh — literal-versus-situation contradiction, hyperbole, tonal markers, mock-praise, sentiment-fact mismatch — the few-shot examples, and your threshold and format. It runs locally with no API key; you paste in the text to classify.
Why sarcasm detection is harder than it looks
Standard sentiment classifiers score polarity — positive, negative, neutral — by weighting word frequencies. “Wonderful” scores positive. “Wonderful” written sarcastically after a product catches fire still scores positive, because the model cannot see the fire. Detection requires modeling the relationship between the text and the situation it describes, not just the surface vocabulary.
The three domain options load different cue libraries because the signals differ:
- Social media irony often relies on exaggeration and emoji — “Oh great, another delay 🙄” — where the emoji is the irony marker, not the words.
- Product reviews use mock-praise contradicted by facts — “Five stars, really loved when the handle snapped off on day two” — where the rating signal and the prose signal point in opposite directions.
- Literary and long-form irony often uses elevated register or mock-authority — writing about something trivial in the tone appropriate to an epic — which requires recognising the tonal mismatch.
Worked example
For a product-review classification, the domain examples teach the model patterns like:
“5 stars. I’m so impressed by the charger that heats up hot enough to cook an egg. Highly recommend if you enjoy fire hazards.”
The cue: star rating says positive, but the body describes a dangerous defect in mock-enthusiastic language. The generated prompt instructs the model to recognize the sentiment-fact mismatch and label it as ironic with high confidence, returning in JSON format the label, the cue it triggered on, and the confidence score.
Tips and notes
- Match the domain. Review sarcasm and literary irony look different; the wrong example set measurably hurts accuracy on the other domain.
- Raise the threshold when false positives cost you. Moderation pipelines often prefer to miss subtle sarcasm than to flag sincere praise as mockery — a high threshold means the “ironic” label only fires on clear cases.
- Use JSON output with a cue list. Reading why the model labeled something sarcastic is the fastest way to spot and fix misclassifications when you audit outputs.
- Add your own examples. The domain sets are a starting point; appending a few of your hardest real cases as extra few-shot examples before the text to classify consistently lifts accuracy further.