You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many entries in docs/oscar_references.bib which have neither a DOI nor a URL field, but which clearly an online version exists.
Someone should go through the file and resolve this with help of MathSciNet and zbMATH, at least were possible with reasonable effort.
This would be an ideal task for a HiWi
UPDATE: there is a script at https://tex.stackexchange.com/a/300474 which is super handy for automatically adding DOIs. It is not perfect but still helps. I've run it now, but for future reference I include its code below. Also https://www.doi2bib.org/ is useful for turning DOIs into bib entries (not perfect ones but can still be helpful)
#!/usr/bin/env pythonimportsys, refromunidecodeimportunidecodeimportbibtexparserfrombibtexparser.bwriterimportBibTexWriterimporthttp.clientashttplibimporturllib# Search for the DOI given a title; e.g. "computation in Noisy Radio Networks"# Credit to user13348, slight modifications# http://tex.stackexchange.com/questions/6810/automatically-adding-doi-fields-to-a-hand-made-bibliographydefsearchdoi(title, author):
params=urllib.parse.urlencode({"titlesearch":"titlesearch", "auth2" : author, "atitle2" : title, "multi_hit" : "on", "article_title_search" : "Search", "queryType" : "author-title"})
headers= {"User-Agent": "Mozilla/5.0" , "Accept": "text/html", "Content-Type" : "application/x-www-form-urlencoded", "Host" : "www.crossref.org"}
# conn = httplib.HTTPConnection("www.crossref.org:80") # Not working any more, HTTPS requiredconn=httplib.HTTPSConnection("www.crossref.org")
conn.request("POST", "/guestquery/", params, headers)
response=conn.getresponse()
#print(response.status, response.reason)data=response.read()
conn.close()
returnre.search(r'doi\.org/([^"^<^>]+)', str(data))
defnormalize(string):
"""Normalize strings to ascii, without latex."""string=re.sub(r'[{}\\\'"^]',"", string)
string=re.sub(r"\$.*?\$","",string) # better remove all math expressionsreturnunidecode(string)
defget_authors(entry):
"""Get a list of authors' or editors' last names."""defget_last_name(authors):
forauthorinauthors :
author=author.strip(" ")
if","inauthor:
yieldauthor.split(",")[0]
elif" "inauthor:
yieldauthor.split(" ")[-1]
else:
yieldauthortry:
authors=entry["author"]
exceptKeyError:
authors=entry["editor"]
authors=normalize(authors).split("and")
returnlist(get_last_name(authors))
print("Reading Bibliography...")
withopen(sys.argv[1]) asbibtex_file:
bibliography=bibtexparser.load(bibtex_file)
print("Looking for Dois...")
before=0new=0total=len(bibliography.entries)
fori,entryinenumerate(bibliography.entries):
print("\r{i}/{total} entries processed, please wait...".format(i=i,total=total),flush=True,end="")
try:
if"doi"notinentryorentry["doi"].isspace():
title=entry["title"]
authors=get_authors(entry)
forauthorinauthors:
doi_match=searchdoi(title,author)
ifdoi_match:
doi=doi_match.groups()[0]
entry["doi"] =doinew+=1else:
before+=1except:
passprint("")
template="We added {new} DOIs !\nBefore: {before}/{total} entries had DOI\nNow: {after}/{total} entries have DOI"print(template.format(new=new,before=before,after=before+new,total=total))
outfile=sys.argv[1]+"_doi.bib"print("Writing result to ",outfile)
writer=BibTexWriter()
writer.indent=' '# indent entries with 4 spaces instead of onewithopen(outfile, 'w') asbibfile:
bibfile.write(writer.write(bibliography))
The text was updated successfully, but these errors were encountered:
There are many entries in
docs/oscar_references.bib
which have neither a DOI nor a URL field, but which clearly an online version exists.Someone should go through the file and resolve this with help of MathSciNet and zbMATH, at least were possible with reasonable effort.
This would be an ideal task for a HiWi
UPDATE: there is a script at https://tex.stackexchange.com/a/300474 which is super handy for automatically adding DOIs. It is not perfect but still helps. I've run it now, but for future reference I include its code below. Also https://www.doi2bib.org/ is useful for turning DOIs into bib entries (not perfect ones but can still be helpful)
The text was updated successfully, but these errors were encountered: