You are on page 1of 4

English_Word Cloud

December 15, 2021

[1]: pip install wordcloud

Requirement already satisfied: wordcloud in c:\users\legion\anaconda3\lib\site-


packages (1.8.0)
Requirement already satisfied: numpy>=1.6.1 in
c:\users\legion\anaconda3\lib\site-packages (from wordcloud) (1.18.1)
Requirement already satisfied: matplotlib in c:\users\legion\anaconda3\lib\site-
packages (from wordcloud) (3.1.3)
Requirement already satisfied: pillow in c:\users\legion\anaconda3\lib\site-
packages (from wordcloud) (7.2.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in
c:\users\legion\anaconda3\lib\site-packages (from matplotlib->wordcloud) (2.4.6)
Requirement already satisfied: python-dateutil>=2.1 in
c:\users\legion\anaconda3\lib\site-packages (from matplotlib->wordcloud) (2.8.1)
Requirement already satisfied: cycler>=0.10 in
c:\users\legion\anaconda3\lib\site-packages (from matplotlib->wordcloud)
(0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in
c:\users\legion\anaconda3\lib\site-packages (from matplotlib->wordcloud) (1.1.0)
Requirement already satisfied: six>=1.5 in c:\users\legion\anaconda3\lib\site-
packages (from python-dateutil>=2.1->matplotlib->wordcloud) (1.14.0)
Requirement already satisfied: setuptools in c:\users\legion\anaconda3\lib\site-
packages (from kiwisolver>=1.0.1->matplotlib->wordcloud) (45.2.0.post20200210)
Note: you may need to restart the kernel to use updated packages.

[4]: #Import Library


import matplotlib.pyplot as plt
from wordcloud import WordCloud

text = "Dhoni is a great cricket player"


wordcloud = WordCloud(width = 800, height = 800, background_color ='Tomato',␣
,→min_font_size = 8).generate(text)

# plot the WordCloud image


plt.figure(figsize = (6, 6), facecolor = 'cyan')
plt.imshow(wordcloud)
plt.axis("on")
plt.tight_layout(pad = 0)

1
plt.savefig("English_Text.png")
plt.show()

[6]: text = open("Input_English.txt").read()


print(text)

Tendulkar took up cricket at the age of eleven, made his Test debut on 15
November 1989 against Pakistan in Karachi at the age of sixteen, and went on to
represent Mumbai domestically and India internationally for close to twenty-four
years. In 2002, halfway through his career, Wisden Cricketers Almanack ranked
him the second-greatest Test batsman of all time, behind Don Bradman, and the
second-greatest ODI batsman of all time, behind Viv Richards. Later in his
career, Tendulkar was a part of the Indian team that won the 2011 World Cup, his

2
first win in six World Cup appearances for India.He had previously been named
Player of the Tournament at the 2003 edition of the tournament, held in South
Africa.

[7]: #Import Library


import matplotlib.pyplot as plt
from wordcloud import WordCloud

wordcloud = WordCloud(width = 800, height = 800, background_color ='Tomato',␣


,→min_font_size = 8).generate(text)

# plot the WordCloud image


plt.figure(figsize = (6, 6), facecolor = 'cyan')
plt.imshow(wordcloud)
plt.axis("on")
plt.tight_layout(pad = 0)
plt.savefig("English_Text.png")
plt.show()

3
[ ]:

You might also like