-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathread_annotated_mocap_data.py
39 lines (31 loc) · 1.41 KB
/
read_annotated_mocap_data.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
36
37
38
39
from collections import Counter
from plot_utils.plot_functions import *
from utils.read_annotated_data import read_data
utt_speaker, utt, utt_emotion, utt_EDAs = read_data('Annotated_EDA_data/eda_iemocap_no_utts_dataset.csv')
colors_emo = ['Green', 'Cyan', 'Blue', 'Black', 'Gray', 'Olive', 'Mediumvioletred', 'Orange', 'Red', 'Brown']
emotions = ['hap', 'exc', 'sur', 'neu', 'xxx', 'fea', 'sad', 'fru', 'ang']
colors_sent = ['Green', 'Black', 'Red']
sentiments = ['positive', 'neutral', 'negative']
tags = sorted(list(Counter(utt_EDAs).keys()))
c = Counter(utt_EDAs)
x = [(i, c[i] / len(utt_EDAs) * 100.0) for i, count in c.most_common()]
print("Number of utterances per dialogue act in percentages")
for item in x:
print(item[0], round(item[1], 2))
stack_emotions_values = []
for tag in tags:
if tag is not str:
pass
temp_emotion = []
for i in range(len(utt)):
if str(utt_EDAs[i]) == str(tag):
temp_emotion.append(utt_emotion[i])
data_emotion = Counter(temp_emotion)
values_emotion = []
for emotion in emotions:
values_emotion.append(data_emotion[emotion])
stack_emotions_values.append(values_emotion)
# save stacked bar graph for Emotion IEMOCAP
plot_bars_plot(stack_emotions_values, emotions, colors_emo, tags,
test_show_plot=False, data='iemocap', type_of='emotion', plot_sankeys=True) # , save_eps=True)
print('ran read_annotated_mocap_data.py')