Table of Contents

Sarcasm Detection with LLM in .NET Applications


🎯 Purpose of the Sample

The Sarcasm Detection Demo demonstrates how to utilize the LM-Kit.NET SDK for detecting sarcasm in text. This sample showcases the integration of large language models (LLMs) into a .NET application to classify text as either sarcastic or sincere, highlighting the capabilities of advanced AI models in understanding nuanced human language.


👥 Industry Target Audience

This sample is particularly beneficial for developers and organizations in the following sectors:

  • 📱 Social Media Monitoring: Identify sarcastic comments to better understand public sentiment and engagement.
  • 📞 Customer Support: Detect sarcasm in customer interactions to provide more accurate and empathetic responses.
  • ✍️ Content Creation: Ensure that the tone of the content aligns with the intended message by identifying and adjusting sarcastic remarks.
  • 📊 Market Research: Analyze consumer feedback and reviews to understand the true sentiment behind sarcastic comments.

🚀 Problem Solved

Detecting sarcasm in text can be challenging due to the subtlety and complexity of sarcastic language. The Sarcasm Detection Demo addresses this problem by leveraging LLMs to automate the detection process, providing accurate and consistent classification of text as sarcastic or sincere. This automation improves understanding of textual data and enhances the ability to respond appropriately.


💻 Sample Application Description

The Sarcasm Detection Demo is a console application that allows users to classify text as either sarcastic or sincere using an AI model.

✨ Key Features

  • 📈 Model Selection: The application uses a predefined model specifically fine-tuned for the English language.
  • 📊 Progress Tracking: The application displays download and loading progress for the selected model.
  • 🔍 Dynamic Sarcasm Detection: The application classifies user-provided text as sarcastic or sincere.
  • 📈 Performance Metrics: Displays elapsed time and confidence level for each sarcasm detection.

🧠 Supported Models

The sample uses the following state-of-the-art model:

  • LM-Kit Sarcasm Detection TinyLlama 1.1B

🛠️ Getting Started

📋 Prerequisites

  • .NET Framework 4.6.2 or .NET 6.0

📥 Download the Project

▶️ Running the Application

  1. 📂 Clone the repository:

    git clone https://github.com/LM-Kit/lm-kit-net-samples.git
    
  2. 📁 Navigate to the project directory:

    cd lm-kit-net-samples/console_framework_4.62/sarcasm_detection
    

    or

    cd lm-kit-net-samples/console_net6/sarcasm_detection
    
  3. 🔨 Build and run the application:

    dotnet build
    dotnet run
    
  4. 📝 Follow the on-screen prompts to start detecting sarcasm in text.

💡 Example Usage

  1. Enter Text for Sarcasm Detection: Provide the text you want to analyze.
  2. Receive Sarcasm Classification: The application will classify the text as sarcastic or sincere and display the result along with the confidence level and elapsed time.
  3. Continue or Exit: Enter another text for analysis or end the program by submitting an empty input.

By following these steps, developers can explore the functionalities of LM-Kit.NET and integrate advanced sarcasm detection capabilities into their applications, gaining valuable insights into textual data through automated, AI-driven sarcasm classification processes.