除 pip 包外还需按文档类型装系统依赖,如 libmagic-dev、poppler-utils、tesseract-ocr、libreoffice;只装 unstructured 基础包时仅支持纯文本、HTML、XML、JSON 和邮件;本地开发用 uv 管理依赖,需先装 uv 再执行 make install。
unstructured
Unstructured-IOApache-2.0活跃维护把 PDF、DOCX、图片等复杂文档解析成干净结构化数据,方便喂给语言模型做 RAG 和检索。
Convert documents to structured data effortlessly. Unstructured is open-source ETL solution for transforming complex documents into clean, structured formats for language models. Visit our website to learn more about our enterprise grade Platform product for production grade workflows, partitioning, enrichments, chunking and embedding.
pip install "unstructured[all-docs]"
from unstructured.partition.auto import partition
elements = partition(filename="example-docs/eml/fake-email.eml")README 未说明显存或 GPU 要求;解析图片和 PDF 依赖 tesseract-ocr 与 poppler-utils,属于 CPU 侧的系统依赖。
开源文档 ETL 库,把 PDF、Word、HTML 等复杂文档解析成结构化元素,供 LLM 使用
把 PDF、DOCX、图片等复杂文档解析成干净结构化数据,方便喂给语言模型做 RAG 和检索。
核心能力
- 用 partition 自动识别文件类型并切分为结构化元素
- 支持 PDF、HTML、Word、图片、邮件等多种文档格式
- 按文档类型安装可选依赖,如 unstructured[docx,pptx]
- 提供连接器与模块化函数,串联数据摄取与预处理流程
- 附带 Docker 开发环境,可挂载本地仓库调试
容易踩的坑
- 0.27.37最新正式版2026-11-06 · 2026-11-06 21:29 UTC
What's Changed
Fixes
- fix(lang): keep the languages a caller passes on short ASCII text by @chrikrah in https://github.com/Unstructured-IO/unstructured/pull/4601
- fix(pdf): extract vector-heavy PDFs with the fast strategy instead of returning nothing by @CyMule in https://github.com/Unstructured-IO/unstructured/pull/4540
- fix(cleaners): stop swapping en and em dashes in replace_unicode_quotes by @chrikrah in https://github.com/Unstructured-IO/unstructured/pull/4654
Other changes
- chore: start 0.27.37-dev after 0.27.36 release by @ryannikolaidis in https://github.com/Unstructured-IO/unstructured/pull/4634
- fix(pptx): keep visible text in translated, scaled and nested groups by @feiiiiii5 in https://github.com/Unstructured-IO/unstructured/pull/4619
- fix(metrics): read evaluation files as UTF-8 on every platform by @tanishqbaweja in https://github.com/Unstructured-IO/unstructured/pull/4623
- fix(deps): require filelock>=4.2.1 for GHSA-v4x8-3wr5-3wq8 by @tanishqbaweja in https://github.com/Unstructured-IO/unstructured/pull/4628
- fix(html): render each Title at its own heading level in elements_to_html by @tanishqbaweja in https://github.com/Unstructured-IO/unstructured/pull/4627
- fix(json): accept non-seekable streams while preserving legacy adapters by @Zhi-Xiang-Guo in https://github.com/Unstructured-IO/unstructured/pull/4649
- fix(docx): keep text that python-docx skips inside wrapper elements by @qued in https://github.com/Unstructured-IO/unstructured/pull/4661
- fix(documents): count the hash-id sequence number per page, not per contiguous run by @Eapp1e in https://github.com/Unstructured-IO/unstructured/pull/4621
- fix(coordinates): default CoordinateSystem.orientation to CARTESIAN by @Eapp1e in https://github.com/Unstructured-IO/unstructured/pull/4615
- chore: release 0.27.37 by @qued in https://github.com/Unstructured-IO/unstructured/pull/4668
New Contributors
- @Zhi-Xiang-Guo made their first contribution in https://github.com/Unstructured-IO/unstructured/pull/4649
Full Changelog: https://github.com/Unstructured-IO/unstructured/compare/0.27.36...0.27.37
- 0.27.362026-10-30 · 2026-10-30 00:57 UTC
查看更新说明
What's Changed
Other changes
- chore: start 0.27.36-dev after 0.27.35 release by @ryannikolaidis in https://github.com/Unstructured-IO/unstructured/pull/4607
- fix(xml): keep text that runs through child elements by @L4XB in https://github.com/Unstructured-IO/unstructured/pull/4573
- fix(pptx): filter off-slide shapes by how much of the box is visible by @feiiiiii5 in https://github.com/Unstructured-IO/unstructured/pull/4604
- fix(html_table): keep a declared rowspan of zero on empty cells by @Eapp1e in https://github.com/Unstructured-IO/unstructured/pull/4611
- fix(utils): detect temp files by path containment, not name prefix by @Eapp1e in https://github.com/Unstructured-IO/unstructured/pull/4609
- fix(ocr): expand an inferred list element into one element per item by @Eapp1e in https://github.com/Unstructured-IO/unstructured/pull/4617
- fix(pdf): keep FAST partitioning independent of ONNX load failures by @fallenmi in https://github.com/Unstructured-IO/unstructured/pull/4600
- fix: switch
skip_infer_table_typesdefault toNoneby @TrueFurina in https://github.com/Unstructured-IO/unstructured/pull/4464 - fix(filetype): detect the file type when the content type is application/octet-stream by @tanishqbaweja in https://github.com/Unstructured-IO/unstructured/pull/4625
- fix(partition): classify text as an address only when all of it is one by @Eapp1e in https://github.com/Unstructured-IO/unstructured/pull/4630
- fix: tolerate a dangling DOCX header/footer relationship instead of crashing by @aballman in https://github.com/Unstructured-IO/unstructured/pull/4624
- chore: release 0.27.36 by @aballman in https://github.com/Unstructured-IO/unstructured/pull/4631
New Contributors
- @Eapp1e made their first contribution in https://github.com/Unstructured-IO/unstructured/pull/4611
- @fallenmi made their first contribution in https://github.com/Unstructured-IO/unstructured/pull/4600
- @tanishqbaweja made their first contribution in https://github.com/Unstructured-IO/unstructured/pull/4625
Full Changelog: https://github.com/Unstructured-IO/unstructured/compare/0.27.35...0.27.36
- 0.27.352026-10-27 · 2026-10-27 00:32 UTC
查看更新说明
What's Changed
Other changes
- chore: replace per-PR changelog edits with generated release notes by @cragwolfe in https://github.com/Unstructured-IO/unstructured/pull/4578
- fix(utils): compare bounding boxes for elements with no page number by @simpleqt in https://github.com/Unstructured-IO/unstructured/pull/4561
- fix(chunking): measure combine thresholds in tokens when max_tokens is set by @joaquinhuigomez in https://github.com/Unstructured-IO/unstructured/pull/4528
- ci: guard release versions without blocking ordinary PRs by @cragwolfe in https://github.com/Unstructured-IO/unstructured/pull/4589
- fix(xml): honor explicit encodings when extracting text by @JackyHsu-X in https://github.com/Unstructured-IO/unstructured/pull/4572
- fix(msg): read the Cc, Bcc and Message-ID headers in any letter case by @L4XB in https://github.com/Unstructured-IO/unstructured/pull/4579
- fix(tsv): honor infer_table_structure when partitioning TSV files by @feiiiiii5 in https://github.com/Unstructured-IO/unstructured/pull/4513
- fix(msg): keep a comma in a quoted sender or recipient name by @RaphaelFakhri in https://github.com/Unstructured-IO/unstructured/pull/4570
- fix(xlsx): keep cell text like N/A and None instead of emptying it by @wenqiw777 in https://github.com/Unstructured-IO/unstructured/pull/4505
- feat: expose the DOCX paragraph style name in element metadata by @Ei-Ayw in https://github.com/Unstructured-IO/unstructured/pull/4591
- fix(text): keep a bulleted list that follows its lead-in line as list items by @L4XB in https://github.com/Unstructured-IO/unstructured/pull/4580
- fix(image): charge GIF frames at the canvas size Pillow decodes them at by @badGarnet in https://github.com/Unstructured-IO/unstructured/pull/4526
- fix(utils): recognize a box nested when the tolerance is zero by @SashaMIT in https://github.com/Unstructured-IO/unstructured/pull/4507
- perf(pdf): hi_res read every page with pdfminer just to learn whether the PDF has text by @CyMule in https://github.com/Unstructured-IO/unstructured/pull/4588
- fix(csv): read a line break in a quoted CSV or TSV cell as whitespace, not a literal \n by @CyberNativeAI in https://github.com/Unstructured-IO/unstructured/pull/4592
- ci: fail check-version when a PR edits the frozen CHANGELOG.md by @cragwolfe in https://github.com/Unstructured-IO/unstructured/pull/4594
- fix(metrics): let _mean ignore unmeasured scores like its siblings by @sclfcz in https://github.com/Unstructured-IO/unstructured/pull/4510
- fix(filetype): detect a .markdown file as Markdown, not plain text by @sinnercode228 in https://github.com/Unstructured-IO/unstructured/pull/4599
- fix(cleaners): translate each chunk in translate_text instead of the whole text by @sinnercode228 in https://github.com/Unstructured-IO/unstructured/pull/4568
- fix: render analysis bbox overlays at the pdf_image_dpi used for partitioning by @sinnercode228 in https://github.com/Unstructured-IO/unstructured/pull/4602
- fix(chunking): cap combine_text_under_n_chars at new_after_n_chars by @simpleqt in https://github.com/Unstructured-IO/unstructured/pull/4605
- fix(email): partition an attached email (message/rfc822) instead of raising AssertionError by @sinnercode228 in https://github.com/Unstructured-IO/unstructured/pull/4597
- ci: automate post-release development bump PRs by @cragwolfe in https://github.com/Unstructured-IO/unstructured/pull/4590
- fix(partition): recognize addresses in Alabama and Wyoming by @SergeevDmitry in https://github.com/Unstructured-IO/unstructured/pull/4581
- fix(md): return no elements for an empty text body by @feiiiiii5 in https://github.com/Unstructured-IO/unstructured/pull/4603
- chore: release 0.27.35 by @cragwolfe in https://github.com/Unstructured-IO/unstructured/pull/4606
New Contributors
- @simpleqt made their first contribution in https://github.com/Unstructured-IO/unstr
- 0.27.342026-10-22 · 2026-10-22 19:01 UTC
查看更新说明
What's Changed
- perf: Free decode buffers sooner when restoring original elements by @CyMule in https://github.com/Unstructured-IO/unstructured/pull/4524
- perf: Free image buffers sooner during figure extraction by @CyMule in https://github.com/Unstructured-IO/unstructured/pull/4523
- fix: honor encoding= in partition_json and partition_ndjson by @linhongyu510 in https://github.com/Unstructured-IO/unstructured/pull/4483
- fix(pptx): read a line break as a newline instead of a vertical tab by @L4XB in https://github.com/Unstructured-IO/unstructured/pull/4571
- fix(email): drop the empty entry of an address group by @chrikrah in https://github.com/Unstructured-IO/unstructured/pull/4576
- fix(csv): read CSV and TSV cells as the file holds them by @L4XB in https://github.com/Unstructured-IO/unstructured/pull/4574
- chore: bump Weaviate test image to 1.39.13 by @dudanogueira in https://github.com/Unstructured-IO/unstructured/pull/4575
- fix(partition): classify text as an email address only when all of it is one by @chrikrah in https://github.com/Unstructured-IO/unstructured/pull/4577
- chore: release 0.27.34 by @CyMule in https://github.com/Unstructured-IO/unstructured/pull/4582
New Contributors
- @L4XB made their first contribution in https://github.com/Unstructured-IO/unstructured/pull/4571
Full Changelog: https://github.com/Unstructured-IO/unstructured/compare/0.27.33...0.27.34
- 0.27.332026-10-22 · 2026-10-22 00:01 UTC
查看更新说明
What's Changed
- fix(chunking): don't repeat a very large split element in every chunk by @kholdrex in https://github.com/Unstructured-IO/unstructured/pull/4565
- fix(deps): bump certifi to 2026.10.19 by @lawrence-u10d in https://github.com/Unstructured-IO/unstructured/pull/4564
Full Changelog: https://github.com/Unstructured-IO/unstructured/compare/0.27.32...0.27.33
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
The unstructured library provides open-source components for ingesting and pre-processing images and text documents, such as PDFs, HTML, Word docs, and many more. The use cases of unstructured revolve around streamlining and optimizing the data processing workflow for LLMs. unstructured modular functions and connectors form a cohesive system that simplifies data ingestion and pre-processing, making it adaptable to different platforms and efficient in transforming unstructured data into structured outputs.
[!NOTE] The open-source library is, and will stay, completely free. If you need higher-quality output, though, our latest models are available through the Transform v2 API. Compared with this library, Transform gets 2x table content accuracy, 58% less invented content, and 0.878 text accuracy (vs. 0.715):
Model Table Cell Content Table Cell Spatial Adjusted CCT (text accuracy) Tokens Added (lower is better) Transform (Best) 0.866 0.853 0.878 0.050 Unstructured OSS 0.426 0.498 0.715 0.119 OSS: unstructured.io/benchmarks (1,000+ pages). Transform Best: SCOREBench, 224 pages, Sept 2026.
:eight_pointed_black_star: Quick Start
There are several ways to use the unstructured library:
- Run the library in a container or
- Install the library
- For installation with
condaon Windows system, please refer to the documentation
Run the library in a container
The following instructions are intended to help you get up and running using Docker to interact with unstructured.
See here if you don't already have docker installed on your machine.
NOTE: we build multi-platform images to support both x86_64 and Apple silicon hardware. docker pull should download the corresponding image for your architecture, but you can specify with --platform (e.g. --platform linux/amd64) if needed.
We build Docker images for all pushes to main. We tag each image with the corresponding short commit hash (e.g. fbc7a69) and the application version (e.g. 0.5.5-dev1). We also tag the most recent image with latest. To leverage this, docker pull from our image repository.
docker pull downloads.unstructured.io/unstructured-io/unstructured:latest
Once pulled, you can create a container from this image and shell to it.
# 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 bash
You can also build your own Docker image. Note that the base image is wolfi-base, which is
updated regularly. If you are building the image locally, it is possible docker-build could
fail due to upstream changes in wolfi-base.
If you only plan on parsing one type of data you can speed up building the image by commenting out some of the packages/requirements necessary for other data types. See Dockerfile to know which lines are necessary for your use case.
make docker-build
# this will drop you into a bash shell where the Docker image is running
make docker-start-bash
Once in the running container, you can try things directly in Python interpreter's interactive mode.
# 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")
Installing the library
Use the following instructions to get up and running with unstructured and test your
installation.
-
Install the Python SDK to support all document types with
pip install "unstructured[all-docs]"- For plain text files, HTML, XML, JSON and Emails that do not require any extra dependencies, you can run
pip install unstructured - To process other doc types, you can install the extras required for those documents, such as
pip install "unstructured[docx,pptx]"
- For plain text files, HTML, XML, JSON and Emails that do not require any extra dependencies, you can run
-
Install the following system dependencies if they are not already available on your system. Depending on what document types you're parsing, you may not need all of these.
libmagic-dev(filetype detection)poppler-utils(images and PDFs)tesseract-ocr(images and PDFs, installtesseract-langfor additional language support)libreoffice(MS Office docs)pandocis bundled automatically via thepypandoc-binaryPython package (no system install needed)
-
For suggestions on how to install on the Windows and to learn about dependencies for other features, see the installation documentation here.
At this point, you should be able to run the following code:
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]))
Installation Instructions for Local Development
The following instructions are intended to help you get up and running with unstructured
locally if you are planning to contribute to the project.
This project uses uv for dependency management. Install it first:
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
Then install all dependencies (base, extras, dev, test, and lint groups):
make install
This runs uv sync --locked --all-extras --all-groups, which creates a virtual environment
and installs everything in one step. No need to manually create or activate a virtualenv.
To install only specific document-type extras:
uv sync --extra pdf
uv sync --extra csv --extra docx
To update the lock file after changing dependencies in pyproject.toml:
make lock
- Optional:
- To install extras for processing images and PDFs locally, run
uv sync --extra pdf --extra image. - For processing image files,
tesseractis required. See here for installation instructions. - For processing PDF files,
tesseractandpopplerare required. The pdf2image docs have instructions on installingpoppleracross various platforms.
- To install extras for processing images and PDFs locally, run
Additionally, if you're planning to contribute to unstructured, we provide you an optional pre-commit configuration
file to ensure your code matches the formatting and linting standards used in unstructured.
If you'd prefer not to have code changes auto-tidied before every commit, you can use make check to see
whether any linting or formatting changes should be applied, and make tidy to apply them.
If using the optional pre-commit, you'll just need to install the hooks with pre-commit install since the
pre-commit package is installed as part of make install mentioned above. Finally, if you decided to use pre-commit
you can also uninstall the hooks with pre-commit uninstall.
In addition to develop in your local OS we also provide a helper to use docker providing a development environment:
make docker-start-dev
This starts a docker container with your local repo mounted to /mnt/local_unstructured. This docker image allows you to develop without worrying about your OS's compatibility with the repo and its dependencies.
:clap: Quick Tour
Documentation
For more comprehensive documentation, visit https://docs.unstructured.io . You can also learn more about our other products on the documentation page, including our SaaS API.
Here are a few pages from the Open Source documentation page that are helpful for new users to review:
PDF Document Parsing Example
The following examples show how to get started with the unstructured library. The easiest way to parse a document in unstructured is to use the partition function. If you use partition function, unstructured will detect the file type and route it to the appropriate file-specific partitioning function. If you are using the partition function, you may need to install additional dependencies per doc type.
For example, to install docx dependencies you need to run pip install "unstructured[docx]".
See our installation guide for more details.
from unstructured.partition.auto import partition
elements = partition("example-docs/layout-parser-paper.pdf")
Run print("\n\n".join([str(el) for el in elements])) to get a string representation of the
output, which looks like:
LayoutParser : A Unified Toolkit for Deep Learning Based Document Image Analysis
Zejiang Shen 1 ( (cid:0) ), Ruochen Zhang 2 , Melissa Dell 3 , Benjamin Charles Germain Lee 4 , Jacob Carlson 3 , and
Weining Li 5
Abstract. Recent advances in document image analysis (DIA) have been primarily driven by the application of neural
networks. Ideally, research outcomes could be easily deployed in production and extended for further investigation.
However, various factors like loosely organized codebases and sophisticated model configurations complicate the easy
reuse of important innovations by a wide audience. Though there have been ongoing efforts to improve reusability and
simplify deep learning (DL) model development in disciplines like natural language processing and computer vision, none
of them are optimized for challenges in the domain of DIA. This represents a major gap in the existing toolkit, as DIA
is central to academic research across a wide range of disciplines in the social sciences and humanities. This paper
introduces LayoutParser, an open-source library for streamlining the usage of DL in DIA research and applications.
The core LayoutParser library comes with a set of simple and intuitive interfaces for applying and customizing DL models
for layout detection, character recognition, and many other document processing tasks. To promote extensibility,
LayoutParser also incorporates a community platform for sharing both pre-trained models and full document digitization
pipelines. We demonstrate that LayoutParser is helpful for both lightweight and large-scale digitization pipelines in
real-word use cases. The library is publicly available at https://layout-parser.github.io
Keywords: Document Image Analysis · Deep Learning · Layout Analysis · Character Recognition · Open Source library ·
Toolkit.
Introduction
Deep Learning(DL)-based approaches are the state-of-the-art for a wide range of document image analysis (DIA) tasks
including document image classification [11,
See the partitioning section in our documentation for a full list of options and instructions on how to use file-specific partitioning functions.
:guardsman: Security Policy
See our security policy for information on how to report security vulnerabilities.
:bug: Reporting Bugs
Encountered a bug? Please create a new GitHub issue and use our bug report template to describe the problem. To help us diagnose the issue, use the python scripts/collect_env.py command to gather your system's environment information and include it in your report. Your assistance helps us continuously improve our software - thank you!
:books: Learn more
| Section | Description |
|---|---|
| Company Website | Unstructured.io product and company info |
| Documentation | Full API documentation |
| Batch Processing | Ingesting batches of documents through Unstructured |
:chart_with_upwards_trend: Analytics
Unstructured sends lightweight analytics to GET https://packages.unstructured.io/python-telemetry by default: one library-load ping when it is imported and one best-effort local attempt for each top-level public partition call. The shared endpoint supports separate startup and runtime query-parameter schemas. Runtime events contain the package version, normalized platform/Python/architecture values, fixed-enum partition characteristics, and aggregate final-element counts as URL query parameters; there is no request body. They never contain document or element content, filenames, paths, URLs supplied for partitioning, raw MIME values, exception details, credentials, proxy configuration, or persistent installation, machine, process, account, user, or developer identifiers. Runtime delivery never waits on the network from partition processing, has no redirects, retries, response-body download, or queue, and does not consult proxy or netrc environment settings. At most one telemetry daemon can remain stranded in a network operation; later events drop while that slot is occupied, and process exit does not wait for it. Connect/read timeouts limit socket operations, not total network wall-clock duration.
To opt out before importing or partitioning, set either DO_NOT_TRACK or SCARF_NO_ANALYTICS to any non-empty value after trimming whitespace (for example, true, 1, yes, false, or 0); either variable disables both library-load and runtime telemetry. Unset the variables or leave them empty or whitespace-only to retain the default behavior. See our Privacy Policy.