Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to build a clean word cloud using pytagcloud without a crowded image - Python
    primarykey
    data
    text
    <p>In a <a href="https://stackoverflow.com/questions/18952894/word-frequency-count-based-on-two-words-using-python/18952984#18952984">previous question,</a> i asked the community on how to count the frequency of each consecutive two words in a sentence and I got a great answer! now I'm trying to build a word cloud out from the results using the package,pytagcloud. </p> <p>The issue that I do have is that the pictures produced is crowded and words are smooching together. any idea if there's a function to separate words and make them readable or if there's any alternative way to do that in python.<br> Thanks! </p> <p>My code is bellow. this is the <a href="http://www.gutenberg.org/dirs/etext90/const11.txt" rel="nofollow noreferrer">link</a> of the text I used for test I tried to use a smaller number of word combination but that didn't change the crowdness of the text in the picture.<br> I also added few function like playing with "layout" and "size" and "fontname='Lobster' and fontzoom=1" but none of them give the optimal results which is a clean word cloud picture where the words are not crowded. </p> <pre><code>import operator import urllib2 from roundup.backends.indexer_common import STOPWORDS import requests, collections, bs4 Data = "TEXT FROM The link above- TEXT file" two_words = [' '.join(ws) for ws in zip(Data, Data[1:])] wordscount = {w:f for w, f in Counter(two_words).most_common() if f &gt; 12} sorted_wordscount = sorted(wordscount.iteritems(), key=operator.itemgetter(1)) print sorted_wordscount; from pytagcloud import create_tag_image, create_html_data, make_tags, LAYOUT_HORIZONTAL, LAYOUTS, LAYOUT_MIX, LAYOUT_VERTICAL, LAYOUT_MOST_HORIZONTAL, LAYOUT_MOST_VERTICAL from pytagcloud.colors import COLOR_SCHEMES from pytagcloud.lang.counter import get_tag_counts create_tag_image(make_tags(sorted_wordscount), 'filename.png', size=(1300,1150), background=(0, 0, 0, 255), layout=LAYOUT_MIX, fontname='Molengo', rectangular=True) </code></pre> <p>This is an example of the output results I get : <a href="https://imgur.com/7BpXeTM" rel="nofollow noreferrer">HERE</a><br> The optimal result will be something similar to one of the images <a href="http://peekaboo-vision.blogspot.com/2012/11/a-wordcloud-in-python.html" rel="nofollow noreferrer">HERE</a> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload