SciPDF Parser
A Python parser for scientific PDF based on GROBID.
Installation
Use pip to install from this Github repository
pip install git+https://github.com/titipata/scipdf_parser
Note
- We also need an
en_core_web_smmodel for spacy, where you can runpython -m spacy download en_core_web_smto download it - You can change GROBID version in
serve_grobid.shto test the parser on a new GROBID version
Usage
Run the GROBID using the given bash script before parsing PDF
bash serve_grobid.sh
This script will download GROBID and run the service at default port 8070 (see more here).
To parse a PDF provided in example_data folder or direct URL, use the following function:
import scipdf
article_dict = scipdf.parse_pdf_to_dict('example_data/futoma2017improved.pdf') # return dictionary
# option to parse directly from URL to PDF, if as_list is set to True, output 'text' of parsed section will be in a list of paragraphs instead
article_dict = scipdf.parse_pdf_to_dict('https://www.biorxiv.org/content/biorxiv/early/2018/11/20/463760.full.pdf', as_list=False)
# output example
>> {
'title': 'Proceedings of Machine Learning for Healthcare',
'abstract': '...',
'sections': [
{'heading': '...', 'text': '...'},
{'heading': '...', 'text': '...'},
...
],
'references': [
{'title': '...', 'year': '...', 'journal': '...', 'author': '...'},
...
],
'figures': [
{'figure_label': '...', 'figure_type': '...', 'figure_id': '...', 'figure_caption': '...', 'figure_data': '...'},
...
],
'doi': '...'
}
xml = scipdf.parse_pdf('example_data/futoma2017improved.pdf', soup=True) # option to parse full XML from GROBID
To parse figures from PDF using pdffigures2, you can run
scipdf.parse_figures('example_data', output_folder='figures') # folder should contain only PDF files
You can see example output figures in figures folder.
Metadata
Release files for scipdf-parser 0.52
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scipdf_parser-0.52.tar.gz | 10.4 kB | Without provenance | Details for scipdf_parser-0.52.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scipdf_parser-0.52-py3-none-any.whl | Python 3 | none | any | Details for scipdf_parser-0.52-py3-none-any.whl |
Total release size: 21.1 kB
Release files / scipdf_parser-0.52.tar.gz
| Download URL | scipdf_parser-0.52.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
750df1af1adf9393d0844fa1292a2689e0e2c05e14285389212b16181d406716
|
|
BLAKE2b-256 checksum How to use checksums |
741f7f7371f54696b30f2e436934cafd8bb3b294ef874558894207dc022c57ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / scipdf_parser-0.52-py3-none-any.whl
| Download URL | scipdf_parser-0.52-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63a7fa588ac039bd913fb0ea175f533535ad70f89b602ba726caac64e81c423a
|
|
BLAKE2b-256 checksum How to use checksums |
d29c755427ef9f58815d19cf060e9f0d85a4851267dbdf39189097bf8b47892c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for scipdf-parser 0.52
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.