docs: 添加涉密文件自检工具实施计划
This commit is contained in:
22
UmiOCR-data/py_src/ocr/tbpu/parser_multi_line.py
Normal file
22
UmiOCR-data/py_src/ocr/tbpu/parser_multi_line.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# 排版解析-多栏-单行
|
||||
|
||||
from .tbpu import Tbpu
|
||||
from .parser_tools.line_preprocessing import linePreprocessing # 行预处理
|
||||
from .parser_tools.gap_tree import GapTree # 间隙树排序算法
|
||||
|
||||
|
||||
class MultiLine(Tbpu):
|
||||
def __init__(self):
|
||||
self.tbpuName = "排版解析-多栏-单行"
|
||||
|
||||
# 构建算法对象,指定包围盒的元素位置
|
||||
self.gtree = GapTree(lambda tb: tb["normalized_bbox"])
|
||||
|
||||
def run(self, textBlocks):
|
||||
textBlocks = linePreprocessing(textBlocks) # 预处理
|
||||
textBlocks = self.gtree.sort(textBlocks) # 构建间隙树
|
||||
# 补充行尾间隔符
|
||||
for tb in textBlocks:
|
||||
tb["end"] = "\n"
|
||||
del tb["normalized_bbox"]
|
||||
return textBlocks
|
||||
Reference in New Issue
Block a user