π Try the demo: https://github.com/LM-Kit/lm-kit-net-samples/tree/main/console_net/text-analysis/sentiment-analysis/sarcasm_detection
Social-Media Sarcasm Triage for C# .NET Applications
π― Purpose of the Demo
An interactive console application that flags suspected sarcasm in incoming messages using LM-Kit.NET's fine-tuned lmkit-sarcasm-detection classifier. The app is built for community-management and CX teams who need a triage pass before sentiment dashboards or auto-replies: a sarcastic complaint and a sincere one demand opposite responses, and naΓ―ve sentiment models flip-flop on tone.
The demo runs entirely on-device. No cloud round-trip, no per-token billing, no data leaving the host.
π₯ Industry Target Audience
- Social-media operations: triage daily comment streams.
- Customer experience: route sarcastic feedback away from auto-reply.
- Content moderation: pre-filter for human review.
- Market research: ensure tone doesn't pollute aggregate sentiment.
π Problem Solved
A keyword classifier reads "Wow, I love how the app crashes every time I open it" as positive. The LM-Kit fine-tuned classifier returns IsSarcastic = true with a calibrated confidence. The demo turns that single call into a triage workflow: live testing while you type, batch processing of a file, plus a built-in sample dataset, with optional CSV export of the results.
π» Application Overview
The application launches an interactive menu β no command-line arguments β and lets the user pick how to feed messages in:
| Mode | What it does |
|---|---|
| Live | Prompts for one message at a time; classifies immediately; ideal for trying tricky cases. |
| Sample | Runs a built-in 12-message mixed dataset (clearly sarcastic, clearly sincere, ambiguous) to demo the full workflow. |
| File | Prompts for a UTF-8 text file path (1 message per line) and classifies every non-empty line. |
| Quit | Exits cleanly. |
After every batch (sample or file), the demo prints a summary (total / sarcastic / sincere / median latency, plus the top suspected sarcasm items for human review) and optionally writes a triage CSV: id, classified_at, is_sarcastic, confidence, latency_ms, text.
β¨ Key Features
SarcasmDetection.IsSarcastic+.Confidence: the entire detection is one API call per message.- Interactive, no flags: every input is a console prompt.
- Three input modes (live, sample, file) selectable from the same menu loop without restarting the model.
- CSV audit trail for batch mode, suitable for handing to a CX dashboard or reviewer queue.
- Calibrated confidence: enables a threshold-based routing policy in your downstream code.
π§ Model
lmkit-sarcasm-detectionβ fine-tuned for English. Loaded once at startup; reused for every classification in the session.
π οΈ Getting Started
π Prerequisites
- .NET 8.0 or later
- ~1 GB free disk space for the model download on first run
βΆοΈ Running the Application
git clone https://github.com/LM-Kit/lm-kit-net-samples
cd lm-kit-net-samples/console_net/text-analysis/sentiment-analysis/sarcasm_detection
dotnet run
The app prompts for everything; no arguments are required.
π‘ Example Session
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Social-Media Sarcasm Triage β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
1 / live Classify one message at a time
2 / sample Run the built-in 12-message sample dataset
3 / file Classify every line of a UTF-8 text file
q / quit Exit
> 2
--- Built-in sample (12 messages) ---
[ 1] SARCASM (96%, 142 ms) Oh great, another two-hour wait for support. ...
[ 2] sincere (91%, 138 ms) Thank you so much, the new dashboard saved my ...
...
Summary
Total : 12
Sarcastic : 6 (50.0%)
Sincere : 6
Median latency : 140 ms