# 统计文本中单词出现的频率 def count_words(text): # 转换为小写并分割单词 words = text.lower().split() word_count = {} for word in words: # 移除标点符号 cleaned_word = ''.join(c for c in word if c