<commit_before>from lanpros import *
from wordcloud import *
import matplotlib.pyplot as plt
from ncbiutils import *

def create_wordcloud(normalized_all_counts):

    word_cloud_list = [(key + ' ') * int(round(normalized_all_counts[key],4)*10000) for key in normalized_all_counts.keys()]
    word_cloud_text = '-'.join(word_cloud_list)
    word_cloud = WordCloud().generate(word_cloud_text)
    plt.imshow(word_cloud)
    plt.axis("off")
    plt.savefig("figure.png")
    plt.show()
    return


#test implementation

toquery=get_pmids("rs328")

abstracts = get_abstracts(toquery)
<commit_msg>added func for working w/o X<commit_after>from lanpros import *
from wordcloud import *
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from ncbiutils import *

def create_wordcloud(normalized_all_counts):

    word_cloud_list = [(key + ' ') * int(round(normalized_all_counts[key],4)*10000) for key in normalized_all_counts.keys()]
    word_cloud_text = '-'.join(word_cloud_list)
    word_cloud = WordCloud().generate(word_cloud_text)
    plt.imshow(word_cloud)
    plt.axis("off")
    plt.savefig("figure.png")
    #plt.show()
    return


#test implementation

toquery=get_pmids("rs328")

abstracts = get_abstracts(toquery)

{'fraction_non_alphanumeric': 0.11655948553054662, 'fraction_numerical': 0.014469453376205787, 'mean_word_length': 5.1940298507462686, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1651006', 'n_tokens_mistral': 451, 'n_tokens_neox': 434, 'n_words': 80}