Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Small library for extracting references used in scholarly communication.

Project Description

Small library for extracting references used in scholarly communication.

Originally exported from Invenio https://github.com/inveniosoftware/invenio.

Installation

pip install refextract

Usage

To get structured info 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': u'',
    'page': u'13445',
    'title': u'J. Phys.',
    'type': 'JOURNAL',
    'volume': u'A39',
    'year': ''
 }

To extract references from a publication full-text PDF:

from refextract import extract_references_from_file
reference = extract_references_from_file("some/fulltext/1503.07589v1.pdf")
print(reference)
[
        {'author': [u'F. Englert and R. Brout'],
         'doi': [u'10.1103/PhysRevLett.13.321'],
         'journal_page': [u'321'],
         'journal_reference': ['Phys.Rev.Lett.,13,1964'],
         'journal_title': [u'Phys.Rev.Lett.'],
         'journal_volume': [u'13'],
         'journal_year': [u'1964'],
         'linemarker': [u'1'],
         'title': [u'Broken symmetry and the mass of gauge vector mesons'],
         'year': [u'1964']}, ...
]

You can also extract directly from a URL:

from refextract import extract_references_from_url
reference = extract_references_from_url("http://arxiv.org/pdf/1503.07589v1.pdf")
print(reference)
[
         {'author': [u'F. Englert and R. Brout'],
          'doi': [u'10.1103/PhysRevLett.13.321'],
          'journal_page': [u'321'],
          'journal_reference': ['Phys.Rev.Lett.,13,1964'],
          'journal_title': [u'Phys.Rev.Lett.'],
          'journal_volume': [u'13'],
          'journal_year': [u'1964'],
          'linemarker': [u'1'],
          'title': [u'Broken symmetry and the mass of gauge vector mesons'],
          'year': [u'1964']}, ...
]

Changes

Version 0.2.2 (2017-07-17)

  • Handle pyPDF2 internal errors.

Version 0.2.1 (2017-07-02)

  • Named destinations may not always have left and top coordinates. This case is now handled gracefully: no TeXkeys are returned by extract_texkeys_from_pdf instead of raising an uncaught exception.
  • Makes CFG_PATH_GFILE and CFG_PATH_PDFTOTEXT configurable through shell variables, with fallback on the output of which, in order to allow for easier containerization.

Version 0.2.0 (2017-06-26)

  • Substantial rewrite of the API. In particular:
    • extract_references_from_file, extract_references_from_string, and extract_references_from_url now return a list of the references, instead of an object with keys stats and references.
    • If the number of TeXkeys that were extracted from the PDF metadata matches the number of references parsed by RefExtract, an extra texkey field is added to each returned reference.
    • The API now raises exceptions when it encounters an unrecoverable error.
    • Finally, the API now returns the list of raw references on which refextract worked.

Version 0.1.0 (2016-01-12)

Release History

Release History

This version
History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.0

History Node

0.1.0.dev20150722

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
refextract-0.2.2.tar.gz (4.2 MB) Copy SHA256 Checksum SHA256 Source Jul 17, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting