Constructor DocumentParser
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
effortParsingEffortThe 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
effortis 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
effortParsingEffortThe trade-off between the time a document takes and the fidelity of the result.
modelPathstringThe path of the model file GetModelCards(ParsingEffort) lists. The parser loads it and releases it when it is disposed.
Exceptions
- ArgumentException
modelPathis null or empty, oreffortis Minimal, which reads with no model.- ArgumentOutOfRangeException
effortis 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
effortParsingEffortThe trade-off between the time a document takes and the fidelity of the result.
modelLMThe 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
modelis null.- ArgumentException
effortis Minimal, which reads with no model.- ArgumentOutOfRangeException
effortis 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.