Move reference fetching code into a sub-library

This commit is contained in:
Lucas Verney 2015-12-23 23:46:37 +01:00
parent 97fef88498
commit c880fe27a8
10 changed files with 15 additions and 14 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "opendetex"]
path = opendetex
path = reference_fetcher/opendetex
url = https://github.com/Phyks/opendetex

View File

@ -8,19 +8,19 @@ For building `opendetex` (which is a necessary dependency), you will need
* Clone this repository: `git clone https://github.com/Phyks/arxiv_metadata`.
* Init submodules (`opendetex`): `git submodule init; git submodule update`.
* Build `opendetex`: `cd opendetex; make`.
* Build `opendetex`: `cd reference_fetcher/opendetex; make`.
* You are ready to go.
## Usage
* `./main.py some_file.bbl` to get a list of DOIs associated to each `\bibitem`.
* `./main.py arxiv_eprint_id` to get a list of DOIs associated to each reference from the provided arXiv eprint.
* `./fetch_references.py some_file.bbl` to get a list of DOIs associated to each `\bibitem`.
* `./fetch_references.py arxiv_eprint_id` to get a list of DOIs associated to each reference from the provided arXiv eprint.
## Example
```
$ ./main.py 1401.2910
$ ./fetch_references.py 1401.2910
```
```
@ -67,7 +67,7 @@ $ ./main.py 1401.2910
```
$ ./main.py /tmp/test.bbl
$ ./fetch_reference.py /tmp/test.bbl
```
```

View File

@ -3,8 +3,8 @@ import os
import sys
# Local import
import arxiv
import bbl
from ..reference_fetcher import arxiv
from ..reference_fetcher import bbl
if __name__ == "__main__":

View File

View File

@ -1,11 +1,12 @@
"""
This file contains all the arXiv-specific functions.
"""
import bbl
import io
import requests
import tarfile
from . import bbl
def sources_from_arxiv(eprint):
"""

View File

@ -1,14 +1,14 @@
"""
This files contains all the functions to deal with bbl files.
"""
import doi
import math
import os
import requests
import subprocess
import regex
import tools
from . import doi
from . import regex
from . import tools
def clean_bibitem(bibitem):

View File

@ -3,8 +3,8 @@ This file contains all the DOI-related functions.
"""
import requests
import regex
import tools
from . import regex
from . import tools
def extract_doi_links(urls):