November 2016
Beginner to intermediate
687 pages
15h 31m
English
A corpus may be known as a collection of documents. A corpora is the collection of multiple corpus.
Let's see the following code, which will generate a data directory inside the home directory:
>>> import nltk
>>> import os,os.path
>>> create = os.path.expanduser('~/nltkdoc')
>>> if not os.path.exists(create):
os.mkdir(create)
>>> os.path.exists(create)
True
>>> import nltk.data
>>> create in nltk.data.path
TrueThis code will create a data directory named ~/nltkdoc inside the home directory. The last line of this code will return True and will ensure that the data directory has been created. If the last line of the code returns False, then it means that the data directory has not been created and we need to create it ...
Read now
Unlock full access