examples/sentiment_analysis/skep/predict_opinion.py
def parse_predict_result(predictions, seq_lens, label_map):
    """
    Parses the prediction results to the label tag.
    """
    pred_tag = []
    for idx, pred in enumerate(predictions):
        seq_len = seq_lens[idx]
        # drop the "[CLS]" and "[SEP]" token
        tag = [label_map[i] for i in pred[1:seq_len - 1]]
        pred_tag.append(tag)
    return pred_tag

    Parses the prediction results to the label tag.
    
Parses the prediction results to the label tag.
Parses the prediction results to the label tag .
def parse_predict_result(predictions, seq_lens, label_map):
    pred_tag = []
    for idx, pred in enumerate(predictions):
        seq_len = seq_lens[idx]
        tag = [label_map[i] for i in pred[1:seq_len - 1]]
        pred_tag.append(tag)
    return pred_tag
def parse_predict_result ( predictions , seq_lens , label_map ) : pred_tag = [ ] for idx , pred in enumerate ( predictions ) : seq_len = seq_lens [ idx ] tag = [ label_map [ i ] for i in pred [ 1 : seq_len - 1 ] ] pred_tag . append ( tag ) return pred_tag
Parses the prediction results to the label tag.
Parses the prediction results to the label tag .
"""
    Parses the prediction results to the label tag.
    """ # drop the "[CLS]" and "[SEP]" token
predictions
seq_lens
label_map