unstructured/examples/ingest/biomed/ingest-with-path.sh
cragwolfe bd8a74d686
chore: shell scripts default indent of 2 instead of 4 (#2287)
Given the tendency for shell scripts to easily enter into a few levels
of indentation and long line lengths, update the default to 2 spaces.
2023-12-19 07:48:21 +00:00

35 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Processes the Unstructured-IO/unstructured repository
# through Unstructured's library in 2 processes.
# Structured outputs are stored in biomed-ingest-output-path/
# Biomedical documents can be extracted in one of two ways, in this script is the FTP directory approach.
# The supported ftp directories is:
# https://ftp.ncbi.nlm.nih.gov/pub/pmc/oa_pdf
# By providing the path, the documents existing therein are downloaded.
# For example, to download the documents in the path: https://ftp.ncbi.nlm.nih.gov/pub/pmc/oa_pdf/07/
# The path needed is oa_pdf/07/
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
cd "$SCRIPT_DIR"/../../.. || exit 1
# The example below will ingest the PDF from the "oa_pdf/07/07/sbaa031.073.PMC7234218.pdf" path.
# You can ingest all the documents in the "oa_pdf/07/07" path by passing "oa_pdf/07/07" instead.
# WARNING: There are many documents in that path.
PYTHONPATH=. ./unstructured/ingest/main.py \
biomed \
--path "oa_pdf/07/07/sbaa031.073.PMC7234218.pdf" \
--output-dir biomed-ingest-output-path \
--num-processes 2 \
--verbose \
--preserve-downloads
# Alternatively, you can call it using:
# unstructured-ingest --biomed-path ...