I imported nltk package. I need to use nltk.sent_tokenize and nltk.word_tokenize and when I do, I get the following error no matter what:
An error occurred while calling z:org.apache.spark.api.python.PythonRDD.runJob.
: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 1.0 failed 4 times, most recent failure: Lost task 0.3 in stage 1.0 (TID 7, 10.0.0.4): org.apache.spark.api.python.PythonException: Traceback (most recent call last):
File "/usr/hdp/current/spark-client/python/lib/pyspark.zip/pyspark/worker.py", line 111, in main
process()
File "/usr/hdp/current/spark-client/python/lib/pyspark.zip/pyspark/worker.py", line 106, in process
serializer.dump_stream(func(split_index, iterator), outfile)
File "/usr/hdp/current/spark-client/python/lib/pyspark.zip/pyspark/serializers.py", line 263, in dump_stream
vs = list(itertools.islice(iterator, batch))
File "<stdin>", line 2, in <lambda>
File "/usr/bin/anaconda/lib/python2.7/site-packages/nltk/tokenize/__init__.py", line 85, in sent_tokenize
tokenizer = load('tokenizers/punkt/{0}.pickle'.format(language))
File "/usr/bin/anaconda/lib/python2.7/site-packages/nltk/data.py", line 781, in load
opened_resource = _open(resource_url)
File "/usr/bin/anaconda/lib/python2.7/site-packages/nltk/data.py", line 895, in _open
return find(path_, path + ['']).open()
File "/usr/bin/anaconda/lib/python2.7/site-packages/nltk/data.py", line 624, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource u'tokenizers/punkt/english.pickle' not found. Please
use the NLTK Downloader to obtain the resource: >>>
nltk.download()
Searched in:
- '/home/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
- u''
**********************************************************************
I've referred to many posts discussing about this topic and tried nltk.download(all') , -d, arranging the sub-folders as well.
Azure ML's python doesn't come with nltk library. There should be some other way to use nltk on this platform. Please help!! Thank you!