文と単語のトークン化
トークン化はNLPの最初の重要なステップです。テキストをトークンと呼ばれる小さな単位に分割することで、言語データを扱うための基本になります。あなたの課題は、ニュース記事の一部を文と単語の両方にトークン化することです。
この演習はコースの一部です
Pythonで学ぶ自然言語処理(NLP)
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Import nltk
____
# Download the punkt_tab package
____
text = """
The stock market saw a significant dip today. Experts believe the downturn may continue.
However, many investors are optimistic about future growth.
"""
# Tokenize the text into sentences
sentences = ____
print(sentences)