Why shows error "import nltk"?
Question:
I was trying to build web crawler using python and I’v got following error when it executed.
import sys
import math
import re
from collections import OrderedDict, defaultdict
import os
import nltk //This line shows error
import pickle
from xml.dom import minidom
from xml.dom import EMPTY_NAMESPACE
import nltk //This line shows error
from nltk.stem.porter import PorterStemmer
import time`enter code here`
How to overcome this problem?
Answers:
try to install the package in your computer.
ubuntu:
sudo apt-get install python-nltk
First you can check whether already nltk you have installed or not.
Otherwise you can download from here.
In ubuntu, you can try followng one:
sudo apt-get install python-nltk
use…
nltk.download('punkt')
…after you load nltk. You should be fine.
I was trying to build web crawler using python and I’v got following error when it executed.
import sys
import math
import re
from collections import OrderedDict, defaultdict
import os
import nltk //This line shows error
import pickle
from xml.dom import minidom
from xml.dom import EMPTY_NAMESPACE
import nltk //This line shows error
from nltk.stem.porter import PorterStemmer
import time`enter code here`
How to overcome this problem?
try to install the package in your computer.
ubuntu:
sudo apt-get install python-nltk
First you can check whether already nltk you have installed or not.
Otherwise you can download from here.
In ubuntu, you can try followng one:
sudo apt-get install python-nltk
use…
nltk.download('punkt')
…after you load nltk. You should be fine.