我有一个这样的代码示例:
def run_prediction(self, min_len=5):
predict_list = []
desire_list = []
desire_name = []
for text, label, pos in zip(self.dataframe.text, self.dataframe.label, self.dataframe.pos):
tokenized = hazm.word_tokenize(text)
pos = pos.strip().split()
if len(tokenized) < min_len:
tokenized = tokenized + "<pad>" * (min_len - len(tokenized))
pos = pos + "<pad>" * (min_len - len(tokenized))
tokenized 和 pos 是列表,问题出在 。
而且我有错误:
tokenized = tokenized + "<pad>" * (min_len - len(tokenized))
pos = pos + "<pad>" * (min_len - len(tokenized))```
the bug is :
**TypeError: can only concatenate list (not "str") to list**
how can I solve this in best way?