def visualize(sentence):
rows, words = sentence2sequence(sentence)
mat = np.vstack(rows)
fig = plt.figure()
ax = fig.add_subplot(111)
shown = ax.matshow(mat, aspect="auto")
ax.yaxis.set_major_locator(ticker.MultipleLocator(1))
fig.colorbar(shown)
ax.set_yticklabels([""]+words)
plt.show()
visualize("The quick brown fox jumped over the lazy dog.")
visualize("The pretty flowers shone in the sunlight.")
ValueError Traceback (most recent call last)
<ipython-input-12-6af23dd02c4c> in <module>
12 plt.show()
13
---> 14 visualize("The quick brown fox jumped over the lazy dog.")
15 visualize("The pretty flowers shone in the sunlight.")
<ipython-input-12-6af23dd02c4c> in visualize(sentence)
1 def visualize(