Highlighter.Net 2.0.0

Highlighter.GetBestFragments Method (TokenStream, String, Int32)

Highlights chosen terms in a text, extracting the most relevant sections. The document text is analysed in chunks to record hit statistics across the document. After accumulating stats, the fragments with the highest scores are returned as an array of strings in order of score (contiguous fragments are merged into one in their original order to improve readability)

public string[] GetBestFragments(
   TokenStream tokenStream,
   string text,
   int maxNumFragments
);

Parameters

tokenStream
text
text to highlight terms in
maxNumFragments
the maximum number of fragments.

Return Value

highlighted text fragments (between 0 and maxNumFragments number of fragments)

See Also

Highlighter Class | Lucene.Net.Highlight Namespace | Highlighter.GetBestFragments Overload List