def y2label()

in code/source/postprocessing.py [0:0]


def y2label(y_pred, int2tag, mask=0):
    """
    Transforms numbers to the corresponding label
    :param y_pred: list of lists of tag predictions as integers for each word in a sentence
    :param int2tag: (dict) dictionary of integers to their corresponding tag
    :param mask: (int) integer corresponding to '-PAD-' tag
    :return: list of lists of tag predictions as real tag (not integer)
    """
    out_pred = []
    for pred in y_pred:
        predicted_tags = []
        for token in pred:
            if token != mask:
                predicted_tags.append(int2tag[str(token)])
        out_pred.append(predicted_tags)
    return out_pred