官术网_书友最值得收藏!

Installing NLTK and its modules

Before getting started with the examples, we will set the system up with NLTK and other dependent Python libraries. The pip installer can be used to install NLTK, with an optional installation of numpy, as follows:

sudo pip install -U nltk
sudo pip install -U numpy

The NLTK corpora and various modules can be installed by using the common NLTK downloader in the Python interactive shell or a Jupyter Notebook, shown as follows:

import nltk
nltk.download()

The preceding command will open an NLTK Downloader, as follows. Select the packages or collections that are required:

As shown in the preceding screenshot, specific collections, text corpora, NLTK models, or packages, can be selected and installed. Navigate to stopwords and install it for future use. The following is a list of modules that are required for this chapter's examples:

主站蜘蛛池模板: 中西区| 灵台县| 鞍山市| 高雄县| 威远县| 佛山市| 泰顺县| 高台县| 泗阳县| 嘉黎县| 永新县| 敦煌市| 抚州市| 黄平县| 林口县| 团风县| 高台县| 丰台区| 阳山县| 甘泉县| 衡水市| 卢湾区| 北流市| 关岭| 克什克腾旗| 西峡县| 武山县| 三河市| 石阡县| 安泽县| 新郑市| 乐至县| 高尔夫| 台湾省| 西吉县| 凤冈县| 临桂县| 和平县| 大关县| 自治县| 永城市|