Spaces:
Sleeping
Sleeping
| from dataclasses import dataclass, field | |
| from typing import Any | |
| class PageMarker: | |
| page: int | |
| char_start: int | |
| char_end: int | |
| class TextSpan: | |
| text: str | |
| char_start: int | |
| char_end: int | |
| class Chunk: | |
| chunk_id: str | |
| doc_id: str | |
| source_file: str | |
| chunk_index: int | |
| content: str | |
| content_for_embedding: str | |
| metadata: dict[str, Any] = field(default_factory=dict) | |
| def to_dict(self) -> dict[str, Any]: | |
| return { | |
| "chunk_id": self.chunk_id, | |
| "doc_id": self.doc_id, | |
| "source_file": self.source_file, | |
| "chunk_index": self.chunk_index, | |
| "content": self.content, | |
| "content_for_embedding": self.content_for_embedding, | |
| "metadata": self.metadata, | |
| } | |