unstructured
unstructured 是开源的非结构化数据预处理工具。
核验日期
核心信息
以下信息由程序从官方接口读取,不经模型改写。
- 许可证
- Apache-2.0
- 语言
- HTML
- 维护方
- Unstructured-IO
- 核验日期
它是什么
unstructured 是开源的非结构化数据预处理工具。unstructured 库提供开源组件,用于摄取和预处理图像与文本文档,例如 PDF、HTML、Word 文档。项目方表示,这个开源库完全免费,并将一直保持免费。
主要能力
使用 partition 函数时,unstructured 会检测文件类型,并将其路由到相应的特定文件类型分区函数。
使用 partition 函数时,可能需要按文档类型安装额外的依赖。
项目构建多平台镜像,以支持 x86_64 和 Apple silicon 硬件。
每次推送到 main,项目都会构建 Docker 镜像。
项目提供可选的 pre-commit 配置。
除了在本地操作系统中开发,项目还提供一个使用 docker 的辅助工具,用来提供开发环境。
怎么上手
对于不需要额外依赖的纯文本文件、HTML、XML、JSON 和电子邮件,可以安装基础包 unstructured。
处理其他文档类型时,可以安装这些文档所需的附加项,例如 docx 和 pptx。
用户也可以构建自己的 Docker 镜像。
拉取镜像后,可以从该镜像创建容器并进入其 shell。
进入运行中的容器后,可以在 Python 解释器的交互模式中直接尝试。
docker pull downloads.unstructured.io/unstructured-io/unstructured:latest# create the container
docker run -dt --name unstructured downloads.unstructured.io/unstructured-io/unstructured:latest
# this will drop you into a bash shell where the Docker image is running
docker exec -it unstructured bashmake docker-build
# this will drop you into a bash shell where the Docker image is running
make docker-start-bash# this will drop you into a python console so you can run the below partition functions
python3
>>> from unstructured.partition.pdf import partition_pdf
>>> elements = partition_pdf(filename="example-docs/layout-parser-paper-fast.pdf")
>>> from unstructured.partition.text import partition_text
>>> elements = partition_text(filename="example-docs/fake-text.txt")from unstructured.partition.auto import partition
elements = partition(filename="example-docs/eml/fake-email.eml")
print("\n\n".join([str(el) for el in elements]))适合谁
libmagic-dev 用于文件类型检测。poppler-utils 用于图像和 PDF。tesseract-ocr 用于图像和 PDF,安装 tesseract-lang 可获得额外的语言支持。
libreoffice 用于 MS Office 文档。pandoc 通过 pypandoc-binary Python 包自动捆绑,无需系统安装。在本地开发安装的可选项中,处理图像文件需要 tesseract。
在本地开发安装的可选项中,处理 PDF 文件需要 tesseract 和 poppler。unstructured 的运行时事件包含包版本、规范化的平台、Python 和架构值、固定枚举的分区特征以及最终元素的汇总数量,这些内容作为 URL 查询参数发送,没有请求体。运行时事件从不包含文档或元素内容、文件名、路径、为分区提供的 URL、原始 MIME 值、异常详情、凭据、代理配置,也不包含持久的安装、机器、进程、账户、用户或开发者标识符。
在导入或分区之前,将 DO_NOT_TRACK 或 SCARF_NO_ANALYTICS 设置为去除空白后的非空值,例如 true、1、yes、false 或 0,任一变量都会同时禁用库加载遥测和运行时遥测。最多只有一个遥测守护线程可以滞留在网络操作中。
来源
本页内容整理自以下官方来源,点击可核对原文。
- GitHub READMEhttps://github.com/Unstructured-IO/unstructured抓取于
核验日期 ·
本页由 AI 依据上述官方来源整理,并经自动核对,未经本站实测。 发现错误?告诉我们。