Add FireRed OCR comparison and preserve attribution layout
This commit is contained in:
@@ -13,12 +13,15 @@ def main():
|
||||
parser.add_argument('source',type=Path);parser.add_argument('--output',required=True,type=Path)
|
||||
parser.add_argument('--work',required=True,type=Path);parser.add_argument('--language',choices=['zh-CN','en'],required=True)
|
||||
parser.add_argument('--title');parser.add_argument('--author');parser.add_argument('--pages',help='1-based inclusive selection, e.g. 1-30,40; output is explicitly partial')
|
||||
parser.add_argument('--ocr',choices=['auto','native','vision','tesseract'],default='auto')
|
||||
parser.add_argument('--ocr',choices=['auto','native','vision','tesseract','firered'],default='auto')
|
||||
parser.add_argument('--dpi',type=int,default=180);parser.add_argument('--cover-page',type=int);parser.add_argument('--image-pages',help='Preserve chosen illustration/title/back-cover pages as images, e.g. 2,13,476')
|
||||
parser.add_argument('--corrections',type=Path,help='Source SHA-bound, exact OCR line corrections JSON')
|
||||
parser.add_argument('--ocr-url',help='Explicit local OpenAI-compatible OCR endpoint')
|
||||
parser.add_argument('--ocr-model',default='firered-ocr');parser.add_argument('--ocr-prompt',type=Path)
|
||||
parser.add_argument('--geometry-work',type=Path,help='Optional matching Vision page cache for geometry only')
|
||||
args=parser.parse_args()
|
||||
try:
|
||||
report=convert(args.source,args.output,args.work,args.language,args.title,args.author,args.ocr,args.pages,args.dpi,args.cover_page,image_pages=args.image_pages,corrections=args.corrections)
|
||||
report=convert(args.source,args.output,args.work,args.language,args.title,args.author,args.ocr,args.pages,args.dpi,args.cover_page,image_pages=args.image_pages,corrections=args.corrections,ocr_url=args.ocr_url,ocr_model=args.ocr_model,ocr_prompt=args.ocr_prompt,geometry_work=args.geometry_work)
|
||||
except (ValueError,RuntimeError,ImportError,OSError) as exc:
|
||||
parser.exit(1,f'PDF import failed: {exc}\n')
|
||||
print(json.dumps({k:report[k] for k in ['output','partial','processed_pages','source_pages','engines']},ensure_ascii=False))
|
||||
|
||||
Reference in New Issue
Block a user