diff --git a/docling_core/types/doc/document.py b/docling_core/types/doc/document.py index 6e06d256..bbcfe27f 100644 --- a/docling_core/types/doc/document.py +++ b/docling_core/types/doc/document.py @@ -383,6 +383,145 @@ class TableData(BaseModel): # TBD return table_data + def remove_rows(self, indices: List[int]) -> List[List[TableCell]]: + """Remove rows from the table by their indices. + + :param indices: List[int]: A list of indices of the rows to remove. (Starting from 0) + + :return: List[List[TableCell]]: A list representation of the removed rows as lists of TableCell objects. + """ + if not indices: + return [] + + indices = sorted(indices, reverse=True) + + all_removed_cells = [] + for row_index in indices: + if row_index < 0 or row_index >= self.num_rows: + raise IndexError( + f"Row index {row_index} is out of bounds for the current number of rows {self.num_rows}." + ) + + start_idx = row_index * self.num_cols + end_idx = start_idx + self.num_cols + removed_cells = self.table_cells[start_idx:end_idx] + + # Remove the cells from the table + self.table_cells = self.table_cells[:start_idx] + self.table_cells[end_idx:] + + # Update the number of rows + self.num_rows -= 1 + + # Reassign row offset indices for existing cells + for index, cell in enumerate(self.table_cells): + new_index = index // self.num_cols + cell.start_row_offset_idx = new_index + cell.end_row_offset_idx = new_index + 1 + + all_removed_cells.append(removed_cells) + + return all_removed_cells + + def pop_row(self) -> List[TableCell]: + """Remove and return the last row from the table. + + :returns: List[TableCell]: A list of TableCell objects representing the popped row. + """ + if self.num_rows == 0: + raise IndexError("Cannot pop from an empty table.") + + return self.remove_row(self.num_rows - 1) + + def remove_row(self, row_index: int) -> List[TableCell]: + """Remove a row from the table by its index. + + :param row_index: int: The index of the row to remove. (Starting from 0) + + :returns: List[TableCell]: A list of TableCell objects representing the removed row. + """ + return self.remove_rows([row_index])[0] + + def insert_rows( + self, row_index: int, rows: List[List[str]], after: bool = False + ) -> None: + """Insert multiple new rows from a list of lists of strings before/after a specific index in the table. + + :param row_index: int: The index at which to insert the new rows. (Starting from 0) + :param rows: List[List[str]]: A list of lists, where each inner list represents the content of a new row. + :param after: bool: If True, insert the rows after the specified index, otherwise before it. (Default is False) + + :returns: None + """ + effective_rows = rows[::-1] + + for row in effective_rows: + self.insert_row(row_index, row, after) + + def insert_row(self, row_index: int, row: List[str], after: bool = False) -> None: + """Insert a new row from a list of strings before/after a specific index in the table. + + :param row_index: int: The index at which to insert the new row. (Starting from 0) + :param row: List[str]: A list of strings representing the content of the new row. + :param after: bool: If True, insert the row after the specified index, otherwise before it. (Default is False) + + :returns: None + """ + if len(row) != self.num_cols: + raise ValueError( + f"Row length {len(row)} does not match the number of columns {self.num_cols}." + ) + + effective_index = row_index + (1 if after else 0) + + if effective_index < 0 or effective_index > self.num_rows: + raise IndexError( + f"Row index {row_index} is out of bounds for the current number of rows {self.num_rows}." + ) + + new_row_cells = [ + TableCell( + text=text, + start_row_offset_idx=effective_index, + end_row_offset_idx=effective_index + 1, + start_col_offset_idx=j, + end_col_offset_idx=j + 1, + ) + for j, text in enumerate(row) + ] + + self.table_cells = ( + self.table_cells[: effective_index * self.num_cols] + + new_row_cells + + self.table_cells[effective_index * self.num_cols :] + ) + + # Reassign row offset indices for existing cells + for index, cell in enumerate(self.table_cells): + new_index = index // self.num_cols + cell.start_row_offset_idx = new_index + cell.end_row_offset_idx = new_index + 1 + + self.num_rows += 1 + + def add_rows(self, rows: List[List[str]]) -> None: + """Add multiple new rows to the table from a list of lists of strings. + + :param rows: List[List[str]]: A list of lists, where each inner list represents the content of a new row. + + :returns: None + """ + for row in rows: + self.add_row(row) + + def add_row(self, row: List[str]) -> None: + """Add a new row to the table from a list of strings. + + :param row: List[str]: A list of strings representing the content of the new row. + + :returns: None + """ + self.insert_row(row_index=self.num_rows - 1, row=row, after=True) + def get_row_bounding_boxes(self) -> dict[int, BoundingBox]: """Get the minimal bounding box for each row in the table. @@ -839,7 +978,7 @@ class NodeItem(BaseModel): after: bool = True, ) -> bool: """Add sibling node in tree.""" - if len(stack) == 1 and stack[0] < len(self.children) and (not after): + if len(stack) == 1 and stack[0] <= len(self.children) and (not after): # ensure the parent is correct new_item = new_ref.resolve(doc=doc) new_item.parent = self.get_ref() @@ -1975,6 +2114,16 @@ class DoclingDocument(BaseModel): item.self_ref = cref item.parent = parent_ref + self.groups.append(item) + elif isinstance(item, GroupItem): + item_label = "groups" + item_index = len(self.groups) + + cref = f"#/{item_label}/{item_index}" + + item.self_ref = cref + item.parent = parent_ref + self.groups.append(item) else: @@ -1993,7 +2142,7 @@ class DoclingDocument(BaseModel): item_index = int(path[2]) if ( - len(self.__getattribute__(item_label)) + 1 == item_index + len(self.__getattribute__(item_label)) == item_index + 1 ): # we can only pop the last item del self.__getattribute__(item_label)[item_index] else: @@ -2018,6 +2167,10 @@ class DoclingDocument(BaseModel): if not success: self._pop_item(item=item) + raise ValueError( + f"Could not insert item: {item} under parent: {parent_ref.resolve(doc=self)}" + ) + return item.get_ref() def _delete_items(self, refs: list[RefItem]): @@ -2397,17 +2550,6 @@ class DoclingDocument(BaseModel): hyperlink=hyperlink, ) - elif label in [DocItemLabel.TITLE]: - return self.add_title( - text=text, - orig=orig, - prov=prov, - parent=parent, - content_layer=content_layer, - formatting=formatting, - hyperlink=hyperlink, - ) - elif label in [DocItemLabel.SECTION_HEADER]: return self.add_heading( text=text, @@ -2807,6 +2949,1000 @@ class DoclingDocument(BaseModel): return form_item + # --------------------------- + # Node Item Insertion Methods + # --------------------------- + + def _get_insertion_stack_and_parent( + self, sibling: NodeItem + ) -> tuple[list[int], RefItem]: + """Get the stack and parent reference for inserting a new item at a sibling.""" + # Get the stack of the sibling + sibling_ref = sibling.get_ref() + + success, stack = self._get_stack_of_refitem(ref=sibling_ref) + + if not success: + raise ValueError( + f"Could not insert at {sibling_ref.cref}: could not find the stack" + ) + + # Get the parent RefItem + parent_ref = self.body._get_parent_ref(doc=self, stack=stack) + + if parent_ref is None: + raise ValueError(f"Could not find a parent at stack: {stack}") + + return stack, parent_ref + + def _insert_in_structure( + self, + item: NodeItem, + stack: list[int], + after: bool, + created_parent: Optional[bool] = False, + ) -> None: + """Insert item into the document structure at the specified stack and handle errors.""" + # Ensure the item has a parent reference + if item.parent is None: + item.parent = self.body.get_ref() + + self._append_item(item=item, parent_ref=item.parent) + + new_ref = item.get_ref() + + success = self.body._add_sibling( + doc=self, stack=stack, new_ref=new_ref, after=after + ) + + # Error handling can be determined here + if not success: + self._pop_item(item=item) + + if created_parent: + self.delete_items(node_items=[item.parent.resolve(self)]) + + raise ValueError( + f"Could not insert item: {item} under parent: {item.parent.resolve(doc=self)}" + ) + + def insert_list_group( + self, + sibling: NodeItem, + name: Optional[str] = None, + content_layer: Optional[ContentLayer] = None, + after: bool = True, + ) -> ListGroup: + """Creates a new ListGroup item and inserts it into the document. + + :param sibling: NodeItem: + :param name: Optional[str]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: ListGroup: The newly created ListGroup item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + group = ListGroup(self_ref="#", parent=parent_ref) + + if name is not None: + group.name = name + if content_layer: + group.content_layer = content_layer + + self._insert_in_structure(item=group, stack=stack, after=after) + + return group + + def insert_inline_group( + self, + sibling: NodeItem, + name: Optional[str] = None, + content_layer: Optional[ContentLayer] = None, + after: bool = True, + ) -> InlineGroup: + """Creates a new InlineGroup item and inserts it into the document. + + :param sibling: NodeItem: + :param name: Optional[str]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: InlineGroup: The newly created InlineGroup item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new InlineGroup NodeItem + group = InlineGroup(self_ref="#", parent=parent_ref) + + if name is not None: + group.name = name + if content_layer: + group.content_layer = content_layer + + self._insert_in_structure(item=group, stack=stack, after=after) + + return group + + def insert_group( + self, + sibling: NodeItem, + label: Optional[GroupLabel] = None, + name: Optional[str] = None, + content_layer: Optional[ContentLayer] = None, + after: bool = True, + ) -> GroupItem: + """Creates a new GroupItem item and inserts it into the document. + + :param sibling: NodeItem: + :param label: Optional[GroupLabel]: (Default value = None) + :param name: Optional[str]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: GroupItem: The newly created GroupItem. + """ + if label in [GroupLabel.LIST, GroupLabel.ORDERED_LIST]: + return self.insert_list_group( + sibling=sibling, + name=name, + content_layer=content_layer, + after=after, + ) + elif label == GroupLabel.INLINE: + return self.insert_inline_group( + sibling=sibling, + name=name, + content_layer=content_layer, + after=after, + ) + + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new GroupItem NodeItem + group = GroupItem(self_ref="#", parent=parent_ref) + + if name is not None: + group.name = name + if label is not None: + group.label = label + if content_layer: + group.content_layer = content_layer + + self._insert_in_structure(item=group, stack=stack, after=after) + + return group + + def insert_list_item( + self, + sibling: NodeItem, + text: str, + enumerated: bool = False, + marker: Optional[str] = None, + orig: Optional[str] = None, + prov: Optional[ProvenanceItem] = None, + content_layer: Optional[ContentLayer] = None, + formatting: Optional[Formatting] = None, + hyperlink: Optional[Union[AnyUrl, Path]] = None, + after: bool = True, + ) -> ListItem: + """Creates a new ListItem item and inserts it into the document. + + :param sibling: NodeItem: + :param text: str: + :param enumerated: bool: (Default value = False) + :param marker: Optional[str]: (Default value = None) + :param orig: Optional[str]: (Default value = None) + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param formatting: Optional[Formatting]: (Default value = None) + :param hyperlink: Optional[Union[AnyUrl, Path]]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: ListItem: The newly created ListItem item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Ensure the parent is a ListGroup + + parent = parent_ref.resolve(self) + set_parent = False + + if not isinstance(parent, ListGroup): + warnings.warn( + "ListItem parent must be a ListGroup, creating one on the fly.", + DeprecationWarning, + ) + parent = self.insert_list_group(sibling=sibling, after=after) + parent_ref = parent.get_ref() + if after: + stack[-1] += 1 + stack.append(0) + after = False + set_parent = True + + # Create a new ListItem NodeItem + if not orig: + orig = text + + list_item = ListItem( + text=text, + orig=orig, + self_ref="#", + parent=parent_ref, + enumerated=enumerated, + marker=marker or "", + formatting=formatting, + hyperlink=hyperlink, + ) + + if prov: + list_item.prov.append(prov) + if content_layer: + list_item.content_layer = content_layer + + self._insert_in_structure( + item=list_item, stack=stack, after=after, created_parent=set_parent + ) + + return list_item + + def insert_text( + self, + sibling: NodeItem, + label: DocItemLabel, + text: str, + orig: Optional[str] = None, + prov: Optional[ProvenanceItem] = None, + content_layer: Optional[ContentLayer] = None, + formatting: Optional[Formatting] = None, + hyperlink: Optional[Union[AnyUrl, Path]] = None, + after: bool = True, + ) -> TextItem: + """Creates a new TextItem item and inserts it into the document. + + :param sibling: NodeItem: + :param label: DocItemLabel: + :param text: str: + :param orig: Optional[str]: (Default value = None) + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param formatting: Optional[Formatting]: (Default value = None) + :param hyperlink: Optional[Union[AnyUrl, Path]]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: TextItem: The newly created TextItem item. + """ + if label in [DocItemLabel.TITLE]: + return self.insert_title( + sibling=sibling, + text=text, + orig=orig, + prov=prov, + content_layer=content_layer, + formatting=formatting, + hyperlink=hyperlink, + after=after, + ) + + elif label in [DocItemLabel.LIST_ITEM]: + return self.insert_list_item( + sibling=sibling, + text=text, + orig=orig, + prov=prov, + content_layer=content_layer, + formatting=formatting, + hyperlink=hyperlink, + after=after, + ) + + elif label in [DocItemLabel.SECTION_HEADER]: + return self.insert_heading( + sibling=sibling, + text=text, + orig=orig, + prov=prov, + content_layer=content_layer, + formatting=formatting, + hyperlink=hyperlink, + after=after, + ) + + elif label in [DocItemLabel.CODE]: + return self.insert_code( + sibling=sibling, + text=text, + orig=orig, + prov=prov, + content_layer=content_layer, + formatting=formatting, + hyperlink=hyperlink, + after=after, + ) + + elif label in [DocItemLabel.FORMULA]: + return self.insert_formula( + sibling=sibling, + text=text, + orig=orig, + prov=prov, + content_layer=content_layer, + formatting=formatting, + hyperlink=hyperlink, + after=after, + ) + + else: + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new TextItem NodeItem + if not orig: + orig = text + + text_item = TextItem( + label=label, + text=text, + orig=orig, + self_ref="#", + parent=parent_ref, + formatting=formatting, + hyperlink=hyperlink, + ) + + if prov: + text_item.prov.append(prov) + if content_layer: + text_item.content_layer = content_layer + + self._insert_in_structure(item=text_item, stack=stack, after=after) + + return text_item + + def insert_table( + self, + sibling: NodeItem, + data: TableData, + caption: Optional[Union[TextItem, RefItem]] = None, + prov: Optional[ProvenanceItem] = None, + label: DocItemLabel = DocItemLabel.TABLE, + content_layer: Optional[ContentLayer] = None, + annotations: Optional[list[TableAnnotationType]] = None, + after: bool = True, + ) -> TableItem: + """Creates a new TableItem item and inserts it into the document. + + :param sibling: NodeItem: + :param data: TableData: + :param caption: Optional[Union[TextItem, RefItem]]: (Default value = None) + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param label: DocItemLabel: (Default value = DocItemLabel.TABLE) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param annotations: Optional[List[TableAnnotationType]]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: TableItem: The newly created TableItem item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new ListItem NodeItem + table_item = TableItem( + label=label, + data=data, + self_ref="#", + parent=parent_ref, + annotations=annotations or [], + ) + + if prov: + table_item.prov.append(prov) + if content_layer: + table_item.content_layer = content_layer + if caption: + table_item.captions.append(caption.get_ref()) + + self._insert_in_structure(item=table_item, stack=stack, after=after) + + return table_item + + def insert_picture( + self, + sibling: NodeItem, + annotations: Optional[List[PictureDataType]] = None, + image: Optional[ImageRef] = None, + caption: Optional[Union[TextItem, RefItem]] = None, + prov: Optional[ProvenanceItem] = None, + content_layer: Optional[ContentLayer] = None, + after: bool = True, + ) -> PictureItem: + """Creates a new PictureItem item and inserts it into the document. + + :param sibling: NodeItem: + :param annotations: Optional[List[PictureDataType]]: (Default value = None) + :param image: Optional[ImageRef]: (Default value = None) + :param caption: Optional[Union[TextItem, RefItem]]: (Default value = None) + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: PictureItem: The newly created PictureItem item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new PictureItem NodeItem + picture_item = PictureItem( + label=DocItemLabel.PICTURE, + annotations=annotations or [], + image=image, + self_ref="#", + parent=parent_ref, + ) + + if prov: + picture_item.prov.append(prov) + if content_layer: + picture_item.content_layer = content_layer + if caption: + picture_item.captions.append(caption.get_ref()) + + self._insert_in_structure(item=picture_item, stack=stack, after=after) + + return picture_item + + def insert_title( + self, + sibling: NodeItem, + text: str, + orig: Optional[str] = None, + prov: Optional[ProvenanceItem] = None, + content_layer: Optional[ContentLayer] = None, + formatting: Optional[Formatting] = None, + hyperlink: Optional[Union[AnyUrl, Path]] = None, + after: bool = True, + ) -> TitleItem: + """Creates a new TitleItem item and inserts it into the document. + + :param sibling: NodeItem: + :param text: str: + :param orig: Optional[str]: (Default value = None) + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param formatting: Optional[Formatting]: (Default value = None) + :param hyperlink: Optional[Union[AnyUrl, Path]]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: TitleItem: The newly created TitleItem item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new TitleItem NodeItem + if not orig: + orig = text + + title_item = TitleItem( + text=text, + orig=orig, + self_ref="#", + parent=parent_ref, + formatting=formatting, + hyperlink=hyperlink, + ) + + if prov: + title_item.prov.append(prov) + if content_layer: + title_item.content_layer = content_layer + + self._insert_in_structure(item=title_item, stack=stack, after=after) + + return title_item + + def insert_code( + self, + sibling: NodeItem, + text: str, + code_language: Optional[CodeLanguageLabel] = None, + orig: Optional[str] = None, + caption: Optional[Union[TextItem, RefItem]] = None, + prov: Optional[ProvenanceItem] = None, + content_layer: Optional[ContentLayer] = None, + formatting: Optional[Formatting] = None, + hyperlink: Optional[Union[AnyUrl, Path]] = None, + after: bool = True, + ) -> CodeItem: + """Creates a new CodeItem item and inserts it into the document. + + :param sibling: NodeItem: + :param text: str: + :param code_language: Optional[str]: (Default value = None) + :param orig: Optional[str]: (Default value = None) + :param caption: Optional[Union[TextItem, RefItem]]: (Default value = None) + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param formatting: Optional[Formatting]: (Default value = None) + :param hyperlink: Optional[Union[AnyUrl, Path]]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: CodeItem: The newly created CodeItem item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new CodeItem NodeItem + if not orig: + orig = text + + code_item = CodeItem( + text=text, + orig=orig, + self_ref="#", + parent=parent_ref, + formatting=formatting, + hyperlink=hyperlink, + ) + + if code_language: + code_item.code_language = code_language + if content_layer: + code_item.content_layer = content_layer + if prov: + code_item.prov.append(prov) + if caption: + code_item.captions.append(caption.get_ref()) + + self._insert_in_structure(item=code_item, stack=stack, after=after) + + return code_item + + def insert_formula( + self, + sibling: NodeItem, + text: str, + orig: Optional[str] = None, + prov: Optional[ProvenanceItem] = None, + content_layer: Optional[ContentLayer] = None, + formatting: Optional[Formatting] = None, + hyperlink: Optional[Union[AnyUrl, Path]] = None, + after: bool = True, + ) -> FormulaItem: + """Creates a new FormulaItem item and inserts it into the document. + + :param sibling: NodeItem: + :param text: str: + :param orig: Optional[str]: (Default value = None) + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param formatting: Optional[Formatting]: (Default value = None) + :param hyperlink: Optional[Union[AnyUrl, Path]]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: FormulaItem: The newly created FormulaItem item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new FormulaItem NodeItem + if not orig: + orig = text + + formula_item = FormulaItem( + text=text, + orig=orig, + self_ref="#", + parent=parent_ref, + formatting=formatting, + hyperlink=hyperlink, + ) + + if prov: + formula_item.prov.append(prov) + if content_layer: + formula_item.content_layer = content_layer + + self._insert_in_structure(item=formula_item, stack=stack, after=after) + + return formula_item + + def insert_heading( + self, + sibling: NodeItem, + text: str, + orig: Optional[str] = None, + level: LevelNumber = 1, + prov: Optional[ProvenanceItem] = None, + content_layer: Optional[ContentLayer] = None, + formatting: Optional[Formatting] = None, + hyperlink: Optional[Union[AnyUrl, Path]] = None, + after: bool = True, + ) -> SectionHeaderItem: + """Creates a new SectionHeaderItem item and inserts it into the document. + + :param sibling: NodeItem: + :param text: str: + :param orig: Optional[str]: (Default value = None) + :param level: LevelNumber: (Default value = 1) + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param content_layer: Optional[ContentLayer]: (Default value = None) + :param formatting: Optional[Formatting]: (Default value = None) + :param hyperlink: Optional[Union[AnyUrl, Path]]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: SectionHeaderItem: The newly created SectionHeaderItem item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new SectionHeaderItem NodeItem + if not orig: + orig = text + + section_header_item = SectionHeaderItem( + level=level, + text=text, + orig=orig, + self_ref="#", + parent=parent_ref, + formatting=formatting, + hyperlink=hyperlink, + ) + + if prov: + section_header_item.prov.append(prov) + if content_layer: + section_header_item.content_layer = content_layer + + self._insert_in_structure(item=section_header_item, stack=stack, after=after) + + return section_header_item + + def insert_key_values( + self, + sibling: NodeItem, + graph: GraphData, + prov: Optional[ProvenanceItem] = None, + after: bool = True, + ) -> KeyValueItem: + """Creates a new KeyValueItem item and inserts it into the document. + + :param sibling: NodeItem: + :param graph: GraphData: + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: KeyValueItem: The newly created KeyValueItem item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new KeyValueItem NodeItem + key_value_item = KeyValueItem(graph=graph, self_ref="#", parent=parent_ref) + + if prov: + key_value_item.prov.append(prov) + + self._insert_in_structure(item=key_value_item, stack=stack, after=after) + + return key_value_item + + def insert_form( + self, + sibling: NodeItem, + graph: GraphData, + prov: Optional[ProvenanceItem] = None, + after: bool = True, + ) -> FormItem: + """Creates a new FormItem item and inserts it into the document. + + :param sibling: NodeItem: + :param graph: GraphData: + :param prov: Optional[ProvenanceItem]: (Default value = None) + :param after: bool: (Default value = True) + + :returns: FormItem: The newly created FormItem item. + """ + # Get stack and parent reference of the sibling + stack, parent_ref = self._get_insertion_stack_and_parent(sibling=sibling) + + # Create a new FormItem NodeItem + form_item = FormItem(graph=graph, self_ref="#", parent=parent_ref) + + if prov: + form_item.prov.append(prov) + + self._insert_in_structure(item=form_item, stack=stack, after=after) + + return form_item + + # --------------------------- + # Range Manipulation Methods + # --------------------------- + + def delete_items_range( + self, + *, + start: NodeItem, + end: NodeItem, + start_inclusive: bool = True, + end_inclusive: bool = True, + ) -> None: + """Deletes all NodeItems and their children in the range from the start NodeItem to the end NodeItem. + + :param start: NodeItem: The starting NodeItem of the range + :param end: NodeItem: The ending NodeItem of the range + :param start_inclusive: bool: (Default value = True): If True, the start NodeItem will also be deleted + :param end_inclusive: bool: (Default value = True): If True, the end NodeItem will also be deleted + + :returns: None + """ + start_parent_ref = ( + start.parent if start.parent is not None else self.body.get_ref() + ) + end_parent_ref = end.parent if end.parent is not None else self.body.get_ref() + + if start.parent != end.parent: + raise ValueError( + "Start and end NodeItems must have the same parent to delete a range." + ) + + start_ref = start.get_ref() + end_ref = end.get_ref() + + start_parent = start_parent_ref.resolve(doc=self) + end_parent = end_parent_ref.resolve(doc=self) + + start_index = start_parent.children.index(start_ref) + end_index = end_parent.children.index(end_ref) + + if start_index > end_index: + raise ValueError( + "Start NodeItem must come before or be the same as the end NodeItem in the document structure." + ) + + to_delete = start_parent.children[start_index : end_index + 1] + + if not start_inclusive: + to_delete = to_delete[1:] + if not end_inclusive: + to_delete = to_delete[:-1] + + self._delete_items(refs=to_delete) + + def extract_items_range( + self, + *, + start: NodeItem, + end: NodeItem, + start_inclusive: bool = True, + end_inclusive: bool = True, + delete: bool = False, + ) -> "DoclingDocument": + """Extracts NodeItems and children in the range from the start NodeItem to the end as a new DoclingDocument. + + :param start: NodeItem: The starting NodeItem of the range (must be a direct child of the document body) + :param end: NodeItem: The ending NodeItem of the range (must be a direct child of the document body) + :param start_inclusive: bool: (Default value = True): If True, the start NodeItem will also be extracted + :param end_inclusive: bool: (Default value = True): If True, the end NodeItem will also be extracted + :param delete: bool: (Default value = False): If True, extracted items are deleted in the original document + + :returns: DoclingDocument: A new document containing the extracted NodeItems and their children + """ + if not start.parent == end.parent: + raise ValueError( + "Start and end NodeItems must have the same parent to extract a range." + ) + + start_ref = start.get_ref() + end_ref = end.get_ref() + + start_parent_ref = ( + start.parent if start.parent is not None else self.body.get_ref() + ) + end_parent_ref = end.parent if end.parent is not None else self.body.get_ref() + + start_parent = start_parent_ref.resolve(doc=self) + end_parent = end_parent_ref.resolve(doc=self) + + start_index = start_parent.children.index(start_ref) + ( + 0 if start_inclusive else 1 + ) + end_index = end_parent.children.index(end_ref) + (1 if end_inclusive else 0) + + if start_index > end_index: + raise ValueError( + "Start NodeItem must come before or be the same as the end NodeItem in the document structure." + ) + + new_doc = DoclingDocument(name=f"{self.name}- Extracted Range") + + ref_items = start_parent.children[start_index:end_index] + node_items = [ref.resolve(self) for ref in ref_items] + + new_doc.add_node_items(node_items=node_items, doc=self) + + if delete: + self.delete_items_range( + start=start, + end=end, + start_inclusive=start_inclusive, + end_inclusive=end_inclusive, + ) + + return new_doc + + def insert_document( + self, + doc: "DoclingDocument", + sibling: NodeItem, + after: bool = True, + ) -> None: + """Inserts the content from the body of a DoclingDocument into this document at a specific position. + + :param doc: DoclingDocument: The document whose content will be inserted + :param sibling: NodeItem: The NodeItem after/before which the new items will be inserted + :param after: bool: If True, insert after the sibling; if False, insert before (Default value = True) + + :returns: None + """ + ref_items = doc.body.children + node_items = [ref.resolve(doc) for ref in ref_items] + self.insert_node_items( + sibling=sibling, node_items=node_items, doc=doc, after=after + ) + + def add_document( + self, + doc: "DoclingDocument", + parent: Optional[NodeItem] = None, + ) -> None: + """Adds the content from the body of a DoclingDocument to this document under a specific parent. + + :param doc: DoclingDocument: The document whose content will be added + :param parent: Optional[NodeItem]: The parent NodeItem under which new items are added (Default value = None) + + :returns: None + """ + ref_items = doc.body.children + node_items = [ref.resolve(doc) for ref in ref_items] + self.add_node_items(node_items=node_items, doc=doc, parent=parent) + + def add_node_items( + self, + node_items: List[NodeItem], + doc: "DoclingDocument", + parent: Optional[NodeItem] = None, + ) -> None: + """Adds multiple NodeItems and their children under a parent in this document. + + :param node_items: list[NodeItem]: The NodeItems to be added + :param doc: DoclingDocument: The document to which the NodeItems and their children belong + :param parent: Optional[NodeItem]: The parent NodeItem under which new items are added (Default value = None) + + :returns: None + """ + parent = self.body if parent is None else parent + + # Check for ListItem parent violations + if not isinstance(parent, ListGroup): + for item in node_items: + if isinstance(item, ListItem): + raise ValueError("Cannot add ListItem into a non-ListGroup parent.") + + # Append the NodeItems to the document content + + parent_ref = parent.get_ref() + + new_refs = self._append_item_copies( + node_items=node_items, parent_ref=parent_ref, doc=doc + ) + + # Add the new item refs in the document structure + + for ref in new_refs: + parent.children.append(ref) + + def insert_node_items( + self, + sibling: NodeItem, + node_items: List[NodeItem], + doc: "DoclingDocument", + after: bool = True, + ) -> None: + """Insert multiple NodeItems and their children at a specific position in the document. + + :param sibling: NodeItem: The NodeItem after/before which the new items will be inserted + :param node_items: list[NodeItem]: The NodeItems to be inserted + :param doc: DoclingDocument: The document to which the NodeItems and their children belong + :param after: bool: If True, insert after the sibling; if False, insert before (Default value = True) + + :returns: None + """ + # Check for ListItem parent violations + parent = sibling.parent.resolve(self) if sibling.parent else self.body + + if not isinstance(parent, ListGroup): + for item in node_items: + if isinstance(item, ListItem): + raise ValueError( + "Cannot insert ListItem into a non-ListGroup parent." + ) + + # Append the NodeItems to the document content + + parent_ref = parent.get_ref() + + new_refs = self._append_item_copies( + node_items=node_items, parent_ref=parent_ref, doc=doc + ) + + # Get the stack of the sibling + + sibling_ref = sibling.get_ref() + + success, stack = self._get_stack_of_refitem(ref=sibling_ref) + + if not success: + raise ValueError( + f"Could not insert at {sibling_ref.cref}: could not find the stack" + ) + + # Insert the new item refs in the document structure + + reversed_new_refs = new_refs[::-1] + + for ref in reversed_new_refs: + success = self.body._add_sibling( + doc=self, stack=stack, new_ref=ref, after=after + ) + + if not success: + raise ValueError( + f"Could not insert item {ref.cref} at {sibling.get_ref().cref}" + ) + + def _append_item_copies( + self, + node_items: List[NodeItem], + parent_ref: RefItem, + doc: "DoclingDocument", + ) -> List[RefItem]: + """Append node item copies (with their children) from a different document to the content of this document. + + :param node_items: List[NodeItem]: The NodeItems to be appended + :param parent_ref: RefItem: The reference of the parent of the new items in this document + :param doc: DoclingDocument: The document from which the NodeItems are taken + + :returns: List[RefItem]: A list of references to the newly added items in this document + """ + new_refs: List[RefItem] = [] + + for item in node_items: + item_copy = item.model_copy(deep=True) + + self._append_item(item=item_copy, parent_ref=parent_ref) + + if item_copy.children: + children_node_items = [ref.resolve(doc) for ref in item_copy.children] + + item_copy.children = self._append_item_copies( + node_items=children_node_items, + parent_ref=item_copy.get_ref(), + doc=doc, + ) + + new_ref = item_copy.get_ref() + new_refs.append(new_ref) + + return new_refs + def num_pages(self): """num_pages.""" return len(self.pages.values()) diff --git a/test/data/doc/constructed_doc.added_extracted_doc.json.gt b/test/data/doc/constructed_doc.added_extracted_doc.json.gt new file mode 100644 index 00000000..2b26e712 --- /dev/null +++ b/test/data/doc/constructed_doc.added_extracted_doc.json.gt @@ -0,0 +1,2191 @@ +{ + "schema_name": "DoclingDocument", + "version": "1.5.0", + "name": "Untitled 1", + "furniture": { + "self_ref": "#/furniture", + "children": [], + "content_layer": "furniture", + "name": "_root_", + "label": "unspecified" + }, + "body": { + "self_ref": "#/body", + "children": [ + { + "$ref": "#/groups/0" + }, + { + "$ref": "#/texts/1" + }, + { + "$ref": "#/texts/4" + }, + { + "$ref": "#/tables/0" + }, + { + "$ref": "#/texts/5" + }, + { + "$ref": "#/pictures/0" + }, + { + "$ref": "#/texts/6" + }, + { + "$ref": "#/groups/1" + }, + { + "$ref": "#/groups/2" + }, + { + "$ref": "#/groups/3" + }, + { + "$ref": "#/groups/4" + }, + { + "$ref": "#/texts/21" + }, + { + "$ref": "#/texts/22" + }, + { + "$ref": "#/texts/23" + }, + { + "$ref": "#/texts/24" + }, + { + "$ref": "#/key_value_items/0" + }, + { + "$ref": "#/form_items/0" + }, + { + "$ref": "#/groups/8" + }, + { + "$ref": "#/groups/9" + }, + { + "$ref": "#/groups/12" + }, + { + "$ref": "#/texts/45" + }, + { + "$ref": "#/groups/16" + }, + { + "$ref": "#/form_items/1" + }, + { + "$ref": "#/texts/52" + }, + { + "$ref": "#/texts/51" + }, + { + "$ref": "#/pictures/1" + }, + { + "$ref": "#/texts/50" + }, + { + "$ref": "#/texts/49" + }, + { + "$ref": "#/texts/48" + }, + { + "$ref": "#/groups/15" + }, + { + "$ref": "#/groups/14" + }, + { + "$ref": "#/groups/13" + }, + { + "$ref": "#/texts/47" + } + ], + "content_layer": "body", + "name": "_root_", + "label": "unspecified" + }, + "groups": [ + { + "self_ref": "#/groups/0", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/0" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/7" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/3", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/8" + }, + { + "$ref": "#/texts/9" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/4", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/10" + }, + { + "$ref": "#/texts/11" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/5", + "parent": { + "$ref": "#/texts/11" + }, + "children": [ + { + "$ref": "#/texts/12" + }, + { + "$ref": "#/texts/13" + }, + { + "$ref": "#/texts/17" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/6", + "parent": { + "$ref": "#/texts/13" + }, + "children": [ + { + "$ref": "#/texts/14" + }, + { + "$ref": "#/texts/15" + }, + { + "$ref": "#/texts/16" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/7", + "parent": { + "$ref": "#/texts/17" + }, + "children": [ + { + "$ref": "#/texts/18" + }, + { + "$ref": "#/texts/19" + }, + { + "$ref": "#/texts/20" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/8", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/25" + }, + { + "$ref": "#/texts/26" + }, + { + "$ref": "#/texts/27" + }, + { + "$ref": "#/texts/28" + }, + { + "$ref": "#/texts/29" + }, + { + "$ref": "#/texts/30" + }, + { + "$ref": "#/texts/31" + }, + { + "$ref": "#/texts/32" + }, + { + "$ref": "#/texts/33" + }, + { + "$ref": "#/texts/34" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/9", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/35" + }, + { + "$ref": "#/texts/36" + }, + { + "$ref": "#/texts/37" + }, + { + "$ref": "#/texts/43" + } + ], + "content_layer": "body", + "name": "list A", + "label": "list" + }, + { + "self_ref": "#/groups/10", + "parent": { + "$ref": "#/texts/37" + }, + "children": [ + { + "$ref": "#/texts/38" + }, + { + "$ref": "#/texts/39" + }, + { + "$ref": "#/texts/42" + } + ], + "content_layer": "body", + "name": "list B", + "label": "list" + }, + { + "self_ref": "#/groups/11", + "parent": { + "$ref": "#/texts/39" + }, + "children": [ + { + "$ref": "#/texts/40" + }, + { + "$ref": "#/texts/41" + }, + { + "$ref": "#/texts/46" + } + ], + "content_layer": "body", + "name": "list C", + "label": "list" + }, + { + "self_ref": "#/groups/12", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/44" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/13", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/groups/17" + }, + { + "$ref": "#/groups/18" + }, + { + "$ref": "#/groups/19" + }, + { + "$ref": "#/texts/56" + }, + { + "$ref": "#/texts/57" + }, + { + "$ref": "#/tables/1" + }, + { + "$ref": "#/texts/58" + }, + { + "$ref": "#/texts/59" + }, + { + "$ref": "#/key_value_items/1" + }, + { + "$ref": "#/groups/20" + }, + { + "$ref": "#/texts/63" + }, + { + "$ref": "#/texts/64" + } + ], + "content_layer": "body", + "name": "Inserted List Group", + "label": "list" + }, + { + "self_ref": "#/groups/14", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/15", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ INLINE Label", + "label": "inline" + }, + { + "self_ref": "#/groups/16", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/53" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/17", + "parent": { + "$ref": "#/groups/13" + }, + "children": [ + { + "$ref": "#/texts/54" + }, + { + "$ref": "#/texts/55" + } + ], + "content_layer": "body", + "name": "Inserted Inline Group", + "label": "inline" + }, + { + "self_ref": "#/groups/18", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ ORDERED_LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/19", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ UNSPECIFIED Label", + "label": "unspecified" + }, + { + "self_ref": "#/groups/20", + "parent": { + "$ref": "#/groups/13" + }, + "children": [ + { + "$ref": "#/texts/60" + }, + { + "$ref": "#/texts/61" + }, + { + "$ref": "#/texts/62" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + } + ], + "texts": [ + { + "self_ref": "#/texts/0", + "parent": { + "$ref": "#/groups/0" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item of leading list", + "text": "item of leading list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/2" + }, + { + "$ref": "#/texts/3" + } + ], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Title of the Document", + "text": "Title of the Document" + }, + { + "self_ref": "#/texts/2", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 1\nAffiliation 1", + "text": "Author 1\nAffiliation 1" + }, + { + "self_ref": "#/texts/3", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 2\nAffiliation 2", + "text": "Author 2\nAffiliation 2" + }, + { + "self_ref": "#/texts/4", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of table 1.", + "text": "This is the caption of table 1." + }, + { + "self_ref": "#/texts/5", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 1.", + "text": "This is the caption of figure 1." + }, + { + "self_ref": "#/texts/6", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 2.", + "text": "This is the caption of figure 2." + }, + { + "self_ref": "#/texts/7", + "parent": { + "$ref": "#/groups/1" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list", + "text": "item 1 of list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/8", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list after empty list", + "text": "item 1 of list after empty list", + "enumerated": false, + "marker": "*" + }, + { + "self_ref": "#/texts/9", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of list after empty list", + "text": "item 2 of list after empty list", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/10", + "parent": { + "$ref": "#/groups/4" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of neighboring list", + "text": "item 1 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/11", + "parent": { + "$ref": "#/groups/4" + }, + "children": [ + { + "$ref": "#/groups/5" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of neighboring list", + "text": "item 2 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/12", + "parent": { + "$ref": "#/groups/5" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of sub list", + "text": "item 1 of sub list", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/13", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/6" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/14", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code snippet:", + "text": "Here a code snippet:" + }, + { + "self_ref": "#/texts/15", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/16", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/17", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/7" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/18", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula:", + "text": "Here a formula:" + }, + { + "self_ref": "#/texts/19", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/20", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/21", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code block:", + "text": "Here a code block:" + }, + { + "self_ref": "#/texts/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula block:", + "text": "Here a formula block:" + }, + { + "self_ref": "#/texts/24", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/25", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Some formatting chops:", + "text": "Some formatting chops:" + }, + { + "self_ref": "#/texts/26", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "bold", + "text": "bold", + "formatting": { + "bold": true, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/27", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "italic", + "text": "italic", + "formatting": { + "bold": false, + "italic": true, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/28", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "underline", + "text": "underline", + "formatting": { + "bold": false, + "italic": false, + "underline": true, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/29", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "strikethrough", + "text": "strikethrough", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": true, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/30", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "subscript", + "text": "subscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "sub" + } + }, + { + "self_ref": "#/texts/31", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "superscript", + "text": "superscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "super" + } + }, + { + "self_ref": "#/texts/32", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "hyperlink", + "text": "hyperlink", + "hyperlink": "." + }, + { + "self_ref": "#/texts/33", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "&", + "text": "&" + }, + { + "self_ref": "#/texts/34", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "everything at the same time.", + "text": "everything at the same time.", + "formatting": { + "bold": true, + "italic": true, + "underline": true, + "strikethrough": true, + "script": "baseline" + }, + "hyperlink": "https://github.com/DS4SD/docling" + }, + { + "self_ref": "#/texts/35", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in A", + "text": "Item 1 in A", + "enumerated": true, + "marker": "(i)" + }, + { + "self_ref": "#/texts/36", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in A", + "text": "Item 2 in A", + "enumerated": true, + "marker": "(ii)" + }, + { + "self_ref": "#/texts/37", + "parent": { + "$ref": "#/groups/9" + }, + "children": [ + { + "$ref": "#/groups/10" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in A", + "text": "Item 3 in A", + "enumerated": true, + "marker": "(iii)" + }, + { + "self_ref": "#/texts/38", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in B", + "text": "Item 1 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/39", + "parent": { + "$ref": "#/groups/10" + }, + "children": [ + { + "$ref": "#/groups/11" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in B", + "text": "Item 2 in B", + "enumerated": true, + "marker": "42." + }, + { + "self_ref": "#/texts/40", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in C", + "text": "Item 1 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/41", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in C", + "text": "Item 2 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/42", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in B", + "text": "Item 3 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/43", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 4 in A", + "text": "Item 4 in A", + "enumerated": true, + "marker": "(iv)" + }, + { + "self_ref": "#/texts/44", + "parent": { + "$ref": "#/groups/12" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "List item without parent list group", + "text": "List item without parent list group", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/45", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "The end.", + "text": "The end." + }, + { + "self_ref": "#/texts/46", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "child text appended at body", + "text": "child text appended at body", + "enumerated": false, + "marker": "-" + }, + { + "self_ref": "#/texts/47", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "new child", + "text": "new child" + }, + { + "self_ref": "#/texts/48", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Text w/ TITLE Label", + "text": "Inserted Text w/ TITLE Label" + }, + { + "self_ref": "#/texts/49", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Text w/ CODE Label", + "text": "Inserted Text w/ CODE Label", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/50", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Inserted Text w/ TEXT Label", + "text": "Inserted Text w/ TEXT Label" + }, + { + "self_ref": "#/texts/51", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Code", + "text": "Inserted Code", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/52", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Heading", + "text": "Inserted Heading", + "level": 1 + }, + { + "self_ref": "#/texts/53", + "parent": { + "$ref": "#/groups/16" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "text": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/54", + "parent": { + "$ref": "#/groups/17" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 1", + "text": "Bulk Addition 1" + }, + { + "self_ref": "#/texts/55", + "parent": { + "$ref": "#/groups/17" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 2", + "text": "Bulk Addition 2" + }, + { + "self_ref": "#/texts/56", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Text w/ SECTION_HEADER Label", + "text": "Inserted Text w/ SECTION_HEADER Label", + "level": 1 + }, + { + "self_ref": "#/texts/57", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Text w/ FORMULA Label", + "text": "Inserted Text w/ FORMULA Label" + }, + { + "self_ref": "#/texts/58", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Title", + "text": "Inserted Title" + }, + { + "self_ref": "#/texts/59", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Formula", + "text": "Inserted Formula" + }, + { + "self_ref": "#/texts/60", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Correct Parent", + "text": "Inserted Text with LIST_ITEM Label, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/61", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Incorrect Parent", + "text": "Inserted List Item, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/62", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Correct Parent", + "text": "Inserted List Item, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/63", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 1", + "text": "Bulk Insertion 1" + }, + { + "self_ref": "#/texts/64", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 2", + "text": "Bulk Insertion 2" + } + ], + "pictures": [ + { + "self_ref": "#/pictures/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [ + { + "$ref": "#/texts/5" + } + ], + "references": [], + "footnotes": [], + "annotations": [] + }, + { + "self_ref": "#/pictures/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "image": { + "mimetype": "image/png", + "dpi": 72, + "size": { + "width": 64.0, + "height": 64.0 + }, + "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAIklEQVR4nO3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAA8G4wQAABiwCo9wAAAABJRU5ErkJggg==" + }, + "annotations": [] + } + ], + "tables": [ + { + "self_ref": "#/tables/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [ + { + "$ref": "#/texts/4" + } + ], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + }, + { + "self_ref": "#/tables/1", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "a", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "b", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "c", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 4, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "a", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "b", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "c", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + } + ], + "key_value_items": [ + { + "self_ref": "#/key_value_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/key_value_items/1", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "form_items": [ + { + "self_ref": "#/form_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/form_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "pages": {} +} \ No newline at end of file diff --git a/test/data/doc/constructed_doc.bulk_item_addition.json.gt b/test/data/doc/constructed_doc.bulk_item_addition.json.gt new file mode 100644 index 00000000..c03c7ecf --- /dev/null +++ b/test/data/doc/constructed_doc.bulk_item_addition.json.gt @@ -0,0 +1,2086 @@ +{ + "schema_name": "DoclingDocument", + "version": "1.5.0", + "name": "Untitled 1", + "furniture": { + "self_ref": "#/furniture", + "children": [], + "content_layer": "furniture", + "name": "_root_", + "label": "unspecified" + }, + "body": { + "self_ref": "#/body", + "children": [ + { + "$ref": "#/groups/0" + }, + { + "$ref": "#/texts/1" + }, + { + "$ref": "#/texts/4" + }, + { + "$ref": "#/tables/0" + }, + { + "$ref": "#/texts/5" + }, + { + "$ref": "#/pictures/0" + }, + { + "$ref": "#/texts/6" + }, + { + "$ref": "#/groups/1" + }, + { + "$ref": "#/groups/2" + }, + { + "$ref": "#/groups/3" + }, + { + "$ref": "#/groups/4" + }, + { + "$ref": "#/texts/21" + }, + { + "$ref": "#/texts/22" + }, + { + "$ref": "#/texts/23" + }, + { + "$ref": "#/texts/24" + }, + { + "$ref": "#/key_value_items/0" + }, + { + "$ref": "#/form_items/0" + }, + { + "$ref": "#/groups/8" + }, + { + "$ref": "#/groups/9" + }, + { + "$ref": "#/groups/12" + }, + { + "$ref": "#/groups/14" + }, + { + "$ref": "#/groups/16" + }, + { + "$ref": "#/groups/18" + }, + { + "$ref": "#/texts/49" + }, + { + "$ref": "#/texts/51" + }, + { + "$ref": "#/tables/1" + }, + { + "$ref": "#/texts/53" + }, + { + "$ref": "#/texts/55" + }, + { + "$ref": "#/key_value_items/1" + }, + { + "$ref": "#/groups/19" + }, + { + "$ref": "#/texts/45" + }, + { + "$ref": "#/groups/20" + }, + { + "$ref": "#/form_items/1" + }, + { + "$ref": "#/texts/56" + }, + { + "$ref": "#/texts/54" + }, + { + "$ref": "#/pictures/1" + }, + { + "$ref": "#/texts/52" + }, + { + "$ref": "#/texts/50" + }, + { + "$ref": "#/texts/48" + }, + { + "$ref": "#/groups/17" + }, + { + "$ref": "#/groups/15" + }, + { + "$ref": "#/groups/13" + }, + { + "$ref": "#/texts/47" + } + ], + "content_layer": "body", + "name": "_root_", + "label": "unspecified" + }, + "groups": [ + { + "self_ref": "#/groups/0", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/0" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/7" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/3", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/8" + }, + { + "$ref": "#/texts/9" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/4", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/10" + }, + { + "$ref": "#/texts/11" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/5", + "parent": { + "$ref": "#/texts/11" + }, + "children": [ + { + "$ref": "#/texts/12" + }, + { + "$ref": "#/texts/13" + }, + { + "$ref": "#/texts/17" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/6", + "parent": { + "$ref": "#/texts/13" + }, + "children": [ + { + "$ref": "#/texts/14" + }, + { + "$ref": "#/texts/15" + }, + { + "$ref": "#/texts/16" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/7", + "parent": { + "$ref": "#/texts/17" + }, + "children": [ + { + "$ref": "#/texts/18" + }, + { + "$ref": "#/texts/19" + }, + { + "$ref": "#/texts/20" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/8", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/25" + }, + { + "$ref": "#/texts/26" + }, + { + "$ref": "#/texts/27" + }, + { + "$ref": "#/texts/28" + }, + { + "$ref": "#/texts/29" + }, + { + "$ref": "#/texts/30" + }, + { + "$ref": "#/texts/31" + }, + { + "$ref": "#/texts/32" + }, + { + "$ref": "#/texts/33" + }, + { + "$ref": "#/texts/34" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/9", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/35" + }, + { + "$ref": "#/texts/36" + }, + { + "$ref": "#/texts/37" + }, + { + "$ref": "#/texts/43" + } + ], + "content_layer": "body", + "name": "list A", + "label": "list" + }, + { + "self_ref": "#/groups/10", + "parent": { + "$ref": "#/texts/37" + }, + "children": [ + { + "$ref": "#/texts/38" + }, + { + "$ref": "#/texts/39" + }, + { + "$ref": "#/texts/42" + } + ], + "content_layer": "body", + "name": "list B", + "label": "list" + }, + { + "self_ref": "#/groups/11", + "parent": { + "$ref": "#/texts/39" + }, + "children": [ + { + "$ref": "#/texts/40" + }, + { + "$ref": "#/texts/41" + }, + { + "$ref": "#/texts/46" + } + ], + "content_layer": "body", + "name": "list C", + "label": "list" + }, + { + "self_ref": "#/groups/12", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/44" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/13", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted List Group", + "label": "list" + }, + { + "self_ref": "#/groups/14", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/61" + }, + { + "$ref": "#/texts/62" + } + ], + "content_layer": "body", + "name": "Inserted Inline Group", + "label": "inline" + }, + { + "self_ref": "#/groups/15", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/16", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ ORDERED_LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/17", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ INLINE Label", + "label": "inline" + }, + { + "self_ref": "#/groups/18", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ UNSPECIFIED Label", + "label": "unspecified" + }, + { + "self_ref": "#/groups/19", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/59" + }, + { + "$ref": "#/texts/57" + }, + { + "$ref": "#/texts/58" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/20", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/60" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + } + ], + "texts": [ + { + "self_ref": "#/texts/0", + "parent": { + "$ref": "#/groups/0" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item of leading list", + "text": "item of leading list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/2" + }, + { + "$ref": "#/texts/3" + } + ], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Title of the Document", + "text": "Title of the Document" + }, + { + "self_ref": "#/texts/2", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 1\nAffiliation 1", + "text": "Author 1\nAffiliation 1" + }, + { + "self_ref": "#/texts/3", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 2\nAffiliation 2", + "text": "Author 2\nAffiliation 2" + }, + { + "self_ref": "#/texts/4", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of table 1.", + "text": "This is the caption of table 1." + }, + { + "self_ref": "#/texts/5", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 1.", + "text": "This is the caption of figure 1." + }, + { + "self_ref": "#/texts/6", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 2.", + "text": "This is the caption of figure 2." + }, + { + "self_ref": "#/texts/7", + "parent": { + "$ref": "#/groups/1" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list", + "text": "item 1 of list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/8", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list after empty list", + "text": "item 1 of list after empty list", + "enumerated": false, + "marker": "*" + }, + { + "self_ref": "#/texts/9", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of list after empty list", + "text": "item 2 of list after empty list", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/10", + "parent": { + "$ref": "#/groups/4" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of neighboring list", + "text": "item 1 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/11", + "parent": { + "$ref": "#/groups/4" + }, + "children": [ + { + "$ref": "#/groups/5" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of neighboring list", + "text": "item 2 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/12", + "parent": { + "$ref": "#/groups/5" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of sub list", + "text": "item 1 of sub list", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/13", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/6" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/14", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code snippet:", + "text": "Here a code snippet:" + }, + { + "self_ref": "#/texts/15", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/16", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/17", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/7" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/18", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula:", + "text": "Here a formula:" + }, + { + "self_ref": "#/texts/19", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/20", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/21", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code block:", + "text": "Here a code block:" + }, + { + "self_ref": "#/texts/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula block:", + "text": "Here a formula block:" + }, + { + "self_ref": "#/texts/24", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/25", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Some formatting chops:", + "text": "Some formatting chops:" + }, + { + "self_ref": "#/texts/26", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "bold", + "text": "bold", + "formatting": { + "bold": true, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/27", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "italic", + "text": "italic", + "formatting": { + "bold": false, + "italic": true, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/28", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "underline", + "text": "underline", + "formatting": { + "bold": false, + "italic": false, + "underline": true, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/29", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "strikethrough", + "text": "strikethrough", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": true, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/30", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "subscript", + "text": "subscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "sub" + } + }, + { + "self_ref": "#/texts/31", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "superscript", + "text": "superscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "super" + } + }, + { + "self_ref": "#/texts/32", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "hyperlink", + "text": "hyperlink", + "hyperlink": "." + }, + { + "self_ref": "#/texts/33", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "&", + "text": "&" + }, + { + "self_ref": "#/texts/34", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "everything at the same time.", + "text": "everything at the same time.", + "formatting": { + "bold": true, + "italic": true, + "underline": true, + "strikethrough": true, + "script": "baseline" + }, + "hyperlink": "https://github.com/DS4SD/docling" + }, + { + "self_ref": "#/texts/35", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in A", + "text": "Item 1 in A", + "enumerated": true, + "marker": "(i)" + }, + { + "self_ref": "#/texts/36", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in A", + "text": "Item 2 in A", + "enumerated": true, + "marker": "(ii)" + }, + { + "self_ref": "#/texts/37", + "parent": { + "$ref": "#/groups/9" + }, + "children": [ + { + "$ref": "#/groups/10" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in A", + "text": "Item 3 in A", + "enumerated": true, + "marker": "(iii)" + }, + { + "self_ref": "#/texts/38", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in B", + "text": "Item 1 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/39", + "parent": { + "$ref": "#/groups/10" + }, + "children": [ + { + "$ref": "#/groups/11" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in B", + "text": "Item 2 in B", + "enumerated": true, + "marker": "42." + }, + { + "self_ref": "#/texts/40", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in C", + "text": "Item 1 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/41", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in C", + "text": "Item 2 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/42", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in B", + "text": "Item 3 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/43", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 4 in A", + "text": "Item 4 in A", + "enumerated": true, + "marker": "(iv)" + }, + { + "self_ref": "#/texts/44", + "parent": { + "$ref": "#/groups/12" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "List item without parent list group", + "text": "List item without parent list group", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/45", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "The end.", + "text": "The end." + }, + { + "self_ref": "#/texts/46", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "child text appended at body", + "text": "child text appended at body", + "enumerated": false, + "marker": "-" + }, + { + "self_ref": "#/texts/47", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "new child", + "text": "new child" + }, + { + "self_ref": "#/texts/48", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Text w/ TITLE Label", + "text": "Inserted Text w/ TITLE Label" + }, + { + "self_ref": "#/texts/49", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Text w/ SECTION_HEADER Label", + "text": "Inserted Text w/ SECTION_HEADER Label", + "level": 1 + }, + { + "self_ref": "#/texts/50", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Text w/ CODE Label", + "text": "Inserted Text w/ CODE Label", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/51", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Text w/ FORMULA Label", + "text": "Inserted Text w/ FORMULA Label" + }, + { + "self_ref": "#/texts/52", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Inserted Text w/ TEXT Label", + "text": "Inserted Text w/ TEXT Label" + }, + { + "self_ref": "#/texts/53", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Title", + "text": "Inserted Title" + }, + { + "self_ref": "#/texts/54", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Code", + "text": "Inserted Code", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/55", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Formula", + "text": "Inserted Formula" + }, + { + "self_ref": "#/texts/56", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Heading", + "text": "Inserted Heading", + "level": 1 + }, + { + "self_ref": "#/texts/57", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Incorrect Parent", + "text": "Inserted List Item, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/58", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Correct Parent", + "text": "Inserted List Item, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/59", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Correct Parent", + "text": "Inserted Text with LIST_ITEM Label, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/60", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "text": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/61", + "parent": { + "$ref": "#/groups/14" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 1", + "text": "Bulk Addition 1" + }, + { + "self_ref": "#/texts/62", + "parent": { + "$ref": "#/groups/14" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 2", + "text": "Bulk Addition 2" + } + ], + "pictures": [ + { + "self_ref": "#/pictures/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [ + { + "$ref": "#/texts/5" + } + ], + "references": [], + "footnotes": [], + "annotations": [] + }, + { + "self_ref": "#/pictures/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "image": { + "mimetype": "image/png", + "dpi": 72, + "size": { + "width": 64.0, + "height": 64.0 + }, + "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAIklEQVR4nO3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAA8G4wQAABiwCo9wAAAABJRU5ErkJggg==" + }, + "annotations": [] + } + ], + "tables": [ + { + "self_ref": "#/tables/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [ + { + "$ref": "#/texts/4" + } + ], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + }, + { + "self_ref": "#/tables/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + } + ], + "key_value_items": [ + { + "self_ref": "#/key_value_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/key_value_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "form_items": [ + { + "self_ref": "#/form_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/form_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "pages": {} +} \ No newline at end of file diff --git a/test/data/doc/constructed_doc.bulk_item_insertion.json.gt b/test/data/doc/constructed_doc.bulk_item_insertion.json.gt new file mode 100644 index 00000000..08dfbe15 --- /dev/null +++ b/test/data/doc/constructed_doc.bulk_item_insertion.json.gt @@ -0,0 +1,2116 @@ +{ + "schema_name": "DoclingDocument", + "version": "1.5.0", + "name": "Untitled 1", + "furniture": { + "self_ref": "#/furniture", + "children": [], + "content_layer": "furniture", + "name": "_root_", + "label": "unspecified" + }, + "body": { + "self_ref": "#/body", + "children": [ + { + "$ref": "#/groups/0" + }, + { + "$ref": "#/texts/1" + }, + { + "$ref": "#/texts/4" + }, + { + "$ref": "#/tables/0" + }, + { + "$ref": "#/texts/5" + }, + { + "$ref": "#/pictures/0" + }, + { + "$ref": "#/texts/6" + }, + { + "$ref": "#/groups/1" + }, + { + "$ref": "#/groups/2" + }, + { + "$ref": "#/groups/3" + }, + { + "$ref": "#/groups/4" + }, + { + "$ref": "#/texts/21" + }, + { + "$ref": "#/texts/22" + }, + { + "$ref": "#/texts/23" + }, + { + "$ref": "#/texts/24" + }, + { + "$ref": "#/key_value_items/0" + }, + { + "$ref": "#/form_items/0" + }, + { + "$ref": "#/groups/8" + }, + { + "$ref": "#/groups/9" + }, + { + "$ref": "#/groups/12" + }, + { + "$ref": "#/groups/14" + }, + { + "$ref": "#/groups/16" + }, + { + "$ref": "#/groups/18" + }, + { + "$ref": "#/texts/49" + }, + { + "$ref": "#/texts/51" + }, + { + "$ref": "#/tables/1" + }, + { + "$ref": "#/texts/53" + }, + { + "$ref": "#/texts/55" + }, + { + "$ref": "#/key_value_items/1" + }, + { + "$ref": "#/groups/19" + }, + { + "$ref": "#/texts/63" + }, + { + "$ref": "#/texts/64" + }, + { + "$ref": "#/texts/45" + }, + { + "$ref": "#/groups/20" + }, + { + "$ref": "#/form_items/1" + }, + { + "$ref": "#/texts/56" + }, + { + "$ref": "#/texts/54" + }, + { + "$ref": "#/pictures/1" + }, + { + "$ref": "#/texts/52" + }, + { + "$ref": "#/texts/50" + }, + { + "$ref": "#/texts/48" + }, + { + "$ref": "#/groups/17" + }, + { + "$ref": "#/groups/15" + }, + { + "$ref": "#/groups/13" + }, + { + "$ref": "#/texts/47" + } + ], + "content_layer": "body", + "name": "_root_", + "label": "unspecified" + }, + "groups": [ + { + "self_ref": "#/groups/0", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/0" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/7" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/3", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/8" + }, + { + "$ref": "#/texts/9" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/4", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/10" + }, + { + "$ref": "#/texts/11" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/5", + "parent": { + "$ref": "#/texts/11" + }, + "children": [ + { + "$ref": "#/texts/12" + }, + { + "$ref": "#/texts/13" + }, + { + "$ref": "#/texts/17" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/6", + "parent": { + "$ref": "#/texts/13" + }, + "children": [ + { + "$ref": "#/texts/14" + }, + { + "$ref": "#/texts/15" + }, + { + "$ref": "#/texts/16" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/7", + "parent": { + "$ref": "#/texts/17" + }, + "children": [ + { + "$ref": "#/texts/18" + }, + { + "$ref": "#/texts/19" + }, + { + "$ref": "#/texts/20" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/8", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/25" + }, + { + "$ref": "#/texts/26" + }, + { + "$ref": "#/texts/27" + }, + { + "$ref": "#/texts/28" + }, + { + "$ref": "#/texts/29" + }, + { + "$ref": "#/texts/30" + }, + { + "$ref": "#/texts/31" + }, + { + "$ref": "#/texts/32" + }, + { + "$ref": "#/texts/33" + }, + { + "$ref": "#/texts/34" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/9", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/35" + }, + { + "$ref": "#/texts/36" + }, + { + "$ref": "#/texts/37" + }, + { + "$ref": "#/texts/43" + } + ], + "content_layer": "body", + "name": "list A", + "label": "list" + }, + { + "self_ref": "#/groups/10", + "parent": { + "$ref": "#/texts/37" + }, + "children": [ + { + "$ref": "#/texts/38" + }, + { + "$ref": "#/texts/39" + }, + { + "$ref": "#/texts/42" + } + ], + "content_layer": "body", + "name": "list B", + "label": "list" + }, + { + "self_ref": "#/groups/11", + "parent": { + "$ref": "#/texts/39" + }, + "children": [ + { + "$ref": "#/texts/40" + }, + { + "$ref": "#/texts/41" + }, + { + "$ref": "#/texts/46" + } + ], + "content_layer": "body", + "name": "list C", + "label": "list" + }, + { + "self_ref": "#/groups/12", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/44" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/13", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted List Group", + "label": "list" + }, + { + "self_ref": "#/groups/14", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/61" + }, + { + "$ref": "#/texts/62" + } + ], + "content_layer": "body", + "name": "Inserted Inline Group", + "label": "inline" + }, + { + "self_ref": "#/groups/15", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/16", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ ORDERED_LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/17", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ INLINE Label", + "label": "inline" + }, + { + "self_ref": "#/groups/18", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ UNSPECIFIED Label", + "label": "unspecified" + }, + { + "self_ref": "#/groups/19", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/59" + }, + { + "$ref": "#/texts/57" + }, + { + "$ref": "#/texts/58" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/20", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/60" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + } + ], + "texts": [ + { + "self_ref": "#/texts/0", + "parent": { + "$ref": "#/groups/0" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item of leading list", + "text": "item of leading list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/2" + }, + { + "$ref": "#/texts/3" + } + ], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Title of the Document", + "text": "Title of the Document" + }, + { + "self_ref": "#/texts/2", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 1\nAffiliation 1", + "text": "Author 1\nAffiliation 1" + }, + { + "self_ref": "#/texts/3", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 2\nAffiliation 2", + "text": "Author 2\nAffiliation 2" + }, + { + "self_ref": "#/texts/4", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of table 1.", + "text": "This is the caption of table 1." + }, + { + "self_ref": "#/texts/5", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 1.", + "text": "This is the caption of figure 1." + }, + { + "self_ref": "#/texts/6", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 2.", + "text": "This is the caption of figure 2." + }, + { + "self_ref": "#/texts/7", + "parent": { + "$ref": "#/groups/1" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list", + "text": "item 1 of list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/8", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list after empty list", + "text": "item 1 of list after empty list", + "enumerated": false, + "marker": "*" + }, + { + "self_ref": "#/texts/9", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of list after empty list", + "text": "item 2 of list after empty list", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/10", + "parent": { + "$ref": "#/groups/4" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of neighboring list", + "text": "item 1 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/11", + "parent": { + "$ref": "#/groups/4" + }, + "children": [ + { + "$ref": "#/groups/5" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of neighboring list", + "text": "item 2 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/12", + "parent": { + "$ref": "#/groups/5" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of sub list", + "text": "item 1 of sub list", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/13", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/6" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/14", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code snippet:", + "text": "Here a code snippet:" + }, + { + "self_ref": "#/texts/15", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/16", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/17", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/7" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/18", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula:", + "text": "Here a formula:" + }, + { + "self_ref": "#/texts/19", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/20", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/21", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code block:", + "text": "Here a code block:" + }, + { + "self_ref": "#/texts/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula block:", + "text": "Here a formula block:" + }, + { + "self_ref": "#/texts/24", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/25", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Some formatting chops:", + "text": "Some formatting chops:" + }, + { + "self_ref": "#/texts/26", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "bold", + "text": "bold", + "formatting": { + "bold": true, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/27", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "italic", + "text": "italic", + "formatting": { + "bold": false, + "italic": true, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/28", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "underline", + "text": "underline", + "formatting": { + "bold": false, + "italic": false, + "underline": true, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/29", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "strikethrough", + "text": "strikethrough", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": true, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/30", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "subscript", + "text": "subscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "sub" + } + }, + { + "self_ref": "#/texts/31", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "superscript", + "text": "superscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "super" + } + }, + { + "self_ref": "#/texts/32", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "hyperlink", + "text": "hyperlink", + "hyperlink": "." + }, + { + "self_ref": "#/texts/33", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "&", + "text": "&" + }, + { + "self_ref": "#/texts/34", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "everything at the same time.", + "text": "everything at the same time.", + "formatting": { + "bold": true, + "italic": true, + "underline": true, + "strikethrough": true, + "script": "baseline" + }, + "hyperlink": "https://github.com/DS4SD/docling" + }, + { + "self_ref": "#/texts/35", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in A", + "text": "Item 1 in A", + "enumerated": true, + "marker": "(i)" + }, + { + "self_ref": "#/texts/36", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in A", + "text": "Item 2 in A", + "enumerated": true, + "marker": "(ii)" + }, + { + "self_ref": "#/texts/37", + "parent": { + "$ref": "#/groups/9" + }, + "children": [ + { + "$ref": "#/groups/10" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in A", + "text": "Item 3 in A", + "enumerated": true, + "marker": "(iii)" + }, + { + "self_ref": "#/texts/38", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in B", + "text": "Item 1 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/39", + "parent": { + "$ref": "#/groups/10" + }, + "children": [ + { + "$ref": "#/groups/11" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in B", + "text": "Item 2 in B", + "enumerated": true, + "marker": "42." + }, + { + "self_ref": "#/texts/40", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in C", + "text": "Item 1 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/41", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in C", + "text": "Item 2 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/42", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in B", + "text": "Item 3 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/43", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 4 in A", + "text": "Item 4 in A", + "enumerated": true, + "marker": "(iv)" + }, + { + "self_ref": "#/texts/44", + "parent": { + "$ref": "#/groups/12" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "List item without parent list group", + "text": "List item without parent list group", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/45", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "The end.", + "text": "The end." + }, + { + "self_ref": "#/texts/46", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "child text appended at body", + "text": "child text appended at body", + "enumerated": false, + "marker": "-" + }, + { + "self_ref": "#/texts/47", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "new child", + "text": "new child" + }, + { + "self_ref": "#/texts/48", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Text w/ TITLE Label", + "text": "Inserted Text w/ TITLE Label" + }, + { + "self_ref": "#/texts/49", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Text w/ SECTION_HEADER Label", + "text": "Inserted Text w/ SECTION_HEADER Label", + "level": 1 + }, + { + "self_ref": "#/texts/50", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Text w/ CODE Label", + "text": "Inserted Text w/ CODE Label", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/51", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Text w/ FORMULA Label", + "text": "Inserted Text w/ FORMULA Label" + }, + { + "self_ref": "#/texts/52", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Inserted Text w/ TEXT Label", + "text": "Inserted Text w/ TEXT Label" + }, + { + "self_ref": "#/texts/53", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Title", + "text": "Inserted Title" + }, + { + "self_ref": "#/texts/54", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Code", + "text": "Inserted Code", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/55", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Formula", + "text": "Inserted Formula" + }, + { + "self_ref": "#/texts/56", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Heading", + "text": "Inserted Heading", + "level": 1 + }, + { + "self_ref": "#/texts/57", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Incorrect Parent", + "text": "Inserted List Item, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/58", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Correct Parent", + "text": "Inserted List Item, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/59", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Correct Parent", + "text": "Inserted Text with LIST_ITEM Label, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/60", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "text": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/61", + "parent": { + "$ref": "#/groups/14" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 1", + "text": "Bulk Addition 1" + }, + { + "self_ref": "#/texts/62", + "parent": { + "$ref": "#/groups/14" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 2", + "text": "Bulk Addition 2" + }, + { + "self_ref": "#/texts/63", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 1", + "text": "Bulk Insertion 1" + }, + { + "self_ref": "#/texts/64", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 2", + "text": "Bulk Insertion 2" + } + ], + "pictures": [ + { + "self_ref": "#/pictures/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [ + { + "$ref": "#/texts/5" + } + ], + "references": [], + "footnotes": [], + "annotations": [] + }, + { + "self_ref": "#/pictures/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "image": { + "mimetype": "image/png", + "dpi": 72, + "size": { + "width": 64.0, + "height": 64.0 + }, + "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAIklEQVR4nO3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAA8G4wQAABiwCo9wAAAABJRU5ErkJggg==" + }, + "annotations": [] + } + ], + "tables": [ + { + "self_ref": "#/tables/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [ + { + "$ref": "#/texts/4" + } + ], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + }, + { + "self_ref": "#/tables/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + } + ], + "key_value_items": [ + { + "self_ref": "#/key_value_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/key_value_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "form_items": [ + { + "self_ref": "#/form_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/form_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "pages": {} +} \ No newline at end of file diff --git a/test/data/doc/constructed_doc.deleted_items_range.json.gt b/test/data/doc/constructed_doc.deleted_items_range.json.gt new file mode 100644 index 00000000..a6cc656e --- /dev/null +++ b/test/data/doc/constructed_doc.deleted_items_range.json.gt @@ -0,0 +1,1375 @@ +{ + "schema_name": "DoclingDocument", + "version": "1.5.0", + "name": "Untitled 1", + "furniture": { + "self_ref": "#/furniture", + "children": [], + "content_layer": "furniture", + "name": "_root_", + "label": "unspecified" + }, + "body": { + "self_ref": "#/body", + "children": [ + { + "$ref": "#/groups/0" + }, + { + "$ref": "#/texts/1" + }, + { + "$ref": "#/texts/4" + }, + { + "$ref": "#/tables/0" + }, + { + "$ref": "#/texts/5" + }, + { + "$ref": "#/pictures/0" + }, + { + "$ref": "#/texts/6" + }, + { + "$ref": "#/groups/1" + }, + { + "$ref": "#/groups/2" + }, + { + "$ref": "#/groups/3" + }, + { + "$ref": "#/groups/4" + }, + { + "$ref": "#/texts/21" + }, + { + "$ref": "#/texts/22" + }, + { + "$ref": "#/texts/23" + }, + { + "$ref": "#/texts/24" + }, + { + "$ref": "#/key_value_items/0" + }, + { + "$ref": "#/form_items/0" + }, + { + "$ref": "#/groups/8" + }, + { + "$ref": "#/groups/9" + }, + { + "$ref": "#/groups/12" + }, + { + "$ref": "#/texts/45" + }, + { + "$ref": "#/texts/47" + } + ], + "content_layer": "body", + "name": "_root_", + "label": "unspecified" + }, + "groups": [ + { + "self_ref": "#/groups/0", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/0" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/7" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/3", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/8" + }, + { + "$ref": "#/texts/9" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/4", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/10" + }, + { + "$ref": "#/texts/11" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/5", + "parent": { + "$ref": "#/texts/11" + }, + "children": [ + { + "$ref": "#/texts/12" + }, + { + "$ref": "#/texts/13" + }, + { + "$ref": "#/texts/17" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/6", + "parent": { + "$ref": "#/texts/13" + }, + "children": [ + { + "$ref": "#/texts/14" + }, + { + "$ref": "#/texts/15" + }, + { + "$ref": "#/texts/16" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/7", + "parent": { + "$ref": "#/texts/17" + }, + "children": [ + { + "$ref": "#/texts/18" + }, + { + "$ref": "#/texts/19" + }, + { + "$ref": "#/texts/20" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/8", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/25" + }, + { + "$ref": "#/texts/26" + }, + { + "$ref": "#/texts/27" + }, + { + "$ref": "#/texts/28" + }, + { + "$ref": "#/texts/29" + }, + { + "$ref": "#/texts/30" + }, + { + "$ref": "#/texts/31" + }, + { + "$ref": "#/texts/32" + }, + { + "$ref": "#/texts/33" + }, + { + "$ref": "#/texts/34" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/9", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/35" + }, + { + "$ref": "#/texts/36" + }, + { + "$ref": "#/texts/37" + }, + { + "$ref": "#/texts/43" + } + ], + "content_layer": "body", + "name": "list A", + "label": "list" + }, + { + "self_ref": "#/groups/10", + "parent": { + "$ref": "#/texts/37" + }, + "children": [ + { + "$ref": "#/texts/38" + }, + { + "$ref": "#/texts/39" + }, + { + "$ref": "#/texts/42" + } + ], + "content_layer": "body", + "name": "list B", + "label": "list" + }, + { + "self_ref": "#/groups/11", + "parent": { + "$ref": "#/texts/39" + }, + "children": [ + { + "$ref": "#/texts/40" + }, + { + "$ref": "#/texts/41" + }, + { + "$ref": "#/texts/46" + } + ], + "content_layer": "body", + "name": "list C", + "label": "list" + }, + { + "self_ref": "#/groups/12", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/44" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + } + ], + "texts": [ + { + "self_ref": "#/texts/0", + "parent": { + "$ref": "#/groups/0" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item of leading list", + "text": "item of leading list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/2" + }, + { + "$ref": "#/texts/3" + } + ], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Title of the Document", + "text": "Title of the Document" + }, + { + "self_ref": "#/texts/2", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 1\nAffiliation 1", + "text": "Author 1\nAffiliation 1" + }, + { + "self_ref": "#/texts/3", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 2\nAffiliation 2", + "text": "Author 2\nAffiliation 2" + }, + { + "self_ref": "#/texts/4", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of table 1.", + "text": "This is the caption of table 1." + }, + { + "self_ref": "#/texts/5", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 1.", + "text": "This is the caption of figure 1." + }, + { + "self_ref": "#/texts/6", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 2.", + "text": "This is the caption of figure 2." + }, + { + "self_ref": "#/texts/7", + "parent": { + "$ref": "#/groups/1" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list", + "text": "item 1 of list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/8", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list after empty list", + "text": "item 1 of list after empty list", + "enumerated": false, + "marker": "*" + }, + { + "self_ref": "#/texts/9", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of list after empty list", + "text": "item 2 of list after empty list", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/10", + "parent": { + "$ref": "#/groups/4" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of neighboring list", + "text": "item 1 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/11", + "parent": { + "$ref": "#/groups/4" + }, + "children": [ + { + "$ref": "#/groups/5" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of neighboring list", + "text": "item 2 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/12", + "parent": { + "$ref": "#/groups/5" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of sub list", + "text": "item 1 of sub list", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/13", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/6" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/14", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code snippet:", + "text": "Here a code snippet:" + }, + { + "self_ref": "#/texts/15", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/16", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/17", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/7" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/18", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula:", + "text": "Here a formula:" + }, + { + "self_ref": "#/texts/19", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/20", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/21", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code block:", + "text": "Here a code block:" + }, + { + "self_ref": "#/texts/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula block:", + "text": "Here a formula block:" + }, + { + "self_ref": "#/texts/24", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/25", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Some formatting chops:", + "text": "Some formatting chops:" + }, + { + "self_ref": "#/texts/26", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "bold", + "text": "bold", + "formatting": { + "bold": true, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/27", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "italic", + "text": "italic", + "formatting": { + "bold": false, + "italic": true, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/28", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "underline", + "text": "underline", + "formatting": { + "bold": false, + "italic": false, + "underline": true, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/29", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "strikethrough", + "text": "strikethrough", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": true, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/30", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "subscript", + "text": "subscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "sub" + } + }, + { + "self_ref": "#/texts/31", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "superscript", + "text": "superscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "super" + } + }, + { + "self_ref": "#/texts/32", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "hyperlink", + "text": "hyperlink", + "hyperlink": "." + }, + { + "self_ref": "#/texts/33", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "&", + "text": "&" + }, + { + "self_ref": "#/texts/34", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "everything at the same time.", + "text": "everything at the same time.", + "formatting": { + "bold": true, + "italic": true, + "underline": true, + "strikethrough": true, + "script": "baseline" + }, + "hyperlink": "https://github.com/DS4SD/docling" + }, + { + "self_ref": "#/texts/35", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in A", + "text": "Item 1 in A", + "enumerated": true, + "marker": "(i)" + }, + { + "self_ref": "#/texts/36", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in A", + "text": "Item 2 in A", + "enumerated": true, + "marker": "(ii)" + }, + { + "self_ref": "#/texts/37", + "parent": { + "$ref": "#/groups/9" + }, + "children": [ + { + "$ref": "#/groups/10" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in A", + "text": "Item 3 in A", + "enumerated": true, + "marker": "(iii)" + }, + { + "self_ref": "#/texts/38", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in B", + "text": "Item 1 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/39", + "parent": { + "$ref": "#/groups/10" + }, + "children": [ + { + "$ref": "#/groups/11" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in B", + "text": "Item 2 in B", + "enumerated": true, + "marker": "42." + }, + { + "self_ref": "#/texts/40", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in C", + "text": "Item 1 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/41", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in C", + "text": "Item 2 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/42", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in B", + "text": "Item 3 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/43", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 4 in A", + "text": "Item 4 in A", + "enumerated": true, + "marker": "(iv)" + }, + { + "self_ref": "#/texts/44", + "parent": { + "$ref": "#/groups/12" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "List item without parent list group", + "text": "List item without parent list group", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/45", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "The end.", + "text": "The end." + }, + { + "self_ref": "#/texts/46", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "child text appended at body", + "text": "child text appended at body", + "enumerated": false, + "marker": "-" + }, + { + "self_ref": "#/texts/47", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "new child", + "text": "new child" + } + ], + "pictures": [ + { + "self_ref": "#/pictures/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [ + { + "$ref": "#/texts/5" + } + ], + "references": [], + "footnotes": [], + "annotations": [] + } + ], + "tables": [ + { + "self_ref": "#/tables/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [ + { + "$ref": "#/texts/4" + } + ], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + } + ], + "key_value_items": [ + { + "self_ref": "#/key_value_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "form_items": [ + { + "self_ref": "#/form_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "pages": {} +} \ No newline at end of file diff --git a/test/data/doc/constructed_doc.extracted_with_deletion.json.gt b/test/data/doc/constructed_doc.extracted_with_deletion.json.gt new file mode 100644 index 00000000..dfbdf65d --- /dev/null +++ b/test/data/doc/constructed_doc.extracted_with_deletion.json.gt @@ -0,0 +1,1599 @@ +{ + "schema_name": "DoclingDocument", + "version": "1.5.0", + "name": "Untitled 1", + "furniture": { + "self_ref": "#/furniture", + "children": [], + "content_layer": "furniture", + "name": "_root_", + "label": "unspecified" + }, + "body": { + "self_ref": "#/body", + "children": [ + { + "$ref": "#/groups/0" + }, + { + "$ref": "#/texts/1" + }, + { + "$ref": "#/texts/4" + }, + { + "$ref": "#/tables/0" + }, + { + "$ref": "#/texts/5" + }, + { + "$ref": "#/pictures/0" + }, + { + "$ref": "#/texts/6" + }, + { + "$ref": "#/groups/1" + }, + { + "$ref": "#/groups/2" + }, + { + "$ref": "#/groups/3" + }, + { + "$ref": "#/groups/4" + }, + { + "$ref": "#/texts/21" + }, + { + "$ref": "#/texts/22" + }, + { + "$ref": "#/texts/23" + }, + { + "$ref": "#/texts/24" + }, + { + "$ref": "#/key_value_items/0" + }, + { + "$ref": "#/form_items/0" + }, + { + "$ref": "#/groups/8" + }, + { + "$ref": "#/groups/9" + }, + { + "$ref": "#/groups/12" + }, + { + "$ref": "#/texts/45" + }, + { + "$ref": "#/groups/16" + }, + { + "$ref": "#/form_items/1" + }, + { + "$ref": "#/texts/52" + }, + { + "$ref": "#/texts/51" + }, + { + "$ref": "#/pictures/1" + }, + { + "$ref": "#/texts/50" + }, + { + "$ref": "#/texts/49" + }, + { + "$ref": "#/texts/48" + }, + { + "$ref": "#/groups/15" + }, + { + "$ref": "#/groups/14" + }, + { + "$ref": "#/groups/13" + }, + { + "$ref": "#/texts/47" + } + ], + "content_layer": "body", + "name": "_root_", + "label": "unspecified" + }, + "groups": [ + { + "self_ref": "#/groups/0", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/0" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/7" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/3", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/8" + }, + { + "$ref": "#/texts/9" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/4", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/10" + }, + { + "$ref": "#/texts/11" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/5", + "parent": { + "$ref": "#/texts/11" + }, + "children": [ + { + "$ref": "#/texts/12" + }, + { + "$ref": "#/texts/13" + }, + { + "$ref": "#/texts/17" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/6", + "parent": { + "$ref": "#/texts/13" + }, + "children": [ + { + "$ref": "#/texts/14" + }, + { + "$ref": "#/texts/15" + }, + { + "$ref": "#/texts/16" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/7", + "parent": { + "$ref": "#/texts/17" + }, + "children": [ + { + "$ref": "#/texts/18" + }, + { + "$ref": "#/texts/19" + }, + { + "$ref": "#/texts/20" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/8", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/25" + }, + { + "$ref": "#/texts/26" + }, + { + "$ref": "#/texts/27" + }, + { + "$ref": "#/texts/28" + }, + { + "$ref": "#/texts/29" + }, + { + "$ref": "#/texts/30" + }, + { + "$ref": "#/texts/31" + }, + { + "$ref": "#/texts/32" + }, + { + "$ref": "#/texts/33" + }, + { + "$ref": "#/texts/34" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/9", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/35" + }, + { + "$ref": "#/texts/36" + }, + { + "$ref": "#/texts/37" + }, + { + "$ref": "#/texts/43" + } + ], + "content_layer": "body", + "name": "list A", + "label": "list" + }, + { + "self_ref": "#/groups/10", + "parent": { + "$ref": "#/texts/37" + }, + "children": [ + { + "$ref": "#/texts/38" + }, + { + "$ref": "#/texts/39" + }, + { + "$ref": "#/texts/42" + } + ], + "content_layer": "body", + "name": "list B", + "label": "list" + }, + { + "self_ref": "#/groups/11", + "parent": { + "$ref": "#/texts/39" + }, + "children": [ + { + "$ref": "#/texts/40" + }, + { + "$ref": "#/texts/41" + }, + { + "$ref": "#/texts/46" + } + ], + "content_layer": "body", + "name": "list C", + "label": "list" + }, + { + "self_ref": "#/groups/12", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/44" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/13", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted List Group", + "label": "list" + }, + { + "self_ref": "#/groups/14", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/15", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ INLINE Label", + "label": "inline" + }, + { + "self_ref": "#/groups/16", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/53" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + } + ], + "texts": [ + { + "self_ref": "#/texts/0", + "parent": { + "$ref": "#/groups/0" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item of leading list", + "text": "item of leading list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/2" + }, + { + "$ref": "#/texts/3" + } + ], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Title of the Document", + "text": "Title of the Document" + }, + { + "self_ref": "#/texts/2", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 1\nAffiliation 1", + "text": "Author 1\nAffiliation 1" + }, + { + "self_ref": "#/texts/3", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 2\nAffiliation 2", + "text": "Author 2\nAffiliation 2" + }, + { + "self_ref": "#/texts/4", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of table 1.", + "text": "This is the caption of table 1." + }, + { + "self_ref": "#/texts/5", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 1.", + "text": "This is the caption of figure 1." + }, + { + "self_ref": "#/texts/6", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 2.", + "text": "This is the caption of figure 2." + }, + { + "self_ref": "#/texts/7", + "parent": { + "$ref": "#/groups/1" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list", + "text": "item 1 of list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/8", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list after empty list", + "text": "item 1 of list after empty list", + "enumerated": false, + "marker": "*" + }, + { + "self_ref": "#/texts/9", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of list after empty list", + "text": "item 2 of list after empty list", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/10", + "parent": { + "$ref": "#/groups/4" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of neighboring list", + "text": "item 1 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/11", + "parent": { + "$ref": "#/groups/4" + }, + "children": [ + { + "$ref": "#/groups/5" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of neighboring list", + "text": "item 2 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/12", + "parent": { + "$ref": "#/groups/5" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of sub list", + "text": "item 1 of sub list", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/13", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/6" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/14", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code snippet:", + "text": "Here a code snippet:" + }, + { + "self_ref": "#/texts/15", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/16", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/17", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/7" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/18", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula:", + "text": "Here a formula:" + }, + { + "self_ref": "#/texts/19", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/20", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/21", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code block:", + "text": "Here a code block:" + }, + { + "self_ref": "#/texts/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula block:", + "text": "Here a formula block:" + }, + { + "self_ref": "#/texts/24", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/25", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Some formatting chops:", + "text": "Some formatting chops:" + }, + { + "self_ref": "#/texts/26", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "bold", + "text": "bold", + "formatting": { + "bold": true, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/27", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "italic", + "text": "italic", + "formatting": { + "bold": false, + "italic": true, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/28", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "underline", + "text": "underline", + "formatting": { + "bold": false, + "italic": false, + "underline": true, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/29", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "strikethrough", + "text": "strikethrough", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": true, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/30", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "subscript", + "text": "subscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "sub" + } + }, + { + "self_ref": "#/texts/31", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "superscript", + "text": "superscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "super" + } + }, + { + "self_ref": "#/texts/32", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "hyperlink", + "text": "hyperlink", + "hyperlink": "." + }, + { + "self_ref": "#/texts/33", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "&", + "text": "&" + }, + { + "self_ref": "#/texts/34", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "everything at the same time.", + "text": "everything at the same time.", + "formatting": { + "bold": true, + "italic": true, + "underline": true, + "strikethrough": true, + "script": "baseline" + }, + "hyperlink": "https://github.com/DS4SD/docling" + }, + { + "self_ref": "#/texts/35", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in A", + "text": "Item 1 in A", + "enumerated": true, + "marker": "(i)" + }, + { + "self_ref": "#/texts/36", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in A", + "text": "Item 2 in A", + "enumerated": true, + "marker": "(ii)" + }, + { + "self_ref": "#/texts/37", + "parent": { + "$ref": "#/groups/9" + }, + "children": [ + { + "$ref": "#/groups/10" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in A", + "text": "Item 3 in A", + "enumerated": true, + "marker": "(iii)" + }, + { + "self_ref": "#/texts/38", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in B", + "text": "Item 1 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/39", + "parent": { + "$ref": "#/groups/10" + }, + "children": [ + { + "$ref": "#/groups/11" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in B", + "text": "Item 2 in B", + "enumerated": true, + "marker": "42." + }, + { + "self_ref": "#/texts/40", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in C", + "text": "Item 1 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/41", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in C", + "text": "Item 2 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/42", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in B", + "text": "Item 3 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/43", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 4 in A", + "text": "Item 4 in A", + "enumerated": true, + "marker": "(iv)" + }, + { + "self_ref": "#/texts/44", + "parent": { + "$ref": "#/groups/12" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "List item without parent list group", + "text": "List item without parent list group", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/45", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "The end.", + "text": "The end." + }, + { + "self_ref": "#/texts/46", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "child text appended at body", + "text": "child text appended at body", + "enumerated": false, + "marker": "-" + }, + { + "self_ref": "#/texts/47", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "new child", + "text": "new child" + }, + { + "self_ref": "#/texts/48", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Text w/ TITLE Label", + "text": "Inserted Text w/ TITLE Label" + }, + { + "self_ref": "#/texts/49", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Text w/ CODE Label", + "text": "Inserted Text w/ CODE Label", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/50", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Inserted Text w/ TEXT Label", + "text": "Inserted Text w/ TEXT Label" + }, + { + "self_ref": "#/texts/51", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Code", + "text": "Inserted Code", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/52", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Heading", + "text": "Inserted Heading", + "level": 1 + }, + { + "self_ref": "#/texts/53", + "parent": { + "$ref": "#/groups/16" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "text": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "enumerated": false, + "marker": "" + } + ], + "pictures": [ + { + "self_ref": "#/pictures/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [ + { + "$ref": "#/texts/5" + } + ], + "references": [], + "footnotes": [], + "annotations": [] + }, + { + "self_ref": "#/pictures/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "image": { + "mimetype": "image/png", + "dpi": 72, + "size": { + "width": 64.0, + "height": 64.0 + }, + "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAIklEQVR4nO3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAA8G4wQAABiwCo9wAAAABJRU5ErkJggg==" + }, + "annotations": [] + } + ], + "tables": [ + { + "self_ref": "#/tables/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [ + { + "$ref": "#/texts/4" + } + ], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + } + ], + "key_value_items": [ + { + "self_ref": "#/key_value_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "form_items": [ + { + "self_ref": "#/form_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/form_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "pages": {} +} \ No newline at end of file diff --git a/test/data/doc/constructed_doc.inserted_extracted_doc.json.gt b/test/data/doc/constructed_doc.inserted_extracted_doc.json.gt new file mode 100644 index 00000000..fc315587 --- /dev/null +++ b/test/data/doc/constructed_doc.inserted_extracted_doc.json.gt @@ -0,0 +1,2782 @@ +{ + "schema_name": "DoclingDocument", + "version": "1.5.0", + "name": "Untitled 1", + "furniture": { + "self_ref": "#/furniture", + "children": [], + "content_layer": "furniture", + "name": "_root_", + "label": "unspecified" + }, + "body": { + "self_ref": "#/body", + "children": [ + { + "$ref": "#/groups/0" + }, + { + "$ref": "#/texts/1" + }, + { + "$ref": "#/texts/4" + }, + { + "$ref": "#/tables/0" + }, + { + "$ref": "#/texts/5" + }, + { + "$ref": "#/pictures/0" + }, + { + "$ref": "#/texts/6" + }, + { + "$ref": "#/groups/1" + }, + { + "$ref": "#/groups/2" + }, + { + "$ref": "#/groups/3" + }, + { + "$ref": "#/groups/4" + }, + { + "$ref": "#/texts/21" + }, + { + "$ref": "#/texts/22" + }, + { + "$ref": "#/texts/23" + }, + { + "$ref": "#/texts/24" + }, + { + "$ref": "#/key_value_items/0" + }, + { + "$ref": "#/form_items/0" + }, + { + "$ref": "#/groups/8" + }, + { + "$ref": "#/groups/9" + }, + { + "$ref": "#/groups/12" + }, + { + "$ref": "#/texts/45" + }, + { + "$ref": "#/groups/16" + }, + { + "$ref": "#/form_items/1" + }, + { + "$ref": "#/texts/52" + }, + { + "$ref": "#/texts/51" + }, + { + "$ref": "#/pictures/1" + }, + { + "$ref": "#/texts/50" + }, + { + "$ref": "#/texts/49" + }, + { + "$ref": "#/texts/48" + }, + { + "$ref": "#/groups/15" + }, + { + "$ref": "#/groups/14" + }, + { + "$ref": "#/groups/21" + }, + { + "$ref": "#/groups/22" + }, + { + "$ref": "#/groups/23" + }, + { + "$ref": "#/texts/67" + }, + { + "$ref": "#/texts/68" + }, + { + "$ref": "#/tables/2" + }, + { + "$ref": "#/texts/69" + }, + { + "$ref": "#/texts/70" + }, + { + "$ref": "#/key_value_items/2" + }, + { + "$ref": "#/groups/24" + }, + { + "$ref": "#/texts/74" + }, + { + "$ref": "#/texts/75" + }, + { + "$ref": "#/groups/13" + }, + { + "$ref": "#/texts/47" + } + ], + "content_layer": "body", + "name": "_root_", + "label": "unspecified" + }, + "groups": [ + { + "self_ref": "#/groups/0", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/0" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/7" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/3", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/8" + }, + { + "$ref": "#/texts/9" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/4", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/10" + }, + { + "$ref": "#/texts/11" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/5", + "parent": { + "$ref": "#/texts/11" + }, + "children": [ + { + "$ref": "#/texts/12" + }, + { + "$ref": "#/texts/13" + }, + { + "$ref": "#/texts/17" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/6", + "parent": { + "$ref": "#/texts/13" + }, + "children": [ + { + "$ref": "#/texts/14" + }, + { + "$ref": "#/texts/15" + }, + { + "$ref": "#/texts/16" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/7", + "parent": { + "$ref": "#/texts/17" + }, + "children": [ + { + "$ref": "#/texts/18" + }, + { + "$ref": "#/texts/19" + }, + { + "$ref": "#/texts/20" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/8", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/25" + }, + { + "$ref": "#/texts/26" + }, + { + "$ref": "#/texts/27" + }, + { + "$ref": "#/texts/28" + }, + { + "$ref": "#/texts/29" + }, + { + "$ref": "#/texts/30" + }, + { + "$ref": "#/texts/31" + }, + { + "$ref": "#/texts/32" + }, + { + "$ref": "#/texts/33" + }, + { + "$ref": "#/texts/34" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/9", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/35" + }, + { + "$ref": "#/texts/36" + }, + { + "$ref": "#/texts/37" + }, + { + "$ref": "#/texts/43" + } + ], + "content_layer": "body", + "name": "list A", + "label": "list" + }, + { + "self_ref": "#/groups/10", + "parent": { + "$ref": "#/texts/37" + }, + "children": [ + { + "$ref": "#/texts/38" + }, + { + "$ref": "#/texts/39" + }, + { + "$ref": "#/texts/42" + } + ], + "content_layer": "body", + "name": "list B", + "label": "list" + }, + { + "self_ref": "#/groups/11", + "parent": { + "$ref": "#/texts/39" + }, + "children": [ + { + "$ref": "#/texts/40" + }, + { + "$ref": "#/texts/41" + }, + { + "$ref": "#/texts/46" + } + ], + "content_layer": "body", + "name": "list C", + "label": "list" + }, + { + "self_ref": "#/groups/12", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/44" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/13", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/groups/17" + }, + { + "$ref": "#/groups/18" + }, + { + "$ref": "#/groups/19" + }, + { + "$ref": "#/texts/56" + }, + { + "$ref": "#/texts/57" + }, + { + "$ref": "#/tables/1" + }, + { + "$ref": "#/texts/58" + }, + { + "$ref": "#/texts/59" + }, + { + "$ref": "#/key_value_items/1" + }, + { + "$ref": "#/groups/20" + }, + { + "$ref": "#/texts/63" + }, + { + "$ref": "#/texts/64" + } + ], + "content_layer": "body", + "name": "Inserted List Group", + "label": "list" + }, + { + "self_ref": "#/groups/14", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/15", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ INLINE Label", + "label": "inline" + }, + { + "self_ref": "#/groups/16", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/53" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/17", + "parent": { + "$ref": "#/groups/13" + }, + "children": [ + { + "$ref": "#/texts/54" + }, + { + "$ref": "#/texts/55" + } + ], + "content_layer": "body", + "name": "Inserted Inline Group", + "label": "inline" + }, + { + "self_ref": "#/groups/18", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ ORDERED_LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/19", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ UNSPECIFIED Label", + "label": "unspecified" + }, + { + "self_ref": "#/groups/20", + "parent": { + "$ref": "#/groups/13" + }, + "children": [ + { + "$ref": "#/texts/60" + }, + { + "$ref": "#/texts/61" + }, + { + "$ref": "#/texts/62" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/21", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/65" + }, + { + "$ref": "#/texts/66" + } + ], + "content_layer": "body", + "name": "Inserted Inline Group", + "label": "inline" + }, + { + "self_ref": "#/groups/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ ORDERED_LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ UNSPECIFIED Label", + "label": "unspecified" + }, + { + "self_ref": "#/groups/24", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/71" + }, + { + "$ref": "#/texts/72" + }, + { + "$ref": "#/texts/73" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + } + ], + "texts": [ + { + "self_ref": "#/texts/0", + "parent": { + "$ref": "#/groups/0" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item of leading list", + "text": "item of leading list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/2" + }, + { + "$ref": "#/texts/3" + } + ], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Title of the Document", + "text": "Title of the Document" + }, + { + "self_ref": "#/texts/2", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 1\nAffiliation 1", + "text": "Author 1\nAffiliation 1" + }, + { + "self_ref": "#/texts/3", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 2\nAffiliation 2", + "text": "Author 2\nAffiliation 2" + }, + { + "self_ref": "#/texts/4", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of table 1.", + "text": "This is the caption of table 1." + }, + { + "self_ref": "#/texts/5", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 1.", + "text": "This is the caption of figure 1." + }, + { + "self_ref": "#/texts/6", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 2.", + "text": "This is the caption of figure 2." + }, + { + "self_ref": "#/texts/7", + "parent": { + "$ref": "#/groups/1" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list", + "text": "item 1 of list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/8", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list after empty list", + "text": "item 1 of list after empty list", + "enumerated": false, + "marker": "*" + }, + { + "self_ref": "#/texts/9", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of list after empty list", + "text": "item 2 of list after empty list", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/10", + "parent": { + "$ref": "#/groups/4" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of neighboring list", + "text": "item 1 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/11", + "parent": { + "$ref": "#/groups/4" + }, + "children": [ + { + "$ref": "#/groups/5" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of neighboring list", + "text": "item 2 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/12", + "parent": { + "$ref": "#/groups/5" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of sub list", + "text": "item 1 of sub list", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/13", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/6" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/14", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code snippet:", + "text": "Here a code snippet:" + }, + { + "self_ref": "#/texts/15", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/16", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/17", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/7" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/18", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula:", + "text": "Here a formula:" + }, + { + "self_ref": "#/texts/19", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/20", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/21", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code block:", + "text": "Here a code block:" + }, + { + "self_ref": "#/texts/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula block:", + "text": "Here a formula block:" + }, + { + "self_ref": "#/texts/24", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/25", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Some formatting chops:", + "text": "Some formatting chops:" + }, + { + "self_ref": "#/texts/26", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "bold", + "text": "bold", + "formatting": { + "bold": true, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/27", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "italic", + "text": "italic", + "formatting": { + "bold": false, + "italic": true, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/28", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "underline", + "text": "underline", + "formatting": { + "bold": false, + "italic": false, + "underline": true, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/29", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "strikethrough", + "text": "strikethrough", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": true, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/30", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "subscript", + "text": "subscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "sub" + } + }, + { + "self_ref": "#/texts/31", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "superscript", + "text": "superscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "super" + } + }, + { + "self_ref": "#/texts/32", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "hyperlink", + "text": "hyperlink", + "hyperlink": "." + }, + { + "self_ref": "#/texts/33", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "&", + "text": "&" + }, + { + "self_ref": "#/texts/34", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "everything at the same time.", + "text": "everything at the same time.", + "formatting": { + "bold": true, + "italic": true, + "underline": true, + "strikethrough": true, + "script": "baseline" + }, + "hyperlink": "https://github.com/DS4SD/docling" + }, + { + "self_ref": "#/texts/35", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in A", + "text": "Item 1 in A", + "enumerated": true, + "marker": "(i)" + }, + { + "self_ref": "#/texts/36", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in A", + "text": "Item 2 in A", + "enumerated": true, + "marker": "(ii)" + }, + { + "self_ref": "#/texts/37", + "parent": { + "$ref": "#/groups/9" + }, + "children": [ + { + "$ref": "#/groups/10" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in A", + "text": "Item 3 in A", + "enumerated": true, + "marker": "(iii)" + }, + { + "self_ref": "#/texts/38", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in B", + "text": "Item 1 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/39", + "parent": { + "$ref": "#/groups/10" + }, + "children": [ + { + "$ref": "#/groups/11" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in B", + "text": "Item 2 in B", + "enumerated": true, + "marker": "42." + }, + { + "self_ref": "#/texts/40", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in C", + "text": "Item 1 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/41", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in C", + "text": "Item 2 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/42", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in B", + "text": "Item 3 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/43", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 4 in A", + "text": "Item 4 in A", + "enumerated": true, + "marker": "(iv)" + }, + { + "self_ref": "#/texts/44", + "parent": { + "$ref": "#/groups/12" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "List item without parent list group", + "text": "List item without parent list group", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/45", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "The end.", + "text": "The end." + }, + { + "self_ref": "#/texts/46", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "child text appended at body", + "text": "child text appended at body", + "enumerated": false, + "marker": "-" + }, + { + "self_ref": "#/texts/47", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "new child", + "text": "new child" + }, + { + "self_ref": "#/texts/48", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Text w/ TITLE Label", + "text": "Inserted Text w/ TITLE Label" + }, + { + "self_ref": "#/texts/49", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Text w/ CODE Label", + "text": "Inserted Text w/ CODE Label", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/50", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Inserted Text w/ TEXT Label", + "text": "Inserted Text w/ TEXT Label" + }, + { + "self_ref": "#/texts/51", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Code", + "text": "Inserted Code", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/52", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Heading", + "text": "Inserted Heading", + "level": 1 + }, + { + "self_ref": "#/texts/53", + "parent": { + "$ref": "#/groups/16" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "text": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/54", + "parent": { + "$ref": "#/groups/17" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 1", + "text": "Bulk Addition 1" + }, + { + "self_ref": "#/texts/55", + "parent": { + "$ref": "#/groups/17" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 2", + "text": "Bulk Addition 2" + }, + { + "self_ref": "#/texts/56", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Text w/ SECTION_HEADER Label", + "text": "Inserted Text w/ SECTION_HEADER Label", + "level": 1 + }, + { + "self_ref": "#/texts/57", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Text w/ FORMULA Label", + "text": "Inserted Text w/ FORMULA Label" + }, + { + "self_ref": "#/texts/58", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Title", + "text": "Inserted Title" + }, + { + "self_ref": "#/texts/59", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Formula", + "text": "Inserted Formula" + }, + { + "self_ref": "#/texts/60", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Correct Parent", + "text": "Inserted Text with LIST_ITEM Label, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/61", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Incorrect Parent", + "text": "Inserted List Item, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/62", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Correct Parent", + "text": "Inserted List Item, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/63", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 1", + "text": "Bulk Insertion 1" + }, + { + "self_ref": "#/texts/64", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 2", + "text": "Bulk Insertion 2" + }, + { + "self_ref": "#/texts/65", + "parent": { + "$ref": "#/groups/21" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 1", + "text": "Bulk Addition 1" + }, + { + "self_ref": "#/texts/66", + "parent": { + "$ref": "#/groups/21" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 2", + "text": "Bulk Addition 2" + }, + { + "self_ref": "#/texts/67", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Text w/ SECTION_HEADER Label", + "text": "Inserted Text w/ SECTION_HEADER Label", + "level": 1 + }, + { + "self_ref": "#/texts/68", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Text w/ FORMULA Label", + "text": "Inserted Text w/ FORMULA Label" + }, + { + "self_ref": "#/texts/69", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Title", + "text": "Inserted Title" + }, + { + "self_ref": "#/texts/70", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Formula", + "text": "Inserted Formula" + }, + { + "self_ref": "#/texts/71", + "parent": { + "$ref": "#/groups/24" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Correct Parent", + "text": "Inserted Text with LIST_ITEM Label, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/72", + "parent": { + "$ref": "#/groups/24" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Incorrect Parent", + "text": "Inserted List Item, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/73", + "parent": { + "$ref": "#/groups/24" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Correct Parent", + "text": "Inserted List Item, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/74", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 1", + "text": "Bulk Insertion 1" + }, + { + "self_ref": "#/texts/75", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 2", + "text": "Bulk Insertion 2" + } + ], + "pictures": [ + { + "self_ref": "#/pictures/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [ + { + "$ref": "#/texts/5" + } + ], + "references": [], + "footnotes": [], + "annotations": [] + }, + { + "self_ref": "#/pictures/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "image": { + "mimetype": "image/png", + "dpi": 72, + "size": { + "width": 64.0, + "height": 64.0 + }, + "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAIklEQVR4nO3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAA8G4wQAABiwCo9wAAAABJRU5ErkJggg==" + }, + "annotations": [] + } + ], + "tables": [ + { + "self_ref": "#/tables/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [ + { + "$ref": "#/texts/4" + } + ], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + }, + { + "self_ref": "#/tables/1", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "a", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "b", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "c", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 4, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "a", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "b", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "c", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + }, + { + "self_ref": "#/tables/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "a", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "b", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "c", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 4, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "a", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "b", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "c", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + } + ], + "key_value_items": [ + { + "self_ref": "#/key_value_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/key_value_items/1", + "parent": { + "$ref": "#/groups/13" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/key_value_items/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "form_items": [ + { + "self_ref": "#/form_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/form_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "pages": {} +} \ No newline at end of file diff --git a/test/data/doc/constructed_doc.inserted_items_with_insert_*.json.gt b/test/data/doc/constructed_doc.inserted_items_with_insert_*.json.gt new file mode 100644 index 00000000..a5bf219d --- /dev/null +++ b/test/data/doc/constructed_doc.inserted_items_with_insert_*.json.gt @@ -0,0 +1,1959 @@ +{ + "schema_name": "DoclingDocument", + "version": "1.5.0", + "name": "Untitled 1", + "furniture": { + "self_ref": "#/furniture", + "children": [], + "content_layer": "furniture", + "name": "_root_", + "label": "unspecified" + }, + "body": { + "self_ref": "#/body", + "children": [ + { + "$ref": "#/groups/0" + }, + { + "$ref": "#/texts/1" + }, + { + "$ref": "#/texts/4" + }, + { + "$ref": "#/tables/0" + }, + { + "$ref": "#/texts/5" + }, + { + "$ref": "#/pictures/0" + }, + { + "$ref": "#/texts/6" + }, + { + "$ref": "#/groups/1" + }, + { + "$ref": "#/groups/2" + }, + { + "$ref": "#/groups/3" + }, + { + "$ref": "#/groups/4" + }, + { + "$ref": "#/texts/21" + }, + { + "$ref": "#/texts/22" + }, + { + "$ref": "#/texts/23" + }, + { + "$ref": "#/texts/24" + }, + { + "$ref": "#/key_value_items/0" + }, + { + "$ref": "#/form_items/0" + }, + { + "$ref": "#/groups/8" + }, + { + "$ref": "#/groups/9" + }, + { + "$ref": "#/groups/12" + }, + { + "$ref": "#/groups/14" + }, + { + "$ref": "#/groups/16" + }, + { + "$ref": "#/groups/18" + }, + { + "$ref": "#/texts/49" + }, + { + "$ref": "#/texts/51" + }, + { + "$ref": "#/tables/1" + }, + { + "$ref": "#/texts/53" + }, + { + "$ref": "#/texts/55" + }, + { + "$ref": "#/key_value_items/1" + }, + { + "$ref": "#/texts/45" + }, + { + "$ref": "#/form_items/1" + }, + { + "$ref": "#/texts/56" + }, + { + "$ref": "#/texts/54" + }, + { + "$ref": "#/pictures/1" + }, + { + "$ref": "#/texts/52" + }, + { + "$ref": "#/texts/50" + }, + { + "$ref": "#/texts/48" + }, + { + "$ref": "#/groups/17" + }, + { + "$ref": "#/groups/15" + }, + { + "$ref": "#/groups/13" + }, + { + "$ref": "#/texts/47" + } + ], + "content_layer": "body", + "name": "_root_", + "label": "unspecified" + }, + "groups": [ + { + "self_ref": "#/groups/0", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/0" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/7" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/3", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/8" + }, + { + "$ref": "#/texts/9" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/4", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/10" + }, + { + "$ref": "#/texts/11" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/5", + "parent": { + "$ref": "#/texts/11" + }, + "children": [ + { + "$ref": "#/texts/12" + }, + { + "$ref": "#/texts/13" + }, + { + "$ref": "#/texts/17" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/6", + "parent": { + "$ref": "#/texts/13" + }, + "children": [ + { + "$ref": "#/texts/14" + }, + { + "$ref": "#/texts/15" + }, + { + "$ref": "#/texts/16" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/7", + "parent": { + "$ref": "#/texts/17" + }, + "children": [ + { + "$ref": "#/texts/18" + }, + { + "$ref": "#/texts/19" + }, + { + "$ref": "#/texts/20" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/8", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/25" + }, + { + "$ref": "#/texts/26" + }, + { + "$ref": "#/texts/27" + }, + { + "$ref": "#/texts/28" + }, + { + "$ref": "#/texts/29" + }, + { + "$ref": "#/texts/30" + }, + { + "$ref": "#/texts/31" + }, + { + "$ref": "#/texts/32" + }, + { + "$ref": "#/texts/33" + }, + { + "$ref": "#/texts/34" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/9", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/35" + }, + { + "$ref": "#/texts/36" + }, + { + "$ref": "#/texts/37" + }, + { + "$ref": "#/texts/43" + } + ], + "content_layer": "body", + "name": "list A", + "label": "list" + }, + { + "self_ref": "#/groups/10", + "parent": { + "$ref": "#/texts/37" + }, + "children": [ + { + "$ref": "#/texts/38" + }, + { + "$ref": "#/texts/39" + }, + { + "$ref": "#/texts/42" + } + ], + "content_layer": "body", + "name": "list B", + "label": "list" + }, + { + "self_ref": "#/groups/11", + "parent": { + "$ref": "#/texts/39" + }, + "children": [ + { + "$ref": "#/texts/40" + }, + { + "$ref": "#/texts/41" + }, + { + "$ref": "#/texts/46" + } + ], + "content_layer": "body", + "name": "list C", + "label": "list" + }, + { + "self_ref": "#/groups/12", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/44" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/13", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted List Group", + "label": "list" + }, + { + "self_ref": "#/groups/14", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Inline Group", + "label": "inline" + }, + { + "self_ref": "#/groups/15", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/16", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ ORDERED_LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/17", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ INLINE Label", + "label": "inline" + }, + { + "self_ref": "#/groups/18", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ UNSPECIFIED Label", + "label": "unspecified" + } + ], + "texts": [ + { + "self_ref": "#/texts/0", + "parent": { + "$ref": "#/groups/0" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item of leading list", + "text": "item of leading list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/2" + }, + { + "$ref": "#/texts/3" + } + ], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Title of the Document", + "text": "Title of the Document" + }, + { + "self_ref": "#/texts/2", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 1\nAffiliation 1", + "text": "Author 1\nAffiliation 1" + }, + { + "self_ref": "#/texts/3", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 2\nAffiliation 2", + "text": "Author 2\nAffiliation 2" + }, + { + "self_ref": "#/texts/4", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of table 1.", + "text": "This is the caption of table 1." + }, + { + "self_ref": "#/texts/5", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 1.", + "text": "This is the caption of figure 1." + }, + { + "self_ref": "#/texts/6", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 2.", + "text": "This is the caption of figure 2." + }, + { + "self_ref": "#/texts/7", + "parent": { + "$ref": "#/groups/1" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list", + "text": "item 1 of list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/8", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list after empty list", + "text": "item 1 of list after empty list", + "enumerated": false, + "marker": "*" + }, + { + "self_ref": "#/texts/9", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of list after empty list", + "text": "item 2 of list after empty list", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/10", + "parent": { + "$ref": "#/groups/4" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of neighboring list", + "text": "item 1 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/11", + "parent": { + "$ref": "#/groups/4" + }, + "children": [ + { + "$ref": "#/groups/5" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of neighboring list", + "text": "item 2 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/12", + "parent": { + "$ref": "#/groups/5" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of sub list", + "text": "item 1 of sub list", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/13", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/6" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/14", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code snippet:", + "text": "Here a code snippet:" + }, + { + "self_ref": "#/texts/15", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/16", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/17", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/7" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/18", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula:", + "text": "Here a formula:" + }, + { + "self_ref": "#/texts/19", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/20", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/21", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code block:", + "text": "Here a code block:" + }, + { + "self_ref": "#/texts/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula block:", + "text": "Here a formula block:" + }, + { + "self_ref": "#/texts/24", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/25", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Some formatting chops:", + "text": "Some formatting chops:" + }, + { + "self_ref": "#/texts/26", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "bold", + "text": "bold", + "formatting": { + "bold": true, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/27", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "italic", + "text": "italic", + "formatting": { + "bold": false, + "italic": true, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/28", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "underline", + "text": "underline", + "formatting": { + "bold": false, + "italic": false, + "underline": true, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/29", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "strikethrough", + "text": "strikethrough", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": true, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/30", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "subscript", + "text": "subscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "sub" + } + }, + { + "self_ref": "#/texts/31", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "superscript", + "text": "superscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "super" + } + }, + { + "self_ref": "#/texts/32", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "hyperlink", + "text": "hyperlink", + "hyperlink": "." + }, + { + "self_ref": "#/texts/33", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "&", + "text": "&" + }, + { + "self_ref": "#/texts/34", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "everything at the same time.", + "text": "everything at the same time.", + "formatting": { + "bold": true, + "italic": true, + "underline": true, + "strikethrough": true, + "script": "baseline" + }, + "hyperlink": "https://github.com/DS4SD/docling" + }, + { + "self_ref": "#/texts/35", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in A", + "text": "Item 1 in A", + "enumerated": true, + "marker": "(i)" + }, + { + "self_ref": "#/texts/36", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in A", + "text": "Item 2 in A", + "enumerated": true, + "marker": "(ii)" + }, + { + "self_ref": "#/texts/37", + "parent": { + "$ref": "#/groups/9" + }, + "children": [ + { + "$ref": "#/groups/10" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in A", + "text": "Item 3 in A", + "enumerated": true, + "marker": "(iii)" + }, + { + "self_ref": "#/texts/38", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in B", + "text": "Item 1 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/39", + "parent": { + "$ref": "#/groups/10" + }, + "children": [ + { + "$ref": "#/groups/11" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in B", + "text": "Item 2 in B", + "enumerated": true, + "marker": "42." + }, + { + "self_ref": "#/texts/40", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in C", + "text": "Item 1 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/41", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in C", + "text": "Item 2 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/42", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in B", + "text": "Item 3 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/43", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 4 in A", + "text": "Item 4 in A", + "enumerated": true, + "marker": "(iv)" + }, + { + "self_ref": "#/texts/44", + "parent": { + "$ref": "#/groups/12" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "List item without parent list group", + "text": "List item without parent list group", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/45", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "The end.", + "text": "The end." + }, + { + "self_ref": "#/texts/46", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "child text appended at body", + "text": "child text appended at body", + "enumerated": false, + "marker": "-" + }, + { + "self_ref": "#/texts/47", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "new child", + "text": "new child" + }, + { + "self_ref": "#/texts/48", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Text w/ TITLE Label", + "text": "Inserted Text w/ TITLE Label" + }, + { + "self_ref": "#/texts/49", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Text w/ SECTION_HEADER Label", + "text": "Inserted Text w/ SECTION_HEADER Label", + "level": 1 + }, + { + "self_ref": "#/texts/50", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Text w/ CODE Label", + "text": "Inserted Text w/ CODE Label", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/51", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Text w/ FORMULA Label", + "text": "Inserted Text w/ FORMULA Label" + }, + { + "self_ref": "#/texts/52", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Inserted Text w/ TEXT Label", + "text": "Inserted Text w/ TEXT Label" + }, + { + "self_ref": "#/texts/53", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Title", + "text": "Inserted Title" + }, + { + "self_ref": "#/texts/54", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Code", + "text": "Inserted Code", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/55", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Formula", + "text": "Inserted Formula" + }, + { + "self_ref": "#/texts/56", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Heading", + "text": "Inserted Heading", + "level": 1 + } + ], + "pictures": [ + { + "self_ref": "#/pictures/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [ + { + "$ref": "#/texts/5" + } + ], + "references": [], + "footnotes": [], + "annotations": [] + }, + { + "self_ref": "#/pictures/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "image": { + "mimetype": "image/png", + "dpi": 72, + "size": { + "width": 64.0, + "height": 64.0 + }, + "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAIklEQVR4nO3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAA8G4wQAABiwCo9wAAAABJRU5ErkJggg==" + }, + "annotations": [] + } + ], + "tables": [ + { + "self_ref": "#/tables/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [ + { + "$ref": "#/texts/4" + } + ], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + }, + { + "self_ref": "#/tables/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + } + ], + "key_value_items": [ + { + "self_ref": "#/key_value_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/key_value_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "form_items": [ + { + "self_ref": "#/form_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/form_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "pages": {} +} \ No newline at end of file diff --git a/test/data/doc/constructed_doc.inserted_list_items_with_insert_*.json.gt b/test/data/doc/constructed_doc.inserted_list_items_with_insert_*.json.gt new file mode 100644 index 00000000..351925c8 --- /dev/null +++ b/test/data/doc/constructed_doc.inserted_list_items_with_insert_*.json.gt @@ -0,0 +1,2055 @@ +{ + "schema_name": "DoclingDocument", + "version": "1.5.0", + "name": "Untitled 1", + "furniture": { + "self_ref": "#/furniture", + "children": [], + "content_layer": "furniture", + "name": "_root_", + "label": "unspecified" + }, + "body": { + "self_ref": "#/body", + "children": [ + { + "$ref": "#/groups/0" + }, + { + "$ref": "#/texts/1" + }, + { + "$ref": "#/texts/4" + }, + { + "$ref": "#/tables/0" + }, + { + "$ref": "#/texts/5" + }, + { + "$ref": "#/pictures/0" + }, + { + "$ref": "#/texts/6" + }, + { + "$ref": "#/groups/1" + }, + { + "$ref": "#/groups/2" + }, + { + "$ref": "#/groups/3" + }, + { + "$ref": "#/groups/4" + }, + { + "$ref": "#/texts/21" + }, + { + "$ref": "#/texts/22" + }, + { + "$ref": "#/texts/23" + }, + { + "$ref": "#/texts/24" + }, + { + "$ref": "#/key_value_items/0" + }, + { + "$ref": "#/form_items/0" + }, + { + "$ref": "#/groups/8" + }, + { + "$ref": "#/groups/9" + }, + { + "$ref": "#/groups/12" + }, + { + "$ref": "#/groups/14" + }, + { + "$ref": "#/groups/16" + }, + { + "$ref": "#/groups/18" + }, + { + "$ref": "#/texts/49" + }, + { + "$ref": "#/texts/51" + }, + { + "$ref": "#/tables/1" + }, + { + "$ref": "#/texts/53" + }, + { + "$ref": "#/texts/55" + }, + { + "$ref": "#/key_value_items/1" + }, + { + "$ref": "#/groups/19" + }, + { + "$ref": "#/texts/45" + }, + { + "$ref": "#/groups/20" + }, + { + "$ref": "#/form_items/1" + }, + { + "$ref": "#/texts/56" + }, + { + "$ref": "#/texts/54" + }, + { + "$ref": "#/pictures/1" + }, + { + "$ref": "#/texts/52" + }, + { + "$ref": "#/texts/50" + }, + { + "$ref": "#/texts/48" + }, + { + "$ref": "#/groups/17" + }, + { + "$ref": "#/groups/15" + }, + { + "$ref": "#/groups/13" + }, + { + "$ref": "#/texts/47" + } + ], + "content_layer": "body", + "name": "_root_", + "label": "unspecified" + }, + "groups": [ + { + "self_ref": "#/groups/0", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/0" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/7" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/3", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/8" + }, + { + "$ref": "#/texts/9" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/4", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/10" + }, + { + "$ref": "#/texts/11" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/5", + "parent": { + "$ref": "#/texts/11" + }, + "children": [ + { + "$ref": "#/texts/12" + }, + { + "$ref": "#/texts/13" + }, + { + "$ref": "#/texts/17" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/6", + "parent": { + "$ref": "#/texts/13" + }, + "children": [ + { + "$ref": "#/texts/14" + }, + { + "$ref": "#/texts/15" + }, + { + "$ref": "#/texts/16" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/7", + "parent": { + "$ref": "#/texts/17" + }, + "children": [ + { + "$ref": "#/texts/18" + }, + { + "$ref": "#/texts/19" + }, + { + "$ref": "#/texts/20" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/8", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/25" + }, + { + "$ref": "#/texts/26" + }, + { + "$ref": "#/texts/27" + }, + { + "$ref": "#/texts/28" + }, + { + "$ref": "#/texts/29" + }, + { + "$ref": "#/texts/30" + }, + { + "$ref": "#/texts/31" + }, + { + "$ref": "#/texts/32" + }, + { + "$ref": "#/texts/33" + }, + { + "$ref": "#/texts/34" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/9", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/35" + }, + { + "$ref": "#/texts/36" + }, + { + "$ref": "#/texts/37" + }, + { + "$ref": "#/texts/43" + } + ], + "content_layer": "body", + "name": "list A", + "label": "list" + }, + { + "self_ref": "#/groups/10", + "parent": { + "$ref": "#/texts/37" + }, + "children": [ + { + "$ref": "#/texts/38" + }, + { + "$ref": "#/texts/39" + }, + { + "$ref": "#/texts/42" + } + ], + "content_layer": "body", + "name": "list B", + "label": "list" + }, + { + "self_ref": "#/groups/11", + "parent": { + "$ref": "#/texts/39" + }, + "children": [ + { + "$ref": "#/texts/40" + }, + { + "$ref": "#/texts/41" + }, + { + "$ref": "#/texts/46" + } + ], + "content_layer": "body", + "name": "list C", + "label": "list" + }, + { + "self_ref": "#/groups/12", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/44" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/13", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted List Group", + "label": "list" + }, + { + "self_ref": "#/groups/14", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Inline Group", + "label": "inline" + }, + { + "self_ref": "#/groups/15", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/16", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ ORDERED_LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/17", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ INLINE Label", + "label": "inline" + }, + { + "self_ref": "#/groups/18", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ UNSPECIFIED Label", + "label": "unspecified" + }, + { + "self_ref": "#/groups/19", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/59" + }, + { + "$ref": "#/texts/57" + }, + { + "$ref": "#/texts/58" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/20", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/60" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + } + ], + "texts": [ + { + "self_ref": "#/texts/0", + "parent": { + "$ref": "#/groups/0" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item of leading list", + "text": "item of leading list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/2" + }, + { + "$ref": "#/texts/3" + } + ], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Title of the Document", + "text": "Title of the Document" + }, + { + "self_ref": "#/texts/2", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 1\nAffiliation 1", + "text": "Author 1\nAffiliation 1" + }, + { + "self_ref": "#/texts/3", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 2\nAffiliation 2", + "text": "Author 2\nAffiliation 2" + }, + { + "self_ref": "#/texts/4", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of table 1.", + "text": "This is the caption of table 1." + }, + { + "self_ref": "#/texts/5", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 1.", + "text": "This is the caption of figure 1." + }, + { + "self_ref": "#/texts/6", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 2.", + "text": "This is the caption of figure 2." + }, + { + "self_ref": "#/texts/7", + "parent": { + "$ref": "#/groups/1" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list", + "text": "item 1 of list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/8", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list after empty list", + "text": "item 1 of list after empty list", + "enumerated": false, + "marker": "*" + }, + { + "self_ref": "#/texts/9", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of list after empty list", + "text": "item 2 of list after empty list", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/10", + "parent": { + "$ref": "#/groups/4" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of neighboring list", + "text": "item 1 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/11", + "parent": { + "$ref": "#/groups/4" + }, + "children": [ + { + "$ref": "#/groups/5" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of neighboring list", + "text": "item 2 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/12", + "parent": { + "$ref": "#/groups/5" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of sub list", + "text": "item 1 of sub list", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/13", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/6" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/14", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code snippet:", + "text": "Here a code snippet:" + }, + { + "self_ref": "#/texts/15", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/16", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/17", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/7" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/18", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula:", + "text": "Here a formula:" + }, + { + "self_ref": "#/texts/19", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/20", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/21", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code block:", + "text": "Here a code block:" + }, + { + "self_ref": "#/texts/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula block:", + "text": "Here a formula block:" + }, + { + "self_ref": "#/texts/24", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/25", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Some formatting chops:", + "text": "Some formatting chops:" + }, + { + "self_ref": "#/texts/26", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "bold", + "text": "bold", + "formatting": { + "bold": true, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/27", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "italic", + "text": "italic", + "formatting": { + "bold": false, + "italic": true, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/28", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "underline", + "text": "underline", + "formatting": { + "bold": false, + "italic": false, + "underline": true, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/29", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "strikethrough", + "text": "strikethrough", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": true, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/30", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "subscript", + "text": "subscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "sub" + } + }, + { + "self_ref": "#/texts/31", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "superscript", + "text": "superscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "super" + } + }, + { + "self_ref": "#/texts/32", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "hyperlink", + "text": "hyperlink", + "hyperlink": "." + }, + { + "self_ref": "#/texts/33", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "&", + "text": "&" + }, + { + "self_ref": "#/texts/34", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "everything at the same time.", + "text": "everything at the same time.", + "formatting": { + "bold": true, + "italic": true, + "underline": true, + "strikethrough": true, + "script": "baseline" + }, + "hyperlink": "https://github.com/DS4SD/docling" + }, + { + "self_ref": "#/texts/35", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in A", + "text": "Item 1 in A", + "enumerated": true, + "marker": "(i)" + }, + { + "self_ref": "#/texts/36", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in A", + "text": "Item 2 in A", + "enumerated": true, + "marker": "(ii)" + }, + { + "self_ref": "#/texts/37", + "parent": { + "$ref": "#/groups/9" + }, + "children": [ + { + "$ref": "#/groups/10" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in A", + "text": "Item 3 in A", + "enumerated": true, + "marker": "(iii)" + }, + { + "self_ref": "#/texts/38", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in B", + "text": "Item 1 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/39", + "parent": { + "$ref": "#/groups/10" + }, + "children": [ + { + "$ref": "#/groups/11" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in B", + "text": "Item 2 in B", + "enumerated": true, + "marker": "42." + }, + { + "self_ref": "#/texts/40", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in C", + "text": "Item 1 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/41", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in C", + "text": "Item 2 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/42", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in B", + "text": "Item 3 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/43", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 4 in A", + "text": "Item 4 in A", + "enumerated": true, + "marker": "(iv)" + }, + { + "self_ref": "#/texts/44", + "parent": { + "$ref": "#/groups/12" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "List item without parent list group", + "text": "List item without parent list group", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/45", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "The end.", + "text": "The end." + }, + { + "self_ref": "#/texts/46", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "child text appended at body", + "text": "child text appended at body", + "enumerated": false, + "marker": "-" + }, + { + "self_ref": "#/texts/47", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "new child", + "text": "new child" + }, + { + "self_ref": "#/texts/48", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Text w/ TITLE Label", + "text": "Inserted Text w/ TITLE Label" + }, + { + "self_ref": "#/texts/49", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Text w/ SECTION_HEADER Label", + "text": "Inserted Text w/ SECTION_HEADER Label", + "level": 1 + }, + { + "self_ref": "#/texts/50", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Text w/ CODE Label", + "text": "Inserted Text w/ CODE Label", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/51", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Text w/ FORMULA Label", + "text": "Inserted Text w/ FORMULA Label" + }, + { + "self_ref": "#/texts/52", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Inserted Text w/ TEXT Label", + "text": "Inserted Text w/ TEXT Label" + }, + { + "self_ref": "#/texts/53", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Title", + "text": "Inserted Title" + }, + { + "self_ref": "#/texts/54", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Code", + "text": "Inserted Code", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/55", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Formula", + "text": "Inserted Formula" + }, + { + "self_ref": "#/texts/56", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Heading", + "text": "Inserted Heading", + "level": 1 + }, + { + "self_ref": "#/texts/57", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Incorrect Parent", + "text": "Inserted List Item, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/58", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Correct Parent", + "text": "Inserted List Item, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/59", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Correct Parent", + "text": "Inserted Text with LIST_ITEM Label, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/60", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "text": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "enumerated": false, + "marker": "" + } + ], + "pictures": [ + { + "self_ref": "#/pictures/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [ + { + "$ref": "#/texts/5" + } + ], + "references": [], + "footnotes": [], + "annotations": [] + }, + { + "self_ref": "#/pictures/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "image": { + "mimetype": "image/png", + "dpi": 72, + "size": { + "width": 64.0, + "height": 64.0 + }, + "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAIklEQVR4nO3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAA8G4wQAABiwCo9wAAAABJRU5ErkJggg==" + }, + "annotations": [] + } + ], + "tables": [ + { + "self_ref": "#/tables/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [ + { + "$ref": "#/texts/4" + } + ], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + }, + { + "self_ref": "#/tables/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + } + ], + "key_value_items": [ + { + "self_ref": "#/key_value_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/key_value_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "form_items": [ + { + "self_ref": "#/form_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/form_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "pages": {} +} \ No newline at end of file diff --git a/test/data/doc/constructed_doc.manipulated_table.json.gt b/test/data/doc/constructed_doc.manipulated_table.json.gt new file mode 100644 index 00000000..ce59e945 --- /dev/null +++ b/test/data/doc/constructed_doc.manipulated_table.json.gt @@ -0,0 +1,2190 @@ +{ + "schema_name": "DoclingDocument", + "version": "1.5.0", + "name": "Untitled 1", + "furniture": { + "self_ref": "#/furniture", + "children": [], + "content_layer": "furniture", + "name": "_root_", + "label": "unspecified" + }, + "body": { + "self_ref": "#/body", + "children": [ + { + "$ref": "#/groups/0" + }, + { + "$ref": "#/texts/1" + }, + { + "$ref": "#/texts/4" + }, + { + "$ref": "#/tables/0" + }, + { + "$ref": "#/texts/5" + }, + { + "$ref": "#/pictures/0" + }, + { + "$ref": "#/texts/6" + }, + { + "$ref": "#/groups/1" + }, + { + "$ref": "#/groups/2" + }, + { + "$ref": "#/groups/3" + }, + { + "$ref": "#/groups/4" + }, + { + "$ref": "#/texts/21" + }, + { + "$ref": "#/texts/22" + }, + { + "$ref": "#/texts/23" + }, + { + "$ref": "#/texts/24" + }, + { + "$ref": "#/key_value_items/0" + }, + { + "$ref": "#/form_items/0" + }, + { + "$ref": "#/groups/8" + }, + { + "$ref": "#/groups/9" + }, + { + "$ref": "#/groups/12" + }, + { + "$ref": "#/groups/14" + }, + { + "$ref": "#/groups/16" + }, + { + "$ref": "#/groups/18" + }, + { + "$ref": "#/texts/49" + }, + { + "$ref": "#/texts/51" + }, + { + "$ref": "#/tables/1" + }, + { + "$ref": "#/texts/53" + }, + { + "$ref": "#/texts/55" + }, + { + "$ref": "#/key_value_items/1" + }, + { + "$ref": "#/groups/19" + }, + { + "$ref": "#/texts/63" + }, + { + "$ref": "#/texts/64" + }, + { + "$ref": "#/texts/45" + }, + { + "$ref": "#/groups/20" + }, + { + "$ref": "#/form_items/1" + }, + { + "$ref": "#/texts/56" + }, + { + "$ref": "#/texts/54" + }, + { + "$ref": "#/pictures/1" + }, + { + "$ref": "#/texts/52" + }, + { + "$ref": "#/texts/50" + }, + { + "$ref": "#/texts/48" + }, + { + "$ref": "#/groups/17" + }, + { + "$ref": "#/groups/15" + }, + { + "$ref": "#/groups/13" + }, + { + "$ref": "#/texts/47" + } + ], + "content_layer": "body", + "name": "_root_", + "label": "unspecified" + }, + "groups": [ + { + "self_ref": "#/groups/0", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/0" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/7" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/2", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/3", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/8" + }, + { + "$ref": "#/texts/9" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/4", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/10" + }, + { + "$ref": "#/texts/11" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/5", + "parent": { + "$ref": "#/texts/11" + }, + "children": [ + { + "$ref": "#/texts/12" + }, + { + "$ref": "#/texts/13" + }, + { + "$ref": "#/texts/17" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/6", + "parent": { + "$ref": "#/texts/13" + }, + "children": [ + { + "$ref": "#/texts/14" + }, + { + "$ref": "#/texts/15" + }, + { + "$ref": "#/texts/16" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/7", + "parent": { + "$ref": "#/texts/17" + }, + "children": [ + { + "$ref": "#/texts/18" + }, + { + "$ref": "#/texts/19" + }, + { + "$ref": "#/texts/20" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/8", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/25" + }, + { + "$ref": "#/texts/26" + }, + { + "$ref": "#/texts/27" + }, + { + "$ref": "#/texts/28" + }, + { + "$ref": "#/texts/29" + }, + { + "$ref": "#/texts/30" + }, + { + "$ref": "#/texts/31" + }, + { + "$ref": "#/texts/32" + }, + { + "$ref": "#/texts/33" + }, + { + "$ref": "#/texts/34" + } + ], + "content_layer": "body", + "name": "group", + "label": "inline" + }, + { + "self_ref": "#/groups/9", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/35" + }, + { + "$ref": "#/texts/36" + }, + { + "$ref": "#/texts/37" + }, + { + "$ref": "#/texts/43" + } + ], + "content_layer": "body", + "name": "list A", + "label": "list" + }, + { + "self_ref": "#/groups/10", + "parent": { + "$ref": "#/texts/37" + }, + "children": [ + { + "$ref": "#/texts/38" + }, + { + "$ref": "#/texts/39" + }, + { + "$ref": "#/texts/42" + } + ], + "content_layer": "body", + "name": "list B", + "label": "list" + }, + { + "self_ref": "#/groups/11", + "parent": { + "$ref": "#/texts/39" + }, + "children": [ + { + "$ref": "#/texts/40" + }, + { + "$ref": "#/texts/41" + }, + { + "$ref": "#/texts/46" + } + ], + "content_layer": "body", + "name": "list C", + "label": "list" + }, + { + "self_ref": "#/groups/12", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/44" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/13", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted List Group", + "label": "list" + }, + { + "self_ref": "#/groups/14", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/61" + }, + { + "$ref": "#/texts/62" + } + ], + "content_layer": "body", + "name": "Inserted Inline Group", + "label": "inline" + }, + { + "self_ref": "#/groups/15", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/16", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ ORDERED_LIST Label", + "label": "list" + }, + { + "self_ref": "#/groups/17", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ INLINE Label", + "label": "inline" + }, + { + "self_ref": "#/groups/18", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "name": "Inserted Group w/ UNSPECIFIED Label", + "label": "unspecified" + }, + { + "self_ref": "#/groups/19", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/59" + }, + { + "$ref": "#/texts/57" + }, + { + "$ref": "#/texts/58" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + }, + { + "self_ref": "#/groups/20", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/60" + } + ], + "content_layer": "body", + "name": "group", + "label": "list" + } + ], + "texts": [ + { + "self_ref": "#/texts/0", + "parent": { + "$ref": "#/groups/0" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item of leading list", + "text": "item of leading list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/1", + "parent": { + "$ref": "#/body" + }, + "children": [ + { + "$ref": "#/texts/2" + }, + { + "$ref": "#/texts/3" + } + ], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Title of the Document", + "text": "Title of the Document" + }, + { + "self_ref": "#/texts/2", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 1\nAffiliation 1", + "text": "Author 1\nAffiliation 1" + }, + { + "self_ref": "#/texts/3", + "parent": { + "$ref": "#/texts/1" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Author 2\nAffiliation 2", + "text": "Author 2\nAffiliation 2" + }, + { + "self_ref": "#/texts/4", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of table 1.", + "text": "This is the caption of table 1." + }, + { + "self_ref": "#/texts/5", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 1.", + "text": "This is the caption of figure 1." + }, + { + "self_ref": "#/texts/6", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "caption", + "prov": [], + "orig": "This is the caption of figure 2.", + "text": "This is the caption of figure 2." + }, + { + "self_ref": "#/texts/7", + "parent": { + "$ref": "#/groups/1" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list", + "text": "item 1 of list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/8", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of list after empty list", + "text": "item 1 of list after empty list", + "enumerated": false, + "marker": "*" + }, + { + "self_ref": "#/texts/9", + "parent": { + "$ref": "#/groups/3" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of list after empty list", + "text": "item 2 of list after empty list", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/10", + "parent": { + "$ref": "#/groups/4" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of neighboring list", + "text": "item 1 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/11", + "parent": { + "$ref": "#/groups/4" + }, + "children": [ + { + "$ref": "#/groups/5" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 2 of neighboring list", + "text": "item 2 of neighboring list", + "enumerated": false, + "marker": "\u25a0" + }, + { + "self_ref": "#/texts/12", + "parent": { + "$ref": "#/groups/5" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "item 1 of sub list", + "text": "item 1 of sub list", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/13", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/6" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/14", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code snippet:", + "text": "Here a code snippet:" + }, + { + "self_ref": "#/texts/15", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/16", + "parent": { + "$ref": "#/groups/6" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/17", + "parent": { + "$ref": "#/groups/5" + }, + "children": [ + { + "$ref": "#/groups/7" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "", + "text": "", + "enumerated": false, + "marker": "\u25a1" + }, + { + "self_ref": "#/texts/18", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula:", + "text": "Here a formula:" + }, + { + "self_ref": "#/texts/19", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/20", + "parent": { + "$ref": "#/groups/7" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "(to be displayed inline)", + "text": "(to be displayed inline)" + }, + { + "self_ref": "#/texts/21", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a code block:", + "text": "Here a code block:" + }, + { + "self_ref": "#/texts/22", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "print(\"Hello world\")", + "text": "print(\"Hello world\")", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/23", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Here a formula block:", + "text": "Here a formula block:" + }, + { + "self_ref": "#/texts/24", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "E=mc^2", + "text": "E=mc^2" + }, + { + "self_ref": "#/texts/25", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Some formatting chops:", + "text": "Some formatting chops:" + }, + { + "self_ref": "#/texts/26", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "bold", + "text": "bold", + "formatting": { + "bold": true, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/27", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "italic", + "text": "italic", + "formatting": { + "bold": false, + "italic": true, + "underline": false, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/28", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "underline", + "text": "underline", + "formatting": { + "bold": false, + "italic": false, + "underline": true, + "strikethrough": false, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/29", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "strikethrough", + "text": "strikethrough", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": true, + "script": "baseline" + } + }, + { + "self_ref": "#/texts/30", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "subscript", + "text": "subscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "sub" + } + }, + { + "self_ref": "#/texts/31", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "superscript", + "text": "superscript", + "formatting": { + "bold": false, + "italic": false, + "underline": false, + "strikethrough": false, + "script": "super" + } + }, + { + "self_ref": "#/texts/32", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "hyperlink", + "text": "hyperlink", + "hyperlink": "." + }, + { + "self_ref": "#/texts/33", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "&", + "text": "&" + }, + { + "self_ref": "#/texts/34", + "parent": { + "$ref": "#/groups/8" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "everything at the same time.", + "text": "everything at the same time.", + "formatting": { + "bold": true, + "italic": true, + "underline": true, + "strikethrough": true, + "script": "baseline" + }, + "hyperlink": "https://github.com/DS4SD/docling" + }, + { + "self_ref": "#/texts/35", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in A", + "text": "Item 1 in A", + "enumerated": true, + "marker": "(i)" + }, + { + "self_ref": "#/texts/36", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in A", + "text": "Item 2 in A", + "enumerated": true, + "marker": "(ii)" + }, + { + "self_ref": "#/texts/37", + "parent": { + "$ref": "#/groups/9" + }, + "children": [ + { + "$ref": "#/groups/10" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in A", + "text": "Item 3 in A", + "enumerated": true, + "marker": "(iii)" + }, + { + "self_ref": "#/texts/38", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in B", + "text": "Item 1 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/39", + "parent": { + "$ref": "#/groups/10" + }, + "children": [ + { + "$ref": "#/groups/11" + } + ], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in B", + "text": "Item 2 in B", + "enumerated": true, + "marker": "42." + }, + { + "self_ref": "#/texts/40", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 1 in C", + "text": "Item 1 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/41", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 2 in C", + "text": "Item 2 in C", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/42", + "parent": { + "$ref": "#/groups/10" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 3 in B", + "text": "Item 3 in B", + "enumerated": true, + "marker": "" + }, + { + "self_ref": "#/texts/43", + "parent": { + "$ref": "#/groups/9" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Item 4 in A", + "text": "Item 4 in A", + "enumerated": true, + "marker": "(iv)" + }, + { + "self_ref": "#/texts/44", + "parent": { + "$ref": "#/groups/12" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "List item without parent list group", + "text": "List item without parent list group", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/45", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "The end.", + "text": "The end." + }, + { + "self_ref": "#/texts/46", + "parent": { + "$ref": "#/groups/11" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "child text appended at body", + "text": "child text appended at body", + "enumerated": false, + "marker": "-" + }, + { + "self_ref": "#/texts/47", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "new child", + "text": "new child" + }, + { + "self_ref": "#/texts/48", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Text w/ TITLE Label", + "text": "Inserted Text w/ TITLE Label" + }, + { + "self_ref": "#/texts/49", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Text w/ SECTION_HEADER Label", + "text": "Inserted Text w/ SECTION_HEADER Label", + "level": 1 + }, + { + "self_ref": "#/texts/50", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Text w/ CODE Label", + "text": "Inserted Text w/ CODE Label", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/51", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Text w/ FORMULA Label", + "text": "Inserted Text w/ FORMULA Label" + }, + { + "self_ref": "#/texts/52", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Inserted Text w/ TEXT Label", + "text": "Inserted Text w/ TEXT Label" + }, + { + "self_ref": "#/texts/53", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "title", + "prov": [], + "orig": "Inserted Title", + "text": "Inserted Title" + }, + { + "self_ref": "#/texts/54", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "code", + "prov": [], + "orig": "Inserted Code", + "text": "Inserted Code", + "captions": [], + "references": [], + "footnotes": [], + "code_language": "unknown" + }, + { + "self_ref": "#/texts/55", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "formula", + "prov": [], + "orig": "Inserted Formula", + "text": "Inserted Formula" + }, + { + "self_ref": "#/texts/56", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "section_header", + "prov": [], + "orig": "Inserted Heading", + "text": "Inserted Heading", + "level": 1 + }, + { + "self_ref": "#/texts/57", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Incorrect Parent", + "text": "Inserted List Item, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/58", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted List Item, Correct Parent", + "text": "Inserted List Item, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/59", + "parent": { + "$ref": "#/groups/19" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Correct Parent", + "text": "Inserted Text with LIST_ITEM Label, Correct Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/60", + "parent": { + "$ref": "#/groups/20" + }, + "children": [], + "content_layer": "body", + "label": "list_item", + "prov": [], + "orig": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "text": "Inserted Text with LIST_ITEM Label, Incorrect Parent", + "enumerated": false, + "marker": "" + }, + { + "self_ref": "#/texts/61", + "parent": { + "$ref": "#/groups/14" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 1", + "text": "Bulk Addition 1" + }, + { + "self_ref": "#/texts/62", + "parent": { + "$ref": "#/groups/14" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Addition 2", + "text": "Bulk Addition 2" + }, + { + "self_ref": "#/texts/63", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 1", + "text": "Bulk Insertion 1" + }, + { + "self_ref": "#/texts/64", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "text", + "prov": [], + "orig": "Bulk Insertion 2", + "text": "Bulk Insertion 2" + } + ], + "pictures": [ + { + "self_ref": "#/pictures/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [ + { + "$ref": "#/texts/5" + } + ], + "references": [], + "footnotes": [], + "annotations": [] + }, + { + "self_ref": "#/pictures/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "picture", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "image": { + "mimetype": "image/png", + "dpi": 72, + "size": { + "width": 64.0, + "height": 64.0 + }, + "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAIklEQVR4nO3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAA8G4wQAABiwCo9wAAAABJRU5ErkJggg==" + }, + "annotations": [] + } + ], + "tables": [ + { + "self_ref": "#/tables/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [ + { + "$ref": "#/texts/4" + } + ], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 3, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 2, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 3, + "text": "Years", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 2, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Product", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "2016", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2017", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "Apple", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "49823", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "695944", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + }, + { + "self_ref": "#/tables/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "table", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "data": { + "table_cells": [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "a", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "b", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "c", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + "num_rows": 4, + "num_cols": 3, + "grid": [ + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "0", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "1", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 0, + "end_row_offset_idx": 1, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "2", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "3", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "4", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 1, + "end_row_offset_idx": 2, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "5", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "6", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "7", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 2, + "end_row_offset_idx": 3, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "8", + "column_header": false, + "row_header": false, + "row_section": false + } + ], + [ + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 0, + "end_col_offset_idx": 1, + "text": "a", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 1, + "end_col_offset_idx": 2, + "text": "b", + "column_header": false, + "row_header": false, + "row_section": false + }, + { + "row_span": 1, + "col_span": 1, + "start_row_offset_idx": 3, + "end_row_offset_idx": 4, + "start_col_offset_idx": 2, + "end_col_offset_idx": 3, + "text": "c", + "column_header": false, + "row_header": false, + "row_section": false + } + ] + ] + }, + "annotations": [] + } + ], + "key_value_items": [ + { + "self_ref": "#/key_value_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/key_value_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "key_value_region", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "form_items": [ + { + "self_ref": "#/form_items/0", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + }, + { + "self_ref": "#/form_items/1", + "parent": { + "$ref": "#/body" + }, + "children": [], + "content_layer": "body", + "label": "form", + "prov": [], + "captions": [], + "references": [], + "footnotes": [], + "graph": { + "cells": [ + { + "label": "key", + "cell_id": 0, + "text": "number", + "orig": "#" + }, + { + "label": "value", + "cell_id": 1, + "text": "1", + "orig": "1" + } + ], + "links": [ + { + "label": "to_value", + "source_cell_id": 0, + "target_cell_id": 1 + }, + { + "label": "to_key", + "source_cell_id": 1, + "target_cell_id": 0 + } + ] + } + } + ], + "pages": {} +} \ No newline at end of file diff --git a/test/test_docling_doc.py b/test/test_docling_doc.py index a965d9ae..e1570e34 100644 --- a/test/test_docling_doc.py +++ b/test/test_docling_doc.py @@ -1649,6 +1649,253 @@ def test_document_manipulation(): filename = Path("test/data/doc/constructed_doc.replaced_item.json") _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + # Test insert_* methods with mixed insertion before/after sibling + + node = _resolve(doc=doc, cref="#/texts/45") + + last_node = doc.insert_list_group( + sibling=node, name="Inserted List Group", after=True + ) + group_node = doc.insert_inline_group( + sibling=node, name="Inserted Inline Group", after=False + ) + doc.insert_group( + sibling=node, + label=GroupLabel.LIST, + name="Inserted Group w/ LIST Label", + after=True, + ) + doc.insert_group( + sibling=node, + label=GroupLabel.ORDERED_LIST, + name="Inserted Group w/ ORDERED_LIST Label", + after=False, + ) + doc.insert_group( + sibling=node, + label=GroupLabel.INLINE, + name="Inserted Group w/ INLINE Label", + after=True, + ) + doc.insert_group( + sibling=node, + label=GroupLabel.UNSPECIFIED, + name="Inserted Group w/ UNSPECIFIED Label", + after=False, + ) + doc.insert_text( + sibling=node, + label=DocItemLabel.TITLE, + text="Inserted Text w/ TITLE Label", + after=True, + ) + doc.insert_text( + sibling=node, + label=DocItemLabel.SECTION_HEADER, + text="Inserted Text w/ SECTION_HEADER Label", + after=False, + ) + doc.insert_text( + sibling=node, + label=DocItemLabel.CODE, + text="Inserted Text w/ CODE Label", + after=True, + ) + doc.insert_text( + sibling=node, + label=DocItemLabel.FORMULA, + text="Inserted Text w/ FORMULA Label", + after=False, + ) + doc.insert_text( + sibling=node, + label=DocItemLabel.TEXT, + text="Inserted Text w/ TEXT Label", + after=True, + ) + + num_rows = 3 + num_cols = 3 + table_cells = [] + + for i in range(num_rows): + for j in range(num_cols): + table_cells.append( + TableCell( + start_row_offset_idx=i, + end_row_offset_idx=i + 1, + start_col_offset_idx=j, + end_col_offset_idx=j + 1, + text=str(i * num_rows + j), + ) + ) + + table_data = TableData( + table_cells=table_cells, num_rows=num_rows, num_cols=num_cols + ) + doc.insert_table(sibling=node, data=table_data, after=False) + + size = (64, 64) + img = PILImage.new("RGB", size, "black") + doc.insert_picture( + sibling=node, image=ImageRef.from_pil(image=img, dpi=72), after=True + ) + + doc.insert_title(sibling=node, text="Inserted Title", after=False) + doc.insert_code(sibling=node, text="Inserted Code", after=True) + doc.insert_formula(sibling=node, text="Inserted Formula", after=False) + doc.insert_heading(sibling=node, text="Inserted Heading", after=True) + + graph = GraphData( + cells=[ + GraphCell( + label=GraphCellLabel.KEY, + cell_id=0, + text="number", + orig="#", + ), + GraphCell( + label=GraphCellLabel.VALUE, + cell_id=1, + text="1", + orig="1", + ), + ], + links=[ + GraphLink( + label=GraphLinkLabel.TO_VALUE, + source_cell_id=0, + target_cell_id=1, + ), + GraphLink(label=GraphLinkLabel.TO_KEY, source_cell_id=1, target_cell_id=0), + ], + ) + + doc.insert_key_values(sibling=node, graph=graph, after=False) + doc.insert_form(sibling=node, graph=graph, after=True) + + filename = Path("test/data/doc/constructed_doc.inserted_items_with_insert_*.json") + _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + + # Test the handling of list items in insert_* methods, both with and without parent groups + + li_sibling = doc.insert_list_item( + sibling=node, text="Inserted List Item, Incorrect Parent", after=False + ) + doc.insert_list_item( + sibling=li_sibling, text="Inserted List Item, Correct Parent", after=True + ) + doc.insert_text( + sibling=li_sibling, + label=DocItemLabel.LIST_ITEM, + text="Inserted Text with LIST_ITEM Label, Correct Parent", + after=False, + ) + doc.insert_text( + sibling=node, + label=DocItemLabel.LIST_ITEM, + text="Inserted Text with LIST_ITEM Label, Incorrect Parent", + after=True, + ) + + filename = Path( + "test/data/doc/constructed_doc.inserted_list_items_with_insert_*.json" + ) + _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + + # Test the bulk addition of node items + + text_item_6 = TextItem( + self_ref="#", + text="Bulk Addition 1", + orig="Bulk Addition 1", + label=DocItemLabel.TEXT, + ) + text_item_7 = TextItem( + self_ref="#", + text="Bulk Addition 2", + orig="Bulk Addition 2", + label=DocItemLabel.TEXT, + ) + + doc.add_node_items( + node_items=[text_item_6, text_item_7], doc=doc, parent=group_node + ) + + filename = Path("test/data/doc/constructed_doc.bulk_item_addition.json") + _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + + # Test the bulk insertion of node items + + text_item_8 = TextItem( + self_ref="#", + text="Bulk Insertion 1", + orig="Bulk Insertion 1", + label=DocItemLabel.TEXT, + ) + text_item_9 = TextItem( + self_ref="#", + text="Bulk Insertion 2", + orig="Bulk Insertion 2", + label=DocItemLabel.TEXT, + ) + + doc.insert_node_items( + sibling=node, node_items=[text_item_8, text_item_9], doc=doc, after=False + ) + + filename = Path("test/data/doc/constructed_doc.bulk_item_insertion.json") + _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + + # Test table data manipulation methods + + table_data.add_row(["*"] * 3) + table_data.add_rows([["a", "b", "c"], ["d", "e", "f"]]) + table_data.insert_row(1, ["*"] * 3) + table_data.insert_rows(1, [["a", "b", "c"], ["d", "e", "f"]], after=True) + table_data.pop_row() + table_data.remove_row(3) + table_data.remove_rows([1, 2, 5]) + + # Try to remove a nonexistent row + with pytest.raises(IndexError): + table_data.remove_row(100) + + filename = Path("test/data/doc/constructed_doc.manipulated_table.json") + _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + + # Test range manipulation methods + + # Try to extract a range where start is after end + with pytest.raises(ValueError): + extracted_doc = doc.extract_items_range(start=node, end=group_node) + + # Try to extract a range where start and end have different parents + with pytest.raises(ValueError): + extracted_doc = doc.extract_items_range(start=li_sibling, end=node) + + extracted_doc = doc.extract_items_range( + start=group_node, end=node, end_inclusive=False, delete=True + ) + + filename = Path("test/data/doc/constructed_doc.extracted_with_deletion.json") + _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + + doc.add_document(doc=extracted_doc, parent=last_node) + + filename = Path("test/data/doc/constructed_doc.added_extracted_doc.json") + _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + + doc.insert_document(doc=extracted_doc, sibling=last_node, after=False) + + filename = Path("test/data/doc/constructed_doc.inserted_extracted_doc.json") + _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + + doc.delete_items_range(start=node, end=last_node, start_inclusive=False) + + filename = Path("test/data/doc/constructed_doc.deleted_items_range.json") + _verify(filename=filename, document=doc, generate=GEN_TEST_DATA) + def test_misplaced_list_items(): filename = Path("test/data/doc/misplaced_list_items.yaml")