def add_label_names(dataset: Dataset, label_column: str, label_names: List[str]): """Adds `names` to a specified `label` column. All labels (i.e. integers) in the dataset should be < than the number of label names. Args: dataset: a Dataset to add label names to label_column: the name of the label column (such as `label` or `labels`) in the dataset label_names: a list of label names Returns: Dataset: A copy of the passed `dataset` with added label names """ new_features: Features = dataset.features.copy() new_features[label_column] = ClassLabel(names=label_names) return dataset.cast(new_features)