Pre-release
This release is a pre-release and may not be stable for production use.
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-mirror 0.1.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scipdf-mirror-0.1.dev0.tar.gz | 31.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scipdf_mirror-0.1.dev0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.4 MB
Release files / scipdf-mirror-0.1.dev0.tar.gz
| Download URL | scipdf-mirror-0.1.dev0.tar.gz |
|---|---|
| Size | 31.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2ad1f5b260669d551dd03c71fa092061bafa7bae889d179a2a01f43a9f55363
|
|
BLAKE2b-256 checksum How to use checksums |
1b9b4ec48c1cf0688a61da82e894da543eaf420425ed7010f1109be8c207556f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / scipdf_mirror-0.1.dev0-py3-none-any.whl
| Download URL | scipdf_mirror-0.1.dev0-py3-none-any.whl |
|---|---|
| Size | 30.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d4b96d1142c9bd441306f8b96334ac7ba5f5f537df3d3e5c125a3a596bd7ba03
|
|
BLAKE2b-256 checksum How to use checksums |
ee4b7fd8bd3a155ccec7194254be15b2030b8b9f99d98f3bec5be6a7ecede4c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|