Beispiel #1
0
    def set_content(self, full_input):
        try:
            input = full_input.split(":", 1)[1].lower()
        except IndexError:
            return

        if not is_valid(input):
            return

        response = arxiv2bib_dict([input])
        my_reference = response[input]
        self.content = {}
        try:
            self.content["title"] = re.sub("\s+", " ", my_reference.title)
            self.content["URL"] = my_reference.url
            self.content["container-title"] = "arXiv"
            self.content["year"] = my_reference.year
            self.content["eprint"] = my_reference.id
            self.content["issued"] = {"date-parts": [[my_reference.year]]}
        except AttributeError:
            pass

        self.content["type"] = "article"

        self.content["author"] = []
        for author in my_reference.authors:
            self.content["author"].append(author_name_as_dict(author))
 def test_is_valid_return_false(self):
     self.assertFalse(a2b.is_valid('a'))
 def test_is_valid_old_style(self):
     self.assertTrue(a2b.is_valid('math.CO/0000000'))
 def test_is_valid_new_style(self):
     self.assertTrue(a2b.is_valid('0000.0000'))
Beispiel #5
0
        start = startidx[i]
        end = endidx[i]
        for citationkey in extractcitationkey(text[start:end]):
            citationkeylist.append(citationkey)

    citationkeylist = list(set(citationkeylist))

    # =============================================================================
    #     Classement
    # =============================================================================

    # Liste de reference provenant d'arXiv
    list_arxiv_id = []

    for doi in citationkeylist:
        if arxiv2bib.is_valid(doi):
            list_arxiv_id.append(doi)

    refs_arxiv = arxiv2bib.arxiv2bib(list_arxiv_id)
    list_text_refs_arxiv = [arxref.bibtex() for arxref in refs_arxiv]

    # liste de reference au format doi
    list_doi_refs = []
    doi_pattern = '(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)'

    for doi in citationkeylist:
        if re.search(doi_pattern, doi):
            list_doi_refs.append(doi)

    list_text_refs_doi = [pydoi2bib(doi) for doi in list_doi_refs]
Beispiel #6
0
 def test_is_valid_return_false(self):
     self.assertFalse(a2b.is_valid('a'))
Beispiel #7
0
 def test_is_valid_old_style(self):
     self.assertTrue(a2b.is_valid('math.CO/0000000'))
Beispiel #8
0
 def test_is_valid_new_style(self):
     self.assertTrue(a2b.is_valid('0000.0000'))