Word Cloud python库在每个单词的末尾显示一个撇号

Word Cloud python库在每个单词的末尾显示一个撇号,python,nltk,word-cloud,Python,Nltk,Word Cloud,我使用nltk.tokenize来标记一个txt文件,它生成了一个新文件,我们称之为“file_B” 然后我跑: from wordcloud import WordCloud import matplotlib.pyplot as plt text = open('File_B').read() wordcloud = WordCloud(width=1600, height=800).generate(text) wordcloud = WordCloud(font_path=font

我使用
nltk.tokenize
来标记一个txt文件,它生成了一个新文件,我们称之为“file_B”

然后我跑:

from wordcloud import WordCloud
import matplotlib.pyplot as plt

text = open('File_B').read()

wordcloud = WordCloud(width=1600, height=800).generate(text)

wordcloud = WordCloud(font_path=font_path, width=1600, height=800).generate(text)
plt.figure(figsize=(20,10))
plt.imshow(wordcloud, interpolation="bilinear")
plt.axis("off")
plt.tight_layout(pad=0)
plt.savefig("wordcloud.png", bbox_inches='tight')
结果是:


每个单词的末尾都有一个撇号,即使它们不在文件B中。我遗漏了什么?

当我将标记化文本转换为字符串时,撇号不会出现:

string_text = ' '.join(tokenized_text)    
wordcloud = WordCloud(width=1600, height=800).generate(string_text)