Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Sentiment Analysis in Python

Cursus bekijken

Oefeninstructies

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

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Import the required function
from nltk import ____

# Transform the GoT string to word tokens
print(____(____))
Code bewerken en uitvoeren