How to Create a Wordcloud with Python
Vložit
- čas přidán 8. 09. 2024
- In this video, we're going to show you how to create a Python word cloud from World Cup Tweets. This is a great way to see the most popular words tweeted about the World Cup by fans around the world!
Word clouds are a great way to see the most frequent words used in a given dataset. In this video, we'll show you how to create a Python word cloud from World Cup Tweets and use it to get a sense of the content of the tweets. After watching this video, you'll be able to create your own word clouds using Python!
The code and data used in this how to make a world cloud in python video is available from GitHub and can be accessed from the link below.
github.com/Sup...
It was awsome, but could you please make a video of how did you get the sentiment analysis. Thanks in advance.
Im going to do one eventually on the project. In the meantime this video lays out the method really good czcams.com/video/QpzMWQvxXWk/video.html .. Just follow the Roberta bit , found the Vaders model didnt work well...
@@analyticswithadam Thanks a lot for the prompt response.
I was able to create the wordcloud, but was wondering how I could get two words to stay together without leaving out the space between them. I want to create a cloud that uses first and last names of people. So an example would be John Doe but I want them together and not spread out across the cloud, is that possible?
You could try something lile this but you would have to designate the names.
from wordcloud import WordCloud
import matplotlib.pyplot as plt
# text with multi-word phrases
text = "John Doe is a software engineer. John Doe likes to code. Jane Smith is a doctor. Jane Smith likes to read."
# replace spaces in multi-word phrases with underscores
text = text.replace('John Doe', 'John_Doe').replace('Jane Smith', 'Jane_Smith')
# generate word cloud
wordcloud = WordCloud().generate(text)
# display the generated image
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis("off")
plt.show()
@@analyticswithadam thank you for the speedy response, I will try this when I get home!
@@analyticswithadam is it possible for a wordcloud to use multiple fonts, like the words have a randomized chance on which font they use?
@@maxparsons9431 technically it is possible but it would be quite hard, essentially overlaying two images of seperate wordclouds on top of each other. You cant do it directly in the params as far as I know.
@@analyticswithadam oh well, thanks again for the response!
I am trying to import word cloud in Jupyter notebook but it did not work. Also, I tried to install the package but it did not work too. Please help me to solve this issue.
Try to copy and paste code exactly. If it works then the setup is good, just change the csv and you are good to go.
github.com/SuperDataWorld/Screenshots/blob/main/WC.ipynb