Skip to content

Instantly share code, notes, and snippets.

@Bachmann1234
Created January 2, 2015 18:19
Show Gist options
  • Save Bachmann1234/1bf0de393075eea022a2 to your computer and use it in GitHub Desktop.
Save Bachmann1234/1bf0de393075eea022a2 to your computer and use it in GitHub Desktop.
Word Clouds
from os import path
import sys
from wordcloud import WordCloud
d = path.dirname(__file__)
# Read the whole text.
text = open(path.join(d, sys.argv[1])).read()
wordcloud = WordCloud().generate(text)
wordcloud.to_file(path.join(d, "repo.png"))
@Bachmann1234
Copy link
Author

Script requires a font path to be exported

FONT_PATH='~/Library/Fonts/LiberationMono-Regular.ttf'
export FONT_PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment