The wordcloud word cloud keyword is repeated many times.

I created the word cloud through wordcloud, but the final image was generated with repeated keywords:

:


textprint:

clipboard.png

how to solve this problem?

Apr.02,2021

is related to the collocations parameter. The default collocations=True, counts matching words. For example, your text is "I am visiting a customer". When collocations is True, "visiting a customer" will be counted as a word, so there will be repetition.

wcd=WordCloud (font_path='simsun.ttc', collocations=False,width=900,height=400,background_color='white',max_words=100,scale=1.5) .generate (text)


remove the repetition with unique, and in the output


use jieba.analyse to separate word frequencies, and then use generate_from_frequencies (keywords)

examples are as follows:

result=jieba.analyse.textrank(text_from_file_with_apath,topK=300,withWeight=True)
keywords = dict()
for i in result:
    keywords[i[0]]=i[1]


wc = WordCloud(stopwords=stopwords, font_path=font, width = 1600, height = 900, margin=10, max_font_size = 360, min_font_size = 36, background_color="black", mask=mask).generate_from_frequencies(keywords) 
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b352e1-2b6ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b352e1-2b6ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?