MCPcopy
hub / github.com/VectifyAI/PageIndex / post_processing

Function post_processing

pageindex/utils.py:433–452  ·  view source on GitHub ↗
(structure, end_physical_index)

Source from the content-addressed store, hash-verified

431
432
433def post_processing(structure, end_physical_index):
434 # First convert page_number to start_index in flat list
435 for i, item in enumerate(structure):
436 item['start_index'] = item.get('physical_index')
437 if i < len(structure) - 1:
438 if structure[i + 1].get('appear_start') == 'yes':
439 item['end_index'] = structure[i + 1]['physical_index']-1
440 else:
441 item['end_index'] = structure[i + 1]['physical_index']
442 else:
443 item['end_index'] = end_physical_index
444 tree = list_to_tree(structure)
445 if len(tree)!=0:
446 return tree
447 else:
448 ### remove appear_start
449 for node in structure:
450 node.pop('appear_start', None)
451 node.pop('physical_index', None)
452 return structure
453
454def clean_structure_post(data):
455 if isinstance(data, dict):

Callers 2

tree_parserFunction · 0.85

Calls 1

list_to_treeFunction · 0.85

Tested by

no test coverage detected