Bắt đầu ngayBắt đầu miễn phí

Tokenize a string from GoT

A first standard step when working with text is to tokenize it, in other words, split a bigger string into individual strings, which are usually single words (tokens).

A string GoT has been created for you and it contains a quote from George R.R. Martin's Game of Thrones. Your task is to split it into individual tokens.

Bài tập này là một phần của khóa học

Sentiment Analysis in Python

Xem khóa học

Hướng dẫn bài tập

  • Import the word tokenizing function from nltk.
  • Transform the GoT string to word tokens.

Bài tập tương tác thực hành trực tiếp

Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.

# Import the required function
from nltk import ____

# Transform the GoT string to word tokens
print(____(____))
Chỉnh sửa và Chạy Mã