Python NLTK(Natural Language Toolkit)
ナビゲーションに移動
検索に移動
Python NLTK(Natural Language Toolkit)
インストール
- PIPによるインストール
# pip install nltk
NLTK Bookコレクションのダウンロード
>>> import nltk >>> nltk.download() NLTK Downloader --------------------------------------------------------------------------- d) Download l) List u) Update c) Config h) Help q) Quit ---------------------------------------------------------------------------
Download の選択後、list を選択
Downloader> d Download which package (l=list; x=cancel)?
Enter キーで最後まで送るとCollectionsパッケージが確認できる
Collections: [ ] all-corpora......... All the corpora [ ] all................. All packages [ ] book................ Everything used in the NLTK Book
book モジュールのダウンロード
Downloader> d book Downloading collection 'book' | | Downloading package 'brown' to /home/piroto/nltk_data...
book モジュールをロード
>>> from nltk.book import * *** Introductory Examples for the NLTK Book *** Loading text1, ..., text9 and sent1, ..., sent9 Type the name of the text or sentence to view it. Type: 'texts()' or 'sents()' to list the materials. text1: Moby Dick by Herman Melville 1851 text2: Sense and Sensibility by Jane Austen 1811 text3: The Book of Genesis text4: Inaugural Address Corpus text5: Chat Corpus text6: Monty Python and the Holy Grail text7: Wall Street Journal text8: Personals Corpus text9: The Man Who Was Thursday by G . K . Chesterton 1908
<blockquote>実際の使用例は、[自然言語処理]</blockquote>
© 2006 矢木浩人