def get_labels(self, tag_sets):
"""Create labels from a list of tag_sets
Args:
tag_sets (list(list(str))): A list of word tag sets
Returns:
(list(list(int))): List of list of indices
"""
labels = []
print('Getting labels...')
for tag_set in tag_sets:
indexed_tags = self.index_tags(tag_set)
labels.append(to_categorical(np.asarray(indexed_tags), num_classes=4))
labels = pad_sequences(labels, maxlen=200)
return labels
评论列表
文章目录