def get_tag(self, label): """ retrieves the tag with the highest association for the given label if there are more than one tags with the highest association value, the first one will be returned """ label_index = -1 for count, i in enumerate(self.labels): if i == label: label_index = count break if label_index == -1: return "no_tag" else: max = aux.posMax(self.matrix[label_index]) return self.tags[max]
def get_label(self, tag): """ retrieves the label with the higest association for the given tag if there are more than one labels with the higest association value, the first one will be returned """ tag_index = -1 for count, i in enumerate(self.tags): if i == tag: tag_index = count break if tag_index == -1: return "no_label" else: value_list = [] for i in self.matrix: for count, j in enumerate(i): if count == tag_index: value_list.append(j) return self.labels[aux.posMax(value_list)]