diff --git a/tests/test_tipc/bigru_crf/data.py b/tests/test_tipc/bigru_crf/data.py index 159aa3d94bc3..e1f3b72074e0 100644 --- a/tests/test_tipc/bigru_crf/data.py +++ b/tests/test_tipc/bigru_crf/data.py @@ -141,7 +141,7 @@ def parse_result(words, preds, lengths, word_vocab, label_vocab): for index in words[sent_index][:lengths[sent_index]] ] tags = [ - id2label_dict[index] + id2label_dict.get(index, 'O') for index in preds[sent_index][:lengths[sent_index]] ] diff --git a/tests/test_tipc/bigru_crf/deploy/predict.py b/tests/test_tipc/bigru_crf/deploy/predict.py index 3bb59667fdf3..bea452c97021 100644 --- a/tests/test_tipc/bigru_crf/deploy/predict.py +++ b/tests/test_tipc/bigru_crf/deploy/predict.py @@ -108,7 +108,7 @@ def parse_result(words, preds, lengths, word_vocab, label_vocab): for index in words[sent_index][:lengths[sent_index]] ] tags = [ - id2label_dict[index] + id2label_dict.get(index, 'O') for index in preds[sent_index][:lengths[sent_index]] ]