0
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 的问题,我该如何处理它。我的代码如下: from textblob import TextBlob text = 'The Blob 的名义威胁总是让我印象深刻,因为它是终极电影' blob = TextBlob(text) print blob.tags

4

1 回答 1

0

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

于 2016-03-18T23:55:37.617 回答