Class TextMatch
Represents a matched text span with layout information.
public sealed class TextMatch : TextRegion
- Inheritance
-
TextMatch
- Inherited Members
Examples
Example: Iterate search matches and access text, snippet, score, and bounding box.
using LMKit.Document.Search;
var options = new SearchHighlightOptions
{
SearchMode = SearchMode.Fuzzy,
MaxEditDistance = 2,
ContextChars = 80
};
SearchHighlightResult result = await SearchHighlightEngine.HighlightAsync(
"report.pdf", "accomodation", options);
foreach (TextMatch match in result.Matches)
{
Console.WriteLine($"Page : {match.PageIndex + 1}");
Console.WriteLine($"Matched : "{match.Text}"");
Console.WriteLine($"Snippet : ...{match.Snippet}...");
Console.WriteLine($"Score : {match.Score:F2}");
Console.WriteLine($"Bounds : {match.BoundingBox}");
Console.WriteLine();
}
Properties
- Score
A relevance score in the range [0..1]; 1.0 for exact matches.
- Snippet
A snippet of surrounding text to give the match context.
- Text
The exact matched text (from the page text).