API reference · Kjarni 0.2.7
Class Summarizer
Namespace: Kjarni
Assembly: Kjarni.dll
Summarizes article-length text.
public class Summarizer : IDisposable
Inheritance
Implements
Examples
using var summarizer = new Summarizer();
Console.WriteLine(summarizer.Summarize(article));
Constructors
Summarizer(string?, int, int, string, string?, bool)
Load a summarization model, downloading it on first use.
public Summarizer(string? model = null, int minLength = 0, int maxLength = 0, string device = "cpu", string? cacheDir = null, bool quiet = false)
Parameters
model string?
Model name, e.g. "distilbart-cnn" (the default) or "bart-large-cnn".
minLength int
Minimum summary length in tokens; 0 uses the model's default.
maxLength int
Maximum summary length in tokens; 0 uses the model's default.
device string
Compute device - "cpu" or "gpu".
cacheDir string?
Directory to cache downloaded models.
quiet bool
Suppress progress output.
Methods
Dispose()
Releases the native model. The object cannot be used afterwards.
public void Dispose()
~Summarizer()
Releases the native model if
protected ~Summarizer()
Summarize(string)
Summarize text.
public string Summarize(string text)
Parameters
text string
Returns
Kjarni runs the same engine on every platform: