A script for fetching and extracting text content from articles available in the PubMed Central (PMC) repository. Users need to provide a CSV file containing a list of PMC IDs without column headers. The extracted text content for each article is saved in a separate text file named by its PMC ID.
- Create a CSV file containing PMC IDs you wish to extract text from.
- Ensure the CSV doesn’t have a header, and PMC IDs are populated in the first column.
- Open the
PMC Text Extractor
script. -
- Find the line:
csv_filename = "your_file.csv"
- Replace
"your_file.csv"
with the path and name of your CSV file containing the PMC IDs. -
- Find the line:
PATH_PREFIX = "/PATH/TO/OUTPUT/FOLDER"
- Replace with the path of folder where you want to save text output for each paper.
- Setup Python enviroment with
pip install -r requirements.txt
- Run the script in a Python environment.
python pdf_text_extractor.py
- Each output
.txt
file will contain the extracted text content of the corresponding PMC article. - The file will be named using the PMC ID, TBD: store mapping of ID to name or other readable tag