我正在python中使用wordclouds库处理wordclouds
例如,我想从以下列表中创建一个wordcloud:
word_ls = ['orchards growers northern', 'apple orchards growers', 'threatening apple orchards']
我面临的问题是,当我生成云时,我不能让它单独考虑每个字符串,而不是逐字考虑
我尝试过使用regexp属性以不同的方式进行令牌分离,但没有成功(使用r"\w[\w ']+"
获取KeyError)
有什么见解吗
wordcloud生成代码段示例:
word_text = ";".join(word_ls)
wordcloud = WordCloud().generate(word_text)
wordcloud.to_file("word_test.png")
这应该管用
相关问题 更多 >
编程相关推荐