Share via


Document Class

An object describing the location and semantic content of a document.

Constructor

Document(*args: Any, **kwargs: Any)

Variables

Name Description
doc_type
str

Document type. Required.

bounding_regions

Bounding regions covering the document.

spans

Location of the document in the reading order concatenated content. Required.

fields

Dictionary of named field values.

confidence

Confidence of correctly extracting the document. Required.

Methods

as_dict

Return a dict that can be JSONify using json.dump.

clear
copy
get
items
keys
pop
popitem
setdefault
update
values

as_dict

Return a dict that can be JSONify using json.dump.

as_dict(*, exclude_readonly: bool = False) -> Dict[str, Any]

Keyword-Only Parameters

Name Description
exclude_readonly

Whether to remove the readonly properties.

Default value: False

Returns

Type Description

A dict JSON compatible object

clear

clear() -> None

copy

copy() -> Model

get

get(key: str, default: Any = None) -> Any

Parameters

Name Description
key
Required
default
Default value: None

items

items() -> ItemsView[str, Any]

keys

keys() -> KeysView[str]

pop

pop(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

popitem

popitem() -> Tuple[str, Any]

setdefault

setdefault(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

update

update(*args: Any, **kwargs: Any) -> None

values

values() -> ValuesView[Any]

Attributes

bounding_regions

Bounding regions covering the document.

bounding_regions: List[_models.BoundingRegion] | None

confidence

Confidence of correctly extracting the document. Required.

confidence: float

doc_type

Document type. Required.

doc_type: str

fields

Dictionary of named field values.

fields: Dict[str, _models.DocumentField] | None

spans

Location of the document in the reading order concatenated content. Required.

spans: List[_models.DocumentSpan]