n8n-nodes-extract-pdf
Version:
n8n node to extract text, images and tables from PDF with multilingual support, language detection and comprehensive test suite
50 lines (49 loc) • 2.12 kB
TypeScript
/**
* Module xử lý OCR cho ExtractPdfNode
* @author AI Assistant
* @version 1.0.0
*/
import type { OcrOptions, OcrResult } from '../types';
/**
* Thực hiện OCR trên tệp PDF với cải tiến hiệu suất
*/
export declare function performOcrOnPdf(filePath: string, pageNumbers: number[], options?: OcrOptions): Promise<OcrResult>;
/**
* Trích xuất script từ dữ liệu OSD (Orientation and Script Detection)
* @param osdData Dữ liệu OSD từ Tesseract
* @returns Mã script đã trích xuất hoặc undefined nếu không tìm thấy
*/
export declare function extractScriptFromOSD(osdData: any): string | undefined;
/**
* Ánh xạ script tới ngôn ngữ Tesseract phù hợp
* @param script Mã script
* @returns Mã ngôn ngữ Tesseract
*/
export declare function mapScriptToLanguage(script?: string): string;
/**
* Thực hiện OCR đa ngôn ngữ trên một hình ảnh
* @param imagePath Đường dẫn đến hình ảnh
* @param languages Mảng mã ngôn ngữ cần nhận dạng
* @returns Văn bản đã trích xuất
*/
export declare function performMultilingualOCR(imagePath: string, languages?: string[]): Promise<string>;
/**
* Nâng cao kết quả OCR bằng AI
* @param text Văn bản cần nâng cao
* @param language Mã ngôn ngữ
* @param correctionLevel Mức độ sửa lỗi ('low', 'medium', 'high')
* @returns Văn bản đã nâng cao
*/
export declare function enhanceOcrWithAI(text: string, language?: string, correctionLevel?: string): Promise<string>;
/**
* Tạo thống kê ngôn ngữ từ văn bản
* @param text Văn bản cần phân tích
* @returns Thống kê tần suất ngôn ngữ
*/
export declare function generateLanguageStatistics(text: string): Promise<Record<string, number>>;
/**
* Nâng cao chất lượng hình ảnh để cải thiện OCR
* @param imagePath Đường dẫn đến hình ảnh
* @returns Đường dẫn đến hình ảnh đã cải thiện
*/
export declare function enhanceImageForOcr(imagePath: string): Promise<string>;