Arxiv

arXivopen in new window 是一个开放获取的学术文章存档,涵盖物理学、数学、计算机科学、数量生物学、数量金融、统计学、电气工程与系统科学以及经济学等领域的200万篇学术文章。

本文档展示了如何将从 Arxiv.org 下载的科学文章加载到我们可以在后续处理中使用的文档格式中。

安装

首先,您需要安装 arxiv Python 包。

#!pip install arxiv

其次,您需要安装 PyMuPDF Python 包,该包将从 arxiv.org 网站下载的 PDF 文件转换为文本格式。

#!pip install pymupdf

示例

ArxivLoader 具有以下参数:

  • query:用于在 Arxiv 中查找文档的自由文本。
  • 可选参数 load_max_docs:默认值为100。用于限制下载的文档数量。下载所有100个文档需要时间,请在实验中使用较小的数字。
  • 可选参数 load_all_available_meta:默认值为False。默认情况下,仅下载最重要的字段:Published(文档发布/最后更新的日期)、Title(标题)、Authors(作者)、Summary(摘要)。如果设置为 True,则还会下载其他字段。
from langchain.document_loaders import ArxivLoader
docs = ArxivLoader(query="1605.08386", load_max_docs=2).load()
len(docs)
docs[0].metadata  # meta-information of the Document
{'Published': '2016-05-26',
'Title': 'Heat-bath random walks with Markov bases',
'Authors': 'Caprice Stanley, Tobias Windisch',
'Summary': 'Graphs on lattice points are studied whose edges come from a finite set of\nallowed moves of arbitrary length. We show that the diameter of these graphs on\nfibers of a fixed integer matrix can be bounded from above by a constant. We\nthen study the mixing behaviour of heat-bath random walks on these graphs. We\nalso state explicit conditions on the set of moves so that the heat-bath random\nwalk, a generalization of the Glauber dynamics, is an expander in fixed\ndimension.'}
docs[0].page_content[:400]  # all pages of the Document content

'arXiv:1605.08386v1 [math.CO] 26 May 2016\nHEAT-BATH RANDOM WALKS WITH MARKOV BASES\nCAPRICE STANLEY AND TOBIAS WINDISCH\nAbstract. Graphs on lattice points are studied whose edges come from a finite set of\nallowed moves of arbitrary length. We show that the diameter of these graphs on fibers of a\nfixed integer matrix can be bounded from above by a constant. We then study the mixing\nbehaviour of heat-b'

Last Updated:
Contributors: 刘强