Skip to content

Instantly share code, notes, and snippets.

@kuzux
Created January 23, 2021 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuzux/fe4f9c0bdb201c6b9f2337b494be68ab to your computer and use it in GitHub Desktop.
Save kuzux/fe4f9c0bdb201c6b9f2337b494be68ab to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import sys
filename = sys.argv[1]
word = sys.argv[2]
f = open(filename)
text = f.read()
words = text.split()
indices = indices = [i for i, x in enumerate(words) if x.lower().startswith(word)]
plt.hist(indices, 30, facecolor="green")
plt.show()
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment