Skip to content

Element

Element model.

This module defines the Element model.

Element

Bases: BaseModel

An Element model.

This class serves as the Element model for storing element text, structure, and metadata.

Attributes:

Name Type Description
text str

The element text.

structure str

The element structure.

metadata dict

The element metadata.

from_dict(element) staticmethod

Convert a dictionary to an Element object.

Parameters:

Name Type Description Default
element dict[str, Any]

The dictionary to convert.

required

Returns:

Name Type Description
Element Element

The Element object.

from_list_dict(elements) staticmethod

Convert a list of dictionaries to a list of Element objects.

Parameters:

Name Type Description Default
elements list[dict[str, Any]]

The list of dictionaries to convert.

required

Returns:

Type Description
list[Element]

list[Element]: The list of Element objects.

to_list_dict(elements) staticmethod

Convert a list of Element objects to a list of dictionaries.

Parameters:

Name Type Description Default
elements list[Element]

The list of Element objects to convert.

required

Returns:

Type Description
list[dict[str, Any]]

list[dict[str, Any]]: The list of dictionaries.