Tokenizing the Gettysburg Address
In this exercise, you will be tokenizing one of the most famous speeches of all time: the Gettysburg Address delivered by American President Abraham Lincoln during the American Civil War.
The entire speech is available as a string named gettysburg.
Este exercício faz parte do curso
Feature Engineering for NLP in Python
Instruções do exercício
- Load the
en_core_web_smmodel usingspacy.load(). - Create a Doc object
docfor thegettysburgstring. - Using list comprehension, loop over
docto generate the token texts.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
import spacy
# Load the en_core_web_sm model
nlp = ____.____(____)
# Create a Doc object
doc = ____(____)
# Generate the tokens
tokens = [token.____ for token in ____]
print(tokens)