去除标点符号
在您已经从反馈文本中移除停用词之后,接下来需要处理标点符号。您在上一个练习中得到的词元仍然包含标点,这在对反馈进行分类时通常没有必要。
您的任务是从给定的词元列表中去除标点符号,进一步清理数据。
本练习是课程的一部分
Python 中的自然语言处理(NLP)
练习说明
- 通过移除所有标点符号来清理
filtered_tokens列表。
交互式实操练习
通过完成这段示例代码来试试这个练习。
import string
filtered_tokens = ['reached', 'support', 'got', 'helpful', 'response', 'within', 'minutes', '!', '!', '!', '#', 'impressed']
# Remove punctuation
clean_tokens = [____ for word in filtered_tokens if ____ not in ____.____]
print(clean_tokens)