· 5 years ago · May 20, 2020, 01:24 PM
1def special_text(text):
2 """
3 It creates a dictionary with key a word that contains
4 more than one upper case letter, and as value the
5 aforementioned word in lower case format.
6 :param text: The text that the API will extract its
7 keyphrases
8 """
9 words = text.split()
10 special_words = [word for word in words if len(re.findall('([A-Z])', word)) > 1]
11 special_words = {special_word.lower():special_word for special_word in special_words}
12 return special_words