2023-03-11 01:09:54 +00:00
|
|
|
#!/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/
|
|
|
|
|
2023-12-11 20:04:15 -05:00
|
|
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
2023-03-11 01:09:54 +00:00
|
|
|
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 \
|
2023-12-18 23:48:21 -08:00
|
|
|
biomed \
|
|
|
|
--path "oa_pdf/07/07/sbaa031.073.PMC7234218.pdf" \
|
|
|
|
--output-dir biomed-ingest-output-path \
|
|
|
|
--num-processes 2 \
|
|
|
|
--verbose \
|
|
|
|
--preserve-downloads
|
2023-03-11 01:09:54 +00:00
|
|
|
|
|
|
|
# Alternatively, you can call it using:
|
|
|
|
# unstructured-ingest --biomed-path ...
|