def extract_acronyms(textblob):
"""Creates a list of words beginning with at least 2 capital letters that are not regular English words,
in descending order of frequency. enchant dictionary returns True if word is an English word."""
d = enchant.Dict("en_US")
words = textblob.words
counts = []
for word in words:
if len(word) > 1:
if word[0].isupper() and word[1].isupper() and word not in [p[0] for p in counts]:
if not d.check(word):
counts.append((word, textblob.words.count(word)))
return counts
评论列表
文章目录