refextract
About
A library for extracting references used in scholarly communication.
Getting Started
Note: due to the usage of mmap resize functionality this library cannot be locally installed on a mac
Docker Setup:
Before the first usage, or anytime a new library/dependency is changed a new docker image must be created using:
docker build --target refextract-tests -t refextract .
After that, spin up a refextract service with:
docker run -it -v ./tests:/refextract/tests -v ./refextract:/refextract/refextract refextract
Running tests
Exec into the container via
docker exec -it refextract /bin/bash
Then simply run
pytest .
Usage
To get structured information from a publication reference:
>>> from refextract import extract_journal_reference
>>> reference = extract_journal_reference('J.Phys.,A39,13445')
>>> print(reference)
{
'extra_ibids': [],
'is_ibid': False,
'misc_txt': '',
'page': '13445',
'title': 'J. Phys.',
'type': 'JOURNAL',
'volume': 'A39',
'year': '',
}
To extract references from a PDF:
>>> from refextract import extract_references_from_file
>>> references = extract_references_from_file('1503.07589.pdf')
>>> print(references[0])
{
'author': ['F. Englert and R. Brout'],
'doi': ['doi:10.1103/PhysRevLett.13.321'],
'journal_page': ['321'],
'journal_reference': ['Phys. Rev. Lett. 13 (1964) 321'],
'journal_title': ['Phys. Rev. Lett.'],
'journal_volume': ['13'],
'journal_year': ['1964'],
'linemarker': ['1'],
'raw_ref': ['[1] F. Englert and R. Brout, \u201cBroken symmetry and the mass of gauge vector mesons\u201d, Phys. Rev. Lett. 13 (1964) 321, doi:10.1103/PhysRevLett.13.321.'],
'texkey': ['Englert:1964et'],
'year': ['1964'],
}
To extract directly from a URL:
>>> from refextract import extract_references_from_url
>>> references = extract_references_from_url('https://arxiv.org/pdf/1503.07589.pdf')
>>> print(references[0])
{
'author': ['F. Englert and R. Brout'],
'doi': ['doi:10.1103/PhysRevLett.13.321'],
'journal_page': ['321'],
'journal_reference': ['Phys. Rev. Lett. 13 (1964) 321'],
'journal_title': ['Phys. Rev. Lett.'],
'journal_volume': ['13'],
'journal_year': ['1964'],
'linemarker': ['1'],
'raw_ref': ['[1] F. Englert and R. Brout, \u201cBroken symmetry and the mass of gauge vector mesons\u201d, Phys. Rev. Lett. 13 (1964) 321, doi:10.1103/PhysRevLett.13.321.'],
'texkey': ['Englert:1964et'],
'year': ['1964'],
}
Notes
refextract depends on
Acknowledgments
refextract is based on code and ideas from the following people, who
contributed to the docextract module in Invenio:
- Alessio Deiana
- Federico Poli
- Gerrit Rindermann
- Graham R. Armstrong
- Grzegorz Szpura
- Jan Aage Lavik
- Javier Martin Montull
- Micha Moskovic
- Samuele Kaplun
- Thorsten Schwander
- Tibor Simko
License
GPLv2
Metadata
Release files for refextract 1.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| refextract-1.1.7.tar.gz | 259.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| refextract-1.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 535.1 kB
Release files / refextract-1.1.7.tar.gz
| Download URL | refextract-1.1.7.tar.gz |
|---|---|
| Size | 259.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc3fa23ed22ad2f45e708d75011212d3c6bc83fca940cd34beb355a2e2ab299f
|
|
BLAKE2b-256 checksum How to use checksums |
43ad56a4e00bc899b531d8e028aad7b124625c91dbbd8f3fafccf4d07a78e3ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / refextract-1.1.7-py3-none-any.whl
| Download URL | refextract-1.1.7-py3-none-any.whl |
|---|---|
| Size | 275.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5585df2d270a31878a07c26fdbc0ba532335e4ce7303b212a329649f249a4aba
|
|
BLAKE2b-256 checksum How to use checksums |
24bbc6c2ddec91ee035e7fd82d27a49b0c7592ccac9d4402ade02d9ad1bf8534
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|