def checkSentenceSanity(sentence):
""" Checks the sanity of the sentence. If the sentence is for example all uppercase, it is recjected"""
caseDist = nltk.FreqDist()
for token in sentence:
caseDist[getCasing(token)] += 1
if caseDist.most_common(1)[0][0] != 'allLower':
return False
return True
评论列表
文章目录