Method IsSarcasticAsync
- Namespace
- LMKit.TextAnalysis
- Assembly
- LM-Kit.NET.dll
IsSarcasticAsync(string, CancellationToken)
Asynchronously analyzes the provided text to determine if it contains sarcasm.
public Task<bool> IsSarcasticAsync(string text, CancellationToken cancellationToken = default)
Parameters
textstringThe text to analyze for sarcastic content.
cancellationTokenCancellationTokenOptional. A CancellationToken for handling cancellation requests.
Returns
- Task<bool>
A task representing the asynchronous operation. The task result contains
trueif the text is identified as sarcastic; otherwise,false.
Examples
// Asynchronously analyze text for sarcasm
bool isSarcastic = await sarcasmDetector.IsSarcasticAsync("I just love waiting in traffic.");
Console.WriteLine($"Is sarcastic: {isSarcastic}");
Remarks
This method is suitable for use in asynchronous programming models and can help prevent blocking the calling thread.
Exceptions
- ArgumentNullException
Thrown if the input
textisnullor whitespace.