MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / post_process_cells

Method post_process_cells

docling/models/base_ocr_model.py:122–137  ·  view source on GitHub ↗

r""" Post-process the ocr and programmatic cells and return the final list of of cells

(self, ocr_cells, programmatic_cells)

Source from the content-addressed store, hash-verified

120 return filtered_ocr_cells
121
122 def post_process_cells(self, ocr_cells, programmatic_cells):
123 r"""
124 Post-process the ocr and programmatic cells and return the final list of of cells
125 """
126 if self.options.force_full_page_ocr:
127 # If a full page OCR is forced, use only the OCR cells
128 cells = [
129 Cell(id=c_ocr.id, text=c_ocr.text, bbox=c_ocr.bbox)
130 for c_ocr in ocr_cells
131 ]
132 return cells
133
134 ## Remove OCR cells which overlap with programmatic cells.
135 filtered_ocr_cells = self._filter_ocr_cells(ocr_cells, programmatic_cells)
136 programmatic_cells.extend(filtered_ocr_cells)
137 return programmatic_cells
138
139 def draw_ocr_rects_and_cells(self, conv_res, page, ocr_rects, show: bool = False):
140 image = copy.deepcopy(page.image)

Callers 5

__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45

Calls 2

_filter_ocr_cellsMethod · 0.95
CellClass · 0.90

Tested by

no test coverage detected