|
|
@@ -316,7 +316,7 @@ def parse_mineru_data(data: List, config: Dict, tool_name="mineru") -> List[Dict
|
|
|
parsed_data.append({
|
|
|
'text': str(text).strip(),
|
|
|
'bbox': bbox[:4],
|
|
|
- 'category': 'text',
|
|
|
+ 'category': category,
|
|
|
'confidence': confidence,
|
|
|
'source_tool': tool_name,
|
|
|
'text_level': item.get('text_level', 0) # 保留文本层级信息
|
|
|
@@ -337,6 +337,27 @@ def parse_mineru_data(data: List, config: Dict, tool_name="mineru") -> List[Dict
|
|
|
'img_path': img_path,
|
|
|
'table_body': table_html
|
|
|
})
|
|
|
+ elif category == 'image':
|
|
|
+ img_path = item.get(tool_config.get('img_path_field', 'img_path'), '')
|
|
|
+ if bbox and len(bbox) >= 4:
|
|
|
+ parsed_data.append({
|
|
|
+ 'text': '[Image]',
|
|
|
+ 'bbox': bbox[:4],
|
|
|
+ 'category': 'image',
|
|
|
+ 'confidence': confidence,
|
|
|
+ 'source_tool': tool_name,
|
|
|
+ 'img_path': img_path
|
|
|
+ })
|
|
|
+ else:
|
|
|
+ # 其他类型,按文本处理, header, table_cell, ...
|
|
|
+ if text and bbox and len(bbox) >= 4:
|
|
|
+ parsed_data.append({
|
|
|
+ 'text': str(text).strip(),
|
|
|
+ 'bbox': bbox[:4],
|
|
|
+ 'category': category,
|
|
|
+ 'confidence': confidence,
|
|
|
+ 'source_tool': tool_name
|
|
|
+ })
|
|
|
|
|
|
return parsed_data
|
|
|
|