Tôi vừa mới bắt đầu sử dụng trình gắn thẻ một phần của lời nói và tôi đang gặp nhiều sự cố.Trình gắn thẻ NLTK POS yêu cầu tôi tải xuống là gì?
tôi bắt đầu POS gắn thẻ như sau:
import nltk
text=nltk.word_tokenize("We are going out.Just you and me.")
Khi tôi muốn in 'text'
, sau đây sẽ xảy ra:
print nltk.pos_tag(text)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\Python26\lib\site-packages\nltk\tag\__init__.py", line 63, in pos_tag
tagger = nltk.data.load(_POS_TAGGER)
File "F:\Python26\lib\site-packages\nltk\data.py", line 594, in load
resource_val = pickle.load(_open(resource_url))
File "F:\Python26\lib\site-packages\nltk\data.py", line 673, in _open
return find(path).open()
File "F:\Python26\lib\site-packages\nltk\data.py", line 455, in find
raise LookupError(resource_not_found)`
LookupError:
Resource 'taggers/maxent_treebank_pos_tagger/english.pickle' not
found. Please use the NLTK Downloader to obtain the resource:
>>> nltk.download().
Searched in:
- 'C:\\Documents and Settings\\Administrator/nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
- 'F:\\Python26\\nltk_data'
- 'F:\\Python26\\lib\\nltk_data'
- 'C:\\Documents and Settings\\Administrator\\Application Data\\nltk_data'
tôi đã sử dụng nltk.download()
nhưng nó đã không làm việc.
Tại sao bạn viết tất cả văn bản in đậm? Điều này thực sự không cần thiết. Ngoài ra, vui lòng đăng một ví dụ tối thiểu nhưng đầy đủ để chứng minh lỗi của bạn. –
Ở đó, tôi đã làm sạch nó cho bạn. Hãy lấy điều này làm ví dụ về cách định dạng các câu hỏi trong tương lai. –
thankx ... sự cố đã được giải quyết ... – Pearl