Я получаю эту ошибку при попытке удалить пунктуацию из текста.
train_pos_no_punctuation = remove_punctuation(train_pos)
def remove_punctuation(from_text):
table = str.maketrans('', '', string.punctuation)
stripped = [w.translate(table) for w in from_text]
return stripped
train_pos имеет тип
<class 'list'>
и следующую форму:
[['hello', 'there', 'world!'], ['i', '"like"', 'potatoes.']]
После применения функции я хочу получить результат:
[['hello', 'there', 'world'], ['i', 'like', 'potatoes']]
В чем проблема?