구조화되지 않은 데이터를위한 오픈 소스 사전 처리 도구
unstructured 라이브러리는 PDFS, HTML, Word Docs 등과 같은 이미지 및 사전 처리 이미지 및 텍스트 문서를 수집하고 사전 처리하기위한 오픈 소스 구성 요소를 제공합니다. unstructured 사용 사례는 LLM의 데이터 처리 워크 플로우를 간소화하고 최적화하는 것을 중심으로 회전합니다. unstructured 모듈 식 기능 및 커넥터는 데이터 수집 및 사전 처리를 단순화하는 응집력있는 시스템을 형성하여 다른 플랫폼에 적응하고 구조화되지 않은 데이터를 구조화 된 출력으로 변환하는 데 효율적입니다.
더 나은 사전 처리 성능과 설정이 적은 설정을 찾고 계십니까? 새로운 서버리스 API를 확인하십시오! 구조화되지 않은 Serverless API는 아직 가장 성능이 좋은 API이며 비즈니스 및 LLM 요구를 더 잘 지원하기 위해보다 반응이 좋고 생산 등급 솔루션을 제공합니다. 가입 페이지 페이지로 이동하여 무료로 시작하십시오.
unstructured 라이브러리를 사용하는 몇 가지 방법이 있습니다.
conda 설치하려면 문서를 참조하십시오. 다음 지침은 Docker를 사용하여 unstructured 와 상호 작용하기 위해 일어나서 실행하는 데 도움이됩니다. 컴퓨터에 Docker를 아직 설치하지 않은 경우 여기를 참조하십시오.
참고 : X86_64 및 Apple Silicon 하드웨어를 모두 지원하기 위해 멀티 플랫폼 이미지를 구축합니다. docker pull 아키텍처의 해당 이미지를 다운로드해야하지만 필요한 경우 --platform (예 : --platform linux/amd64 )으로 지정할 수 있습니다.
우리는 main 으로 모든 푸시를 위해 Docker 이미지를 만듭니다. 우리는 각 이미지에 해당 짧은 커밋 해시 (예 : fbc7a69 ) 및 응용 프로그램 버전 (예 : 0.5.5-dev1 )으로 태그됩니다. 또한 최신 이미지를 latest 로 태그합니다. 이를 활용하기 위해 docker pull .
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 bash 자신의 도커 이미지를 만들 수도 있습니다. 기본 이미지는 wolfi-base 이며 정기적으로 업데이트됩니다. 이미지를 로컬로 구축하는 경우 wolfi-base 의 상류 변화로 인해 docker-build 실패 할 수 있습니다.
한 유형의 데이터를 구문 분석 할 계획이라면 다른 데이터 유형에 필요한 일부 패키지/요구 사항을 주석하여 이미지 구축 속도를 높일 수 있습니다. 사용 사례에 필요한 라인을 알기 위해 Dockerfile을 참조하십시오.
make docker-build
# this will drop you into a bash shell where the Docker image is running
make docker-start-bash런닝 컨테이너에 들어가면 Python 통역사의 대화 형 모드에서 직접 시도 할 수 있습니다.
# 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 " ) 다음 지침을 사용하여 unstructured 상태에서 일어나서 실행하고 설치를 테스트하십시오.
pip install "unstructured[all-docs]" 사용하여 모든 문서 유형을 지원하려면 Python SDK를 설치하십시오.
pip install unstructuredpip install "unstructured[docx,pptx]" 와 같은 해당 문서에 필요한 추가 사항을 설치할 수 있습니다.시스템에서 아직 사용할 수없는 경우 다음 시스템 종속성을 설치하십시오. 구문 분석중인 문서 유형에 따라이 모든 것이 필요하지 않을 수 있습니다.
libmagic-dev (filetype detection)poppler-utils (이미지 및 PDF)tesseract-ocr (이미지 및 PDF, 추가 언어 지원을 위해 tesseract-lang 설치)libreoffice (MS Office Docs)pandoc (Epubs, RTF 및 Open Office Docs). RTF 파일을 처리하려면 버전 2.14.2 또는 최신 버전이 필요합니다. make install-pandoc 또는 ./scripts/install-pandoc.sh 를 실행하면 올바른 버전이 설치됩니다.Windows에 설치하는 방법에 대한 제안과 다른 기능의 종속성에 대해 알아 보려면 여기 설치 문서를 참조하십시오.
이 시점에서 다음 코드를 실행할 수 있어야합니다.
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 ])) 다음 지침은 프로젝트에 기여할 계획이라면 unstructured 상태에서 현지에서 일어나고 실행하는 데 도움이됩니다.
pyenv 사용하여 Virtualenv를 관리하는 것이 권장되지만 필요하지 않습니다.
brew install pyenv-virtualenvpyenv install 3.10 작업을 수행하고 활성화 할 수있는 VirtualEnV를 만들어 unstructured 이름을 사용하십시오.
pyenv virtualenv 3.10 unstructured
pyenv activate unstructured
실행 make install
선택 과목:
make install-local-inference 실행하십시오.tesseract 필요합니다. 설치 지침은 여기를 참조하십시오.tesseract 및 poppler 필요합니다. PDF2Image 문서에는 다양한 플랫폼에서 poppler 설치에 대한 지침이 있습니다. 또한 unstructured 에 기여할 계획이라면 코드가 unstructured 에서 사용되는 서식 및 라인팅 표준과 일치하는지 확인하기 위해 선택적 pre-commit 구성 파일을 제공합니다. 모든 커밋 전에 코드 변경을 자동으로 설정하지 않으려는 경우, make check 사용하여 줄무늬 또는 서식 변경 사항을 적용 해야하는지 확인하고 적용 할 수 make tidy .
옵션 pre-commit 사용하는 경우 pre-commit 패키지가 위에서 언급 한 make install 의 일부로 설치되므로 pre-commit install 로 후크를 설치하면됩니다. 마지막으로, pre-commit 사용하기로 결정한 경우 pre-commit uninstall 할 수도 있습니다.
지역 OS에서 개발하는 것 외에도 개발 환경을 제공하는 Docker를 사용하는 도우미를 제공합니다.
make docker-start-dev 이것은 로컬 리포지기가 /mnt/local_unstructured 에 장착 된 Docker 컨테이너를 시작합니다. 이 Docker 이미지를 사용하면 Repo와의 OS의 호환성 및 그 종속성에 대해 걱정하지 않고 개발할 수 있습니다.
보다 포괄적 인 문서를 보려면 https://docs.unstructured.io를 방문하십시오. SaaS API를 포함한 문서 페이지에서 다른 제품에 대해 자세히 알아볼 수도 있습니다.
다음은 새로운 사용자가 검토하는 데 도움이되는 오픈 소스 문서 페이지의 몇 페이지입니다.
unstructured 오픈 소스 패키지 사용 다음 예제는 unstructured 라이브러리를 시작하는 방법을 보여줍니다. 구조화되지 않은 문서를 구문 분석하는 가장 쉬운 방법은 partition 함수를 사용하는 것입니다. partition 함수를 사용하는 경우 unstructured 파일 유형을 감지하여 적절한 파일 별 파티셔닝 기능으로 라우팅합니다. partition 기능을 사용하는 경우 DOC 유형 당 추가 종속성을 설치해야 할 수도 있습니다. 예를 들어, DOCX 종속성을 설치하려면 pip install "unstructured[docx]" 실행해야합니다. 자세한 내용은 설치 안내서를 참조하십시오.
from unstructured . partition . auto import partition
elements = partition ( "example-docs/layout-parser-paper.pdf" ) 출력의 문자열 표현을 얻으려면 print("nn".join([str(el) for el in elements])) 실행합니다.
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,
파일 별 분할 기능 사용 방법에 대한 전체 옵션 및 지침은 문서의 파티션 섹션을 참조하십시오.
보안 취약점을보고하는 방법에 대한 정보는 보안 정책을 참조하십시오.
버그가 발생 했습니까? 새로운 GitHub 문제를 만들고 버그 보고서 템플릿을 사용하여 문제를 설명하십시오. 문제를 진단하려면 python scripts/collect_env.py 명령을 사용하여 시스템의 환경 정보를 수집하고 보고서에 포함시킵니다. 귀하의 도움은 소프트웨어를 지속적으로 개선하는 데 도움이됩니다. 감사합니다!
| 부분 | 설명 |
|---|---|
| 회사 웹 사이트 | Unstuctured.io 제품 및 회사 정보 |
| 선적 서류 비치 | 전체 API 문서 |
| 배치 처리 | 구조화되지 않은 문서 배치 섭취 |
우리는 Scarf (https://scarf.sh)와 파트너 관계를 맺어 익명화 된 사용자 통계를 수집하여 커뮤니티가 사용하는 기능과 향후 제품 의사 결정의 우선 순위를 정하는 방법을 이해합니다. 이 데이터를 수집하고 사용하는 방법에 대한 자세한 내용은 개인 정보 보호 정책을 읽으십시오. 이 데이터 수집을 선택하지 않으려면 unstructured 명령을 실행하기 전에 환경 변수 SCARF_NO_ANALYTICS=true 설정할 수 있습니다.