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

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:

主站蜘蛛池模板: 宁河县| 甘洛县| 新昌县| 桐庐县| 霍林郭勒市| 三河市| 霞浦县| 巴东县| 彰化市| 瑞安市| 渑池县| 毕节市| 新宾| 平顺县| 固安县| 海安县| 宁国市| 安阳市| 科技| 大厂| 丰顺县| 长乐市| 博野县| 英吉沙县| 仁化县| 宜丰县| 阿城市| 格尔木市| 秭归县| 临沧市| 汝州市| 马鞍山市| 富蕴县| 慈利县| 汪清县| 罗定市| 巍山| 株洲市| 饶河县| 天等县| 樟树市|