-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (23 loc) · 829 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from NLP import NaturalLanguage
import os
def main():
"""
Calls NLP library to produce visualizations
"""
# initializing file name list
filename_list = []
# get all file names from songs folder
for file in os.listdir('Songs'):
song = os.path.join('Songs', file)
filename_list.append(song)
# clean song names to extract title for labels
labels = [x[6:].strip('.lrc') for x in filename_list]
# generate instance of nlp object
nlp = NaturalLanguage(filename_list, labels=labels, parser='read_lrc')
# generate repetition plot
nlp.plot_repetition(filenames=filename_list, labels=labels)
# generate sentiment plot
nlp.plot_sentiment(filenames=filename_list, labels=labels)
# generate sankey plot
nlp.wordcount_sankey(num_words=10)
main()