## Document


A text with its annotations.


Usage

``` python
Document(
    *, text, entities=(), relations=(), segments=(), id=None, metadata=None
)
```


On construction, missing entity IDs become `T<n>` and missing relation IDs `R<n>` (the next free numbers), and the document is validated: every span and segment lies inside the text, IDs are unique, and every member and trigger refers to something that exists.


## Parameter Attributes


`text: str`  

`entities: Iterable[Entity] = ()`  

`relations: Iterable[Relation] = ()`  

`segments: Iterable[Segment] = ()`  

`id: str | None = None`  

`metadata: Mapping[str, Any] | None = None`  


## Methods

| Name | Description |
|----|----|
| [entity()](#entity) | Look up an entity by ID. |

------------------------------------------------------------------------


#### entity()


Look up an entity by ID.


Usage

``` python
entity(id)
```
