Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
550 views
in Technique[技术] by (71.8m points)

word cloud - How to un-stem 'Jesu' to get 'Jesus' in wordcloud?

Trying to get a .png image using wordcloud from a book on Bible. The word 'Jesus' is stemmed to 'Jesu'. Is there a way to give an exception to this one word alone? Strangely, 'Moses' is not stemmed.

{file_content = open("Wheres_Heaven.txt").read()}

{wordcloud = WordCloud(stopwords=None, background_color = 'white', width=1200, height=1000, max_words = 500, ).generate(file_content)}

{plt.figure( figsize=(20,10) )
{plt.imshow(wordcloud)}
{plt.axis('off')}
{plt.savefig('Heaven.png')}
{plt.show()}

Heaven.png

question from:https://stackoverflow.com/questions/65950719/how-to-un-stem-jesu-to-get-jesus-in-wordcloud

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you have version 1.8.1 then you can put "Jesu" in stopwords.

The logic is when it sees both "Jesu" and "Jesus" in the text, the code assumes it is a plural. Apparently the text has no "Mose", which is why that was not treated as plural.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...