Extracts data from a document with the same operations, the same option names and the same output files as the hosted Nutrient data extraction service, so code and knowledge carry over between the two. Like every SDK operation, each one reads its options from the document’s settings: ParseSettings and ExtractSettings, generated from the hosted service’s parameters, and the canonical settings they alias. Options left unset keep the default the pipeline or the SDK-wide settings provide.
from nutrient_sdk import DataExtractionConstruction
DataExtraction cannot be instantiated directly. Obtain instances through static factory methods or via other SDK classes.
Class Methods
set
@classmethoddef set(cls, document: Document) -> DataExtractionCreates a DataExtraction instance for the specified document.
Parameters:
| Name | Type | Description |
|---|---|---|
document | Document | The open document to extract data from. |
Returns: DataExtraction - A DataExtraction instance bound to the document. Raises:
NullOrEmptyParameterException: Thrown when document is null.
Methods
extract
def extract(self) -> ExtractResultExtracts structured data from the document with an AI model, shaped by the JSON Schema you supply.
Returns: ExtractResult - The artifacts the run produced, under the same names the hosted service uses. Raises:
InvalidStateException: Thrown when this instance has been disposed.InvalidLicenseException: Thrown when the license does not cover a capability this call runs.InvalidArgumentException: Thrown when a setting is rejected as invalid input.VisionException: Thrown when the run fails; the message ends with the failure code.
parse
def parse(self) -> ParseResultParses the document into structured content (paragraphs, tables, figures, key-value regions and more) and exports it as JSON, Markdown or both.
Returns: ParseResult - The artifacts the run produced, under the same names the hosted service uses. Raises:
InvalidStateException: Thrown when this instance has been disposed.InvalidLicenseException: Thrown when the license does not cover a capability this call runs.InvalidArgumentException: Thrown when a setting is rejected as invalid input.VisionException: Thrown when the run fails; the message ends with the failure code.