def load_headnod(self, speaker_id, listeners): data_root = os.path.join(os.path.dirname(__file__), "data/headnod") data_source = DataSource() data_source.load(data_root) blocks = [] for listener in listeners: if listener not in data_source.data_source: continue listener_data = data_source.data_source[listener] for each_coder in listener_data: for each_label in each_coder: accumulate(blocks, each_label[0], each_label[1]) return blocks
def load_headshake(self, speaker_id, listeners): data_root = os.path.join(os.path.dirname(__file__), "data/headshake1") data_source = DataSource() data_source.load(data_root) blocks = [] for listener in listeners: if listener not in data_source.data_source: continue shakes = [] listener_data = data_source.data_source[listener] for each_coder in listener_data: for each_label in each_coder: accumulate(shakes, each_label[0], each_label[1]) for shake in shakes: if shake["h"] > 1: accumulate(blocks, shake["beg"], shake["end"]) return blocks