「Python NLTK(Natural Language Toolkit)」の版間の差分
ナビゲーションに移動
検索に移動
8行目: | 8行目: | ||
*[http://nltk.org/howto/ NLTK How to] | *[http://nltk.org/howto/ NLTK How to] | ||
==インストール== | ==インストール== | ||
− | * | + | *[[PIP]]によるインストール |
# pip install nltk | # pip install nltk | ||
16行目: | 16行目: | ||
NLTK Downloader | NLTK Downloader | ||
--------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ||
− | d) Download l) List u) Update c) Config h) Help q) Quit | + | d) Download l) List u) Update c) Config h) [[Help]] q) Quit |
--------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ||
====Download の選択後、list を選択==== | ====Download の選択後、list を選択==== | ||
36行目: | 36行目: | ||
*** Introductory Examples for the NLTK Book *** | *** Introductory Examples for the NLTK Book *** | ||
Loading text1, ..., text9 and sent1, ..., sent9 | Loading text1, ..., text9 and sent1, ..., sent9 | ||
− | Type the name of the text or sentence to | + | Type the name of the text or sentence to [[vi]]ew it. |
Type: 'texts()' or 'sents()' to list the materials. | Type: 'texts()' or 'sents()' to list the materials. | ||
− | text1: Moby Dick by Herman | + | text1: Moby Dick by Herman Mel[[vi]]lle 1851 |
text2: Sense and Sensibility by Jane Austen 1811 | text2: Sense and Sensibility by Jane Austen 1811 | ||
text3: The Book of Genesis | text3: The Book of Genesis | ||
text4: Inaugural Address Corpus | text4: Inaugural Address Corpus | ||
text5: Chat Corpus | text5: Chat Corpus | ||
− | text6: Monty Python and the Holy Grail | + | text6: Monty [[Python]] and the Holy Grail |
text7: Wall Street Journal | text7: Wall Street Journal | ||
text8: Personals Corpus | text8: Personals Corpus |
2020年2月16日 (日) 04:31時点における最新版
目次
Python NLTK(Natural Language Toolkit)
Python | Python ライブラリ | 自然言語処理 |
この本に従って試してみる
インストール
- 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 矢木浩人