Table of Contents

Constructor DocumentParser

Namespace
LMKit.Document.Parsing
Assembly
LM-Kit.NET.dll

DocumentParser()

Creates a parser at the Medium effort level, on the model it loads from the model catalog.

public DocumentParser()

Remarks

The model is downloaded on first use into ModelStorageDirectory, loaded when the parser is created and released when it is disposed.

DocumentParser(ParsingEffort)

Creates a parser at the given effort level, on the model it loads from the model catalog.

public DocumentParser(ParsingEffort effort)

Parameters

effort ParsingEffort

The trade-off between the time a document takes and the fidelity of the result.

Remarks

The model (GetModelCards(ParsingEffort)) is downloaded on first use into ModelStorageDirectory, loaded when the parser is created and released when it is disposed.

Exceptions

ArgumentOutOfRangeException

effort is not a defined level.

DocumentParser(ParsingEffort, string)

Creates a parser at the given effort level on the model file the caller provides, for a deployment that ships the model itself instead of downloading it.

public DocumentParser(ParsingEffort effort, string modelPath)

Parameters

effort ParsingEffort

The trade-off between the time a document takes and the fidelity of the result.

modelPath string

The path of the model file GetModelCards(ParsingEffort) lists. The parser loads it and releases it when it is disposed.

Exceptions

ArgumentException

modelPath is null or empty, or effort is Minimal, which reads with no model.

ArgumentOutOfRangeException

effort is not a defined level.

FileNotFoundException

No file exists at modelPath.

InvalidModelException

The file is not the model the parser supports: the parser runs only on the model it is tested with, recognized by the catalog entry it was downloaded from or by its checksum.

DocumentParser(ParsingEffort, LM)

Creates a parser at the given effort level on the model the caller has already loaded, for instance to share it with other components.

public DocumentParser(ParsingEffort effort, LM model)

Parameters

effort ParsingEffort

The trade-off between the time a document takes and the fidelity of the result.

model LM

The model GetModelCards(ParsingEffort) lists, loaded from its file or from the model catalog. It stays with the caller, who disposes it after the parser. The parser loads the other readers of the bundle from the same file and releases them when it is disposed.

Exceptions

ArgumentNullException

model is null.

ArgumentException

effort is Minimal, which reads with no model.

ArgumentOutOfRangeException

effort is not a defined level.

InvalidModelException

The model is not the one the parser supports: the parser runs only on the model it is tested with, recognized by the catalog entry it was loaded from or by the checksum of its file, and it must have been loaded from that file.

Share