У меня есть большие данные о разговоре в кино: - Корнеллские диалоги.Я пытаюсь преобразовать их в нижний регистр
def clean_text(text):
text = text.lower()
text = re.sub(r"i'm", "i am", text)
text = re.sub(r"he's", "he is", text)
text = re.sub(r"she's", "she is", text)
text = re.sub(r"that's", "that is", text)
text = re.sub(r"what's", "what is", text)
text = re.sub(r"where's", "where is", text)
text = re.sub(r"\'re", "are", text)
text = re.sub(r"\'d", "would", text)
text = re.sub(r"won't", "will not", text)
text = re.sub(r"can't", "cannot", text)
text = re.sub(r"[-()\"#/@;:<>{}+=-|.?,]", "", text)
text = re.sub(r"\'ll", "will", text)
text = re.sub(r"\'ve", "have", text)
return text
#cleaning the questions
clean_questions = []
for question in questions:
clean_questions.append(clean_text(question))
и получаю следующий обратный вызов:
Traceback (most recent call last):
File "<ipython-input-17-4733a5502cb3>", line 3, in <module>
clean_questions.append(clean_text(question))
File "<ipython-input-16-a9a9890808b2>", line 2, in clean_text
text = text.lower()
AttributeError: 'list' object has no attribute 'lower'
Любые предложения о том, что я делаю неправильно и как это исправить, будут весьмаоценили !!!Спасибо !!