示例#1
0
def scrape():
    arxiv_number = str(request.form["arxiv_number"])
    get_article("{0}".format(arxiv_number))
    data_list, header_list, unit_list = load_tables(arxiv_number)
    return render_template('data.html', ntables=len(data_list),
                           header="{0}".format(header_list[0]),
                           data="{0}".format(data_list[0]),
                           arxiv_number=arxiv_number)
示例#2
0
def scrape():
    arxiv_number = str(request.form["arxiv_number"])
    get_article("{0}".format(arxiv_number))
    data_list, header_list, unit_list = load_tables(arxiv_number)
    if len(header_list):
        header = "{0}".format(header_list[0])
        data = "{0}".format(data_list[0]),
    else:
        header = "{0}".format(header_list)
        data = "{0}".format(data_list),
    return render_template('data.html',
                           ntables=len(data_list),
                           header=header,
                           data=data,
                           arxiv_number=arxiv_number)
示例#3
0
def parse_article(aid):
    raw, tokens = get_article(aid)
    sentences = defaultdict(list)
    for sent, token_list in izip(raw, tokens):
        try:
            w, p, s, c = pronunciation(token_list)
        except KeyError:
            continue
        sentences[c].append((sent, w, p, s))
    return sentences
示例#4
0
    def test_get(self):
        article = arxiv.get_article("0806.0330")
        self.assertEqual(article.id, "0806.0330")
        self.assertEqual(article.arxiv_url, "http://arxiv.org/abs/0806.0330")
        self.assertEqual(article.authors, ['S. F. King', 'R. Luo', 'D. J. Miller', 'R. Nevzorov'])
        self.assertEqual(article.category, "hep-ph")
        self.assertEqual(article.comment, "40 pages, 9 figures, references added, subsection added")
        self.assertEqual(article.doi, "10.1088/1126-6708/2008/12/042")
        self.assertEqual(article.journal, "JHEP 0812:042,2008")
        self.assertEqual(article.pdf, "http://arxiv.org/pdf/0806.0330")
        self.assertEqual(article.published, time.strptime("2 Jun 2008 16:45:34 GMT", "%d %b %Y %H:%M:%S %Z"))
        self.assertEqual(article.summary, "We calculate flavour dependent lepton asymmetries within the $E_6$ inspired Supersymmetric Standard Model ($\\rm E_6SSM$), which has an extra $U(1)_N$ symmetry. In this model, the right-handed neutrino doesn't participate in gauge interactions, allowing it to be used for both the see--saw mechanism and leptogenesis. Extra Higgs, leptons and leptoquarks predicted by the E$_6$SSM contribute to the ordinary lepton CP asymmetries induced by the decays of the lightest right--handed neutrino (and sneutrino) and give rise to a set of extra decay asymmetries. We find that the CP asymmetries can be relatively large, even when the lightest right--handed neutrino is as light as $10^6 {GeV}$.")
        self.assertEqual(article.summary, article.abstract)
        self.assertEqual(article.title, "Leptogenesis in the Exceptional Supersymmetric Standard Model: flavour dependent lepton asymmetries")
        self.assertEqual(article.updated, time.strptime("8 Oct 2008 12:04:43 GMT", "%d %b %Y %H:%M:%S %Z"))

        self.assertEqual(str(article), "arXiv<0806.0330>")
        self.assertEqual(repr(article), "arXiv<0806.0330>")
示例#5
0
文件: haiku.py 项目: dfm/arxiv-poet
def load_paper(arxiv_id):
    return arxiv.get_article(arxiv_id)
示例#6
0
 def test_get_invalid(self):
     try:
         arxiv.get_article("invalid")
     except ValueError:
         pass