開始使用免費開始

移除標點符號

你已經從回饋文字中移除了停用詞,接下來要處理標點符號。你在前一個練習得到的權杖仍包含標點符號,而在分類回饋時這些通常是不需要的。

你的任務是從提供的權杖清單中移除標點符號,進一步清理資料。

本練習屬於課程

Python 的 Natural Language Processing(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)
編輯並執行程式碼