Skip to content

Commit 3aa02a1

Browse files
authored
Merge pull request #27 from Taylor-Swift1/Taylor_Swift
Update visual.py to solve 'No Such File or Direction' problem
2 parents bbd2a37 + b0e5da5 commit 3aa02a1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

visual.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ def show_tfidf(tfidf, vocab, filename):
1212
plt.xticks(np.arange(tfidf.shape[1]), vocab, fontsize=6, rotation=90)
1313
plt.yticks(np.arange(tfidf.shape[0]), np.arange(1, tfidf.shape[0]+1), fontsize=6)
1414
plt.tight_layout()
15-
plt.savefig("./visual/results/%s.png" % filename, format="png", dpi=500)
15+
# creating the output folder
16+
output_folder = './visual/results/'
17+
os.makedirs(output_folder, exist_ok=True)
18+
plt.savefig(os.path.join(output_folder, '%s.png') % filename, format="png", dpi=500)
1619
plt.show()
1720

1821

0 commit comments

Comments
 (0)