- 追加された行はこのように表示されます。
- 削除された行は
このように表示されます。
!!!Python NLTK(Natural Language Toolkit)
[Python][Python ライブラリ][自然言語処理]
{{amazon 4873114705}}
この本に従って試してみる
*[NLTK|http://nltk.org/]
*[NLTK How to|http://nltk.org/howto/]
!!!インストール
*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
""実際の使用例は、[自然言語処理]