/** * 表格识别(结构 + 单元格 + 单元格文本) * 通过 DI 复用共享 TextDetector/TextRecognizer(不再各自 new) */ import type { OcrImageData, PaddleOcrOptions, TableResult, TextBox, TextLine } from "../typings"; import { BaseRecognizer } from "./baseRecognizer"; export declare class TableRecognizer extends BaseRecognizer { private textDetector?; private textRecognizer?; /** DI 共享:调用方传入全局的 detector/recognizer */ constructor(options: PaddleOcrOptions, textDetector?: { detect(image: OcrImageData): Promise; } | undefined, textRecognizer?: { recognize(image: OcrImageData, boxes?: TextBox[]): Promise; } | undefined); init(): Promise; recognize(image: OcrImageData): Promise; /** 由结构线生成单元格 bbox */ private expandCells; /** 对每个单元格做文本识别 */ private fillCells; private build; }