from typing import Any, List, Literal, TypedDict, Union AnnotationType = Literal["lemma", "pos", "morph", "concept", "chunk", "turn"] ReferenceType = Literal["Token", "Word", "Document", "SpanAnnotation"] UUIDableType = Union[AnnotationType, ReferenceType] class UUIDable(TypedDict): id: str type: UUIDableType class Token(UUIDable): text: str class Word(UUIDable): text: str class Document(UUIDable): word_ids: List[str] class Annotation(UUIDable): value: Any class SingleAnnotation(Annotation): reference_id: str class SpanAnnotation(UUIDable): name: str elements: List[str] class RelationAnnotation(UUIDable): parent: UUIDable child: UUIDable