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
text
stringThe text to analyze for sarcastic content.
cancellationToken
CancellationTokenOptional. A CancellationToken for handling cancellation requests.
Returns
- Task<bool>
A task representing the asynchronous operation. The task result contains
true
if 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
text
isnull
or whitespace.