r""" Post-process the ocr and programmatic cells and return the final list of of cells
(self, ocr_cells, programmatic_cells)
| 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) |