Table of Contents

Class TextExtractionResult

Namespace
LMKit.Extraction
Assembly
LM-Kit.NET.dll

Represents the result of a text extraction process, encapsulating the extracted elements and their JSON representation.

public sealed class TextExtractionResult
Inheritance
TextExtractionResult
Inherited Members

Examples

// Assume 'result' is an instance of TextExtractionResult
Console.WriteLine(result.Json);
var total = result.GetValue<decimal>("Invoice.Total");
foreach (var line in result.EnumerateAt("Lines"))
{
    Console.WriteLine(line.Get("Price").As<decimal>());
}

Remarks

This class holds the extracted data elements obtained from an intelligent text extraction process. It provides access to these elements both as a collection of objects and as a serialized JSON string.

Properties

Confidence

Gets the confidence level of the extraction process.

Elements

Gets a read-only list of the extracted text elements.

this[string]

Indexer access by element name or path (e.g., "Customer.Address.City", "Lines[2].Price"). Throws if not found.

Json

Gets the JSON representation of the extracted items.

JsonDocument

Lazily parsed view over Json as JsonDocument.

Methods

EnumerateAt(string)

Enumerate array items at a path like "Lines" or "Lines[*]". Returns an empty sequence if the path doesn't resolve to an array-of-object.

Get(string)

Returns the first matching element by name or exact path. Throws if not found.

GetAll(string)

Enumerate all elements that match a name anywhere, or an exact path.

GetConfidence(string)

Confidence for a field at path (0..1). Returns null if not tracked or cannot be resolved.

GetValue(string)

Gets the value by name or path as object. Returns null if the element is not found.

GetValue<T>(string, T)

Get typed value by path or name. Returns defaultValue if not found or cast fails.

TryGet(string, out TextExtractionResultElement)

Try to get an element by name or exact path (case-insensitive). Returns false if ambiguous or not found.

TryGetValue(string, out object)

Tries to get the value by name or path as object. Returns true if found; otherwise false.