Constructor TextExtractionElement
- Namespace
- LMKit.Extraction
- Assembly
- LM-Kit.NET.dll
TextExtractionElement(string, ElementType, string, bool)
Initializes a new instance of the TextExtractionElement class representing a simple data element.
public TextExtractionElement(string name, ElementType type, string description = "", bool isRequired = false)
Parameters
namestringThe name of the extraction element; cannot be
null, empty, or whitespace.typeElementTypeThe data type of the extraction element, specified by the ElementType enumeration.
descriptionstringAn optional description providing additional context or information about the extraction element. Defaults to an empty string if omitted.
isRequiredboolA boolean indicating whether this element is mandatory in the output.
Examples
var amount = new TextExtractionElement("Amount", ElementType.Decimal, "Grand total incl. taxes", isRequired: true);
Exceptions
- ArgumentNullException
Thrown if
nameisnull, empty, or consists only of whitespace.
TextExtractionElement(string, IEnumerable<TextExtractionElement>, bool, string, bool)
Initializes a new instance of the TextExtractionElement class representing a complex object or an array with nested elements.
public TextExtractionElement(string name, IEnumerable<TextExtractionElement> innerElements, bool isArray, string description = "", bool isRequired = false)
Parameters
namestringThe name of the extraction element; cannot be
null, empty, or whitespace.innerElementsIEnumerable<TextExtractionElement>A collection of TextExtractionElement instances representing the nested elements within this extraction element. Cannot be
nullor empty.isArrayboolA boolean value indicating whether this element represents an array of objects (
true) or a single object (false).descriptionstringAn optional description providing additional context or information about the extraction element. Defaults to an empty string if omitted.
isRequiredboolA boolean indicating whether this element is mandatory in the output.
Examples
var address = new TextExtractionElement(
"Address",
new[]
{
new TextExtractionElement("Street", ElementType.String),
new TextExtractionElement("City", ElementType.String),
new TextExtractionElement("PostalCode", ElementType.String)
},
isArray: false,
description: "Shipping address");
Exceptions
- ArgumentNullException
Thrown if
nameisnull, empty, or consists only of whitespace. Or ifinnerElementsisnullor empty.