magic_model.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. class MagicModel():
  2. """
  3. 每个函数没有得到元素的时候返回空list
  4. """
  5. def __fix_axis():
  6. # TODO 计算
  7. self.__model_list = xx
  8. def __init__(model_list:list, doc:Fitz.Document):
  9. self.__model_list = model_list
  10. self.__fix_axis()
  11. self.__doc = doc
  12. def get_imgs(self, page_no:int): # @许瑞
  13. image_block = {
  14. }
  15. image_block['bbox'] = [x0, y0, x1, y1]# 计算出来
  16. image_block['img_body_bbox'] = [x0, y0, x1, y1]
  17. image_blcok['img_caption_bbox'] = [x0, y0, x1, y1] # 如果没有就是None,但是保证key存在
  18. image_blcok['img_caption_text']= [x0, y0, x1, y1] # 如果没有就是空字符串,但是保证key存在
  19. return [image_block,]
  20. def get_tables(self, page_no:int) ->list: # 3个坐标, caption, table主体,table-note
  21. pass # 许瑞, 结构和image一样
  22. def get_equations(self, page_no:int)->list: # 有坐标,也有字
  23. return inline_equations, interline_equations # @凯文
  24. def get_discarded(self, page_no:int)->list: # 自研模型,只有坐标
  25. pass # @凯文
  26. def get_text_blocks(self, page_no:int)->list: # 自研模型搞的,只有坐标,没有字
  27. pass # @凯文
  28. def get_title_blocks(self, page_no:int)->list: # 自研模型,只有坐标,没字
  29. pass # @凯文
  30. def get_ocr_text(self, page_no:int)->list: # paddle 搞的,有字也有坐标
  31. pass # @小蒙
  32. def get_ocr_spans(self, page_no:int)->list:
  33. pass # @小蒙