A fast, helpful, and open-source document parser
format
Logan Markewich2d9723a13450
diff --git a/cli/parse.ts b/cli/parse.tsindex 066c14e..b08b907 100644--- a/cli/parse.ts+++ b/cli/parse.ts@@ -70,7 +70,10 @@ program.option("--ocr-server-url <url>", "HTTP OCR server URL (uses Tesseract if not provided)").option("--no-ocr", "Disable OCR").option("--ocr-language <lang>", "OCR language(s)", DEFAULT_LANGUAGE)- .option("--num-workers <n>", "Number of pages to OCR in parallel. Defaults to number of CPU cores minus one.")+ .option(+ "--num-workers <n>",+ "Number of pages to OCR in parallel. Defaults to number of CPU cores minus one."+ ).option("--max-pages <n>", "Max pages to parse", DEFAULT_MAX_PAGES.toString()).option("--target-pages <pages>", 'Target pages (e.g., "1-5,10,15-20")').option("--dpi <dpi>", "DPI for rendering", DEFAULT_DPI.toString())@@ -290,7 +293,10 @@ program.option("--ocr-server-url <url>", "HTTP OCR server URL (uses Tesseract if not provided)").option("--no-ocr", "Disable OCR").option("--ocr-language <lang>", "OCR language(s)", DEFAULT_LANGUAGE)- .option("--num-workers <n>", "Number of pages to OCR in parallel. Defaults to number of CPU cores minus one.")+ .option(+ "--num-workers <n>",+ "Number of pages to OCR in parallel. Defaults to number of CPU cores minus one."+ ).option("--max-pages <n>", "Max pages to parse per file", DEFAULT_MAX_PAGES.toString()).option("--dpi <dpi>", "DPI for rendering", DEFAULT_DPI.toString()).option("--no-precise-bbox", "Disable precise bounding boxes")diff --git a/src/core/parser.ts b/src/core/parser.tsindex b3d80f3..b4cce20 100644--- a/src/core/parser.ts+++ b/src/core/parser.ts@@ -200,9 +200,7 @@ export class LiteParse {const limit = pLimit(this.config.numWorkers);- await Promise.all(- pages.map((page) => limit(() => this.processPageOcr(doc, page, log)))- );+ await Promise.all(pages.map((page) => limit(() => this.processPageOcr(doc, page, log))));}/**@@ -231,11 +229,7 @@ export class LiteParse {try {// Render page as image- const imageBuffer = await this.pdfEngine.renderPageImage(- doc,- page.pageNum,- this.config.dpi- );+ const imageBuffer = await this.pdfEngine.renderPageImage(doc, page.pageNum, this.config.dpi);// Save temporary image fileconst fs = await import("fs/promises");diff --git a/src/engines/ocr/tesseract.ts b/src/engines/ocr/tesseract.tsindex 77b75fc..271c6d1 100644--- a/src/engines/ocr/tesseract.ts+++ b/src/engines/ocr/tesseract.ts@@ -86,9 +86,7 @@ export class TesseractEngine implements OcrEngine {}// Process all images in parallel - scheduler handles distribution- const jobs = imagePaths.map((imagePath) =>- this.recognize(imagePath, options)- );+ const jobs = imagePaths.map((imagePath) => this.recognize(imagePath, options));return Promise.all(jobs);}