urllib2.URLError:<urlopen error =“”unknown =“”url =“”type:=“”c =“”> textblob

时间:2016-03-18 02:03:14

标签: textblob

Traceback (most recent call last):
  File "F:/intership2/jsonTest/blobtest.py", line 4, in <module>
    print blob.tags
  File "C:\Anaconda\lib\site-packages\textblob\decorators.py", line 24, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "C:\Anaconda\lib\site-packages\textblob\blob.py", line 445, in pos_tags
    for word, t in self.pos_tagger.tag(self.raw)
  File "C:\Anaconda\lib\site-packages\textblob\decorators.py", line 35, in decorated
    return func(*args, **kwargs)
  File "C:\Anaconda\lib\site-packages\textblob\en\taggers.py", line 34, in tag
    tagged = nltk.tag.pos_tag(text)
  File "C:\Anaconda\lib\site-packages\nltk\tag\__init__.py", line 110, in pos_tag
    tagger = PerceptronTagger()
  File "C:\Anaconda\lib\site-packages\nltk\tag\perceptron.py", line 141, in __init__
    self.load(AP_MODEL_LOC)
  File "C:\Anaconda\lib\site-packages\nltk\tag\perceptron.py", line 209, in load
    self.model.weights, self.tagdict, self.classes = load(loc)
  File "C:\Anaconda\lib\site-packages\nltk\data.py", line 801, in load
    opened_resource = _open(resource_url)
  File "C:\Anaconda\lib\site-packages\nltk\data.py", line 924, in _open
    return urlopen(resource_url)
  File "C:\Anaconda\lib\urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Anaconda\lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "C:\Anaconda\lib\urllib2.py", line 454, in _open
    'unknown_open', req)
  File "C:\Anaconda\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\Anaconda\lib\urllib2.py", line 1265, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib2.URLError: <urlopen error unknown url type: >

当我使用textblob时,我遇到了问题urllib2.URLError,我该如何处理它。    我的代码如下:     从textblob导入TextBlob     text ='The Blob的名义威胁一直让我觉得这是一部终极电影'     blob = TextBlob(文字)     print blob.tags

1 个答案:

答案 0 :(得分:0)

尝试安装和导入NLTK。如果这不起作用,请查看this question中的解决方法。