Tagger
Verfasst: Donnerstag 10. März 2016, 15:32
Hallo,
ich möchte einen Text taggen, jedoch funktioniert es nicht. Ich mache es nach dem Beispiel in Bird´s NLTK book:
>>>text = word_tokenize("And now for something completely different")
>>> nltk.pos_tag(text)
[('And', 'CC'), ('now', 'RB'), ('for', 'IN'), ('something', 'NN'),
('completely', 'RB'), ('different', 'JJ')]
Aber wenn ich auch nur diesen Beispiel Code in Python eingebe kommt folgende Fehlermeldung:
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
print (nltk.pos_tag(d))
File "C:\Python34\lib\site-packages\nltk\tag\__init__.py", line 110, in pos_tag
tagger = PerceptronTagger()
File "C:\Python34\lib\site-packages\nltk\tag\perceptron.py", line 141, in __init__
self.load(AP_MODEL_LOC)
File "C:\Python34\lib\site-packages\nltk\tag\perceptron.py", line 209, in load
self.model.weights, self.tagdict, self.classes = load(loc)
File "C:\Python34\lib\site-packages\nltk\data.py", line 801, in load
opened_resource = _open(resource_url)
File "C:\Python34\lib\site-packages\nltk\data.py", line 924, in _open
return urlopen(resource_url)
File "C:\Python34\lib\urllib\request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "C:\Python34\lib\urllib\request.py", line 455, in open
response = self._open(req, data)
File "C:\Python34\lib\urllib\request.py", line 478, in _open
'unknown_open', req)
File "C:\Python34\lib\urllib\request.py", line 433, in _call_chain
result = func(*args)
File "C:\Python34\lib\urllib\request.py", line 1244, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: c>
Ich bin Programmieranfänger und habe wirklich keine Ahnung, warum das Taggen nicht funktioniert. Kann mir da bitte jemand weiterhelfen?
ich möchte einen Text taggen, jedoch funktioniert es nicht. Ich mache es nach dem Beispiel in Bird´s NLTK book:
>>>text = word_tokenize("And now for something completely different")
>>> nltk.pos_tag(text)
[('And', 'CC'), ('now', 'RB'), ('for', 'IN'), ('something', 'NN'),
('completely', 'RB'), ('different', 'JJ')]
Aber wenn ich auch nur diesen Beispiel Code in Python eingebe kommt folgende Fehlermeldung:
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
print (nltk.pos_tag(d))
File "C:\Python34\lib\site-packages\nltk\tag\__init__.py", line 110, in pos_tag
tagger = PerceptronTagger()
File "C:\Python34\lib\site-packages\nltk\tag\perceptron.py", line 141, in __init__
self.load(AP_MODEL_LOC)
File "C:\Python34\lib\site-packages\nltk\tag\perceptron.py", line 209, in load
self.model.weights, self.tagdict, self.classes = load(loc)
File "C:\Python34\lib\site-packages\nltk\data.py", line 801, in load
opened_resource = _open(resource_url)
File "C:\Python34\lib\site-packages\nltk\data.py", line 924, in _open
return urlopen(resource_url)
File "C:\Python34\lib\urllib\request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "C:\Python34\lib\urllib\request.py", line 455, in open
response = self._open(req, data)
File "C:\Python34\lib\urllib\request.py", line 478, in _open
'unknown_open', req)
File "C:\Python34\lib\urllib\request.py", line 433, in _call_chain
result = func(*args)
File "C:\Python34\lib\urllib\request.py", line 1244, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: c>
Ich bin Programmieranfänger und habe wirklich keine Ahnung, warum das Taggen nicht funktioniert. Kann mir da bitte jemand weiterhelfen?