def recover_label(pred_variable, gold_variable, mask_variable, label_alphabet, word_recover, sentence_classification=False):
    '\n        input:\n            pred_variable (batch_size, sent_len): pred tag result\n            gold_variable (batch_size, sent_len): gold result variable\n            mask_variable (batch_size, sent_len): mask variable\n    '
    pred_variable = pred_variable[word_recover]
    gold_variable = gold_variable[word_recover]
    mask_variable = mask_variable[word_recover]
    batch_size = gold_variable.size(0)
    if sentence_classification:
        pred_tag = pred_variable.cpu().data.numpy().tolist()
        gold_tag = gold_variable.cpu().data.numpy().tolist()
        pred_label = [label_alphabet.get_instance(pred) for pred in pred_tag]
        gold_label = [label_alphabet.get_instance(gold) for gold in gold_tag]
    else:
        seq_len = gold_variable.size(1)
        mask = mask_variable.cpu().data.numpy()
        pred_tag = pred_variable.cpu().data.numpy()
        gold_tag = gold_variable.cpu().data.numpy()
        batch_size = mask.shape[0]
        pred_label = []
        gold_label = []
        for idx in range(batch_size):
            pred = [label_alphabet.get_instance(pred_tag[idx][idy]) for idy in range(seq_len) if (mask[idx][idy] != 0)]
            gold = [label_alphabet.get_instance(gold_tag[idx][idy]) for idy in range(seq_len) if (mask[idx][idy] != 0)]
            assert (len(pred) == len(gold))
            pred_label.append(pred)
            gold_label.append(gold)
    return (pred_label, gold_label)
input:
    pred_variable (batch_size, sent_len): pred tag result
    gold_variable (batch_size, sent_len): gold result variable
    mask_variable (batch_size, sent_len): mask variable
def recover_label(pred_variable, gold_variable, mask_variable, label_alphabet, word_recover, sentence_classification=False):
    '\n        input:\n            pred_variable (batch_size, sent_len): pred tag result\n            gold_variable (batch_size, sent_len): gold result variable\n            mask_variable (batch_size, sent_len): mask variable\n    '
    pred_variable = pred_variable[word_recover]
    gold_variable = gold_variable[word_recover]
    mask_variable = mask_variable[word_recover]
    batch_size = gold_variable.size(0)
    if sentence_classification:
        pred_tag = pred_variable.cpu().data.numpy().tolist()
        gold_tag = gold_variable.cpu().data.numpy().tolist()
        pred_label = [label_alphabet.get_instance(pred) for pred in pred_tag]
        gold_label = [label_alphabet.get_instance(gold) for gold in gold_tag]
    else:
        seq_len = gold_variable.size(1)
        mask = mask_variable.cpu().data.numpy()
        pred_tag = pred_variable.cpu().data.numpy()
        gold_tag = gold_variable.cpu().data.numpy()
        batch_size = mask.shape[0]
        pred_label = []
        gold_label = []
        for idx in range(batch_size):
            pred = [label_alphabet.get_instance(pred_tag[idx][idy]) for idy in range(seq_len) if (mask[idx][idy] != 0)]
            gold = [label_alphabet.get_instance(gold_tag[idx][idy]) for idy in range(seq_len) if (mask[idx][idy] != 0)]
            assert (len(pred) == len(gold))
            pred_label.append(pred)
            gold_label.append(gold)
    return (pred_label, gold_label)