AutopDftagger是一种专为高效的家庭办公室组织而设计的Python工具,专注于数字化和组织数字和基于纸张的文档。通过自动化PDF文件的标记,包括图像丰富的文档和质量不同的扫描,旨在简化数字档案的组织。
在进步的数字时代,现在以数字方式交付了许多文档,但大量文档通常仍以纸质形式到达。着眼于数字未来,将这些文档的整合到统一的数字档案馆中变得越来越有价值。使用智能手机摄像机进行简单扫描使其实用。但是,现有的OCR技术的可靠性及其有效索引非文本内容(如图纸或照片)的能力有限,这阻碍了这些文档的搜索性。 Autopdftagger的目的是通过提供AI辅助分析和PDF文件的组织,以与人类努力相当的精确度来提高其可搜索性和组织,从而弥合这一差距。
目前,存在具有Python模块的终端程序形式的功能原型,该原型展示了其功能,并且已经为我获得了令人印象深刻的结果。对于更广泛的应用程序,肯定需要进行许多详细的改进,尤其是在测试,提前优化,错误处理和文档中。
如果您发现此工具有帮助并有改进的想法,请随时做出贡献。虽然我不是全职程序员,但我根本不觉得专业,但欢迎任何建议或增强。提交错误报告,功能请求或任何其他反馈。感谢您停下来!
$ pip install git+https://github.com/Uli-Z/autoPDFtagger创建配置文件并将其保存到〜/.autopdftagger.conf :
; Configuration for autoPDFtagger
[DEFAULT]
language = {YOUR LANGUAGE}
[OPENAI-API]
API-Key = {INSERT YOUR API-KEY}该程序从根本上结构如下:
file analysis )text analysis )image analysis )tag analysis )注意:主要是(几乎)所有选项都是可组合的。但是,单个步骤的顺序是固定的。它们按上述顺序处理。取而代之的是,明确考虑了在终端中使用管道的使用,从而使数据库的状态传递到程序的另一个实例。这使得可以检查和修改每个步骤(例如,首次文本分析,然后按质量过滤,然后进行图像分析,然后重新过滤,最后导出PDF文件)。使用JSON-OUTPUT,可以将程序的结果直接输送到程序的另一个实例。
$ autoPDFtagger --help
usage: autoPDFtagger [-h] [--config-file CONFIG_FILE] [-b [BASE_DIRECTORY]] [-j [JSON]] [-s [CSV]] [-d {0,1,2}] [-f] [-t] [-i] [-c] [-e [EXPORT]] [-l]
[--keep-above [KEEP_ABOVE]] [--keep-below [KEEP_BELOW]] [--calc-stats]
[input_items ...]
Smart PDF-analyzing Tool
positional arguments:
input_items List of input PDFs and folders, alternativly you can use a JSON- or CSV-file
options:
-h , --help show this help message and exit
--config-file CONFIG_FILE
Specify path to configuration file. Defaults to ~ /.autoPDFtagger.conf
-b [BASE_DIRECTORY], --base-directory [BASE_DIRECTORY]
Set base directory
-j [JSON], --json [JSON]
Output JSON-Database to stdout. If filename provided, save it to file
-s [CSV], --csv [CSV]
Output CSV-Database to specified file
-d {0,1,2}, --debug {0,1,2}
Debug level (0: no debug, 1: basic debug, 2: detailed debug)
-f , --file-analysis Try to conventionally extract metadata from file, file name and folder structure
-t , --ai-text-analysis
Do an AI text analysis
-i, --ai-image-analysis
Do an AI image analysis
-c , --ai-tag-analysis
Do an AI tag analysis
-e [EXPORT], --export [EXPORT]
Copy Documents to a target folder
-l, --list List documents stored in database
--keep-above [KEEP_ABOVE]
Before applying actions, filter out and retain only the documents with a confidence index greater than or equal to a specific
value (default: 7).
--keep-below [KEEP_BELOW]
Analogous to --keep-above. Retain only document with an index less than specified.
--calc-stats Calculate statistics and (roughly ! ) estimate costs for different analyses从文件夹pdf_archive ,进行基本文件分析(-f)中读取所有PDF文件,然后将信息存储在JSON-DABASE FILE..JSON (-J [FILENAME])中:
$ autoPDFtagger ./pdf_archive --file-analysis --json allfiles.json阅读先前创建的JSON数据库和进行AI-Text-Analysis,将结果存储在新的JSON文件中
$ autoPDFtagger allfiles.json --ai-text-analysis --json textanalysis.json对所有具有估计低质量元数据的文件进行AI图像分析。
$ autoPDFtagger textanalysis.json --keep-below --ai-image-analysis --json imageanalysis.json共同收集全部,分析和组织标签
$ autoPDFtagger textanalysis.json imageanalysis.json --ai-tag-analysis --json final.json将文件复制到新文件夹new_archive设置新元数据并分配新文件名。原始文件夹结构保持不变。
$ autoPDFtagger final.json -e ./new_archive立刻做所有事情:
$ autoPDFtagger pdf_archive -ftic -e new_archivemain.py :应用程序的终端接口。autoPDFtagger.py :管理工具的核心功能。AIAgents.py代理管理的基础类,包括OpenAI API通信。AIAgents_OPENAI_pdf.py :专用于文本,图像和标签分析的特定AI代理。PDFDocument.py :处理单个PDF文档,管理元数据读写。PDFList.py :监督PDF文档,其元数据的数据库,并提供导出功能。config.py :管理配置文件。autoPDFtagger_example_config.conf :一个示例配置文件,概述了API键设置和其他设置。 GPL-3