「Python NLTK(Natural Language Toolkit)」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「==Python NLTK(Natural Language Toolkit)== [Python][Python ライブラリ][自然言語処理] {{amazon|4873114705}} この本に従って試してみる *[http:/…」) |
|||
1行目: | 1行目: | ||
==Python NLTK(Natural Language Toolkit)== | ==Python NLTK(Natural Language Toolkit)== | ||
− | [Python][Python ライブラリ][自然言語処理] | + | [[Python][Python ライブラリ][自然言語処理]] |
{{amazon|4873114705}} | {{amazon|4873114705}} | ||
12行目: | 12行目: | ||
===NLTK Bookコレクションのダウンロード=== | ===NLTK Bookコレクションのダウンロード=== | ||
− | + | >>> import nltk | |
− | + | >>> nltk.download() | |
NLTK Downloader | NLTK Downloader | ||
--------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ||
19行目: | 19行目: | ||
--------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ||
====Download の選択後、list を選択==== | ====Download の選択後、list を選択==== | ||
− | Downloader | + | Downloader> d |
Download which package (l=list; x=cancel)? | Download which package (l=list; x=cancel)? | ||
28行目: | 28行目: | ||
[ ] book................ Everything used in the NLTK Book | [ ] book................ Everything used in the NLTK Book | ||
====book モジュールのダウンロード==== | ====book モジュールのダウンロード==== | ||
− | Downloader | + | Downloader> d book |
Downloading collection 'book' | Downloading collection 'book' | ||
| | | | ||
| Downloading package 'brown' to /home/piroto/nltk_data... | | Downloading package 'brown' to /home/piroto/nltk_data... | ||
====book モジュールをロード==== | ====book モジュールをロード==== | ||
− | + | >>> from nltk.book import * | |
*** Introductory Examples for the NLTK Book *** | *** Introductory Examples for the NLTK Book *** | ||
Loading text1, ..., text9 and sent1, ..., sent9 | Loading text1, ..., text9 and sent1, ..., sent9 | ||
48行目: | 48行目: | ||
text9: The Man Who Was Thursday by G . K . Chesterton 1908 | text9: The Man Who Was Thursday by G . K . Chesterton 1908 | ||
− | + | <blockquote>実際の使用例は、[自然言語処理]</blockquote> |
2020年2月15日 (土) 08:05時点における版
目次
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 矢木浩人