def plot_wordcloud(self, text, mask=None, max_words=200, max_font_size=100, figure_size=(24.0,16.0), title = None, title_size=40, image_color=False): stopwords = set(STOPWORDS) more_stopwords = {'one', 'br', 'Po', 'th', 'sayi', 'fo', 'Unknown'} stopwords = stopwords.union(more_stopwords) wordcloud = WordCloud(background_color='white', stopwords = stopwords, max_words = max_words, max_font_size = max_font_size, random_state = 42, width=800, height=400, mask = mask) wordcloud.generate(str(text)) plt.figure(figsize=figure_size) if image_color: image_colors = wordcloud.ImageColorGenerator(mask) plt.imshow(wordcloud.recolor(color_func=image_colors), interpolation="bilinear") plt.title(title, fontdict={'size': title_size, 'verticalalignment': 'bottom'}) else: plt.imshow(wordcloud) plt.title(title, fontdict={'size': title_size, 'color': 'green', 'verticalalignment': 'bottom'}) plt.axis('off') plt.tight_layout()