pytextprep.generate_cloud
Module Contents
Functions
|
Creates a word cloud of the most frequently occurring |
- pytextprep.generate_cloud.generate_cloud(tweets, type='words')[source]
Creates a word cloud of the most frequently occurring words in a group of tweets
- Parameters
tweets (list) – List of tweets.
type ({"words", "hashtag", "stopwords"}, default="words") – Type of content to show in wordcloud. “words” shows all words, “hashtag” only shows hashtags, and “stopwords” does not show common English words.
- Returns
Word cloud of most frequently occurring words
- Return type
matplotlib.figure.Figure
Examples
>>> from pytextprep.generate_cloud import generate_cloud >>> import matplotlib.pyplot as plt >>> tweets = [ "Make America Great Again! @DonaldTrump #America", "It's rocket-science tier investment~~ #LoveElonMusk", "America America America #USA #USA" ] >>> fig, wc = generate_cloud(tweets) >>> plt.show()