1 项目地址

https://github.com/Psycoy/EasyLiterature

2 命令行

2.1 写描述

x.md 形如:

1
- {{BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding.}}

注意一层大括号是只提取信息不下载,两层大括号是提取信息并下载。

括号里的可以设置:article title, published articles' doi, and pre-published articles' arvix_id, biorvix_id, and medrvix_id,这样就很好用。

2.2 运行

注意先设代理再运行:

1
2
pip install easyliter
easyliter -i b.md -o /tmp/pdf -p 192.168.10.106:12346 -gp single

下载后,md 文件的内容被填充了。

3 程序

如果不想调用命令行,也可以在程序中调用:

(确实能用,也确实挺慢的)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from easy_literature.utils import get_update_content

def get_bib_and_pdf(content, output_path, proxy, gproxy_mode):
pdfs_path = output_path
if not os.path.exists(pdfs_path):
os.makedirs(pdfs_path)
replace_dict = get_update_content(content, '/tmp/note.md', pdfs_path, proxy=proxy, gproxy_mode=gproxy_mode)
return replace_dict

content = ['{Editing Language Model-based Knowledge Graph Embeddings}']
output_path = '/opt/xieyan/tmp/tmp/'
proxy = '192.168.10.106:12346'
gproxy_mode = 'single'

ret_dict = get_bib_and_pdf(content, output_path, proxy, gproxy_mode)
print(ret_dict)