In a previous question, 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.
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.
Thanks!
My code is bellow. this is the link 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.
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.
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 > 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)
This is an example of the output results I get : HERE
The optimal result will be something similar to one of the images HERE