Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 101ddd4

Browse files
authored
Update wiki-search-cloud.py
1 parent 96380b8 commit 101ddd4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

projects/Wikipedia Search Wordcloud/wiki-search-cloud.py

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# supressing unnecessary warnings
77
warnings.filterwarnings("ignore")
88

9+
910
# function to search the wikipedia article and generate the wordcloud
1011
def gen_cloud(topic):
1112
try:
@@ -18,16 +19,19 @@ def gen_cloud(topic):
1819
wordcloud = WordCloud(stopwords=stopwords, max_words=200, background_color="black", width=600, height=350).generate(content)
1920
return wordcloud
2021

22+
2123
# function to save the wordcloud to current directory
2224
def save_cloud(wordcloud):
2325
wordcloud.to_file("./wordcloud.png")
2426

27+
2528
# function to display the wordcloud with matplotlib
2629
def show_cloud(wordcloud):
2730
plt.imshow(wordcloud, interpolation='bilinear')
2831
plt.axis("off")
2932
plt.show()
3033

34+
3135
# driver code
3236
if __name__ == '__main__':
3337
topic = input("What do you want to search: ").strip()

0 commit comments

Comments
 (0)