I developed a Python script which can do the task.
Important one would need to first register the script unter https://dev.mendeley.com/myapps.html just login and register the app and update the credentials in the code below.
I decided against using it, because the script stringently converts everything to sentence case, however it ignores exception, e.g., acronym for questionnaires (BDI for Beck Depression Inventory) would be converted by the script to "bdi". Anyways in case somebody in the future wants to pick up, here would be a good starting point.
I utilized only two libraries which would be needed to install before
pip install nltk
pip install mendeley
For string manipulation I used i.a. these useful answer
from mendeley import Mendeley
import requests
import nltk.data
# required for capitalizing
sent_tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
# These values should match the ones supplied when registering your application.
# under https://dev.mendeley.com/myapps.html
redirect_uri = "http://localhost:5000/oauth"
client_id = 1111 # please update
client_secret = "1jm12n2n2n3n2" # please update
mendeley = Mendeley(client_id, redirect_uri=redirect_uri)
auth = mendeley.start_implicit_grant_flow()
# The user needs to visit this URL, and log in to Mendeley.
login_url = auth.get_login_url()
res = requests.post(login_url, allow_redirects = False, data = {
'username': '[email protected]', # please update
'password': 'urpassword' # please update
})
res.headers
auth_response = res.headers['Location']
# After logging in, the user will be redirected to a URL, auth_response.
session = auth.authenticate(auth_response)
print(session.files.list().items)
# Iterate over every document in your mendeley library
for document in session.documents.iter():
# Uncomment below to see al titles and ids
# print(document.id)
# print(document.title)
title = document.title
# Note I would recommend you doing a backup of old titles by e.g. saving all ID and titles to a dataframe and saving it as .csv file
title = document.title
sentences = sent_tokenizer.tokenize(title)
sentences = [sent.capitalize() for sent in sentences]
title = ' '.join(sentences)
# Capitalize after :
ind = title.find(":")
if ind != -1:
first = title[:ind]
second = title[ind + 1:].strip().capitalize()
title = ': '.join([first, second])
# Capitalize after "- "
ind = title.find("- ")
if ind != -1:
first = title[:ind]
second = title[ind + 1:].strip().capitalize()
title = '- '.join([first, second])
ind = title.find("– ")
if ind != -1:
first = title[:ind]
second = title[ind + 1:].strip().capitalize()
title = '- '.join([first, second])
# WARNING IF UNCOMMENTED BELOW IT CHANGES TITLE OF DOC IN YOUR MENDELEY LIB PERMANENTLY
# document.update(title=title)