Method ExtractKeywordsAsync
- Namespace
- LMKit.TextAnalysis
- Assembly
- LM-Kit.NET.dll
ExtractKeywordsAsync(string, CancellationToken)
Extracts a set of keywords asynchronously from the given content. If unsuccessful, throws an exception indicating the cause of the failure.
public Task<List<KeywordExtraction.KeywordItem>> ExtractKeywordsAsync(string content, CancellationToken cancellationToken = default)
Parameters
content
stringThe text content from which to extract keywords.
cancellationToken
CancellationTokenA token to cancel the operation if needed.
Returns
- Task<List<KeywordExtraction.KeywordItem>>
A task representing the asynchronous extraction operation, returning a list of extracted KeywordExtraction.KeywordItem instances upon completion.
Examples
var task = extractor.ExtractKeywordsAsync("Async example content about finance and banking.");
var keywords = await task;
Console.WriteLine("Async Extraction Complete:");
foreach (var keyword in keywords)
{
Console.WriteLine(keyword.Value);
}
Exceptions
- ArgumentNullException
Thrown when the content is null or empty.